* target-reloc.h (class Default_comdat_behavior): New, package up..
[deliverable/binutils-gdb.git] / gold / ChangeLog
CommitLineData
168a4726
AM
12012-10-18 Alan Modra <amodra@gmail.com>
2
3 * target-reloc.h (class Default_comdat_behavior): New, package up..
4 (get_comdat_behaviour): ..this.
5 (relocate_section): Add Relocate_comdat_behavior template arg,
6 adjust code to suit.
7 * arm.cc (Target_arm::relocate_section): Adjust to suit.
8 (Target_arm::scan_reloc_section): Likewise.
9 * i386.cc (Target_i386::relocate_section): Likewise.
10 * sparc.cc (Target_sparc::relocate_section): Likewise.
11 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
12 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
13 * powerpc.cc (class Relocate_comdat_behavior): New.
14 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
15 gold::relocate_section with new template arg.
16
acc276d8
AM
172012-10-18 Alan Modra <amodra@gmail.com>
18
19 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
20 dynamic relocs for GOT_TPREL got entries, without symbol if
21 resolving locally.
22 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
23 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
24 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
25
e10f9870
AM
262012-10-17 Alan Modra <amodra@gmail.com>
27
28 PR gold/14726
29 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
30
ae034989
ST
312012-10-16 Sriraman Tallam <tmsriram@google.com>
32
33 * layout.cc (Layout::include_section): Keep sections marked
34 SHF_EXCLUDE when doing relocatable links.
35
f3a0ed29
AM
362012-10-16 Alan Modra <amodra@gmail.com>
37
38 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
39 (Target_powerpc::do_finalize_sections): Call it.
40 (Output_data_save_res): New class and supporting functions.
41 (Target_powerpc::symval_for_branch): Only look up .opd entry for
42 normal symbols defined in object files.
43
c6de8ed4
AM
442012-10-12 Alan Modra <amodra@gmail.com>
45
46 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
47 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
48 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
49 section if scan_opd_relocs not yet called.
50 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
51
03e25981
AM
522012-10-12 Alan Modra <amodra@gmail.com>
53
54 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
55 add_local_ifunc_entry): Revert last change.
56 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
57
c9824451
AM
582012-10-05 Alan Modra <amodra@gmail.com>
59
60 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
61 do_plt_address_for_global): New functions.
62 (Output_data_got_powerpc::do_write): Don't segfault when linking
63 statically.
64 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
65 add_local_ifunc_entry): Return true on adding entry..
66 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
67 glink->add_entry call. Remove unused symtab param. Adjust calls.
68 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
69 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
70 set up symbols here.
71 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
72 syms here. Do so even when no .iplt. Don't segfault when linking
73 statically.
74 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
75 new variants without reloc param.
76 (Glink_sym_ent::Glink_sym_ent): Likewise.
77 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
78 reloc when refs will resolve to plt call stub.
79 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
80 R_PPC_PLTREL24 to resolve locally.
81 (Target_powerpc::Scan::global): Correct ifunc handling.
82 (Target_powerpc::Relocate::relocate): Correct local sym glink
83 lookup. Don't destroy "value" when we have a plt call stub,
84 and when checking plt call validity.
85 (Target_powerpc::do_dynsym_value): Simplify.
86
19fec8c1
AM
872012-10-05 Alan Modra <amodra@gmail.com>
88
89 * i386.cc (Output_data_plt_i386::address_for_global,
90 address_for_local): Add plt offset to returned value. Adjust uses.
91 * sparc.cc (Output_data_plt_sparc::address_for_global,
92 address_for_local): Likewise.
93 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
94 address_for_local): Likewise.
95 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
96 address_for_local): Likewise.
97 * target.h (Target::plt_address_for_global, plt_address_for_local):
98 Update comment.
99 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
100 (Output_data_got::Got_entry::write): Nor here.
101 * output.h: Comment fix.
102
e867b647
WL
1032012-10-02 Jiong Wang <jiwang@tilera.com>
104
105 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
106 global_offset_table_ value for larget got.
107 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
108
e5d5f5ed
AM
1092012-09-29 Alan Modra <amodra@gmail.com>
110
111 * powerpc.cc (Target_powerpc::iplt_): New output section.
112 (Target_powerpc::iplt_section, make_iplt_section,
113 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
114 (Target_powerpc::make_plt_entry): Handle ifunc syms.
115 Target_powerpc::plt_entry_count): Count iplt entries too.
116 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
117 reloc section in constructor. New params.
118 (Target_powerpc::make_plt_section): Create reloc section here instead.
119 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
120 functions.
121 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
122 (Output_data_glink::add_entry, find_entry): New functions to
123 deal with local syms.
124 (Glink_sym_ent): Add support for local syms.
125 (Output_data_glink::do_write): Handle ifunc plt entries.
126 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
127 (Target_powerpc::Scan::local, global): Handle ifunc syms.
128 (Target_powerpc::Relocate::relocate): Likewise.
129 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
130
ec4dbad3
AM
1312012-09-25 Alan Modra <amodra@gmail.com>
132
133 * object.h (Sized_relobj_file::adjust_local_symbol,
134 do_adjust_local_symbol): New functions.
135 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
136 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
137 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
138 and irregular opd entry spacing.
139 (Powerpc_relobj::do_read_relocs): Add opd size checks.
140 (Global_symbol_visitor_opd): New functor.
141 (Target_powerpc::do_finalize_sections): Omit global symbols defined
142 on deleted opd entries.
143
5c0b3823
WL
1442012-09-15 Jiong Wang <jiwang@tilera.com>
145
146 * tilegx.cc: New file.
147 * Makefile.am (TARGETSOURCES): Add tilegx.cc
148 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
149 * configure.tgt: Add entries for tilegx*.
150 * configure.ac: Likewise.
151 * Makefile.in: Rebuild.
152 * configure: Likewise.
153 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
154 tilegx.
155
bfdfa4cd
AM
1562012-09-13 Alan Modra <amodra@gmail.com>
157
158 * target-reloc.h (scan_relocs): Call scan.local for relocs
159 against symbols in discarded sections. Pass is_discarded
160 param.
161 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
162 Add is_discarded param.
163 * powerpc (Target_powerpc::Scan::local): Likewise. Use
164 is_discarded to flag opd entry as discarded. Don't emit dyn
165 relocs on such entries.
166 (Target_powerpc::Scan::global): Similarly detect and handle
167 such opd entries.
168 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
169 opd_ent_. Update all uses.
170 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
171 (Target_powerpc::relocate_section): Zero out discarded opd
172 entry relocs.
173
d77a0555
ILT
1742012-09-12 Ian Lance Taylor <iant@google.com>
175
176 PR gold/14570
177 * output.cc: Rename Output_data_got template parameter from size
178 to got_size for all functions. Compile all variants of
179 Output_data_got.
180 (Output_data_got::Got_entry::write): Correct use of size for
181 symbol value. Use local_is_tls rather than casting to
182 Sized_relobj_file.
183 * object.h (class Object): Add local_is_tls and do_local_is_tls.
184 (class Sized_relobj_file): Add do_local_is_tls.
185 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
186
815a1205
AM
1872012-09-11 Alan Modra <amodra@gmail.com>
188
189 PR gold/14566
190 * layout.cc (Layout::set_segment_offsets): When using
191 common-page-size alignment, ensure we are on a new max-page-size
192 page.
193 * output.cc (Output_segment::set_section_addresses): Use
194 abi_pagesize, not common_pagesize for relro boundary.
195 (Output_segment::set_offset): Likewise.
196
bd73a62d
AM
1972012-09-11 Alan Modra <amodra@gmail.com>
198
199 * output.h (Output_data_got::add_global_tls, add_local_tls,
200 add_local_tls_pair): New functions.
201 (Output_data_got::add_local_pair_with_rel): Remove second
202 reloc param. Expand comment.
203 (Output_data_got::Got_entry): Rename use_plt_offset_ to
204 use_plt_or_tls_offset_, similarly for constructor param.
205 (Output_data_got::Got_entry::write): Add got_index param.
206 * output.cc (Output_data_got::add_global_tls, add_local_tls,
207 add_local_tls_pair): New functions.
208 (Output_data_got::Got_entry::write): Handle tls symbols
209 with use_plt_or_tls_offset_ set specially.
210 (Output_data_got::add_local_pair_with_rel): Only one reloc.
211 (Output_data_got::do_write): Replace iterator with index, pass
212 index to entry write function.
213 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
214 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
215 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
216 call.
217 * i386.cc (Target_i386::Scan::local): Likewise.
218 * sparc.cc (Target_sparc::Scan::local): Likewise.
219 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
220 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
221 do_tls_offset_for_global): New functions.
222 (Target_powerpc::Scan::local): Correct TLS relocations and got
223 entry values.
224 (Target_powerpc::Scan::global): Don't emit unnecessary
225 dynamic relocations on TLS GOT entries.
226
00716ab1
AM
2272012-09-10 Matthias Klose <doko@ubuntu.com>
228
229 * config.in: Disable sanity check for kfreebsd.
230
c891b3f9
SA
2312012-09-10 Sterling Augustine <saugustine@google.com>
232
233 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
234 (Gdb_index::pubtypes_read): New parameter.
235 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
236 to calls.
237 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
238 pubtypes_object_.
239
e81fea4d
AM
2402012-09-09 Alan Modra <amodra@gmail.com>
241
242 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
243 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
244 * gc.h (gc_process_relocs): Call target gc_add_reference.
245 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
246 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
247 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
248 unnecessary cast.
249 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
250 to cater for when we don't need code offset. Update use.
251 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
252 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
253 set_opd_valid): New functions.
254 (Target_powerpc::do_gc_add_reference): New function.
255 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
256 stashed refs.
257 (Target_powerpc::do_gc_mark_symbol): New function.
258
d2d60eef
CC
2592012-09-06 Cary Coutant <ccoutant@google.com>
260
261 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
262 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
263 (Dwarf_die::skip_attributes): Likewise.
264 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
265 * testsuite/gdb_index_test.cc (inline_func_1): New function.
266 (main): Call it.
267 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
268
32ed4573
L
2692012-09-05 H.J. Lu <hongjiu.lu@intel.com>
270
271 * testsuite/script_test_3.t: Add .got.plt output section
272 statement.
273 * testsuite/script_test_4.t: Likewise.
274
f4baf0d4
AM
2752012-09-05 Alan Modra <amodra@gmail.com>
276
277 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
278 update all uses and lose "enum" when using type.
279
864a1b56
AM
2802012-09-05 Alan Modra <amodra@gmail.com>
281
282 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
283 * configure: Regenerate.
284 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
285 (plugin_final_layout.stdout): Likewise.
286 (memory_test): Set page sizes to 0x1000.
287 * testsuite/Makefile.in: Regenerate.
288 * testsuite/discard_locals_test.sh: Add FIXME comment.
289 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
290 * testsuite/pr14265.t: Add .got output section statement.
291 * testsuite/script_test_2.t: Likewise.
292 * testsuite/script_test_3.t: Likewise.
293 * testsuite/script_test_4.t: Likewise.
294 * testsuite/script_test_5.t: Likewise.
295 * testsuite/script_test_6.t: Likewise.
296 * testsuite/script_test_7.t: Likewise.
297 * testsuite/script_test_9.t: Likewise.
298
3ea0a085
AM
2992012-09-05 Alan Modra <amodra@gmail.com>
300
301 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
302 (Powerpc_relocate_functions::Status): New typedef.
303 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
304 (Target_powerpc::Scan::local): Handle REL64.
305 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
306 for REL32 and REL64.
307 (Target_powerpc::symval_for_branch): New function, extracted from..
308 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
309 checks. Report overflow errors.
310
7404fe1b
AM
3112012-09-05 Alan Modra <amodra@gmail.com>
312
313 * object.h (Sized_relobj_file::emit_relocs): Delete.
314 (Sized_relobj_file::emit_relocs_reltype): Delete.
315 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
316 relocate_relocs for --emit-relocs.
317 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
318 * output.h: Update comment.
319 (Output_segment::first_section): New function.
320 (Output_segment::first_section_load_address): Use first_section.
321 * output.cc (Output_segment::first_section): New function extracted..
322 (Output_segment::first_section_load_address): ..from here. Delete.
323 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
324 * target.h (Sized_target::relocate_for_relocatable): Likewise.
325 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
326 adjust call to target.h function.
327 * i386.cc (Target_i386): Likewise.
328 * sparc.cc (Target_sparc): Likewise.
329 * x86_64.cc (Target_x86_64): Likewise.
330 * powerpc.cc (Target_powerpc): Likewise.
331 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
332 first tls section has section symbol for optimised local dynamic
333 output relocs.
334 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
335 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
336 optimised tls code.
337 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
338 Rename to relocate_relocs. Update error message.
339
957564c9
AS
3402012-09-04 Andreas Schwab <schwab@linux-m68k.org>
341
342 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
343 --just-symbols.
344
dd93cd0a
AM
3452012-08-31 Alan Modra <amodra@gmail.com>
346
347 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
348 (Powerpc_relobj::toc_base_offset): New stub function.
349 (Target_powerpc): Add tp_offset, dtp_offset. Rename
350 got_mod_index_offset to tlsld_got_offset. Update all refs.
351 (Target_powerpc::Relocate::enum skip_tls): New.
352 (Target_powerpc::call_tls_get_addr_): New var.
353 (Target_powerpc::is_branch_reloc): Move to file scope.
354 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
355 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
356 New functions.
357 (Target_powerpc::enum Got_type): Delete old values, add new ones.
358 (powerpc_info): Correct common_pagesize for ppc64.
359 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
360 (Powerpc_relocate_functions): Add overflow check enums and functions.
361 Add non-shift version of rela, rela_ua. Delete all rel public
362 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
363 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
364 addr16_ha3, addr14 functions.
365 (Output_data_got_powerpc::add_constant_pair): New function.
366 (Output_data_got_powerpc::got_base_offset): Likewise.
367 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
368 (instruction constants): Sort, add some more.
369 (Output_data_glink::do_write): Add and use Address typedef. Use
370 object->toc_base_offset() stub for 64-bit.
371 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
372 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
373 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
374 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
375 Always treat .opd relocs as against locally defined symbol.
376 Correct condition for RELATIVE relocs.
377 (Target_powerpc::do_finalize_sections): Test for NULL sections.
378 (Target_powerpc::Relocate::relocate): Use plt call stub as value
379 for 32-bit syms with a plt entry. Correct ppc64 toc base
380 calculations. Handle TLS relocs, and more. Add overflow
381 checking and adjust for Powerpc_relocate_functions changes.
382 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
383 Reinstate --emit-relocs code with FIXME.
384
a1373b60
AM
3852012-08-30 Alan Modra <amodra@gmail.com>
386
387 * layout.cc (Layout::set_segment_offsets): Set p_align to
388 abi_pagesize, not common_pagesize.
389 (Layout::relaxation_loop_body): Similarly use abi_pagesize
390 to determine whether file header can go in segment.
391
703d02da
AM
3922012-08-30 Alan Modra <amodra@gmail.com>
393
394 * output.h (Output_reloc::Output_reloc <output section>): Add
395 is_relative param. Adjust calls.
396 (Output_reloc::add_output_section_relative): New functions.
397 * output.cc (Output_reloc::Output_reloc <output section>): Handle
398 is_relative.
399 (Output_reloc::symbol_value): Handle SECTION_CODE.
400
16164a6b
ST
4012012-08-24 Sriraman Tallam <tmsriram@google.com>
402
403 * gold.cc (queue_middle_tasks): Call layout again when unique
404 segments for sections is desired.
405 * layout.cc (Layout::Layout): Initialize new members.
406 (Layout::get_output_section_flags): New function.
407 (Layout::choose_output_section): Call get_output_section_flags.
408 (Layout::layout): Make output section for mapping to a unique segment.
409 (Layout::insert_section_segment_map): New function.
410 (Layout::attach_allocated_section_to_segment): Make unique segment for
703d02da 411 output sections marked so.
16164a6b
ST
412 (Layout::segment_precedes): Check for unique segments when sorting.
413 * layout.h (Layout::Unique_segment_info): New struct.
414 (Layout::Section_segment_map): New typedef.
415 (Layout::insert_section_segment_map): New function.
416 (Layout::get_output_section_flags): New function.
417 (Layout::is_unique_segment_for_sections_specified): New function.
418 (Layout::set_unique_segment_for_sections_specified): New function.
419 (Layout::unique_segment_for_sections_specified_): New member.
420 (Layout::section_segment_map_): New member.
421 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
422 Rename is_gc_pass_one to is_pass_one.
423 Rename is_gc_pass_two to is_pass_two.
424 Rename is_gc_or_icf to is_two_pass.
425 Check for which pass based on whether symbols data is present.
426 Make it two pass when unique segments for sections is desired.
427 * output.cc (Output_section::Output_section): Initialize new
428 members.
429 * output.h (Output_section::is_unique_segment): New function.
430 (Output_section::set_is_unique_segment): New function.
431 (Output_section::is_unique_segment_): New member.
432 (Output_section::extra_segment_flags): New function.
433 (Output_section::set_extra_segment_flags): New function.
434 (Output_section::extra_segment_flags_): New member.
435 (Output_section::segment_alignment): New function.
436 (Output_section::set_segment_alignment): New function.
437 (Output_section::segment_alignment_): New member.
438 (Output_segment::Output_segment): Initialize is_unique_segment_.
439 (Output_segment::is_unique_segment): New function.
440 (Output_segment::set_is_unique_segment): New function.
441 (Output_segment::is_unique_segment_): New member.
442 * plugin.cc (allow_unique_segment_for_sections): New function.
443 (unique_segment_for_sections): New function.
444 (Plugin::load): Add new functions to transfer vector.
445 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
446 * Makefile.in: Regenerate.
447 * testsuite/plugin_final_layout.sh: Check if unique segment
448 functionality works.
449 * testsuite/plugin_section_order.c (onload): Check if new interfaces
450 are available.
451 (allow_unique_segment_for_sections): New global.
452 (unique_segment_for_sections): New global.
453 (claim_file_hook): Call allow_unique_segment_for_sections.
454 (all_symbols_read_hook): Call unique_segment_for_sections.
16164a6b 455
1e2bee4f
CC
4562012-08-22 Cary Coutant <ccoutant@google.com>
457
458 * layout.cc (Layout::include_section): Don't assert on GROUP
459 sections with --emit-relocs.
460
1d5dfe78
CC
4612012-08-21 Cary Coutant <ccoutant@google.com>
462
463 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
464 if --export-dynamic-symbol names an undef symbol.
465
c9269dff
AM
4662012-08-18 Alan Modra <amodra@gmail.com>
467
468 * powerpc.cc: Formatting and white space.
469 (Powerpc_relobj): Rename got2_section_ to special_.
470 Add opd_ent_shndx_ and opd_ent_off_ vectors.
471 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
472 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
473 (Target_powerpc): Add Address typedef and invalid_address. Use
474 throughout.
475 (Target_powerpc::is_branch_reloc): New function.
476 (Powerpc_relocate_functions): Add Address typedef, use throughout.
477 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
478 for dst_mask, value and addend.
479 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
480 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
481 (Output_data_glink::do_write): Correct toc base. Don't try to use
482 uint16_t for 24-bit offset. Use get_output_section_offset and
483 check return.
484 (Target_powerpc::Scan::local): Handle more relocs.
485 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
486 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
487 Plug in toc restoring insn after plt calls. Translate branches
488 to function descriptor symbols to corresponding entry point.
489 (Target_powerpc::relocate_for_relocatable): Check return from
490 get_output_section_offset.
491 * symtab.h: Comment typo.
492
b1759dce
ILT
4932012-08-14 Ian Lance Taylor <iant@google.com>
494
495 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
496 unsupported_relocal_local to call unsupported_reloc_global.
497
b9b2ae8b
NC
4982012-08-14 Nick Clifton <nickc@redhat.com>
499
500 PR ld/14265
501 * script-sections.cc (Sections_element::output_section_name): Add
502 keep return parameter.
503 (Output_section_element::match_name): Add keep return parameter.
504 Return the value of the keep_ member.
505 * script-sections.h (class Output_section): Update
506 output_section_name prototype.
507 * layout.cc (Layout::keep_input_section): New public member
508 function.
509 (Layout::choose_output_section): Pass keep parameter to
510 output_section_name.
511 * layout.h (class Layout): Add keep_input_section.
512 * object.cc (Sized_relobj_file::do_layout): Check for kept input
513 sections.
514 * testsuite/Makefile.am: Add a test.
515 * testsuite/Makefile.in: Regenerate.
516 * testsuite/pr14265.c: Source file for the test.
517 * testsuite/pr14265.t: Linker script for the test.
518 * testsuite/pr14265.sh: Shell script for the test.
519
921b5322
AM
5202012-08-14 Alan Modra <amodra@gmail.com>
521
522 * target.h (Target::output_section_name): New function.
523 (Target::do_output_section_name): New function.
524 * layout.cc (Layout::choose_output_section): Call the above.
525 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
526
6ce78956
AM
5272012-08-14 Alan Modra <amodra@gmail.com>
528
529 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
530 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
531 for replace_constant call.
532 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
533 (Output_data_glink::do_print_to_mapfile): New function.
534 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
535 (Target_powerpc::Relocate::relocate): Likewise.
536
d1a8cabd
AM
5372012-08-14 Alan Modra <amodra@gmail.com>
538
539 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
540 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
541 (Output_data_glink::add_entry,find_entry): Remove shndx param.
542 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
543 all references to shndx_. Handle special case for R_PPC_PLTREL24
544 here.
545 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
546 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
547 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
548 here.
549 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
550 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
551
d83ce4e3
AM
5522012-08-12 Alan Modra <amodra@gmail.com>
553
554 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
555 (glink insn constants): Use uint32_t.
556 (Output_data_glink::add_entry): Use insert, not [] operator.
557
cf43a2fe
AM
5582012-08-11 Alan Modra <amodra@gmail.com>
559
560 * object.h (Sized_relobj_file::find_shdr): New function.
561 (Sized_relobj_file::find_special_sections): New function.
562 * object.cc (Sized_relobj_file::find_shdr): New function.
563 (Sized_relobj_file::find_eh_frame): Use find_shdr.
564 (Sized_relobj_file::find_special_sections): New function, split out..
565 (Sized_relobj_file::do_read_symbols): ..from here.
566 * output.h (Output_data_got::replace_constant): New function.
567 (Output_data_got::num_entries): New function.
568 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
569 (Output_data_got::got_offset): Protected rather than private.
570 (Output_data_got::replace_got_entry): New function.
571 * output.cc (Output_data_got::replace_got_entry): New function.
572 * powerpc.cc (class Powerpc_relobj): New.
573 (class Powerpc_relocate_functions): Delete all psymval variants or
574 convert to value,addend type. Delete pcrela, pcrela_unaligned.
575 Implement _ha functions using corresponding _hi function.
576 (Powerpc_relobj::find_special_sections): New function.
577 (Target_powerpc::do_make_elf_object): New function.
578 (class Output_data_got_powerpc): New.
579 (class Output_data_glink): New.
580 (class Powerpc_scan_relocatable_reloc): New.
581 Many more changes througout file.
582
3c892704
NC
5832012-08-09 Nick Clifton <nickc@redhat.com>
584
585 * po/vi.po: Updated Vietnamese translation.
586
82435b3b
ILT
5872012-08-07 Ian Lance Taylor <iant@google.com>
588
589 * layout.cc (Layout::add_target_dynamic_tags): If
590 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
591 plt_rel.
592
a6dc81d2
NC
5932012-07-30 Nick Clifton <nickc@redhat.com>
594
595 * po/gold.pot: Updated template.
596 * po/es.po: Updated Spanish translation.
597
f1415016
CC
5982012-07-18 Cary Coutant <ccoutant@google.com>
599
600 PR gold/14344
601 * configure.ac: Add check for -gpubnames support.
602 * configure: Regenerate.
603 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
604 support; force -gno-pubnames.
605 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
606 support.
607 (gdb_index_test_4): New test.
608 * testsuite/Makefile.in: Regenerate.
609 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
610 * testsuite/gdb_index_test_2.sh: Likewise.
611 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
612 * testsuite/gdb_index_test_4.sh: New script.
613 * testsuite/gdb_index_test_comm.sh: New script with common code;
614 don't look for space after colon.
615
b7fd7c37
ST
6162012-07-16 Sriraman Tallam <tmsriram@google.com>
617
618 * gold.cc (queue_middle_tasks): Update function order only after
619 deferred objects due to plugins are processed.
620
1f3212db
ILT
6212012-07-11 Ian Lance Taylor <iant@google.com>
622
623 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
624 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
625 (Target_arm::scan_reloc_for_stub): Likewise.
626 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
627 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
628 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
629 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
630 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
631
81c82a68
ILT
6322012-07-10 Dodji Seketeli <dodji@redhat.com>
633 Ian Lance Taylor <iant@google.com>
634
635 PR gold/14309
636 * configure.ac: Test whether std::tr1::hash<off_t> works.
637 * gold.h: Add a specialization for std::tr1::hash<off_t> if
638 needed.
639 * output.h (class Output_fill): Add virtual destructor.
640 * configure, config.in: Rebuild.
641
eabc84f4
RM
6422012-06-22 Roland McGrath <mcgrathr@google.com>
643
644 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
645
370e30b6
RÁE
6462012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
647
648 * plugin.cc (Plugin::load): Handle position independent executables.
649
fb1b895d
CC
6502012-06-06 Cary Coutant <ccoutant@google.com>
651
652 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
653 add .debug_macro.
654 (lines_only_debug_sections): Likewise.
655 (gdb_fast_lookup_sections): New static array.
656 (is_gdb_debug_section): Rename formal parameter.
657 (is_lines_only_debug_section): Likewise.
658 (is_gdb_fast_lookup_section): New function.
659 (Layout::include_section): Check for ".zdebug_" prefix; pass
660 section name suffix to is_gdb_debug_section, et al.; check for
661 fast-lookup sections when building .gdb_index.
662 * options.h (--strip-debug-gdb): Update GDB version number.
663
7c0640fa
CC
6642012-06-06 Cary Coutant <ccoutant@google.com>
665
666 * configure.ac: Add check for fallocate.
667 * configure: Regenerate.
668 * config.in: Regenerate.
669
670 * options.h (class General_options): Add --mmap-output-file and
671 --posix-fallocate options.
672 * output.cc: (posix_fallocate): Remove; replace with...
673 (gold_fallocate): New function.
674 (Output_file::map_no_anonymous): Call gold_fallocate.
675 (Output_file::map): Check --mmap-output-file option.
676
2a49eb69
DK
6772012-06-05 Jing Yu <jingyu@google.com>
678
679 * gold.h (textdomain): Add do {} to empty while(0).
680 (bindtextdomain): Likewise.
681
fad072ac
CC
6822012-06-04 Cary Coutant <ccoutant@google.com>
683
684 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
685 has_dynsym_index.
686
8cc69fb6
ST
6872012-05-25 Sriraman Tallam <tmsriram@google.com>
688
689 * symtab.cc (Symbol_table::define_special_symbol):
690 Initialize *poldsym to prevent uninitialized variable errors.
691
1be75daa
CC
6922012-05-23 Cary Coutant <ccoutant@google.com>
693
694 * layout.cc (Layout::section_name_mapping): Add rules to handle
695 exact match on .data.rel.ro.local or .data.rel.ro.
696 (Layout::output_section_name): Check for exact matches.
697
9b689de0
CC
6982012-05-23 Cary Coutant <ccoutant@google.com>
699
700 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
701 more carefully.
702
b24fdbf5
CC
7032012-05-22 Cary Coutant <ccoutant@google.com>
704
705 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
706 object before exporting symbol.
707
e550e1a2
L
7082012-05-21 H.J. Lu <hongjiu.lu@intel.com>
709
710 * testsuite/tls_test.cc: Include "config.h" first.
711 * testsuite/tls_test_c.c: Likewise.
712
df7b86aa
NC
7132012-05-17 Daniel Richard G. <skunk@iskunk.org>
714 Nick Clifton <nickc@redhat.com>
715
716 PR 14072
717 * configure.in: Add check that sysdep.h has been included before
718 any system header files.
719 * configure: Regenerate.
720 * config.in: Regenerate.
721
1007b503
CC
7222012-05-14 Cary Coutant <ccoutant@google.com>
723
724 * layout.cc (Layout::make_output_section): Mark .tdata section
725 as RELRO.
726 * testsuite/relro_test.cc: Add a TLS variable.
727
fd885f3a
L
7282012-05-10 H.J. Lu <hongjiu.lu@intel.com>
729
730 PR gold/14091
731 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
732 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
733 R_X86_64_64.
734
80f5885c
CC
7352012-05-08 Cary Coutant <ccoutant@google.com>
736
737 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
738 (lines_only_debug_sections): Likewise.
739
2e702c99
RM
7402012-05-02 Roland McGrath <mcgrathr@google.com>
741
742 * nacl.cc: New file.
743 * nacl.h: New file.
744 * Makefile.am (CCFILES, HFILES): Add them.
745 * Makefile.in: Regenerate.
746 * i386.cc (Output_data_plt_i386_nacl): New class.
747 (Output_data_plt_i386_nacl_exec): New class.
748 (Output_data_plt_i386_nacl_dyn): New class.
749 (Target_i386_nacl): New class.
750 (Target_selector_i386_nacl): New class.
751 (target_selector_i386): Use it instead of Target_selector_i386.
752 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
753 (Target_x86_64_nacl): New class.
754 (Target_selector_x86_64_nacl): New class.
755 (target_selector_x86_64, target_selector_x32): Use it instead of
756 Target_selector_x86_64.
757 * arm.cc (Output_data_plt_arm_nacl): New class.
758 (Target_arm_nacl): New class.
759 (Target_selector_arm_nacl): New class.
760 (target_selector_arm, target_selector_armbe): Use it instead of
761 Target_selector_arm.
762
763 * target-select.cc (select_target): Take new Input_file* and off_t
764 arguments, pass them on to recognize method of selector.
765 * object.cc (make_elf_sized_object): Update caller.
766 * parameters.cc (parameters_force_valid_target): Likewise.
767 * incremental.cc (make_sized_incremental_binary): Likewise.
768 * target-select.h: Update decl.
769 (Target_selector::recognize): Take new Input_file* argument,
770 pass it on to do_recognize.
771 (Target_selector::do_recognize): Take new Input_file* argument.
772 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
773 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
774 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
775 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
776
777 * target.h (Target::Target_info): New members isolate_execinstr
778 and rosegment_gap.
779 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
780 * arm.cc (Target_arm::arm_info): Update initializer.
781 * i386.cc (Target_i386::i386_info): Likewise.
782 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
783 * sparc.cc (Target_sparc::sparc_info): Likewise.
784 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
785 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
786 * layout.cc (Layout::attach_allocated_section_to_segment):
787 Take new const Target* argument. If target->isolate_execinstr(), act
788 like --rosegment.
789 (Layout::find_first_load_seg): Take new const Target* argument;
790 if target->isolate_execinstr(), reject PF_X segments.
791 (Layout::relaxation_loop_body): Update caller.
792 (Layout::set_segment_offsets): If target->isolate_execinstr(),
793 reset file offset to zero when we hit LOAD_SEG, and then do a second
794 loop over the segments before LOAD_SEG to reassign offsets after
795 addresses have been determined. Handle target->rosegment_gap().
796 (Layout::attach_section_to_segment): Take new const Target* argument;
797 pass it to attach_allocated_section_to_segment.
798 (Layout::make_output_section): Update caller.
799 (Layout::attach_sections_to_segments): Take new const Target* argument;
800 pass it to attach_section_to_segment.
801 * gold.cc (queue_middle_tasks): Update caller.
802 * layout.h (Layout): Update method decls with new arguments.
803
804 * arm.cc (Target_arm::Target_arm): Take optional argument for the
805 Target_info pointer to use.
806 (Target_arm::do_make_data_plt): New virtual method.
807 (Target_arm::make_data_plt): New method that calls it.
808 (Target_arm::make_plt_entry): Use it.
809 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
810 for the section alignment.
811 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
812 method.
813 (Output_data_plt_arm::first_plt_entry_offset): Call it.
814 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
815 method.
816 (Output_data_plt_arm::get_plt_entry_size): Call it.
817 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
818 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
819 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
820 method.
821 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
822 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
823 method instead of sizeof(plt_entry).
824 (Output_data_plt_arm::add_entry): Likewise.
825 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
826 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
827 than static method.
828 (Target_arm::plt_entry_size): Likewise.
829 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
830 Move to ...
831 (Output_data_plt_arm_standard): ... here, new class.
832 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
833 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
834 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
835
836 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
837 Take additional argument for the PLT entry size.
838 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
839 Use get_plt_entry_size method rather than plt_entry_size variable.
840 (Output_data_plt_x86_64::reserve_slot): Likewise.
841 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
842 (Output_data_plt_x86_64::add_entry): Likewise.
843 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
844 (Output_data_plt_x86_64::address_for_global): Likewise.
845 (Output_data_plt_x86_64::address_for_local): Likewise.
846 (Output_data_plt_x86_64::set_final_data_size): Likewise.
847 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
848 Make method non-static.
849 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
850 method.
851 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
852 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
853 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
854 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
855 virtual method.
856 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
857 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
858 virtual method.
859 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
860 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
861 virtual method.
862 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
863 (Output_data_plt_x86_64::plt_entry_size)
864 (Output_data_plt_x86_64::first_plt_entry)
865 (Output_data_plt_x86_64::plt_entry)
866 (Output_data_plt_x86_64::tlsdesc_plt_entry)
867 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
868 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
869 (Output_data_plt_x86_64_standard): ... here, new class.
870 (Target_x86_64::Target_x86_64): Take optional argument for the
871 Target_info pointer to use.
872 (Target_x86_64::do_make_data_plt): New virtual method.
873 (Target_x86_64::make_data_plt): New method to call it.
874 (Target_x86_64::init_got_plt_for_update): Use that.
875 Call this->plt_->add_eh_frame method here.
876 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
877 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
878 rather than static method.
879 (Target_x86_64::plt_entry_size): Likewise.
880 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
881 rather than plt_entry_size variable. Move guts of PLT filling to...
882 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
883 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
884 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
885
886 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
887 additional argument for the section alignment.
888 Don't do add_eh_frame_for_plt here.
889 (Output_data_plt_i386::first_plt_entry_offset): Make the method
890 non-static. Use get_plt_entry_size method rather than plt_entry_size
891 variable.
892 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
893 method.
894 (Output_data_plt_i386::get_plt_entry_size): Call it.
895 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
896 (Output_data_plt_i386::add_eh_frame): New method to call it.
897 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
898 method.
899 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
900 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
901 method.
902 (Output_data_plt_i386::fill_plt_entry): New method to call it.
903 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
904 method instead of plt_entry_size.
905 (Output_data_plt_i386::plt_entry_size)
906 (Output_data_plt_i386::plt_eh_frame_fde_size)
907 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
908 (Output_data_plt_i386_standard): ... here, new class.
909 (Output_data_plt_i386_exec): New class.
910 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
911 (Output_data_plt_i386_exec::first_plt_entry): ... here.
912 (Output_data_plt_i386::exec_plt_entry): Move to ...
913 (Output_data_plt_i386_exec::plt_entry): ... here.
914 (Output_data_plt_i386_dyn): New class.
915 (Output_data_plt_i386::first_plt_entry): Move to ...
916 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
917 (Output_data_plt_i386::dyn_plt_entry): Move to ...
918 (Output_data_plt_i386_dyn::plt_entry): ... here.
919 (Target_i386::Target_i386): Take optional argument for the Target_info
920 pointer to use.
921 (Target_i386::do_make_data_plt): New virtual method.
922 (Target_i386::make_data_plt): New method to call it.
923 (Target_i386::make_plt_section): Use that.
924 Call this->plt_->add_eh_frame method here.
925 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
926 rather than plt_entry_size variable.
927 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
928 (Output_data_plt_i386::address_for_local): Likewise.
929 (Output_data_plt_i386::do_write): Likewise.
930 Move guts of PLT filling to...
931 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
932 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
933 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
934 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
935
b9b9f2ee
CC
9362012-05-01 Cary Coutant <ccoutant@google.com>
937
938 * dwarf_reader.cc (Dwarf_die::read_attributes)
939 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
940 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
941 * reduced_debug_output.cc
942 (Output_reduced_debug_info_section::get_die_end): Remove
943 DW_FORM_GNU_ref_index. Add default case.
944
57923f48
MW
9452012-04-26 Mark Wielaard <mjw@redhat.com>
946
947 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
948 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
949 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
950 DW_AT_high_pc as offset from DW_AT_low_pc.
951
952 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
953 * testsuite/Makefile.in: Regenerate.
954 * testsuite/gdb_index_test_3.c: New test source file.
955 * testsuite/gdb_index_test_3.sh: New test source file.
956
2c54b4f4
ILT
9572012-04-25 Ian Lance Taylor <iant@google.com>
958
959 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
960 pointer.
961 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
962 as a class, not a struct.
963 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
964 (Target_arm::apply_cortex_a8_workaround): Likewise.
965 * gc.h: Declare Reloc_types as a struct, not a class.
966 * object.h: Declare Symbols_data as a struct.
967 * reloc.h: Declare Read_relocs_data as a struct.
968 * target.h: Declare Relocate_info as a struct.
969
a5a5f7a3
DM
9702012-04-24 David S. Miller <davem@davemloft.net>
971
972 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
973 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
974 and R_SPARC_WPLT30.
975
f038d496
CC
9762012-04-24 Cary Coutant <ccoutant@google.com>
977
978 * incremental-dump.cc (find_input_containing_global): Replace
979 magic number with symbolic constant.
980 (dump_incremental_inputs): Update version number.
981 * incremental.cc (Output_section_incremental_inputs): Update version
982 number; import symbolic constants from Incremental_inputs_reader.
983 (Incremental_inputs::create_data_sections): Align relocations
984 section correctly for 64-bit targets.
985 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
986 constants; add padding.
987 (Output_section_incremental_inputs::write_header): Add assert for
988 header_size.
989 (Output_section_incremental_inputs::write_input_files): Add assert
990 for input_entry_size.
991 (Output_section_incremental_inputs::write_info_blocks): Add padding;
992 add assert for object_info_size, input_section_entry_size,
993 global_sym_entry_size.
994 * incremental.h (Incremental_inputs_reader): Add symbolic constants
995 for data structure sizes; use them.
996 (Incremental_input_entry_reader): Import symbolic constants from
997 Incremental_inputs_reader; use them.
998
a4d85145
DM
9992012-04-23 David S. Miller <davem@davemloft.net>
1000
1001 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1002 and elf_flags_set_.
1003 (Target_sparc::Target_sparc): Initialize new fields.
1004 (Target_sparc::do_make_elf_object): New function.
1005 (Target_sparc::do_adjust_elf_header): New function.
1006
1d509098
CC
10072012-04-23 Cary Coutant <ccoutant@google.com>
1008
1009 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1010 CU range table of gdb index.
1011
7ebeff7f
DM
10122012-04-20 David S. Miller <davem@davemloft.net>
1013
1014 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1015 instead of false.
1016
13cf9988
DM
10172012-04-16 David S. Miller <davem@davemloft.net>
1018
2a1079e8
DM
1019 * sparc.cc (Target_sparc::got_address): New function.
1020 (Sparc_relocate_functions::gdop_hix22): New function.
1021 (Sparc_relocate_functions::gdop_lox10): New function.
1022 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1023 relocs.
1024 (Target_sparc::Scan::local): Likewise if the global symbol is not
1025 preemptible and is not IFUNC.
1026 (Target_sparc::Relocate::relocate): Perform GOTDATA code
1027 transformations for local and non-preemptible non-IFUNC global
1028 symbols.
1029
0bc964fc
DM
1030 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1031 writing out 64-bit part of ranges.
1032
661d7a80
DM
1033 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1034 -fpic and -fpie respectively.
1035 * Makefile.in: Regenerate.
1036
8c2bf391
DM
1037 * sparc.cc (class Target_sparc): Add rela_ifunc_.
1038 (Target_sparc::Target_sparc): Initialize new field.
1039 (Target_sparc::do_plt_section_for_global): New function.
1040 (Target_sparc::do_plt_section_for_local): New function.
1041 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1042 (Target_sparc::make_plt_section): New function, broken out of
1043 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
1044 (Target_sparc::make_plt_entry): Call make_plt_section.
1045 (Target_sparc::make_local_ifunc_plt_entry): New function.
1046 (Target_sparc::rela_ifunc_section): New function.
1047 (Target_sparc::plt_section): Remove const.
1048 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
1049 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1050 and ifunc_count_ fields.
1051 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1052 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1053 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1054 (Output_data_plt_sparc::rela_ifunc): New function.
1055 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1056 (Output_data_plt_sparc::has_ifunc_section): New function.
1057 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1058 (Output_data_plt_sparc::address_for_global): New function.
1059 (Output_data_plt_sparc::address_for_local): New function.
1060 (Output_data_plt_sparc::plt_index_to_offset): New function.
1061 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1062 and entry_count.
1063 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1064 entry_count.
1065 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1066 R_SPARC_JMP_IREL to switch.
1067 (Target_sparc::Scan::check_non_pic): Likewise.
1068 (Target_sparc::Scan::local): Handle IFUNC symbols.
1069 (Target_sparc::Scan::local): Likewise.
1070 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1071 and plt_address_for_local.
1072 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1073 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1074
13cf9988
DM
1075 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1076 (class Output_data_reloc): Adjust calls to Output_reloc_type.
1077 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1078 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1079 global relocs too.
1080 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1081 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1082 calls.
1083 * sparc.cc (Target_sparc::Scan::global): Likewise.
1084 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1085
31821be0
CC
10862012-04-16 Cary Coutant <ccoutant@google.com>
1087
1088 * archive.cc (Library_base::should_include_member): Check for
1089 --export-dynamic-symbol.
1090 * options.h (class General_options): Add --export-dynamic-symbol.
1091 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1092 --export-dynamic-symbol.
1093 (Symbol_table::gc_mark_undef_symbols): Likewise.
1094 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1095
2615994e
DM
10962012-04-12 David S. Miller <davem@davemloft.net>
1097
1098 * sparc.cc (Reloc::wdisp10): New relocation method.
1099 (Reloc::h34): Likewise.
1100 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1101 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1102 R_SPARC_WDISP10.
1103 (Target_sparc::Scan::local): Likewise.
1104 (Target_sparc::Scan::global): Likewise.
1105 (Target_sparc::Relocate::relocate): Likewise.
1106
6782735d
CC
11072012-04-09 Cary Coutant <ccoutant@google.com>
1108
1109 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1110 low_pc == 0.
1111
8c7a0b00
ILT
11122012-04-06 Ian Lance Taylor <iant@google.com>
1113
1114 * timer.cc: #include <unistd.h>.
1115
58797674
RM
11162012-04-06 Roland McGrath <mcgrathr@google.com>
1117
1118 * configure.in (AC_CHECK_HEADERS): Add locale.h.
1119 * config.in: Regenerate.
1120 * configure: Regenerate.
1121
44350750
NC
11222012-04-05 Nick Clifton <nickc@redhat.com>
1123
1124 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1125 (AM_LC_MESSAGES): Add.
1126 * aclocal.m4: Regenerate.
1127 * config.in: Regenerate.
1128 * configure: Regenerate.
1129
c1027032
CC
11302012-03-21 Cary Coutant <ccoutant@google.com>
1131
1132 * Makefile.am: Add gdb-index.cc, gdb-index.h.
1133 * Makefile.in: Regenerate.
1134 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1135 (Sized_elf_reloc_mapper::symbol_section): New function.
1136 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1137 (make_elf_reloc_mapper): New function.
1138 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1139 (Dwarf_abbrev_table::do_read_abbrevs): New function.
1140 (Dwarf_abbrev_table::do_get_abbrev): New function.
1141 (Dwarf_ranges_table::read_ranges_table): New function.
1142 (Dwarf_ranges_table::read_range_list): New function.
1143 (Dwarf_pubnames_table::read_section): New function.
1144 (Dwarf_pubnames_table::read_header): New function.
1145 (Dwarf_pubnames_table::next_name): New function.
1146 (Dwarf_die::Dwarf_die): New function.
1147 (Dwarf_die::read_attributes): New function.
1148 (Dwarf_die::skip_attributes): New function.
1149 (Dwarf_die::set_name): New function.
1150 (Dwarf_die::set_linkage_name): New function.
1151 (Dwarf_die::attribute): New function.
1152 (Dwarf_die::string_attribute): New function.
1153 (Dwarf_die::int_attribute): New function.
1154 (Dwarf_die::uint_attribute): New function.
1155 (Dwarf_die::ref_attribute): New function.
1156 (Dwarf_die::child_offset): New function.
1157 (Dwarf_die::sibling_offset): New function.
1158 (Dwarf_info_reader::check_buffer): New function.
1159 (Dwarf_info_reader::parse): New function.
1160 (Dwarf_info_reader::do_parse): New function.
1161 (Dwarf_info_reader::do_read_string_table): New function.
1162 (Dwarf_info_reader::lookup_reloc): New function.
1163 (Dwarf_info_reader::get_string): New function.
1164 (Dwarf_info_reader::visit_compilation_unit): New function.
1165 (Dwarf_info_reader::visit_type_unit): New function.
1166 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1167 Sized_elf_reloc_mapper.
1168 (Sized_dwarf_line_info::symbol_section): Remove function.
1169 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1170 (Sized_dwarf_line_info::read_line_mappings): Remove object
1171 parameter, adjust callers.
1172 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1173 * dwarf_reader.h: Include <sys/types.h>.
1174 (class Track_relocs): Remove forward declaration.
1175 (class Elf_reloc_mapper): New class.
1176 (class Sized_elf_reloc_mapper): New class.
1177 (class Dwarf_abbrev_table): New class.
1178 (class Dwarf_range_list): New class.
1179 (class Dwarf_ranges_table): New class.
1180 (class Dwarf_pubnames_table): New class.
1181 (class Dwarf_die): New class.
1182 (class Dwarf_info_reader): New class.
1183 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1184 (Sized_dwarf_line_info::symbol_section): Remove member function.
1185 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1186 base class.
1187 * gdb-index.cc: New source file.
1188 * gdb-index.h: New source file.
1189 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1190 and .debug_types sections, call Layout::add_to_gdb_index.
1191 (Sized_relobj_incr::do_section_name): Implement.
1192 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1193 return type; Implement.
1194 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1195 return type.
1196 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1197 parameter list and return type.
1198 (Sized_incr_dynobj::do_section_contents): Likewise.
1199 * layout.cc: Include gdb-index.h.
1200 (Layout::Layout): Initialize gdb_index_data_.
1201 (Layout::init_fixed_output_section): Check for .gdb_index section.
1202 (Layout::add_to_gdb_index): New function. Instantiate.
1203 * layout.h: Add forward declaration for class Gdb_index.
1204 (Layout::add_to_gdb_index): New member function.
1205 (Layout::gdb_index_data_): New data member.
1206 * main.cc: Include gdb-index.h.
1207 (main): Print statistics for gdb index.
1208 * object.cc (Object::section_contents): Move code into
1209 do_section_contents.
1210 (need_decompressed_section): Check for sections needed when building
1211 gdb index.
1212 (build_compressed_section_map): Likewise.
1213 (Sized_relobj_file::do_read_symbols): Need local symbols when building
1214 gdb index.
1215 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1216 sections; call Layout::add_to_gdb_index.
1217 (Sized_relobj_file::do_decompressed_section_contents): Call
1218 do_section_contents directly.
1219 * object.h (Object::do_section_contents): Adjust parameter list and
1220 return type.
1221 (Object::do_decompressed_section_contents): Call do_section_contents
1222 directly.
1223 (Sized_relobj_file::do_section_contents): Adjust parameter list and
1224 return type.
1225 * options.h (class General_options): Add --gdb-index option.
1226 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1227 list and return type.
1228 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1229 * reloc.h (Track_relocs::checkpoint): New function.
1230 (Track_relocs::reset): New function.
1231
1232 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1233 New test cases.
1234 * testsuite/Makefile.in: Regenerate.
1235 * testsuite/gdb_index_test.cc: New test source file.
1236 * testsuite/gdb_index_test_1.sh: New test source file.
1237 * testsuite/gdb_index_test_2.sh: New test source file.
1238
647f1574
DK
12392012-03-19 Doug Kwan <dougkwan@google.com>
1240
1241 * arm.cc (Target_arm::do_define_standard_symbols): New method.
2e702c99 1242 (Target_arm::do_finalize_sections): Remove code which defines
647f1574
DK
1243 __exidx_start and __exidx_end. Make symbol table parameter
1244 anonymous as it is not used.
1245 * gold.cc (queue_middle_tasks): Call target hook to define any
1246 target-specific symbols.
1247 * target.h (Target::define_standard_symbols): New method.
1248 (Target::do_define_standard_symbols): Same.
1249 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1250 * testsuite/Makefile.in: Regenerate.
1251 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1252 and __exidx_end.
1253 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1254 relocations are generated for __exidx_start and __exidx_end.
1255
7c6109da
DK
12562012-03-16 Doug Kwan <dougkwan@google.com>
1257
1258 * testsuite/Makefile.am: Disable test initpri3b.
1259 * testsuite/Makefile.in: Regenerate.
1260
7b8957f8
DK
12612012-03-15 Doug Kwan <dougkwan@google.com>
1262
1263 * arm.cc (Target_arm::got_section): Make .got section read-only
1264 if -z now is given.
1265
14dc9ef7
ILT
12662012-03-15 Ian Lance Taylor <iant@google.com>
1267
1268 PR gold/13850
1269 * layout.cc (Layout::make_output_section): Correctly mark
1270 SHT_INIT_ARRAY, et. al., as relro.
1271
fa40b62a
DK
12722012-03-14 Doug Kwan <dougkwan@google.com>
1273
1274 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1275 dynamic relocations for protected symbols in shared objects.
1276
fd325007
ILT
12772012-03-13 Ian Lance Taylor <iant@google.com>
1278
1279 * resolve.cc (Symbol_table::resolve): When merging common symbols,
1280 keep the larger alignment.
1281
e8dd54e1
CC
12822012-03-12 Cary Coutant <ccoutant@google.com>
1283
1284 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1285 handling of DW_LNE_define_file.
1286
feb5f3b0
CC
12872012-03-12 Cary Coutant <ccoutant@google.com>
1288
1289 * reduced_debug_output.cc
1290 (Output_reduced_debug_info_section::get_die_end): Add new FORM
1291 codes to switch.
1292
a1fb4256
CC
12932012-02-29 Cary Coutant <ccoutant@google.com>
1294
1295 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1296
5dd8762a
CC
12972012-02-29 Cary Coutant <ccoutant@google.com>
1298
1299 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1300 Call Object::decompressed_section_contents.
1301 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1302 New dtor.
1303 (Sized_dwarf_line_info::buffer_start_): New data member.
1304 * merge.cc (Output_merge_data::do_add_input_section): Call
1305 Object::decompressed_section_contents.
1306 (Output_merge_string::do_add_input_section): Likewise.
1307 * object.cc (need_decompressed_section): New function.
1308 (build_compressed_section_map): Decompress sections needed later.
1309 (Sized_relobj_file::do_decompressed_section_contents): New function.
1310 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1311 * object.h (Object::decompressed_section_contents): New function.
1312 (Object::discard_decompressed_sections): New function.
1313 (Object::do_decompressed_section_contents): New function.
1314 (Object::do_discard_decompressed_sections): New function.
1315 (Compressed_section_info): New type.
1316 (Compressed_section_map): Include decompressed section contents.
1317 (Sized_relobj_file::do_decompressed_section_contents): New function.
1318 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1319
7b5de7ee
CC
13202012-02-16 Cary Coutant <ccoutant@google.com>
1321
1322 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1323 * testsuite/Makefile.in: Regenerate.
1324
f9fa4a63
CC
13252012-02-14 Cary Coutant <ccoutant@google.com>
1326
1327 * options.cc (General_options::finalize): Disallow -pie and -static.
1328
2c175ebc
DK
13292012-02-03 Doug Kwan <dougkwan@google.com>
1330
1331 * arm.cc (Arm_relocate_functions::abs8,
1332 Arm_relocate_functions::abs16): Use
1333 Bits::has_signed_unsigned_overflow32.
1334 (Arm_relocate_functions::thm_abs8): Correct range of
1335 overflow check.
1336 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1337 in assertions.
1338
90cff06f
DK
13392012-02-02 Doug Kwan <dougkwan@google.com>
1340
1341 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1342 position independent outputs, not just shared objects.
1343
63887f3d
L
13442012-01-30 H.J. Lu <hongjiu.lu@intel.com>
1345
1346 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1347 * configure: Regenerated.
1348
bef2b434
ILT
13492012-01-27 Ian Lance Taylor <iant@google.com>
1350
1351 * reloc.h (Bits): New class with static functions, copied from
1352 namespace utils in arm.cc.
1353 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
1354 instead.
1355
c335b55d
L
13562012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1357
1358 * incremental.cc (write_info_blocks): Correct relocation offset.
1359
41194d9f
L
13602012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1361
1362 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1363 (Relocate::tls_gd_to_le): Likewise.
1364
1bae613c
L
13652012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1366
1367 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1368
24482ca0
L
13692012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1370
1371 * configure.ac: Check if -mcmodel=medium works.
1372 * configure: Regenerated.
1373
c2c7840a
CC
13742012-01-24 Cary Coutant <ccoutant@google.com>
1375
1376 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1377 definition and ...
1378 (read_unsigned_LEB_128_x): ... this new function.
1379 (read_signed_LEB_128): Replaced with inline definition and ...
1380 (read_signed_LEB_128_x): ... this new function.
1381 * int_encoding.h (read_unsigned_LEB_128_x): New function.
1382 (read_unsigned_LEB_128): Add inline definition.
1383 (read_signed_LEB_128_x): New function.
1384 (read_signed_LEB_128): Add inline definition.
1385 * testsuite/Makefile.am (leb128_unittest): New unit test.
1386 * testsuite/Makefile.in: Regenerate.
1387 * testsuite/leb128_unittest.cc: New unit test.
1388
833de760 13892012-01-23 Ian Lance Taylor <iant@google.com>
9dee3b3c
ILT
1390
1391 PR gold/13617
1392 * i386.cc (Target_i386::do_code_fill): When using a jmp
1393 instruction, pad with nop instructions.
1394 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1395
618d6666
L
13962012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1397
1398 * x86_64.cc (gc_process_relocs): Add typename on types used in
1399 template.
1400 (scan_relocs): Likewise.
1401 (relocate_section): Likewise.
1402 (apply_relocation): Likewise.
1403
3660ff06
L
14042012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1405
1406 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1407 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1408 under x32.
1409
fc51264f
L
14102012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1411
1412 * x86_64.cc: Initial support for x32.
1413
dd74ae06
CC
14142012-01-03 Cary Coutant <ccoutant@google.com>
1415
1416 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1417 Use abstract base class for GOT.
1418 * gold/output.h (class Output_data_got_base): New abstract base class.
1419 (class Output_data_got): Derive from new base class, adjust ctors.
1420 (Output_data_got::reserve_slot): Make virtual; rename to
1421 do_reserve_slot; Adjust callers.
1422 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1423 pointer to abstract base class.
1424 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1425
83896202
ILT
14262011-12-18 Ian Lance Taylor <iant@google.com>
1427
1428 * object.h (Relobj::local_symbol_value): New function.
1429 (Relobj::local_plt_offset): New function.
1430 (Relobj::local_has_got_offset): New function.
1431 (Relobj::local_got_offset): New function.
1432 (Relobj::set_local_got_offset): New function.
1433 (Relobj::do_local_symbol_value): New pure virtual function.
1434 (Relobj::do_local_plt_offset): Likewise.
1435 (Relobj::do_local_has_got_offset): Likewise.
1436 (Relobj::do_local_got_offset): Likewise.
1437 (Relobj::do_set_local_got_offset): Likewise.
1438 (Sized_relobj::do_local_has_got_offset): Rename from
1439 local_has_got_offset.
1440 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1441 (Sized_relobj::do_set_local_got_offset): Rename from
1442 set_local_got_offset.
1443 (Sized_relobj_file::do_local_plt_offset): Rename from
1444 local_plt_offset.
1445 (Sized_relobj_file::do_local_symbol_value): New function.
1446 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1447 local_plt_offset.
1448 * output.cc (Output_data_got::Got_entry::write): Change object to
1449 Relobj. Use local_symbol_value.
1450 (Output_data_got::add_global_with_rel): Change rel_dyn to
1451 Output_data_reloc_generic*. Use add_global_generic.
1452 (Output_data_got::add_global_with_rela): Remove. Change all
1453 callers to use add_global_with_rel.
1454 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1455 Output_data_reloc_generic*. Use add_global_generic.
1456 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1457 callers to use add_global_pair_with_rel.
1458 (Output_data_got::add_local): Change object to Relobj*.
1459 (Output_data_got::add_local_plt): Likewise.
1460 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1461 change rel_dyn to Output_data_reloc_generic*. Use
1462 add_local_generic.
1463 (Output_data_got::add_local_with_rela): Remove. Change all
1464 callers to use all_local_with_rel.
1465 (Output_data_got::add_local_pair_with_rel): Change object to
1466 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1467 add_output_section_generic.
1468 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1469 callers to use add_local_pair_with_rel.
1470 (Output_data_got::reserve_local): Change object to Relobj*.
1471 * output.h: (class Output_data_reloc_generic): Add pure virtual
1472 declarations for add_global_generic, add_local_generic,
1473 add_output_section_generic.
1474 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1475 functions for Output_data_reloc_generic. Update declarations for
1476 changes listed in output.cc.
1477 (class Output_data_got): Change template parameter to got_size.
1478 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1479 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1480 function.
1481 (Sized_relobj_incr::do_local_plt_offset): New function.
1482 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1483 add_global_generic.
1484
76677ad0
CC
14852011-12-17 Cary Coutant <ccoutant@google.com>
1486
1487 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1488 * resolve.cc (Symbol_table::resolve): Likewise.
1489 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1490 arrays.
1491 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1492
8b8dd8d5
ILT
14932011-12-16 Ian Lance Taylor <iant@google.com>
1494
1495 * output.h (Output_data_reloc_generic::add): Only call
1496 add_dynamic_reloc if this is a dynamic reloc section.
1497
d55525b9
L
14982011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1499
1500 PR gold/13505
1501 * target-reloc.h (apply_relocation): Replace <64, false> with
1502 <size, big_endian>.
1503
ff81c7c1
NC
15042011-11-25 Nick Clifton <nickc@redhat.com>
1505
1506 * po/it.po: New Italian translation.
1507
628f39be
SA
15082011-11-17 Sterling Augustine <saugustine@google.com>
1509
1510 * script.cc (script_include_directive): Implement.
1511 (read_script_file): New local variables name and search_path. Update
1512 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1513 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1514 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1515
98ef3ea4
SA
15162011-11-11 Sterling Augustine <saugustine@google.com>
1517
1518 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1519 (file_or_sections_cmd): Likewise.
1520
f4a8b6d7
DK
15212011-11-11 Doug Kwan <dougkwan@google.com>
1522
1523 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1524 if --just-symbols is given.
1525
29ab395d
DK
15262011-11-10 Doug Kwan <dougkwan@google.com>
1527
1528 PR gold/13362
1529 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1530 when processing data relocs.
1531 * reloc.h (Relocate_functions::rel_unaligned): New method.
1532 (Relocate_functions::pcrel_unaligned): Ditto.
1533 (Relocate_functions::rel32_unaligned): Ditto.
1534 (Relocate_functions::pcrel32_unaligned): Ditto.
1535
2c339f71
DK
15362011-11-09 Doug Kwan <dougkwan@google.com>
1537
1538 PR gold/13362
1539 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1540 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1541 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1542 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1543 (Relocate_functions::rel_unaligned): New.
1544 (Relocate_functions::rel32_unaligned): New.
1545 * target-reloc.h (relocate_for_relocatable): Add code to handle
1546 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1547 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1548 arm_unaligned_reloc_r): New targets.
1549 * testsuite/Makefile.in: Regenerate.
1550 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1551 linking.
1552
3f3cddf1
ILT
15532011-11-02 Ian Lance Taylor <iant@google.com>
1554
1555 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1556 NATIVE_LINKER.
1557 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1558 * options.cc (General_options::finalize): Use library search path
1559 from configure script if specified. If not native and no sysroot,
1560 only search TOOLLIBDIR.
1561 * options.h (Search_directory::Search_directory): Change name to
1562 const std::string&.
1563 (General_options::add_to_library_path_with_sysroot): Change arg to
1564 const std::string&.
1565 * configure, Makefile.in, config.in: Rebuild.
1566
a8e2273b
ILT
15672011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1568
1569 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1570 we are working around the ARM1176 Erratum.
1571 * options.h (General_options::fix_arm1176): Add option.
1572 * testsuite/Makefile.am: Add testcases, and keep current ones
1573 working.
1574 * testsuite/Makefile.in: Regenerate.
1575 * testsuite/arm_fix_1176.s: New file.
1576 * testsuite/arm_fix_1176.sh: Likewise.
1577
cd6eab1c
ILT
15782011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1579
1580 * arm.cc (Target_arm::Target_arm): Remove initialisation of
1581 may_use_blx_.
1582 (Target_arm::may_use_blx): Remove method.
1583 (Target_arm::set_may_use_blx): Likewise.
1584 (Target_arm::may_use_v4t_interworking): New method.
1585 (Target_arm::may_use_v5t_interworking): Likewise.
1586 (Target_arm::may_use_blx_): Remove member variable.
1587 (Arm_relocate_functions::arm_branch_common): Check for v5T
1588 interworking.
1589 (Arm_relocate_functions::thumb_branch_common): Likewise.
1590 (Reloc_stub::stub_type_for_reloc): Likewise.
1591 (Target_arm::do_finalize_sections): Correct interworking checks.
1592 * testsuite/Makefile.am: Add new tests.
1593 * testsuite/Makefile.in: Regenerate.
1594 * testsuite/arm_farcall_arm_arm.s: New test.
1595 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1596 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1597 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1598 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1599 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1600 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1601 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1602
286adcf4
CC
16032011-10-31 Cary Coutant <ccoutant@google.com>
1604
1605 PR gold/13023
1606 * expression.cc (Expression::eval_with_dot): Add
1607 is_section_dot_assignment parameter.
1608 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1609 absolute and assigning to dot within a section.
1610 * script-sections.cc
1611 (Output_section_element_assignment::set_section_addresses): Pass
1612 dot_section to set_if_absolute.
1613 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1614 as is_section_dot_assignment flag to eval_with_dot.
1615 (Output_section_element_dot_assignment::set_section_addresses):
1616 Likewise.
1617 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1618 parameter. Also set value if relative to dot_section; set the
1619 symbol's output_section.
1620 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1621 parameter. Adjust all callers.
1622 (Expression::eval_maybe_dot): Likewise.
1623 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1624 Adjust all callers.
1625 * testsuite/script_test_2.t: Test assignment of an absolute value
1626 to dot within an output section element.
1627
9634ed06
CC
16282011-10-31 Cary Coutant <ccoutant@google.com>
1629
1630 * options.h (class General_options): Add --[no-]gnu-unique options.
1631 * symtab.cc (Symbol_table::sized_write_globals): Convert
1632 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1633
de4101c7
CC
16342011-10-31 Cary Coutant <ccoutant@google.com>
1635
1636 PR gold/13359
1637 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1638 unnecessary assertion.
1639 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1640
7257cc92
ST
16412011-10-31 Sriraman Tallam <tmsriram@google.com>
1642
1643 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1644 gc_mark_symbol.
1645 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1646 gc_mark_symbol.
1647 Change to just keep the section associated with symbol.
1648 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1649 they are externally visible and --export-dynamic is turned on.
1650 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1651
bfc34b3f
ILT
16522011-10-19 Ian Lance Taylor <iant@google.com>
1653
1654 PR gold/13163
1655 * script-sections.cc
1656 (Output_section_element_dot_assignment::needs_output_section): New
1657 function.
1658
ea0d8c47
ILT
16592011-10-19 Ian Lance Taylor <iant@google.com>
1660
1661 PR gold/13204
1662 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1663 --section-start option was seen.
1664 * options.h (General_options::any_section_start): New function.
1665
abd242a9
DM
16662011-10-18 David S. Miller <davem@davemloft.net>
1667
1668 PR binutils/13301
1669 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1670 member to track relocation locations that have moved during TLS
1671 reloc optimizations.
1672 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1673 (Target_sparc::Relocate::relocate): Adjust view down by 4
1674 bytes if it matches reloc_adjust_addr_.
1675 (Target_sparc::Relocate::relocate_tls): Always move the
1676 __tls_get_addr call delay slot instruction forward 4 bytes when
1677 performing relaxation.
1678
bab9090f
CC
16792011-10-18 Cary Coutant <ccoutant@google.com>
1680
1681 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1682 (Output_file::map_no_anonymous): Check for non-zero
1683 return code from posix_fallocate.
1684
f7c5b166
CC
16852011-10-17 Cary Coutant <ccoutant@google.com>
1686
1687 PR gold/13245
1688 * plugin.cc (is_visible_from_outside): Check for symbols
1689 referenced from dynamic objects.
1690 * resolve.cc (Symbol_table::resolve): Don't count references
1691 from dynamic objects as references from real ELF files.
1692 * testsuite/plugin_test_2.sh: Adjust expected result.
1693
b490c0bb
CC
16942011-10-17 Cary Coutant <ccoutant@google.com>
1695
1696 * gold.cc: Include timer.h.
1697 (queue_middle_tasks): Stamp time.
1698 (queue_final_tasks): Likewise.
1699 * main.cc (main): Store timer in parameters. Print timers
1700 for each pass.
1701 * parameters.cc (Parameters::Parameters): Initialize timer_.
1702 (Parameters::set_timer): New function.
1703 (set_parameters_timer): New function.
1704 * parameters.h (Parameters::set_timer): New function.
1705 (Parameters::timer): New function.
1706 (Parameters::timer_): New data member.
1707 (set_parameters_timer): New function.
1708 * timer.cc (Timer::stamp): New function.
1709 (Timer::get_pass_time): New function.
1710 * timer.h (Timer::stamp): New function.
1711 (Timer::get_pass_time): New function.
1712 (Timer::pass_times_): New data member.
1713
f475cf7b
CC
17142011-10-17 Cary Coutant <ccoutant@google.com>
1715
1716 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1717 task for members of lib groups.
1718
cdd7e244
CC
17192011-10-17 Cary Coutant <ccoutant@google.com>
1720
1721 PR gold/13288
4f95c8b4 1722 * fileread.cc (File_read::find_view): Add assert.
cdd7e244
CC
1723 (File_read::make_view): Move bounds check (replace with assert)...
1724 (File_read::find_or_make_view): ... to here.
1725
dfb45471
CC
17262011-10-12 Cary Coutant <ccoutant@google.com>
1727
4f95c8b4 1728 * output.cc (Output_file::open_base_file): Handle case where
dfb45471
CC
1729 ::read returns less than requested size.
1730
53bbcc1b
CC
17312011-10-10 Cary Coutant <ccoutant@google.com>
1732
4f95c8b4 1733 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
53bbcc1b
CC
1734 Initialize defined_count_.
1735 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1736 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1737 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1738 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1739 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4f95c8b4 1740 * incremental.h (Sized_relobj_incr::defined_count_): New data
53bbcc1b
CC
1741 member.
1742 (Sized_incr_dynobj::defined_count_): New data member.
4f95c8b4 1743 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
53bbcc1b
CC
1744 Return zeroes instead of internal error.
1745
397b129b
CC
17462011-10-10 Cary Coutant <ccoutant@google.com>
1747
1748 PR gold/13249
4f95c8b4 1749 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
397b129b 1750 (Output_reloc::symbol_value): Return PLT offset if flag is set.
4f95c8b4 1751 * output.h (class Output_reloc): Add use_plt_offset flag.
397b129b
CC
1752 (Output_reloc::type_): Adjust size of bit field.
1753 (Output_reloc::use_plt_offset_): New bit field.
1754 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1755 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1756 flag. Adjust all callers.
4f95c8b4 1757 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
397b129b
CC
1758 creating RELATIVE relocations.
1759
d5698657
NC
17602011-10-10 Nick Clifton <nickc@redhat.com>
1761
1762 * po/es.po: Updated Spanish translation.
1763 * po/fi.po: Updated Finnish translation.
1764
6a59a5c2
DN
17652011-10-03 Diego Novillo <dnovillo@google.com>
1766
1767 * options.cc (parse_uint): Fix dereference of RETVAL.
1768
f0558624
ST
17692011-09-29 Sriraman Tallam <tmsriram@google.com>
1770
1771 * layout.h (section_order_map_): New member.
1772 (get_section_order_map): New member function.
1773 * output.cc (Output_section::add_input_section): Check for patterns
1774 only when --section-ordering-file is specified.
1775 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1776 output_sections have been formed.
1777 * layout.cc (Layout_Layout): Initialize section_order_map_.
1778 * plugin.cc (update_section_order): Store order in order_map. Do not
1779 update the order.
1780 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1781 * testsuite/Makefile.in: Regenerate.
1782 * testsuite/plugin_section_order.c: New file.
1783 * testsuite/plugin_final_layout.cc: New file.
1784 * testsuite/plugin_final_layout.sh: New file.
1785
a7dac153
CC
17862011-09-29 Cary Coutant <ccoutant@google.com>
1787
4f95c8b4 1788 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
a7dac153 1789 Check for NULL.
4f95c8b4 1790 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
a7dac153
CC
1791 symbols during incremental update.
1792 (Symbol_table::add_from_dynobj): Likewise.
1793
eebd87a5
ILT
17942011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1795 Ian Lance Taylor <iant@google.com>
1796
1797 * symtab.cc (Symbol_table::define_special_symbol): Always
1798 canonicalize version string.
1799
403a3331
CC
18002011-09-26 Cary Coutant <ccoutant@google.com>
1801
4f95c8b4
CC
1802 * gold.cc (queue_initial_tasks): Move option checks ...
1803 * options.cc (General_options::finalize): ... to here. Disable
403a3331
CC
1804 some options; make others fatal.
1805
235061c2
CC
18062011-09-26 Cary Coutant <ccoutant@google.com>
1807
1808 gcc PR lto/47247
1809 * plugin.cc (get_symbols_v2): New function.
1810 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1811 (is_referenced_from_outside): New function.
1812 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1813 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1814 (get_symbols): Pass version parameter.
1815 (get_symbols_v2): New function.
1816 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1817 parameter.
1818 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1819 (onload): Add LDPT_GET_SYMBOLS_V2.
1820 (all_symbols_read_hook): Use get_symbols_v2; check for
1821 LDPR_PREVAILING_DEF_IRONLY_EXP.
1822 * testsuite/plugin_test_3.sh: Update expected results.
1823
dc87f620
ILT
18242011-09-23 Simon Baldwin <simonb@google.com>
1825
1826 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1827 configuration options.
1828 * configure: Regenerate.
1829 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1830 * Makefile.in: Regenerate.
1831 * testsuite/Makefile.in: Regenerate.
1832
a8279f82
ST
18332011-09-19 Sriraman Tallam <tmsriram@google.com>
1834
1835 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1836
0c9350c8
CC
18372011-09-19 Cary Coutant <ccoutant@google.com>
1838
1839 * incremental.cc (can_incremental_update): Fix typo in comment.
1840 * incremental.h (can_incremental_update): Likewise.
1841
aa06ae28
CC
18422011-09-18 Cary Coutant <ccoutant@google.com>
1843
1844 * incremental.cc (can_incremental_update): New function.
1845 * incremental.h (can_incremental_update): New function.
1846 * layout.cc (Layout::init_fixed_output_section): Call it.
1847 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1848 * object.cc (Sized_relobj_file::do_layout): Call
1849 can_incremental_update.
1850
ebb300b2
CC
18512011-09-13 Cary Coutant <ccoutant@google.com>
1852
1853 * configure.ac: Check for glibc support for gnu_indirect_function
1854 support with static linking, setting automake conditional
1855 IFUNC_STATIC.
1856 * Makefile.in: Regenerate.
1857 * configure: Regenerate.
1858
1859 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1860 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1861 for IFUNC_STATIC.
1862 * testsuite/Makefile.in: Regenerate.
1863
1206d0d5
CC
18642011-09-13 Cary Coutant <ccoutant@google.com>
1865
1866 * incremental.cc (Sized_relobj_incr::do_layout): Call
1867 report_comdat_group for kept comdat sections.
1868 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1869 * testsuite/Makefile.in: Regenerate.
1870 * testsuite/incr_comdat_test_1.cc: New source file.
1871 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1872 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1873 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1874
40b29874
ILT
18752011-09-13 Ian Lance Taylor <iant@google.com>
1876
1877 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1878 variable external_symbols_offset.
1879
1b045aac
ILT
18802011-09-12 Ian Lance Taylor <iant@google.com>
1881
1882 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1883 triggered if object has no symbols.
1884
24c6c55a
DM
18852011-09-09 David S. Miller <davem@davemloft.net>
1886
1887 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1888 (Output_fill_debug_line::do_write): Likewise.
1889
66570254
CC
18902011-08-29 Cary Coutant <ccoutant@google.com>
1891
1892 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1893 casts to match formatting specs.
1894 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1895
8ea8cd50
CC
18962011-08-26 Cary Coutant <ccoutant@google.com>
1897
1898 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1899 remaining hole size when allocating.
1900 (Layout::make_output_section): Set fill methods for debug sections.
1901 * layout.h (Free_list::Free_list_node): Move from private to
1902 public.
1903 (Free_list::set_min_hole_size): New function.
1904 (Free_list::begin, Free_list::end): New functions.
1905 (Free_list::min_hole_): New data member.
1906 * output.cc: Include dwarf.h.
1907 (Output_fill_debug_info::do_minimum_hole_size): New function.
1908 (Output_fill_debug_info::do_write): New function.
1909 (Output_fill_debug_line::do_minimum_hole_size): New function.
1910 (Output_fill_debug_line::do_write): New function.
1911 (Output_section::Output_section): Initialize new data member.
1912 (Output_section::set_final_data_size): Ensure patch space is larger
1913 than minimum hole size.
1914 (Output_section::do_write): Fill holes in debug sections.
1915 * output.h (Output_fill): New class.
1916 (Output_fill_debug_info): New class.
1917 (Output_fill_debug_line): New class.
1918 (Output_section::set_free_space_fill): New function.
1919 (Output_section::free_space_fill_): New data member.
1920 * testsuite/Makefile.am (incremental_test_3): Add
1921 --incremental-patch option.
1922 (incremental_test_4): Likewise.
1923 (incremental_test_5): Likewise.
1924 (incremental_test_6): Likewise.
1925 (incremental_copy_test): Likewise.
1926 (incremental_common_test_1): Likewise.
1927 * testsuite/Makefile.in: Regenerate.
1928
7cf80422
NC
19292011-08-26 Nick Clifton <nickc@redhat.com>
1930
1931 * po/es.po: Updated Spanish translation.
1932
c3f7b0e5
CC
19332011-08-01 Cary Coutant <ccoutant@google.com>
1934
1935 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1936 * gold/testsuite/Makefile.in: Regenerate.
1937 * gold/testsuite/justsyms_exec.c: New source file.
1938 * gold/testsuite/justsyms_lib.c: New source file.
1939
9590bf25
CC
19402011-08-01 Cary Coutant <ccoutant@google.com>
1941
1942 * layout.cc (Layout::set_segment_offsets): Don't realign text
1943 segment if -Ttext was specified.
1944 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1945 file type.
1946 * object.h (Sized_relobj_file::e_type): New function.
1947 (Sized_relobj_file::e_type_): New data member.
1948 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1949 base address for ET_EXEC files.
1950 * target.cc (Target::do_make_elf_object_implementation): Allow
1951 ET_EXEC files with --just-symbols option.
1952
dcd8d12e
CC
19532011-07-28 Cary Coutant <ccoutant@google.com>
1954
1955 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1956 Add thread_number parameter.
1957 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1958 * workqueue-threads.cc
1959 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1960 current thread if its thread number is greater than desired thread
1961 count.
1962 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1963 Add thread_number parameter.
1964 (Workqueue::should_cancel_thread): Likewise.
1965 (Workqueue::find_runnable_or_wait): Pass thread_number to
1966 should_cancel_thread.
1967 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1968 parameter.
1969
804eb480
ST
19702011-07-22 Sriraman Tallam <tmsriram@google.com>
1971
1972 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1973 only after checking if it cannot be forced local.
1974 * symtab.h (is_externally_visible): Check if the symbol is not forced
1975 local.
1976
f1ddb600
ILT
19772011-07-15 Ian Lance Taylor <iant@google.com>
1978
1979 * options.h (class General_options): Add --print-output-format.
1980 Move -EL next to -EB, for better --help output.
1981 * target-select.cc: Include <cstdio>, "options.h", and
1982 "parameters.h".
1983 (Target_selector::do_target_bfd_name): New function.
1984 (print_output_format): New function.
1985 * target-select.h (class Target_selector): Update declarations.
1986 (Target_selector::target_bfd_name): New function.
1987 (print_output_format): Declare.
1988 * main.cc: Include "target-select.h".
1989 (main): Handle --print-output-format.
1990 * gold.cc: Include "target-select.h".
1991 (queue_initial_tasks): Handle --print-output-format when there are
1992 no input files.
1993 * parameters.cc (parameters_force_valid_target): Give a better
1994 error message if -EB/-EL does not match target.
1995 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1996 function.
1997
7d172687
ILT
19982011-07-15 Ian Lance Taylor <iant@google.com>
1999
2000 * i386.cc (class Output_data_plt_i386): Add layout_ field.
2001 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2002 (Output_data_plt_i386::do_write): Write address of .dynamic
2003 section to first entry in .got.plt section.
2004 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2005 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2006 Initialize layout_.
2007 (Output_data_plt_x86_64::do_write): Write address of .dynamic
2008 section to first entry in .got.plt section.
2009 * layout.h (Layout::dynamic_section): New function.
2010
e9552f7e
ST
20112011-07-13 Sriraman Tallam <tmsriram@google.com>
2012
2013 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2014 to claim_file call.
2015 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2016 input_section_position_, and input_section_glob_.
2017 (read_layout_from_file): Call function section_ordering_specified.
2018 * layout.h (is_section_ordering_specified): New function.
2019 (section_ordering_specified): New function.
2020 (section_ordering_specified_): New boolean member.
2021 * main.cc(main): Call load_plugins after layout object is defined.
2022 * output.cc (Output_section::add_input_section): Use
2023 function section_ordering_specified to check if section ordering is
2024 needed.
2025 * output.cc (Output_section::add_relaxed_input_section): Use
2026 function section_ordering_specified to check if section ordering is
2027 needed.
2028 (Output_section::update_section_layout): New function.
2029 (Output_section::sort_attached_input_sections): Check if input section
2030 must be reordered.
2031 * output.h (Output_section::update_section_layout): New function.
2032 * plugin.cc (get_section_count): New function.
2033 (get_section_type): New function.
2034 (get_section_name): New function.
2035 (get_section_contents): New function.
2036 (update_section_order): New function.
58797674 2037 (allow_section_ordering): New function.
e9552f7e
ST
2038 (Plugin::load): Add the new interfaces to the transfer vector.
2039 (Plugin_manager::load_plugins): New parameter.
2040 (Plugin_manager::all_symbols_read): New parameter.
2041 (Plugin_manager::claim_file): New parameter. Save the elf object for
2042 unclaimed objects.
2043 (Plugin_manager::get_elf_object): New function.
2044 (Plugin_manager::get_view): Change to directly use the bool to check
2045 if get_view is called from claim_file_hook.
2046 * plugin.h (input_objects): New function
2047 (Plugin__manager::load_plugins): New parameter.
2048 (Plugin_manager::claim_file): New parameter.
2049 (Plugin_manager::get_elf_object): New function.
2050 (Plugin_manager::in_claim_file_handler): New function.
2051 (Plugin_manager::in_claim_file_handler_): New member.
2052 (layout): New function.
2053 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2054 handler with an extra parameter. Make the elf object before calling
2055 claim_file handler.
2056 * testsuite/plugin_test.c (get_section_count): New function pointer.
2057 (get_section_type): New function pointer.
2058 (get_section_name): New function pointer.
2059 (get_section_contents): New function pointer.
2060 (update_section_order): New function pointer.
2061 (allow_section_ordering): New function pointer.
2062 (onload): Check if the new interfaces exist.
2063
9446efde
ILT
20642011-07-13 Ian Lance Taylor <iant@google.com>
2065
2066 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2067 relro section.
2068 * x86_64.cc (Target_x86_64::got_section): Likewise.
2069 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2070 (relro_now_test_SOURCES): New variable.
2071 (relro_now_test_DEPENDENCIES): New variable.
2072 (relro_now_test_LDFLAGS): New variable.
2073 (relro_now_test_LDADD): New variable.
2074 (relro_now_test.so): New target.
2075 * testsuite/Makefile.in: Rebuild.
2076
07aa62f2
ILT
20772011-07-12 Ian Lance Taylor <iant@google.com>
2078
2079 PR gold/12980
2080 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2081 GLOB_DAT relocation rather than a RELATIVE relocation for a
2082 protected symbol when creating a shared library.
2083 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2084 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2085 * testsuite/protected_main_1.cc (main): Test that protected
2086 function has same address.
2087
e2153196
ILT
20882011-07-11 Ian Lance Taylor <iant@google.com>
2089
2090 PR gold/12979
2091 * options.h (class General_options): Add -Bgroup.
2092 * options.cc (General_options::finalize): If -Bgroup is set,
2093 default to --unresolved-symbols=report-all.
2094 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2095 * target-reloc.h (issue_undefined_symbol_error): Handle
2096 --unresolved-symbols=report-all.
2097
6daf5215
ILT
20982011-07-08 Ian Lance Taylor <iant@google.com>
2099
2100 PR gold/11985
2101 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2102 if linker script discards key sections.
2103 (Layout::create_dynamic_symtab): Likewise.
2104 (Layout::assign_local_dynsym_offsets): Likewise.
2105 (Layout::sized_create_version_sections): Likewise.
2106 (Layout::create_interp): Likewise.
2107 (Layout::finish_dynamic_section): Likewise.
2108 (Layout::set_dynamic_symbol_size): Likewise.
2109
beabb2c6
ILT
21102011-07-08 Ian Lance Taylor <iant@google.com>
2111
2112 PR gold/12386
2113 * options.h (class General_options): Add --unresolved-symbols.
2114 * target-reloc.h (issue_undefined_symbol_error): Check
2115 --unresolved-symbols. Add comments.
2116
9c16daf1
ILT
21172011-07-08 Ian Lance Taylor <iant@google.com>
2118
2119 * testsuite/odr_violation2.cc (Ordering::operator()): Make
2120 expression more complex.
2121
191f1a2d
ILT
21222011-07-08 Ian Lance Taylor <iant@google.com>
2123
2124 PR gold/11317
2125 * target-reloc.h (issue_undefined_symbol_error): New inline
2126 function, broken out of relocate_section.
2127 (relocate_section): Call issue_undefined_symbol_error.
2128 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2129 there is no TLS segment if we are about to issue an undefined
2130 symbol error.
2131 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2132
62855347
ILT
21332011-07-08 Ian Lance Taylor <iant@google.com>
2134
2135 PR gold/12279
2136 * resolve.cc (Symbol_table::should_override): Add fromtype
2137 parameter. Change all callers. Give error when linking together
2138 TLS and non-TLS symbol.
2139 (Symbol_table::should_override_with_special): Add fromtype
2140 parameter. Change all callers.
2141 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2142 there is no TLS segment if we have reported some errors.
2143 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2144
67181c72
ILT
21452011-07-08 Ian Lance Taylor <iant@google.com>
2146
2147 PR gold/12372
2148 * target.h (Target::plt_address_for_global): New function.
2149 (Target::plt_address_for_local): New function.
2150 (Target::plt_section_for_global): Remove.
2151 (Target::plt_section_for_local): Remove.
2152 (Target::do_plt_address_for_global): New virtual function.
2153 (Target::do_plt_address_for_local): New virtual function.
2154 (Target::do_plt_section_for_global): Remove.
2155 (Target::do_plt_section_for_local): Remove.
2156 (Target::register_global_plt_entry): Add Symbol_table and Layout
2157 parameters.
2158 * output.cc (Output_data_got::Got_entry::write): Use
2159 plt_address_for_global and plt_address_for_local.
2160 * layout.cc (Layout::add_target_dynamic_tags): Use size and
2161 address of output section.
2162 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2163 got_irelative_, and irelative_count_ fields. Update
2164 declarations.
2165 (Output_data_plt_i386::has_irelative_section): New function.
2166 (Output_data_plt_i386::entry_count): Add irelative_count_.
2167 (Output_data_plt_i386::set_final_data_size): Likewise.
2168 (class Target_i386): Add got_irelative_ and rel_irelative_
2169 fields. Update declarations.
2170 (Target_i386::Target_i386): Initialize new fields.
2171 (Target_i386::do_plt_address_for_global): New function replacing
2172 do_plt_section_for_global.
2173 (Target_i386::do_plt_address_for_local): New function replacing
2174 do_plt_section_for_local.
2175 (Target_i386::got_section): Create got_irelative_.
2176 (Target_i386::rel_irelative_section): New function.
2177 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2178 fields. Don't define __rel_iplt_{start,end}.
2179 (Output_data_plt_i386::add_entry): Add symtab and layout
2180 parameters. Change all callers. Use different PLT and GOT for
2181 IFUNC symbols.
2182 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2183 layout parameters. Change all callers. Use different PLT and
2184 GOT.
2185 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2186 (Output_data_plt_i386::rel_irelative): New function.
2187 (Output_data_plt_i386::address_for_global): New function.
2188 (Output_data_plt_i386::address_for_local): New function.
2189 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
2190 IRELATIVE GOT when changing IFUNC GOT entries.
2191 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2192 reloc.
2193 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2194 if we didn't create an IRELATIVE GOT.
2195 (Target_i386::Relocate::relocate): Use plt_address_for_global and
2196 plt_address_for_local.
2197 (Target_i386::do_dynsym_value): Use plt_address_for_global.
2198 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2199 got_irelative_, and irelative_count_ fields. Update
2200 declarations.
2201 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2202 Initialize new fields. Remove symtab parameter. Change all
2203 callers.
2204 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2205 irelative_count_.
2206 (Output_data_plt_x86_64::has_irelative_section): New function.
2207 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2208 (class Target_x86_64): Add got_irelative_ and rel_irelative_
2209 fields. Update declarations.
2210 (Target_x86_64::Target_x86_64): Initialize new fields.
2211 (Target_x86_64::do_plt_address_for_global): New function replacing
2212 do_plt_section_for_global.
2213 (Target_x86_64::do_plt_address_for_local): New function replacing
2214 do_plt_section_for_local.
2215 (Target_x86_64::got_section): Create got_irelative_.
2216 (Target_x86_64::rela_irelative_section): New function.
2217 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
2218 all callers. Don't create __rel_iplt_{start,end}.
2219 (Output_data_plt_x86_64::add_entry): Add symtab and layout
2220 parameters. Change all callers. Use different PLT and GOT for
2221 IFUNC symbols.
2222 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2223 layout parameters. Change all callers. Use different PLT and
2224 GOT.
2225 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2226 parameters. Change all callers. Use different PLT and GOT for
2227 IFUNC symbols.
2228 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2229 (Output_data_plt_x86_64::rela_irelative): New function.
2230 (Output_data_plt_x86_64::address_for_global): New function.
2231 (Output_data_plt_x86_64::address_for_local): New function.
2232 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2233 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2234 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2235 (Target_x86_64::register_global_plt_entry): Add symtab and layout
2236 parameters.
2237 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2238 reloc.
2239 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2240 symbols if we didn't create an IRELATIVE GOT.
2241 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2242 plt_address_for_local.
2243 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2244 * testsuite/ifuncvar1.c: New test file.
2245 * testsuite/ifuncvar2.c: New test file.
2246 * testsuite/ifuncvar3.c: New test file.
2247 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2248 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2249 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2250 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2251 * testsuite/Makefile.in: Rebuild.
2252
33c15b45
CC
22532011-07-07 Cary Coutant <ccoutant@google.com>
2254
2255 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2256 (two_file_test_1_ndebug.o): Likewise.
2257 (two_file_test_1b_ndebug.o): Likewise.
2258 (two_file_test_2_ndebug.o): Likewise.
2259 (two_file_test_main_ndebug.o): Likewise.
2260 (incremental_test_2): Link with no-debug versions.
2261
f48b5fb7
CC
22622011-07-06 Cary Coutant <ccoutant@google.com>
2263
2264 * gold/incremental.cc
2265 (Output_section_incremental_inputs::write_info_blocks): Check for
2266 hidden and internal symbols.
2267
221597a5
CC
22682011-07-06 Cary Coutant <ccoutant@google.com>
2269
2270 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2271 Check disposition for startup file.
2272 (Incremental_inputs::report_command_line): Ignore
2273 --incremental-startup-unchanged option.
2274 * options.cc (General_options::parse_incremental_startup_unchanged):
2275 New function.
2276 (General_options::General_options): Initialize new data member.
2277 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2278 (General_options): Add --incremental-startup-unchanged option.
2279 (General_options::incremental_startup_disposition): New function.
2280 (General_options::incremental_startup_disposition_): New data member.
2281
e24719f6
CC
22822011-07-06 Cary Coutant <ccoutant@google.com>
2283
2284 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2285 input file index to Script_info ctor.
2286 (Sized_incremental_binary::do_file_has_changed): Find the
2287 command-line argument for files named in scripts.
2288 * incremental.h (Script_info::Script_info): New ctor
2289 with input file index.
2290 (Script_info::input_file_index): New function.
2291 (Script_info::input_file_index_): New data member.
2292 (Incremental_binary::get_library): Add const.
2293 (Incremental_binary::get_script_info): Add const.
2294 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2295 * testsuite/Makefile.am (incremental_test_5): New test case.
2296 (incremental_test_6): New test case.
2297 * testsuite/Makefile.in: Regenerate.
2298
8f7c81e8
CC
22992011-07-06 Cary Coutant <ccoutant@google.com>
2300
2301 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2302 debug output when command lines differ.
2303
9fbd3822
CC
23042011-07-06 Cary Coutant <ccoutant@google.com>
2305
2306 * incremental.cc (Incremental_inputs::report_command_line): Ignore
2307 --incremental-patch option.
2308 * layout.cc (Free_list::allocate): Extend allocation beyond original
2309 end if enabled.
2310 (Layout::make_output_section): Mark sections that should get
2311 patch space.
2312 * options.cc (parse_percent): New function.
2313 * options.h (parse_percent): New function.
2314 (DEFINE_percent): New macro.
2315 (General_options): Add --incremental-patch option.
2316 * output.cc (Output_section::Output_section): Initialize new data
2317 members.
2318 (Output_section::add_input_section): Print section name when out
2319 of patch space.
2320 (Output_section::add_output_section_data): Likewise.
2321 (Output_section::set_final_data_size): Add patch space when
2322 doing --incremental-full.
2323 (Output_section::do_reset_address_and_file_offset): Remove patch
2324 space.
2325 (Output_segment::set_section_list_addresses): Print debug output
2326 only if --incremental-update.
2327 * output.h (Output_section::set_is_patch_space_allowed): New function.
2328 (Output_section::is_patch_space_allowed_): New data member.
2329 (Output_section::patch_space_): New data member.
2330 * parameters.cc (Parameters::incremental_full): New function.
2331 * parameters.h (Parameters::incremental_full): New function
2332 * testsuite/Makefile.am (incremental_test_2): Add test for
2333 --incremental-patch option.
2334 * testsuite/Makefile.in: Regenerate.
2335 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2336 (t18): Remove function body.
2337
f6cccc2c
DK
23382011-07-05 Doug Kwan <dougkwan@google.com>
2339
2340 PR gold/12771
2341 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2342 Arm_Address type for relocation result.
2343 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
2344 overflow check.
2345 (Arm_relocate_functions::abs32): Use unaligned access.
2346 (Arm_relocate_functions::rel32): Ditto.
2347 (Arm_relocate_functions::prel31): Ditto.
2348 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2349 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2350 static data relocations.
2351 * testsuite/Makefile.in: Regnerate.
2352 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2353
28a13fec
ILT
23542011-07-05 Ian Lance Taylor <iant@google.com>
2355
2356 PR gold/12392
2357 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2358 symbols if necessary.
2359 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2360
24d47b34
ILT
23612011-07-05 Ian Lance Taylor <iant@google.com>
2362
2363 PR gold/12952
2364 * resolve.cc (Symbol::override_base_with_special): Simply override
2365 version with special symbol version, ignoring previous version.
2366
41f9cbbe
ILT
23672011-07-05 Ian Lance Taylor <iant@google.com>
2368
2369 * object.cc (Sized_relobj_file::include_section_group): Add
2370 information to comment about signature location.
2371
886288f1
ILT
23722011-07-02 Ian Lance Taylor <iant@google.com>
2373
2374 PR gold/12957
2375 * options.h (class General_options): Add -f and -F.
2376 * options.cc (General_options::finalize): Fatal error if -f/-F
2377 are used without -shared.
2378 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2379
ae3a6d4f
ILT
23802011-07-02 Ian Lance Taylor <iant@google.com>
2381
2382 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2383
21131061
ILT
23842011-07-01 Ian Lance Taylor <iant@google.com>
2385
2386 PR gold/12525
2387 PR gold/12952
2388 * resolve.cc (Symbol::override_base_with_special): Don't override
2389 the version if the overriding symbol has a different name.
2390 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2391 all callers. If we give an error about an undefined version,
2392 define the base version if necessary.
2393 * dynobj.h (class Versions): Update declaration.
2394 * testsuite/weak_alias_test_5.cc: New file.
2395 * testsuite/weak_alias_test.script: New file.
2396 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2397 and versioned_alias have the right value, and call t2.
2398 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2399 weak_alias_test_5.so.
2400 (weak_alias_test_LDADD): Likewise.
2401 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2402 * testsuite/Makefile.in: Rebuild.
2403
611062c0
ILT
24042011-07-01 Ian Lance Taylor <iant@google.com>
2405
2406 PR gold/12525
2407 * options.h (class General_options): Support -z notext.
2408 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2409 -Wl,-z,notext.
2410 (two_file_shared_nonpic.so): Likewise.
2411 (two_file_shared_mixed.so): Likewise.
2412 (two_file_shared_mixed_1.so): Likewise.
2413 (weak_undef_lib_nonpic.so): Likewise.
2414 (alt/weak_undef_lib_nonpic.so): Likewise.
2415 (tls_test_shared_nonpic.so): Likewise.
2416 * testsuite/Makefile.in: Rebuild.
2417
328c7c2f
ILT
24182011-07-01 Ian Lance Taylor <iant@google.com>
2419
2420 PR gold/12525
2421 * configure.ac: Test whether static linking works, setting
2422 the automake conditional HAVE_STATIC.
2423 * testsuite/Makefile.am: Disable tests using -static if
2424 HAVE_STATIC is not true.
2425 * configure, testsuite/Makefile.in: Rebuild.
2426
02d7cd44
ILT
24272011-07-01 Ian Lance Taylor <iant@google.com>
2428
2429 PR gold/12525
2430 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2431 Assert if we see DW_EH_PE_indirect.
2432 * target.h (Target::ehframe_datarel_base): New function.
2433 (Target::do_ehframe_datarel_base): New target function.
2434 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2435 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2436 function.
2437
07a60597
ILT
24382011-07-01 Ian Lance Taylor <iant@google.com>
2439
2440 PR gold/12571
2441 * options.h (class General_options): Add
2442 --ld-generated-unwind-info.
2443 * ehframe.cc (Fde::write): Add address parameter. Change all
2444 callers. If associated with PLT, fill in address and size.
2445 (Cie::set_output_offset): Only add merge mapping if there is an
2446 object.
2447 (Cie::write): Add address parameter. Change all callers.
2448 (Eh_frame::add_ehframe_for_plt): New function.
2449 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2450 input_offset_ fields into union u_, with new plt field.
2451 (Fde::Fde): Adjust for new union field.
2452 (Fde::Fde) [Output_data version]: New constructor.
2453 (Fde::add_mapping): Only add merge mapping if there is an object.
2454 (class Cie): Update declarations.
2455 (class Eh_frame): Declare add_ehframe_for_plt.
2456 * layout.cc (Layout::layout_eh_frame): Break out code into
2457 make_eh_frame_section, and call it.
2458 (Layout::make_eh_frame_section): New function.
2459 (Layout::add_eh_frame_for_plt): New function.
2460 * layout.h (class Layout): Update declarations.
2461 * merge.cc (Merge_map::add_mapping): Add assertion.
2462 * i386.cc: Include "dwarf.h".
2463 (class Output_data_plt_i386): Make first_plt_entry,
2464 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2465 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2466 and plt_eh_frame_fde.
2467 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2468 boundary. Call add_eh_frame_for_plt if appropriate.
2469 * x86_64.cc: Include "dwarf.h".
2470 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2471 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2472 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2473 and plt_eh_frame_fde.
2474 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2475 appropriate.
2476
14788a3f
ILT
24772011-06-29 Ian Lance Taylor <iant@google.com>
2478
2479 PR gold/12629
2480 * object.cc (Sized_relobj_file::layout_section): Change shdr
2481 parameter to be const.
2482 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2483 out of do_layout.
2484 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2485 appropriate. Call layout_eh_frame_section.
2486 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2487 sections.
2488 * object.h (class Sized_relobj_file): Update declarations.
2489
6c21fce1
ILT
24902011-06-29 Ian Lance Taylor <iant@google.com>
2491
37e41b03 2492 PR gold/12652
6c21fce1
ILT
2493 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2494 modifier.
2495 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2496
4d5e4e62
ILT
24972011-06-29 Ian Lance Taylor <iant@google.com>
2498
2499 PR gold/12675
2500 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2501 SHT_X86_64_UNWIND.
2502 * layout.cc (Layout::layout_eh_frame): Likewise.
2503
886f533a
ILT
25042011-06-29 Ian Lance Taylor <iant@google.com>
2505
2506 PR gold/12695
2507 * layout.cc (Layout::symtab_section_shndx): New function.
2508 * layout.h (class Layout): Declare symtab_section_shndx.
2509 * output.cc (Output_section::write_header): Call it.
2510
f3ae1b28
ILT
25112011-06-29 Ian Lance Taylor <iant@google.com>
2512
2513 PR gold/12818
2514 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2515 symbols which are not used in a relocation.
2516
aecf301f
ILT
25172011-06-28 Ian Lance Taylor <iant@google.com>
2518
2519 PR gold/12898
2520 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2521 script create indistinguishable segments.
2522 (Layout::set_segment_offsets): Use stable_sort when sorting
2523 segments. Pass this to Compare_segments constructor.
2524 * layout.h (class Layout): Make segment_precedes non-static.
2525 (class Compare_segments): Change from struct to class. Add
2526 layout_ field. Add constructor.
2527 * script-sections.cc
2528 (Script_sections::attach_sections_using_phdrs_clause): Rename
2529 local orphan to is_orphan. Don't report failure to put empty
2530 section in segment. On attachment failure, report name of
2531 section, and attach to first PT_LOAD segment.
2532
03ef7571
ILT
25332011-06-28 Ian Lance Taylor <iant@google.com>
2534
2535 PR gold/12934
2536 * target-select.cc (Target_selector::Target_selector): Add
2537 emulation parameter. Change all callers.
2538 (select_target_by_bfd_name): Rename from select_target_by_name.
2539 Change all callers.
2540 (select_target_by_emulation): New function.
2541 (supported_emulation_names): New function.
2542 * target-select.h (class Target_selector): Add emulation_ field.
2543 Update declarations.
2544 (Target_selector::recognize_by_bfd_name): Rename from
2545 recognize_by_name. Change all callers.
2546 (Target_selector::supported_bfd_names): Rename from
2547 supported_names. Change all callers.
2548 (Target_selector::recognize_by_emulation): New function.
2549 (Target_selector::supported_emulations): New function.
2550 (Target_selector::emulation): New function.
2551 (Target_selector::do_recognize_by_bfd_name): Rename from
2552 do_recognize_by_name. Change all callers.
2553 (Target_selector::do_supported_bfd_names): Rename from
2554 do_supported_names. Change all callers.
2555 (Target_selector::do_recognize_by_emulation): New function.
2556 (Target_selector::do_supported_emulations): New function.
2557 (select_target_by_bfd_name): Change name in declaration.
2558 (select_target_by_emulation): Declare.
2559 (supported_emulation_names): Declare.
2560 * parameters.cc (parameters_force_valid_target): Try to find
2561 target based on emulation from -m option.
2562 * options.h (class General_options): Change doc string for -m.
2563 * options.cc (help): Print emulations.
2564 (General_options::parse_V): Likewise.
2565 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2566 Add emulation parameter. Change all callers.
2567
200b2bb9
ILT
25682011-06-28 Ian Lance Taylor <iant@google.com>
2569
2570 * target.h (class Target): Add osabi_ field.
2571 (Target::osabi): New function.
2572 (Target::set_osabi): New function.
2573 (Target::Target): Initialize osabi_.
2574 (Target::do_adjust_elf_header): Make pure virtual.
2575 (Sized_target::do_adjust_elf_header): Declare.
2576 * target.cc (Sized_target::do_adjust_elf_header): New function.
2577 (class Sized_target): Instantiate all versions.
2578 * freebsd.h (class Target_freebsd): Remove.
2579 (Target_selector_freebsd::do_recognize): Call set_osabi on
2580 Target.
2581 (Target_selector_freebsd::do_recognize_by_name): Likewise.
2582 (Target_selector_freebsd::set_osabi): Remove.
2583 * i386.cc (class Target_i386): Inherit from Sized_target rather
2584 than Target_freebsd.
2585 * x86_64.cc (class Target_x86_64): Likewise.
2586
b3ce541e
ILT
25872011-06-28 Ian Lance Taylor <iant@google.com>
2588
2589 * target.h (Target::can_check_for_function_pointers): Rewrite.
2590 Make non-virtual.
2591 (Target::can_icf_inline_merge_sections): Likewise.
2592 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2593 (Target::Target_info): Add can_icf_inline_merge_sections field.
2594 (Target::do_can_check_for_function_pointers): New virtual
2595 function.
2596 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2597 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2598 from can_check_for_function_pointers, move in file.
2599 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2600 section_may_have_icf_unsafe_poineters, move in file.
2601 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2602 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2603 Rename from can_check_for_function_pointers, move in file.
2604 (Target_i386::can_icf_inline_merge_sections): Remove.
2605 (Target_i386::i386_info): Initialize
2606 can_icf_inline_merge_sections.
2607 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2608 Initialize can_icf_inline_merge_sections.
2609 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2610 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2611 Rename from can_check_for_function_pointers, move in file.
2612 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2613 (Target_x86_64::x86_64_info): Initialize
2614 can_icf_inline_merge_sections.
2615 * testsuite/testfile.cc (Target_test::test_target_info):
2616 Likewise.
2617 * icf.cc (get_section_contents): Correct formatting.
2618
6d1c4efb
ILT
26192011-06-27 Ian Lance Taylor <iant@google.com>
2620
2621 * symtab.cc (Symbol::versioned_name): New function.
2622 (Symbol_table::add_to_final_symtab): Use versioned_name when
2623 appropriate.
2624 (Symbol_table::sized_write_symbol): Likewise.
2625 * symtab.h (class Symbol): Declare versioned_name.
2626 * stringpool.h (class Stringpool_template): Add variant of add
2627 which takes a std::basic_string.
2628 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2629 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2630 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2631 (ver_test_12.o): New target.
2632 * testsuite/Makefile.in: Rebuild.
2633
57eb9b50
DK
26342011-06-27 Doug Kwan <dougkwan@google.com>
2635
2636 * arm.cc (Arm_relocate_functions::thm_jump8,
2637 Arm_relocate_functions::thm_jump11): Use a wider signed
2638 type to compute offset.
2639 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2640 arm_thm_jump8.
2641 * testsuite/Makefile.in: Regenerate.
2642 * testsuite/arm_branch_in_range.sh: Check test results of
2643 arm_thm_jump11 and arm_thm_jump8.
2644 * testsuite/arm_thm_jump11.s: New test source file.
2645 * testsuite/arm_thm_jump11.t: New linker script.
2646 * testsuite/arm_thm_jump8.s: New test source file.
2647 * testsuite/arm_thm_jump8.t: New linker script.
2648
487b39df
ILT
26492011-06-24 Ian Lance Taylor <iant@google.com>
2650
2651 * layout.cc: Include "object.h".
2652 (ctors_sections_in_init_array): New static variable.
2653 (Layout::is_ctors_in_init_array): New function.
2654 (Layout::layout): Add entry to ctors_sections_in_init_array if
2655 appropriate.
2656 * layout.h (class Layout): Declare is_ctors_in_init_array.
2657 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2658 is_ctors_reverse_view is set.
2659 (Sized_relobj_file::write_sections): Add layout parameter. Change
2660 all callers. Set is_ctors_reverse_view field of View_size.
2661 (Sized_relobj_file::reverse_words): New function.
2662 * object.h (Sized_relobj_file::View_size): Add
2663 is_ctors_reverse_view field.
2664 (class Sized_relobj_file): Update declarations.
2665 * testsuite/initpri3.c: New test.
2666 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2667 initpri3b.
2668 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2669 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2670 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2671 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2672 * testsuite/Makefile.in: Rebuild.
2673
472076e4
CC
26742011-06-24 Cary Coutant <ccoutant@google.com>
2675
2676 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2677 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2678 (debug_msg_cdebug.err): New targets.
2679 * testsuite/Makefile.in: Regenerate.
2680 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2681 Fix checks for link with shared library.
2682
a60af0db
DK
26832011-06-24 Doug Kwan <dougkwan@google.com>
2684
2685 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2686 skip empty text sections.
2687 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2688
5393d741
ILT
26892011-06-22 Ian Lance Taylor <iant@google.com>
2690
2691 PR gold/12910
2692 * options.h (class General_options): Add --ctors-in-init-array.
2693 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2694 friends as SHT_PROGBITS for merging sections.
2695 (Layout::layout): Remove special handling of .init_array and
2696 friends. Don't sort if doing relocatable link. Sort for .ctors
2697 and .dtors if ctors_in_init_array.
2698 (Layout::make_output_section): Force correct section types for
2699 .init_array and friends. Don't sort if doing relocatable link,
2700 Don't sort .ctors and .dtors if ctors_in_init_array.
2701 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2702 (Layout::output_section_name): Add relobj parameter. Change all
2703 callers. Handle .ctors. and .dtors. in code rather than table.
2704 Handle .ctors and .dtors if ctors_in_init_array.
2705 (Layout::match_file_name): New function, moved from output.cc.
2706 * layout.h (class Layout): Update declarations.
2707 * output.cc: Include "layout.h".
2708 (Input_section_sort_entry::get_priority): New function.
2709 (Input_section_sort_entry::match_file_name): Just call
2710 Layout::match_file_name.
2711 (Output_section::Input_section_sort_init_fini_compare::operator()):
2712 Handle .ctors and .dtors. Sort by explicit priority rather than
2713 by name.
2714 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2715 * testsuite/initpri2.c: New test.
2716 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2717 (check_PROGRAMS): Add initpri2.
2718 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2719 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2720 * configure, testsuite/Makefile.in: Rebuild.
2721
e1f74f98
ILT
27222011-06-19 Ian Lance Taylor <iant@google.com>
2723
2724 PR gold/12880
2725 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2726 .interp section to a PT_INTERP segment even if we have seen a
2727 --dynamic-linker option. Don't do it if we have seen a PHDRS
2728 clause in a linker script.
2729 (Layout::finalize): Don't create a .interp section if we've
2730 already create a PT_INTERP segment.
2731 (Layout::create_interp): Always call choose_output_section (revert
2732 patch of 2011-06-17). Don't create PT_INTERP segment.
2733 * script-sections.cc
2734 (Script_sections::create_note_and_tls_segments): Add a .interp
2735 section to a PT_INTERP segment even if we have seen a
2736 --dynamic-linker option.
2737
766f91bb
ILT
27382011-06-18 Ian Lance Taylor <iant@google.com>
2739
2740 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2741 merely because a non-PT_LOAD segment has a dynamic reloc.
2742
0d212c3a
ILT
27432011-06-18 Ian Lance Taylor <iant@google.com>
2744
2745 * layout.cc (Layout::finish_dynamic_section): Don't create
2746 DT_FLAGS entry if not needed.
2747
911a5072
ILT
27482011-06-18 Ian Lance Taylor <iant@google.com>
2749
2750 PR gold/12745
2751 * layout.cc (Layout::layout_eh_frame): Correct handling of
2752 writable .eh_frame section.
2753
534b4e5f
ILT
27542011-06-17 Ian Lance Taylor <iant@google.com>
2755
2756 PR gold/12893
2757 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2758 symbol is redefined with the exact same object and value.
2759
10b4f102
ILT
27602011-06-17 Ian Lance Taylor <iant@google.com>
2761
2762 PR gold/12880
2763 * layout.h (class Layout): Add interp_segment_ field.
2764 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2765 (Layout::attach_allocated_section_to_segment): If making shared
2766 library, put .interp section in PT_INTERP segment.
2767 (Layout::finalize): Also call create_interp if -dynamic-linker
2768 option was used.
2769 (Layout::create_interp): Assert that there is no PT_INTERP
2770 segment. If not using a SECTIONS clause, use make_output_section.
2771 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2772 * script-sections.cc
2773 (Script_sections::create_note_and_tls_segments): If making shared
2774 library, put .interp section in PT_INTERP segment.
2775
a29b0dad
ILT
27762011-06-17 Ian Lance Taylor <iant@google.com>
2777
e588ea8d
ILT
2778 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2779 when making a shared library.
2780
27812011-06-17 Ian Lance Taylor <iant@google.com>
2782
2783 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2784 parameter. Change all callers. Don't issue warning about PC32
2785 against locally defined symbol.
a29b0dad 2786
9d3b0698
ILT
27872011-06-16 Ian Lance Taylor <iant@google.com>
2788
2789 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2790 occurs in same object.
2791
85b0f90c
AM
27922011-06-14 Alan Modra <amodra@gmail.com>
2793
2794 * po/POTFILES.in: Regenerate.
2795
a94907d9
ILT
27962011-06-09 Ian Lance Taylor <iant@google.com>
2797
2798 * script-sections.cc
2799 (Orphan_output_section::set_section_addresses): For a relocatable
2800 link set address to 0.
2801
4fb3a1c3
CC
28022011-06-09 Cary Coutant <ccoutant@google.com>
2803
2804 PR gold/12804
2805 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2806 used with --compress-debug-sections.
2807 * gold/object.cc (Sized_relobj_file::do_layout): Report
2808 uncompressed size of compressed input sections.
2809
61220854
CC
28102011-06-08 Cary Coutant <ccoutant@google.com>
2811
2812 PR gold/12804
2813 * testsuite/two_file_test_2_v1.cc: Change initialization of
2814 v2 to keep it in .data.
2815
e6455dfb
CC
28162011-06-07 Cary Coutant <ccoutant@google.com>
2817
2818 * common.cc (Symbol_table::do_allocate_commons_list): Call
2819 gold_fallback.
2820 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2821 (Errors::fallback): New function.
2822 (gold_fallback): New function.
2823 * errors.h (Errors::fallback): New function.
2824 * gold.cc (gold_exit): Change status parameter to enum; adjust
2825 all callers.
2826 (queue_initial_tasks): Call gold_fallback.
2827 * gold.h: Include cstdlib.
2828 (Exit_status): New enum type.
2829 (gold_exit): Change status parameter to enum.
2830 (gold_fallback): New function.
2831 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2832 (Layout::create_symtab_sections): Likewise.
2833 (Layout::create_shdrs): Likewise.
2834 * main.cc (main): Adjust call to gold_exit.
2835 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2836 (Output_data_got::add_got_entry_pair): Likewise.
2837 (Output_section::add_input_section): Likewise.
2838 (Output_section::add_output_section_data): Likewise.
2839 (Output_segment::set_section_list_addresses): Likewise.
2840 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2841
fb0e076f
CC
28422011-06-07 Cary Coutant <ccoutant@google.com>
2843
2844 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2845 for incremental links.
2846 * output.cc (Output_segment::set_section_list_addresses): Remove
2847 FIXME and test for TLS or BSS.
2848
a5ee4d5d
CC
28492011-06-07 Cary Coutant <ccoutant@google.com>
2850
2851 * testsuite/Makefile.am: Add incremental_copy_test,
2852 incremental_common_test_1.
2853 * testsuite/Makefile.in: Regenerate.
2854 * testsuite/common_test_1_v1.c: New source file.
2855 * testsuite/common_test_1_v2.c: New source file.
2856 * testsuite/copy_test_v1.cc: New source file.
2857
5146f448
CC
28582011-06-07 Cary Coutant <ccoutant@google.com>
2859
2860 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2861 update, allocate common from bss section's free list.
2862 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2863 linker-defined symbols.
2864 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2865 Skip GOT and PLT entries that are no longer referenced.
2866 (Output_section_incremental_inputs::write_info_blocks): Mark
2867 linker-defined symbols.
2868 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2869 * output.cc (Output_section::allocate): New function.
2870 * output.h (Output_section::allocate): New function.
2871 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2872 linker-defined symbols.
2873 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2874 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2875 (Symbol::init_base_output_data): Likewise.
2876 (Symbol::init_base_output_segment): Likewise.
2877 (Symbol::init_base_constant): Likewise.
2878 (Sized_symbol::init_output_data): Likewise.
2879 (Sized_symbol::init_output_segment): Likewise.
2880 (Sized_symbol::init_constant): Likewise.
2881 (Symbol_table::do_define_in_output_data): Likewise.
2882 (Symbol_table::do_define_in_output_segment): Likewise.
2883 (Symbol_table::do_define_as_constant): Likewise.
2884 * symtab.h (Symbol::is_predefined): New function.
2885 (Symbol::init_base_output_data): Add is_predefined parameter.
2886 (Symbol::init_base_output_segment): Likewise.
2887 (Symbol::init_base_constant): Likewise.
2888 (Symbol::is_predefined_): New data member.
2889 (Sized_symbol::init_output_data): Add is_predefined parameter.
2890 (Sized_symbol::init_output_segment): Likewise.
2891 (Sized_symbol::init_constant): Likewise.
2892 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2893
26d3c67d
CC
28942011-06-07 Cary Coutant <ccoutant@google.com>
2895
2896 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2897 instead of emit_copy_reloc.
2898 (Copy_relocs::emit_copy_reloc): Refactor.
2899 (Copy_relocs::make_copy_reloc): New function.
2900 (Copy_relocs::add_copy_reloc): Remove.
2901 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2902 section.
2903 (Copy_relocs::make_copy_reloc): New function.
2904 (Copy_relocs::add_copy_reloc): Remove.
2905 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2906 unchanged input files.
2907 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2908 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2909 Reserve BSS space for COPY relocations.
2910 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2911 (Output_section_incremental_inputs::write_info_blocks): Record
2912 whether a symbol is copied from a shared object.
2913 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2914 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2915 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2916 (Incremental_input_entry_reader::get_output_symbol_index): Add
2917 is_copy parameter.
2918 (Incremental_binary::emit_copy_relocs): New function.
2919 (Incremental_binary::do_emit_copy_relocs): New function.
2920 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2921 new data member.
2922 (Sized_incremental_binary::add_copy_reloc): New function.
2923 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2924 (Sized_incremental_binary::Copy_reloc): New struct.
2925 (Sized_incremental_binary::Copy_relocs): New typedef.
2926 (Sized_incremental_binary::copy_relocs_): New data member.
2927 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2928 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2929 * target.h (Sized_target::emit_copy_reloc): New function.
2930 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2931
7cdb37d9
CC
29322011-06-02 Cary Coutant <ccoutant@google.com>
2933
2934 PR gold/12163
2935 * gold/archive.cc (Archive::Archive): Initialize new data member.
2936 (Archive::include_all_members): Return if archive has already been
2937 included.
2938 * gold/archive.h (Archive::include_all_members_): New data member.
2939
cc643b88
NC
29402011-06-02 Nick Clifton <nickc@redhat.com>
2941
2942 * dynobj.h: Fix spelling mistake in comment.
2943 * output.cc: Likewise.
2944
f62a3ca7 29452011-05-31 Doug Kwan <dougkwan@google.com>
2e702c99 2946 Asier Llano
f62a3ca7
DK
2947
2948 PR gold/12826
cc643b88 2949 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
f62a3ca7
DK
2950 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2951 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2952 redundant arm_exidx_test.so.
2953 * testsuite/Makefile.in: Regenerate.
2954 (check_SCRIPTS): Add pr12826.sh
2955 (check_DATA): Add pr12826.stdout
2956 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2957 * testsuite/pr12826.sh: New file.
2958 * testsuite/pr12826_1.s: Ditto.
2959 * testsuite/pr12826_1.s: Ditto.
2960
8dbe1edc
ILT
29612011-05-30 Ian Lance Taylor <iant@google.com>
2962
2963 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2964 sections.
2965
c49875be
ILT
29662011-05-29 Ian Lance Taylor <iant@google.com>
2967
2968 PR gold/12804
2969 * testsuite/Makefile.am: Use different file name for two_file_test
2970 temporary file for each incremental test.
2971 * testsuite/Makefile.in: Rebuild.
2972
69d53f7a
ILT
29732011-05-29 Ian Lance Taylor <iant@google.com>
2974
2975 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2976 binary input file is empty.
2977
41d0ab5f
ILT
29782011-05-27 Ian Lance Taylor <iant@google.com>
2979
2980 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2981 (ver_test_9.so): Likewise.
2982 * testsuite/Makefile.in: Rebuild.
2983
89d8a36b
CC
29842011-05-26 Cary Coutant <ccoutant@google.com>
2985
2986 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2987 * incremental.cc (Incremental_inputs::report_input_section): Fix
2988 comment, indentation.
2989 (Incremental_inputs::report_comdat_group): New function.
2990 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2991 of data for incremental input file entry.
2992 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2993 group count, COMDAT group signatures.
2994 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2995 an unchanged input file.
2996 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2997 Initialize new data member.
2998 (Incremental_object_entry::add_comdat_group): New function.
2999 (Incremental_object_entry::get_comdat_group_count): New function.
3000 (Incremental_object_entry::get_comdat_signature_key): New function.
3001 (Incremental_object_entry::groups_): New data member.
3002 (Incremental_inputs::report_comdat_group): New function.
3003 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3004 data for incremental input file entry.
3005 (Incremental_input_entry_reader::get_comdat_group_count): New function.
3006 (Incremental_input_entry_reader::get_input_section): Adjust size of
3007 data for incremental input file entry.
3008 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3009 (Incremental_input_entry_reader::get_comdat_group_signature): New
3010 function.
3011 * object.cc (Sized_relobj::include_section_group): Report kept
3012 COMDAT groups for incremental links.
3013
1706a06f
ILT
30142011-05-24 David Meyer <pdox@google.com>
3015
3016 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3017 with name parameter. Add found_name parameter.
3018 * fileread.cc (Input_file::find_file): Adjust code accordingly.
3019 * dirsearch.h (class Dirsearch): Update declaration.
3020
a10ae760
ILT
30212011-05-24 Ian Lance Taylor <iant@google.com>
3022
3023 * archive.cc (Library_base::should_include_member): Pull in object
3024 from archive if it defines the entry symbol.
3025 * parameters.cc (Parameters::entry): New function.
3026 * parameters.h (class Parameters): Declare entry.
3027 * output.h (class Output_file_header): Remove entry_ field.
3028 * output.cc (Output_file_header::Output_file_header): Remove entry
3029 parameter. Change all callers.
3030 (Output_file_header::entry): Use parameters->entry.
3031 * gold.cc (queue_middle_tasks): Likewise.
3032 * plugin.cc (Plugin_hook::run): Likewise.
3033
aa92d6ed
CC
30342011-05-24 Cary Coutant <ccoutant@google.com>
3035
3036 * gold.cc (queue_initial_tasks): Pass incremental base filename
3037 to Output_file::open_base_file; don't print error message.
3038 * incremental-dump.cc (main): Adjust call to
3039 Output_file::open_for_modification.
3040 * incremental-dump.cc (main): Likewise.
3041 * incremental.cc (Incremental_inputs::report_command_line):
3042 Ignore --incremental-base option when comparing command lines.
3043 Ignore parameter when given as separate argument.
3044 * options.h (class General_options): Add --incremental-base.
3045 * output.cc (Output_file::Output_file):
3046 (Output_file::open_base_file): Add base_name and writable parameters;
3047 read base file into new file; print error message here.
3048 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3049 callers.
3050 * output.h (Output_file::open_for_modification): Rename to...
3051 (Output_file::open_base_file): ...this; add base_name and
3052 writable parameters; adjust all callers.
3053 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3054 callers.
3055 * testsuite/Makefile.am (incremental_test_4): Test
3056 --incremental-base.
3057 * testsuite/Makefile.in: Regenerate.
3058
2eedd706
CC
30592011-05-24 Cary Coutant <ccoutant@google.com>
3060
3061 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3062 incremental_test_4.
3063 * testsuite/Makefile.in: Regenerate.
3064 * testsuite/two_file_test_1_v1.cc: New test source file.
3065 * testsuite/two_file_test_1b_v1.cc: New test source file.
3066 * testsuite/two_file_test_2_v1.cc: New test source file.
3067
0f1c85a6
CC
30682011-05-24 Cary Coutant <ccoutant@google.com>
3069
3070 * dynobj.h (Dynobj::do_dynobj): New function.
3071 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3072 flag and soname for shared objects.
3073 * incremental.cc (Incremental_inputs::report_object): Make
3074 either Incremental_object_entry or Incremental_dynobj_entry; add
3075 soname to string table.
3076 (Incremental_inputs::report_input_section): Add assertion.
3077 (Output_section_incremental_inputs::set_final_data_size): Adjust
3078 type of input file entry for shared libraries; adjust size of
3079 shared library info entry.
3080 (Output_section_incremental_inputs::write_input_files): Write
3081 as_needed flag for shared libraries.
3082 (Output_section_incremental_inputs::write_info_blocks): Adjust type
3083 of input file entry for shared libraries; write soname.
3084 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3085 soname from incremental info.
3086 * incremental.h (enum Incremental_input_flags): Add
3087 INCREMENTAL_INPUT_AS_NEEDED.
3088 (Incremental_input_entry::Incremental_input_entry): Initialize new
3089 data member.
3090 (Incremental_input_entry::set_as_needed): New function.
3091 (Incremental_input_entry::as_needed): New function.
3092 (Incremental_input_entry::do_dynobj_entry): New function.
3093 (Incremental_input_entry::as_needed_): New data member.
3094 (Incremental_object_entry::Incremental_object_entry): Don't check
3095 for shared library.
3096 (Incremental_object_entry::do_type): Likewise.
3097 (class Incremental_dynobj_entry): New class.
3098 (Incremental_input_entry_reader::as_needed): New function.
3099 (Incremental_input_entry_reader::get_soname): New function.
3100 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3101 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3102 size of shared library info entry.
58797674 3103 * layout.cc (Layout::finish_dynamic_section): Don't test for
0f1c85a6
CC
3104 incremental link when adding DT_NEEDED entries.
3105 * object.h (Object::Object): Initialize new data member.
3106 (Object::dynobj): New function.
3107 (Object::set_as_needed): New function.
3108 (Object::as_needed): New function.
3109 (Object::do_dynobj): New function.
3110 (Object::as_needed_): New data member.
3111
6fa2a40b
CC
31122011-05-24 Cary Coutant <ccoutant@google.com>
3113
3114 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3115 info; adjust display of GOT entries.
3116 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3117 vector of input objects; remove file_status_.
3118 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3119 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3120 got_plt reader; call target hooks to reserve GOT entries.
3121 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3122 of input file info header and GOT info entry.
3123 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3124 relocation info.
3125 (Got_plt_view_info::got_descriptor): Remove.
3126 (Got_plt_view_info::sym_index): New data member.
3127 (Got_plt_view_info::input_index): New data member.
3128 (Local_got_offset_visitor::visit): Write input file index.
3129 (Global_got_offset_visitor::visit): Write 0 for input file index.
3130 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3131 with sym_index and input_index.
3132 (Output_section_incremental_inputs::write_got_plt): Adjust size of
3133 incremental info GOT entry; replace got_descriptor with input_index.
3134 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3135 map from input file index to object.
3136 (Sized_relobj_incr::do_layout): Replace direct data member reference
3137 with accessor function.
3138 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3139 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3140 Adjust size of input file info header.
3141 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3142 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3143 (Incremental_input_entry_reader::get_input_section): Adjust size of
3144 input file info header.
3145 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3146 of incremental info GOT entry.
3147 (Incremental_got_plt_reader::get_got_desc): Remove.
3148 (Incremental_got_plt_reader::get_got_symndx): New function.
3149 (Incremental_got_plt_reader::get_got_input_index): New function.
3150 (Sized_incremental_binary::Sized_incremental_binary): Remove
3151 file_status_; add input_objects_.
3152 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3153 (Sized_incremental_binary::set_file_is_unchanged): Remove.
3154 (Sized_incremental_binary::file_is_unchanged): Remove.
3155 (Sized_incremental_binary::set_input_object): New function.
3156 (Sized_incremental_binary::input_object): New function.
3157 (Sized_incremental_binary::file_status_): Remove.
3158 (Sized_incremental_binary::input_objects_): New data member.
3159 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3160 references.
3161 (Sized_relobj_incr::invalid_address): Move to base class.
3162 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3163 class.
3164 (Sized_relobj_incr::do_output_section_offset): Likewise.
3165 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3166 (Sized_relobj_incr::section_offsets_): Likewise.
3167 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3168 function.
3169 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3170 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3171 with accessor function.
3172 (Sized_relobj_file::do_layout): Likewise.
3173 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3174 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3175 (Sized_relobj_file::compute_final_local_value): Replace refs to
3176 section_offsets_ with accessor function.
3177 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3178 * object.h (Relobj::Relobj): Initialize new data members.
3179 (Relobj::add_dyn_reloc): New function.
3180 (Relobj::first_dyn_reloc): New function.
3181 (Relobj::dyn_reloc_count): New function.
3182 (Relobj::first_dyn_reloc_): New data member.
3183 (Relobj::dyn_reloc_count_): New data member.
3184 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3185 references.
3186 (Sized_relobj::Address): New typedef.
3187 (Sized_relobj::invalid_address): Move here from child class.
3188 (Sized_relobj::Sized_relobj): Initialize new data members.
3189 (Sized_relobj::sized_relobj): New function.
3190 (Sized_relobj::is_output_section_offset_invalid): Move here from
3191 child class.
3192 (Sized_relobj::get_output_section_offset): Likewise.
3193 (Sized_relobj::local_has_got_offset): Likewise.
3194 (Sized_relobj::local_got_offset): Likewise.
3195 (Sized_relobj::set_local_got_offset): Likewise.
3196 (Sized_relobj::do_for_all_local_got_entries): Likewise.
3197 (Sized_relobj::clear_got_offsets): New function.
3198 (Sized_relobj::section_offsets): Move here from child class.
3199 (Sized_relobj::do_output_section_offset): Likewise.
3200 (Sized_relobj::do_set_section_offset): Likewise.
3201 (Sized_relobj::Local_got_offsets): Likewise.
3202 (Sized_relobj::local_got_offsets_): Likewise.
3203 (Sized_relobj::section_offsets_): Likewise.
3204 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3205 references.
3206 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3207 class.
3208 (Sized_relobj_file::sized_relobj): New function
3209 (Sized_relobj_file::local_has_got_offset): Move to base class.
3210 (Sized_relobj_file::local_got_offset): Likewise.
3211 (Sized_relobj_file::set_local_got_offset): Likewise.
3212 (Sized_relobj_file::get_output_section_offset): Likewise.
3213 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3214 (Sized_relobj_file::do_output_section_offset): Likewise.
3215 (Sized_relobj_file::do_set_section_offset): Likewise.
3216 (Sized_relobj_file::Local_got_offsets): Likewise.
3217 (Sized_relobj_file::local_got_offsets_): Likewise.
3218 (Sized_relobj_file::section_offsets_): Likewise.
3219 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3220 (all constructors).
3221 (set_needs_dynsym_index): Convert relobj to derived class pointer.
3222 (Output_reloc::get_symbol_index): Likewise.
3223 (Output_reloc::local_section_offset): Likewise.
3224 (Output_reloc::get_address): Likewise.
3225 (Output_reloc::symbol_value): Likewise.
3226 (Output_data_got::reserve_slot): Move to class definition.
3227 (Output_data_got::reserve_local): New function.
3228 (Output_data_got::reserve_slot_for_global): Remove.
3229 (Output_data_got::reserve_global): New function.
3230 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3231 (all constructors, two instantiations).
3232 (Output_reloc::get_relobj): New function (two instantiations).
3233 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3234 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3235 (Output_data_reloc::add_global): Adjust type of relobj.
3236 (Output_data_reloc::add_global_relative): Likewise.
3237 (Output_data_reloc::add_symbolless_global_addend): Likewise.
3238 (Output_data_reloc::add_local): Likewise.
3239 (Output_data_reloc::add_local_relative): Likewise.
3240 (Output_data_reloc::add_symbolless_local_addend): Likewise.
3241 (Output_data_reloc::add_local_section): Likewise.
3242 (Output_data_reloc::add_output_section): Likewise.
3243 (Output_data_reloc::add_absolute): Likewise.
3244 (Output_data_reloc::add_target_specific): Likewise.
3245 (Output_data_got::reserve_slot): Move definition here.
3246 (Output_data_got::reserve_local): New function.
3247 (Output_data_got::reserve_global): New function.
3248 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3249 section_offsets_ with accessor function.
3250 (Sized_relobj_file::write_sections): Likewise.
3251 (Sized_relobj_file::do_relocate_sections): Likewise.
3252 * target.h (Sized_target::reserve_local_got_entry): New function.
3253 (Sized_target::reserve_global_got_entry): New function.
3254 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3255 (Target_x86_64::reserve_global_got_entry): New function.
3256 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3257
4829d394
CC
32582011-05-23 Cary Coutant <ccoutant@google.com>
3259
3260 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3261 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3262 bit when checking got_type.
3263 * incremental.cc (Sized_incremental_binary::setup_readers):
3264 Store symbol table and string table locations; initialize bit vector
3265 of file status flags.
3266 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3267 unchanged files.
3268 (Sized_incremental_binary::do_process_got_plt): New function.
3269 (Sized_incremental_binary::get_symtab_view): Use stored locations.
3270 (Output_section_incremental_inputs::set_final_data_size): Record
3271 file index for each input file.
3272 (Output_section_incremental_inputs::write_got_plt): Store file index
3273 instead of input entry offset for each GOT entry.
3274 * incremental.h
3275 (Incremental_input_entry::Incremental_input_entry): Initialize new
3276 data member.
3277 (Incremental_input_entry::set_offset): Store file index.
3278 (Incremental_input_entry::get_file_index): New function.
3279 (Incremental_input_entry::file_index_): New data member.
3280 (Incremental_binary::process_got_plt): New function.
3281 (Incremental_binary::do_process_got_plt): New function.
3282 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3283 data members.
3284 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3285 (Sized_incremental_binary::set_file_is_unchanged): New function.
3286 (Sized_incremental_binary::file_is_unchanged): New function.
3287 (Sized_incremental_binary::do_process_got_plt): New function.
3288 (Sized_incremental_binary::file_status_): New data member.
3289 (Sized_incremental_binary::main_symtab_loc_): New data member.
3290 (Sized_incremental_binary::main_strtab_loc_): New data member.
3291 * output.cc (Output_data_got::Got_entry::write): Add case
3292 RESERVED_CODE.
3293 (Output_data_got::add_global): Call add_got_entry.
3294 (Output_data_got::add_global_plt): Likewise.
3295 (Output_data_got::add_global_with_rel): Likewise.
3296 (Output_data_got::add_global_with_rela): Likewise.
3297 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3298 (Output_data_got::add_global_pair_with_rela): Likewise.
3299 (Output_data_got::add_local): Call add_got_entry.
3300 (Output_data_got::add_local_plt): Likewise.
3301 (Output_data_got::add_local_with_rel): Likewise.
3302 (Output_data_got::add_local_with_rela): Likewise.
3303 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3304 (Output_data_got::add_local_pair_with_rela): Likewise.
3305 (Output_data_got::reserve_slot): New function.
3306 (Output_data_got::reserve_slot_for_global): New function.
3307 (Output_data_got::add_got_entry): New function.
3308 (Output_data_got::add_got_entry_pair): New function.
3309 (Output_section::add_output_section_data): Edit FIXME.
3310 * output.h
3311 (Output_section_data_build::Output_section_data_build): New
3312 constructor with size parameter.
3313 (Output_data_space::Output_data_space): Likewise.
3314 (Output_data_got::Output_data_got): Initialize new data member; new
3315 constructor with size parameter.
3316 (Output_data_got::add_constant): Call add_got_entry.
3317 (Output_data_got::reserve_slot): New function.
3318 (Output_data_got::reserve_slot_for_global): New function.
3319 (class Output_data_got::Got_entry): Add RESERVED_CODE.
3320 (Output_data_got::add_got_entry): New function.
3321 (Output_data_got::add_got_entry_pair): New function.
3322 (Output_data_got::free_list_): New data member.
3323 * target.h (Sized_target::init_got_plt_for_update): New function.
3324 (Sized_target::register_global_plt_entry): New function.
3325 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3326 Initialize new data member; call init; add constructor with PLT count.
3327 (Output_data_plt_x86_64::init): New function.
3328 (Output_data_plt_x86_64::add_relocation): New function.
3329 (Output_data_plt_x86_64::reserve_slot): New function.
3330 (Output_data_plt_x86_64::free_list_): New data member.
3331 (Target_x86_64::init_got_plt_for_update): New function.
3332 (Target_x86_64::register_global_plt_entry): New function.
3333 (Output_data_plt_x86_64::add_entry): Allocate from free list for
3334 incremental updates.
3335 (Output_data_plt_x86_64::add_relocation): New function.
3336 * testsuite/object_unittest.cc (Object_test): Set default options.
3337
ec69d6da
ILT
33382011-05-16 Ian Lance Taylor <iant@google.com>
3339
3340 * options.h (class General_options): Make -i a synonym for -r.
3341
732e31de
ILT
33422011-05-16 Ian Lance Taylor <iant@google.com>
3343
3344 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3345
403676b5
CC
33462011-05-10 Cary Coutant <ccoutant@google.com>
3347
3348 * object.cc (Sized_relobj::do_count_local_symbols): Check for
3349 strip_all (-s).
3350
5b7b7d6e
ILT
33512011-05-06 Ian Lance Taylor <iant@google.com>
3352
3353 * layout.cc (Layout::layout): If the output section flags change,
3354 update the ordering.
3355
f0f9babf
CC
33562011-04-25 Cary Coutant <ccoutant@google.com>
3357
3358 * incremental-dump.cc (dump_incremental_inputs): Print local
3359 symbol info for each input file.
3360 * incremental.cc
3361 (Output_section_incremental_inputs::set_final_data_size): Add local
3362 symbol info to input file entries in incremental info.
3363 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3364 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3365 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3366 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3367 implementation.
3368 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3369 (Sized_incr_relobj::do_relocate): Write the local symbols.
3370 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3371 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3372 Adjust size of input file header.
3373 (Incremental_inputs_reader::get_local_symbol_offset): New function.
3374 (Incremental_inputs_reader::get_local_symbol_count): New function.
3375 (Incremental_inputs_reader::get_input_section): Adjust size of input
3376 file header.
3377 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3378 (Sized_incr_relobj::This): New typedef.
3379 (Sized_incr_relobj::sym_size): New const data member.
3380 (Sized_incr_relobj::Local_symbol): New struct.
3381 (Sized_incr_relobj::do_output_local_symbol_count): New function.
3382 (Sized_incr_relobj::do_local_symbol_offset): New function.
3383 (Sized_incr_relobj::local_symbol_count_): New data member.
3384 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3385 (Sized_incr_relobj::local_symbol_index_): New data member.
3386 (Sized_incr_relobj::local_symbol_offset_): New data member.
3387 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3388 (Sized_incr_relobj::local_symbols_): New data member.
3389 * object.h (Relobj::output_local_symbol_count): New function.
3390 (Relobj::local_symbol_offset): New function.
3391 (Relobj::do_output_local_symbol_count): New function.
3392 (Relobj::do_local_symbol_offset): New function.
3393 (Sized_relobj::do_output_local_symbol_count): New function.
3394 (Sized_relobj::do_local_symbol_offset): New function.
3395
d0a9ace3
ILT
33962011-04-22 Vladimir Simonov <sv@sw.ru>
3397
3398 * descriptors.cc (set_close_on_exec): New function.
3399 (Descriptors::open): Use set_close_on_exec.
3400 * output.cc (S_ISLNK): Define if not defined.
3401
94a3fc8b
CC
34022011-04-22 Cary Coutant <ccoutant@google.com>
3403
3404 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3405 global symbol map.
3406 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3407 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3408 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3409 relocations.
3410 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3411 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3412 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3413 * incremental.h
3414 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3415 function.
3416 (Incremental_binary::apply_incremental_relocs): New function.
3417 (Incremental_binary::do_apply_incremental_relocs): New function.
3418 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3419 data member.
3420 (Sized_incremental_binary::add_global_symbol): New function.
3421 (Sized_incremental_binary::global_symbol): New function.
3422 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3423 (Sized_incremental_binary::symbol_map_): New data member.
3424 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3425 * target.h (Sized_target::apply_relocation): New function.
3426 * target-reloc.h (apply_relocation): New function.
3427 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3428
c87e4302
DK
34292011-04-22 Doug Kwan <dougkwan@google.com>
3430
3431 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3432 flag of a SHT_ARM_EXIDX section.
2e702c99 3433 * testsuite/Makefile.am (arm_exidx_test): New test rules.
c87e4302
DK
3434 * testsuite/Makefile.in: Regenerate.
3435 * testsuite/arm_exidx_test.s: New file.
3436 * testsuite/arm_exidx_test.sh: Same.
3437
e7782cf6
CC
34382011-04-20 Cary Coutant <ccoutant@google.com>
3439
3440 PR gold/12689
3441 * archive.h (Incremental_archive_entry::Archive_member):
3442 Initialize arg_serial_ (second constructor).
3443
308ecdc7
ILT
34442011-04-17 Ian Lance Taylor <iant@google.com>
3445
3446 * object.cc (Relocate_info::location): Simplify location string.
3447 * errors.cc (Errors::error_at_location): Don't print program
3448 name.
3449 (Errors::warning_at_location): Likewise.
3450 (Errors::undefined_symbol): Likewise.
3451 * testsuite/debug_msg.sh: Update accordingly.
3452
bec5b579
CC
34532011-04-14 Cary Coutant <ccoutant@google.com>
3454
3455 * gold/layout.cc (Layout::symtab_section_offset): New function.
3456 * gold/layout.h (Layout::symtab_section_offset): New function.
3457 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3458
88597d34
ILT
34592011-04-12 Ian Lance Taylor <iant@google.com>
3460
3461 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3462 with MREMAP_MAYMOVE.
3463 * output.h (class Output_file): Add map_is_allocated_ field.
3464 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3465 not available, provide stubs. If mremap is not available, #define
3466 it to gold_mremap.
3467 (MREMAP_MAYMOVE): Define if not defined.
3468 (Output_file::Output_file): Initialize map_is_allocated_.
3469 (Output_file::resize): Check map_is_allocated_.
3470 (Output_file::map_anonymous): If mmap fails, use malloc.
3471 (Output_file::unmap): Don't do anything for an anonymous map.
3472 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3473 is not available, provide stubs.
3474 (File_read::View::~View): Use free rather than delete[].
3475 (File_read::make_view): Use malloc rather than new[]. If mmap
3476 fails, use malloc.
3477 (File_read::find_or_make_view): Use malloc rather than new[].
3478 * gold.h: Remove HAVE_REMAP code.
3479 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3480 exists. Rename mremap to gold_mremap. If mmap is not available
3481 don't do anything.
3482 * configure, config.in: Rebuild.
3483
11e361bc
ILT
34842011-04-11 Ian Lance Taylor <iant@google.com>
3485
3486 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3487 initialize local variable v.
3488
cdc29364
CC
34892011-04-11 Cary Coutant <ccoutant@google.com>
3490
3491 * archive.cc (Archive::include_member): Adjust call to
3492 report_object.
3493 (Add_archive_symbols::run): Track argument serial numbers.
3494 (Lib_group::include_member): Likewise.
3495 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3496 * archive.h (Incremental_archive_entry::Archive_member):
3497 Initialize arg_serial_.
3498 (Archive_member::arg_serial_): New data member.
3499 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3500 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3501 incremental link.
3502 (Sized_dynobj::do_for_all_local_got_entries): New function.
3503 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3504 function.
3505 * fileread.cc (get_mtime): New function.
3506 * fileread.h (get_mtime): New function.
3507 * gold.cc (queue_initial_tasks): Check for incremental update.
3508 (process_incremental_input): New function.
3509 (queue_middle_tasks): Don't force valid target for incremental
3510 update.
3511 * incremental-dump.cc (find_input_containing_global): Adjust
3512 size of symbol info entry.
3513 (dump_incremental_inputs): Dump argument serial number and
3514 in_system_directory flag; bias shndx by 1; print symbol names
3515 when dumping per-file symbol lists; use new symbol info readers.
3516 * incremental.cc
3517 (Output_section_incremental_inputs:update_data_size): New function.
3518 (Sized_incremental_binary::setup_readers): Setup input readers
3519 for each input file; build maps for files added from libraries
3520 and scripts.
3521 (Sized_incremental_binary::check_input_args): New function.
3522 (Sized_incremental_binary::do_check_inputs): Build map of argument
3523 serial numbers to input arguments.
3524 (Sized_incremental_binary::do_file_has_changed): Rename
3525 do_file_is_unchanged to this; compare file modification times.
3526 (Sized_incremental_binary::do_init_layout): New function.
3527 (Sized_incremental_binary::do_reserve_layout): New function.
3528 (Sized_incremental_binary::do_get_input_reader): Remove.
3529 (Sized_incremental_binary::get_symtab_view): New function.
3530 (Incremental_checker::can_incrementally_link_output_file): Remove.
3531 (Incremental_inputs::report_command_line): Exclude --debug options.
3532 (Incremental_inputs::report_archive_begin): Add parameter; track
3533 argument serial numbers; don't put input file entry for archive
3534 before archive members.
3535 (Incremental_inputs::report_archive_end): Put input file entry
3536 for archive after archive members.
3537 (Incremental_inputs::report_object): Add parameter; track argument
3538 serial numbers and in_system_directory flag.
3539 (Incremental_inputs::report_script): Add parameter; track argument
3540 serial numbers.
3541 (Output_section_incremental_inputs::set_final_data_size): Adjust
3542 size of symbol info entry; check for forwarding symbols.
3543 (Output_section_incremental_inputs::write_input_files): Write
3544 in_system_directory flag and argument serial number.
3545 (Output_section_incremental_inputs::write_info_blocks): Map section
3546 indices between incremental info and original input file; store
3547 input section index for each symbol.
3548 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3549 change operator() to visit().
3550 (class Global_got_offset_visitor): Likewise.
3551 (class Global_symbol_visitor_got_plt):
3552 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3553 classes.
3554 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3555 (Sized_incr_relobj::do_read_symbols): New function.
3556 (Sized_incr_relobj::do_layout): New function.
3557 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3558 (Sized_incr_relobj::do_add_symbols): New function.
3559 (Sized_incr_relobj::do_should_include_member): New function.
3560 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3561 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3562 (Sized_incr_relobj::do_section_size): New function.
3563 (Sized_incr_relobj::do_section_name): New function.
3564 (Sized_incr_relobj::do_section_contents): New function.
3565 (Sized_incr_relobj::do_section_flags): New function.
3566 (Sized_incr_relobj::do_section_entsize): New function.
3567 (Sized_incr_relobj::do_section_address): New function.
3568 (Sized_incr_relobj::do_section_type): New function.
3569 (Sized_incr_relobj::do_section_link): New function.
3570 (Sized_incr_relobj::do_section_info): New function.
3571 (Sized_incr_relobj::do_section_addralign): New function.
3572 (Sized_incr_relobj::do_initialize_xindex): New function.
3573 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3574 (Sized_incr_relobj::do_read_relocs): New function.
3575 (Sized_incr_relobj::do_gc_process_relocs): New function.
3576 (Sized_incr_relobj::do_scan_relocs): New function.
3577 (Sized_incr_relobj::do_count_local_symbols): New function.
3578 (Sized_incr_relobj::do_finalize_local_symbols): New function.
3579 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3580 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3581 (Sized_incr_relobj::do_relocate): New function.
3582 (Sized_incr_relobj::do_set_section_offset): New function.
3583 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3584 (Sized_incr_dynobj::do_read_symbols): New function.
3585 (Sized_incr_dynobj::do_layout): New function.
3586 (Sized_incr_dynobj::do_add_symbols): New function.
3587 (Sized_incr_dynobj::do_should_include_member): New function.
3588 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3589 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3590 (Sized_incr_dynobj::do_section_size): New function.
3591 (Sized_incr_dynobj::do_section_name): New function.
3592 (Sized_incr_dynobj::do_section_contents): New function.
3593 (Sized_incr_dynobj::do_section_flags): New function.
3594 (Sized_incr_dynobj::do_section_entsize): New function.
3595 (Sized_incr_dynobj::do_section_address): New function.
3596 (Sized_incr_dynobj::do_section_type): New function.
3597 (Sized_incr_dynobj::do_section_link): New function.
3598 (Sized_incr_dynobj::do_section_info): New function.
3599 (Sized_incr_dynobj::do_section_addralign): New function.
3600 (Sized_incr_dynobj::do_initialize_xindex): New function.
3601 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3602 (make_sized_incremental_object): New function.
3603 (Incremental_library::copy_unused_symbols): New function.
3604 (Incremental_library::do_for_all_unused_symbols): New function.
3605 * incremental.h (enum Incremental_input_flags): New type.
3606 (class Incremental_checker): Remove.
3607 (Incremental_input_entry::Incremental_input_entry): Add argument
3608 serial number.
3609 (Incremental_input_entry::arg_serial): New function.
3610 (Incremental_input_entry::set_is_in_system_directory): New function.
3611 (Incremental_input_entry::is_in_system_directory): New function.
3612 (Incremental_input_entry::arg_serial_): New data member.
3613 (Incremental_input_entry::is_in_system_directory_): New data member.
3614 (class Script_info): Move here from script.h.
3615 (Script_info::Script_info): Add filename parameter.
3616 (Script_info::filename): New function.
3617 (Script_info::filename_): New data member.
3618 (Incremental_script_entry::Incremental_script_entry): Add argument
3619 serial number.
3620 (Incremental_object_entry::Incremental_object_entry): Likewise.
3621 (Incremental_object_entry::add_input_section): Build list of input
3622 sections with map to original shndx.
3623 (Incremental_object_entry::get_input_section_index): New function.
3624 (Incremental_object_entry::shndx_): New data member.
3625 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3626 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3627 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3628 serial number.
3629 (Incremental_inputs::report_archive_begin): Likewise.
3630 (Incremental_inputs::report_object): Likewise.
3631 (Incremental_inputs::report_script): Likewise.
3632 (class Incremental_global_symbol_reader): New class.
3633 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3634 and store flags and input file type.
3635 (Incremental_input_entry_reader::arg_serial): New function.
3636 (Incremental_input_entry_reader::type): Extract type from flags.
3637 (Incremental_input_entry_reader::is_in_system_directory): New function.
3638 (Incremental_input_entry_reader::get_input_section_count): Call
3639 accessor function for type.
3640 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3641 function for type; adjust size of global symbol entry.
3642 (Incremental_input_entry_reader::get_global_symbol_count): Call
3643 accessor function for type.
3644 (Incremental_input_entry_reader::get_object_count): Likewise.
3645 (Incremental_input_entry_reader::get_object_offset): Likewise.
3646 (Incremental_input_entry_reader::get_member_count): Likewise.
3647 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3648 (Incremental_input_entry_reader::get_member_offset): Likewise.
3649 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3650 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3651 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3652 (Incremental_input_entry_reader::get_global_symbol_reader): New
3653 function.
3654 (Incremental_input_entry_reader::get_output_symbol_index): New
3655 function.
3656 (Incremental_input_entry_reader::type_): Remove.
3657 (Incremental_input_entry_reader::flags_): New data member.
3658 (Incremental_inputs_reader::input_file_offset): New function.
3659 (Incremental_inputs_reader::input_file_index): New function.
3660 (Incremental_inputs_reader::input_file): Call input_file_offset.
3661 (Incremental_inputs_reader::input_file_at_offset): New function.
3662 (Incremental_relocs_reader::get_r_type): Reformat.
3663 (Incremental_relocs_reader::get_r_shndx): Reformat.
3664 (Incremental_relocs_reader::get_r_offset): Reformat.
3665 (Incremental_relocs_reader::data): New function.
3666 (Incremental_binary::Incremental_binary): Initialize new data members.
3667 (Incremental_binary::check_inputs): Add cmdline parameter.
3668 (Incremental_binary::file_is_unchanged): Remove.
3669 (Input_reader::arg_serial): New function.
3670 (Input_reader::get_unused_symbol_count): New function.
3671 (Input_reader::get_unused_symbol): New function.
3672 (Input_reader::do_arg_serial): New function.
3673 (Input_reader::do_get_unused_symbol_count): New function.
3674 (Input_reader::do_get_unused_symbol): New function.
3675 (Incremental_binary::input_file_count): New function.
3676 (Incremental_binary::get_input_reader): Change signature to use
3677 index instead of filename.
3678 (Incremental_binary::file_has_changed): New function.
3679 (Incremental_binary::get_input_argument): New function.
3680 (Incremental_binary::get_library): New function.
3681 (Incremental_binary::get_script_info): New function.
3682 (Incremental_binary::init_layout): New function.
3683 (Incremental_binary::reserve_layout): New function.
3684 (Incremental_binary::output_file): New function.
3685 (Incremental_binary::do_check_inputs): New function.
3686 (Incremental_binary::do_file_is_unchanged): Remove.
3687 (Incremental_binary::do_file_has_changed): New function.
3688 (Incremental_binary::do_init_layout): New function.
3689 (Incremental_binary::do_reserve_layout): New function.
3690 (Incremental_binary::do_input_file_count): New function.
3691 (Incremental_binary::do_get_input_reader): Change signature.
3692 (Incremental_binary::input_args_map_): New data member.
3693 (Incremental_binary::library_map_): New data member.
3694 (Incremental_binary::script_map_): New data member.
3695 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3696 new data members.
3697 (Sized_incremental_binary::output_section): New function.
3698 (Sized_incremental_binary::inputs_reader): Add const.
3699 (Sized_incremental_binary::symtab_reader): Add const.
3700 (Sized_incremental_binary::relocs_reader): Add const.
3701 (Sized_incremental_binary::got_plt_reader): Add const.
3702 (Sized_incremental_binary::get_symtab_view): New function.
3703 (Sized_incremental_binary::Inputs_reader): New typedef.
3704 (Sized_incremental_binary::Input_entry_reader): New typedef.
3705 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3706 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3707 (Sized_incremental_binary::do_file_has_changed): New function.
3708 (Sized_incremental_binary::do_init_layout): New function.
3709 (Sized_incremental_binary::do_reserve_layout): New function.
3710 (Sized_input_reader::Inputs_reader): Remove.
3711 (Sized_input_reader::Input_entry_reader): Remove.
3712 (Sized_input_reader::do_arg_serial): New function.
3713 (Sized_input_reader::do_get_unused_symbol_count): New function.
3714 (Sized_input_reader::do_get_unused_symbol): New function.
3715 (Sized_incremental_binary::do_input_file_count): New function.
3716 (Sized_incremental_binary::do_get_input_reader): Change signature;
3717 use index instead of filename.
3718 (Sized_incremental_binary::section_map_): New data member.
3719 (Sized_incremental_binary::input_entry_readers_): New data member.
3720 (class Sized_incr_relobj): New class.
3721 (class Sized_incr_dynobj): New class.
3722 (make_sized_incremental_object): New function.
3723 (class Incremental_library): New class.
3724 * layout.cc (Free_list::num_lists): New static data member.
3725 (Free_list::num_nodes): New static data member.
3726 (Free_list::num_removes): New static data member.
3727 (Free_list::num_remove_visits): New static data member.
3728 (Free_list::num_allocates): New static data member.
3729 (Free_list::num_allocate_visits): New static data member.
3730 (Free_list::init): New function.
3731 (Free_list::remove): New function.
3732 (Free_list::allocate): New function.
3733 (Free_list::dump): New function.
3734 (Free_list::print_stats): New function.
3735 (Layout_task_runner::run): Resize output file for incremental updates.
3736 (Layout::Layout): Initialize new data members.
3737 (Layout::set_incremental_base): New function.
3738 (Layout::init_fixed_output_section): New function.
3739 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3740 incremental updates.
3741 (Layout::create_gold_note): Do not create gold note section for
3742 incremental updates.
3743 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3744 for incremental updates.
3745 (Layout::set_section_offsets): For incremental updates, allocate space
3746 from free list.
3747 (Layout::create_symtab_sections): Layout with offsets relative to
3748 start of section; for incremental updates, allocate space from free
3749 list.
3750 (Layout::create_shdrs): For incremental updates, allocate space from
3751 free list.
3752 (Layout::finish_dynamic_section): For incremental updates, do not
3753 check --as-needed (fixed in subsequent patch).
3754 * layout.h (class Free_list): New class.
3755 (Layout::set_incremental_base): New function.
3756 (Layout::incremental_base): New function.
3757 (Layout::init_fixed_output_section): New function.
3758 (Layout::allocate): New function.
3759 (Layout::incremental_base_): New data member.
3760 (Layout::free_list_): New data member.
3761 * main.cc (main): Print Free_list statistics.
3762 * object.cc (Relobj::finalize_incremental_relocs): Add
3763 clear_counts parameter; clear counts only when clear_counts is set.
3764 (Sized_relobj::Sized_relobj): Initialize new base class.
3765 (Sized_relobj::do_layout): Don't report special sections.
3766 (Sized_relobj::do_for_all_local_got_entries): New function.
3767 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3768 symtab_off to all symbol table offsets.
3769 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3770 * object.h (class Got_offset_list): Move to top of file.
3771 (Object::Object): Allow case where input_file == NULL.
3772 (Object::~Object): Likewise.
3773 (Object::input_file): Assert that input_file != NULL.
3774 (Object::lock): Allow case where input_file == NULL.
3775 (Object::unlock): Likewise.
3776 (Object::is_locked): Likewise.
3777 (Object::token): Likewise.
3778 (Object::release): Likewise.
3779 (Object::is_incremental): New function.
3780 (Object::get_mtime): New function.
3781 (Object::for_all_local_got_entries): New function.
3782 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3783 (Object::set_is_in_system_directory): New function.
3784 (Object::is_in_system_directory): New function.
3785 (Object::do_is_incremental): New function.
3786 (Object::do_get_mtime): New function.
3787 (Object::do_for_all_local_got_entries): New function.
3788 (Object::is_in_system_directory_): New data member.
3789 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3790 (class Sized_relobj_base): New class.
3791 (class Sized_relobj): Derive from Sized_relobj_base.
3792 (class Sized_relobj::Symbols): Redeclare from base class.
3793 (class Sized_relobj::local_got_offset_list): Remove.
3794 (class Sized_relobj::Output_sections): Redeclare from base class.
3795 (class Sized_relobj::do_for_all_local_got_entries): New function.
3796 (class Sized_relobj::write_local_symbols): Add offset parameter.
3797 (class Sized_relobj::local_symbol_offset_): Update comment.
3798 (class Sized_relobj::local_dynsym_offset_): Update comment.
3799 * options.cc (Input_arguments::add_file): Remove const.
3800 * options.h (Input_file_argument::Input_file_argument):
3801 Initialize arg_serial_ (all constructors).
3802 (Input_file_argument::set_arg_serial): New function.
3803 (Input_file_argument::arg_serial): New function.
3804 (Input_file_argument::arg_serial_): New data member.
3805 (Input_arguments::Input_arguments): Initialize file_count_.
3806 (Input_arguments::add_file): Remove const.
3807 (Input_arguments::number_of_input_files): New function.
3808 (Input_arguments::file_count_): New data member.
3809 (Command_line::number_of_input_files): Call
3810 Input_arguments::number_of_input_files.
3811 * output.cc (Output_segment_headers::Output_segment_headers):
3812 Set current size.
3813 (Output_section::Input_section::current_data_size): New function.
3814 (Output_section::Output_section): Initialize new data members.
3815 (Output_section::add_input_section): Don't do merge sections for
3816 an incremental link; allocate space from free list for an
3817 incremental update.
3818 (Output_section::add_output_section_data): Allocate space from
3819 free list for an incremental update.
3820 (Output_section::update_data_size): New function.
3821 (Output_section::set_fixed_layout): New function.
3822 (Output_section::reserve): New function.
3823 (Output_segment::set_section_addresses): Remove const.
3824 (Output_segment::set_section_list_addresses): Remove const; allocate
3825 space from free list for an incremental update.
3826 (Output_segment::set_offset): Adjust size of RELRO segment for an
3827 incremental update.
3828 * output.h (Output_data::current_data_size): Move here from
3829 child classes.
3830 (Output_data::pre_finalize_data_size): New function.
3831 (Output_data::update_data_size): New function.
3832 (Output_section_headers::update_data_size): new function.
3833 (Output_section_data_build::current_data_size): Move to Output_data.
3834 (Output_data_strtab::update_data_size): New function.
3835 (Output_section::current_data_size): Move to Output_data.
3836 (Output_section::set_fixed_layout): New function.
3837 (Output_section::has_fixed_layout): New function.
3838 (Output_section::reserve): New function.
3839 (Output_section::update_data_size): New function.
3840 (Output_section::has_fixed_layout_): New data member.
3841 (Output_section::free_list_): New data member.
3842 (Output_segment::set_section_addresses): Remove const.
3843 (Output_segment::set_section_list_addresses): Remove const.
3844 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3845 New function.
3846 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3847 New function.
3848 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3849 parameter when calling Add_symbols constructor; store argument
3850 serial number for members of a lib group.
3851 (Add_symbols::locks): Allow case where token == NULL.
3852 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3853 (Read_member::~Read_member): New function.
3854 (Read_member::is_runnable): New function.
3855 (Read_member::locks): New function.
3856 (Read_member::run): New function.
3857 (Check_script::~Check_script): New function.
3858 (Check_script::is_runnable): New function.
3859 (Check_script::locks): New function.
3860 (Check_script::run): New function.
3861 (Check_library::~Check_library): New function.
3862 (Check_library::is_runnable): New function.
3863 (Check_library::locks): New function.
3864 (Check_library::run): New function.
3865 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3866 (Add_symbols::library_): New data member.
3867 (class Read_member): New class.
3868 (class Check_script): New class.
3869 (class Check_library): New class.
3870 * reloc.cc (Read_relocs::is_runnable): Allow case where
3871 token == NULL.
3872 (Read_relocs::locks): Likewise.
3873 (Scan_relocs::locks): Likewise.
3874 (Relocate_task::locks): Likewise.
3875 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3876 to clear counters.
3877 (Sized_relobj::incremental_relocs_scan): Fix comment.
3878 (Sized_relobj::do_relocate): Pass output file offset to
3879 write_local_symbols.
3880 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3881 from class declaration.
3882 * script.cc (read_input_script): Allocate Script_info; pass
3883 argument serial number to report_script.
3884 * script.h (class Script_info): Move to incremental.h.
3885 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3886 * symtab.h (Symbol_table::add_from_incrobj): New function.
3887 (Symbol_table::set_file_offset): New function.
3888
b961d0d7
CC
38892011-04-05 Cary Coutant <ccoutant@google.com>
3890
3891 * incremental-dump.cc (dump_incremental_inputs): Change signature
3892 to take a Sized_incremental_binary; change caller. Use readers
3893 in Sized_incremental_binary.
3894 * incremental.cc
3895 (Sized_incremental_binary::find_incremental_inputs_sections):
3896 Rename do_find_incremental_inputs_sections to this.
3897 (Sized_incremental_binary::setup_readers): New function.
3898 (Sized_incremental_binary::do_check_inputs): Check
3899 has_incremental_info_ flag; move setup code to setup_readers;
3900 use input readers.
3901 (Sized_incremental_binary::do_file_is_unchanged): New function.
3902 (Sized_incremental_binary::do_get_input_reader): New function.
3903 * incremental.h (class Incremental_binary): Move to end of file.
3904 (Incremental_binary::file_is_unchanged): New function.
3905 (Incremental_binary::do_file_is_unchanged): New function.
3906 (Incremental_binary::Input_reader): New class.
3907 (Incremental_binary::get_input_reader): New function.
3908 (class Sized_incremental_binary): Move to end of file.
3909 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3910 input section reader classes.
3911 (Sized_incremental_binary::has_incremental_info): New function.
3912 (Sized_incremental_binary::inputs_reader): New function.
3913 (Sized_incremental_binary::symtab_reader): New function.
3914 (Sized_incremental_binary::relocs_reader): New function.
3915 (Sized_incremental_binary::got_plt_reader): New function.
3916 (Sized_incremental_binary::do_file_is_unchanged): New function.
3917 (Sized_incremental_binary::Sized_input_reader): New class.
3918 (Sized_incremental_binary::get_input_reader): New function.
3919 (Sized_incremental_binary::find_incremental_inputs_sections):
3920 Rename do_find_incremental_inputs_sections to this.
3921 (Sized_incremental_binary::setup_readers): New function.
3922 (Sized_incremental_binary::has_incremental_info_): New data member.
3923 (Sized_incremental_binary::inputs_reader_): New data member.
3924 (Sized_incremental_binary::symtab_reader_): New data member.
3925 (Sized_incremental_binary::relocs_reader_): New data member.
3926 (Sized_incremental_binary::got_plt_reader_): New data member.
3927 (Sized_incremental_binary::current_input_file_): New data member.
3928
a869183f
PP
39292011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3930
3931 PR gold/12640
3932 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3933 violation.
3934
39352011-03-30 Cary Coutant <ccoutant@google.com>
c7975edd
CC
3936
3937 * archive.cc (Archive::include_member): Adjust call to report_object.
3938 (Add_archive_symbols::run): Add script_info to call to
3939 report_archive_begin.
3940 (Lib_group::include_member): Adjust call to report_object.
3941 (Add_lib_group_symbols::run): Adjust call to report_object.
3942 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3943 blocks. Add object count for script input files.
3944 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3945 script_info parameter; change all callers.
3946 (Incremental_inputs::report_object): Add script_info parameter;
3947 change all callers.
3948 (Incremental_inputs::report_script): Store backpointer to
3949 incremental info entry.
3950 (Output_section_incremental_inputs::set_final_data_size): Record
3951 additional information for scripts.
3952 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3953 * incremental.h (Incremental_script_entry::add_object): New function.
3954 (Incremental_script_entry::get_object_count): New function.
3955 (Incremental_script_entry::get_object): New function.
3956 (Incremental_script_entry::objects_): New data member; adjust
3957 constructor.
3958 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3959 (Incremental_inputs::report_object): Add script_info parameter.
3960 (Incremental_inputs_reader::get_object_count): New function.
3961 (Incremental_inputs_reader::get_object_offset): New function.
3962 * options.cc (Input_arguments::add_file): Return reference to
3963 new input argument.
3964 * options.h (Input_argument::set_script_info): New function.
3965 (Input_argument::script_info): New function.
3966 (Input_argument::script_info_): New data member; adjust all
3967 constructors.
3968 (Input_file_group::add_file): Return reference to new input argument.
3969 (Input_file_lib::add_file): Likewise.
3970 (Input_arguments::add_file): Likewise.
3971 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3972 * script.cc (Parser_closure::Parser_closure): Add script_info
3973 parameter; adjust all callers.
3974 (Parser_closure::script_info): New function.
3975 (Parser_closure::script_info_): New data member.
3976 (read_input_script): Report scripts earlier to incremental info.
3977 (script_add_file): Set script_info in Input_argument.
3978 (script_add_library): Likewise.
3979 * script.h (Script_options::Script_info): Rewrite class.
3980
a869183f 39812011-03-29 Cary Coutant <ccoutant@google.com>
e0c52780
CC
3982
3983 * archive.cc (Library_base::should_include_member): Move
3984 method here from class Archive.
3985 (Archive::Archive): Initialize base class.
3986 (Archive::should_include_member): Move to base class.
3987 (Archive::do_for_all_unused_symbols): New function.
3988 (Add_archive_symbols::run): Remove redundant access to
3989 incremental_inputs.
3990 (Lib_group::Lib_group): Initialize base class.
3991 (Lib_group::do_filename): New function.
3992 (Lib_group::include_member): Pass pointer to Lib_group to
3993 report_object.
3994 (Lib_group::do_for_all_unused_symbols): New function.
3995 (Add_lib_group_symbols::run): Report archive information for
3996 incremental links.
3997 * archive.h (class Library_base): New base class.
3998 (class Archive): Derive from Library_base.
3999 (Archive::filename): Move to base class.
4000 (Archive::set_incremental_info): Likewise.
4001 (Archive::incremental_info): Likewise.
4002 (Archive::Should_include): Likewise.
4003 (Archive::should_include_member): Likewise.
4004 (Archive::Armap_entry): Remove.
4005 (Archive::Unused_symbol_iterator): Remove.
4006 (Archive::unused_symbols_begin): Remove.
4007 (Archive::unused_symbols_end): Remove.
4008 (Archive::do_filename): New function.
4009 (Archive::do_get_mtime): New function.
4010 (Archive::do_for_all_unused_symbols): New function.
4011 (Archive::task_): Move to base class.
4012 (Archive::incremental_info_): Likewise.
4013 (class Lib_group): Derive from Library_base.
4014 (Lib_group::do_filename): New function.
4015 (Lib_group::do_get_mtime): New function.
4016 (Lib_group::do_for_all_unused_symbols): New function.
4017 (Lib_group::task_): Move to base class.
4018 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4019 function.
4020 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4021 function.
4022 * incremental.cc (Incremental_inputs::report_archive_begin):
4023 Use Library_base; call library's get_mtime; add incremental inputs
4024 entry before members.
4025 (class Unused_symbol_visitor): New class.
4026 (Incremental_inputs::report_archive_end): Use Library_base; use
4027 visitor class to record unused symbols; don't add incremental inputs
4028 entry after members.
4029 (Incremental_inputs::report_object): Use Library_base.
4030 * incremental.h
4031 (Incremental_archive_entry::Incremental_archive_entry): Remove
4032 unused Archive parameter.
4033 (Incremental_inputs::report_archive_begin): Use Library_base.
4034 (Incremental_inputs::report_archive_end): Likewise.
4035 (Incremental_inputs::report_object): Likewise.
4036 * object.cc (Sized_relobj::do_for_all_global_symbols): New
4037 function.
4038 * object.h (Object::for_all_global_symbols): New function.
4039 (Object::do_for_all_global_symbols): New function.
4040 (Sized_relobj::do_for_all_global_symbols): New function.
4041 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
4042 function.
4043 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
4044 function.
4045
61ab3e40
ILT
40462011-03-27 Ian Lance Taylor <iant@google.com>
4047
4048 * archive.cc (Archive::interpret_header): Return -1 if something
4049 goes wrong. Change callers accordingly.
4050
30e1f9e6
CC
40512011-03-25 Cary Coutant <ccoutant@google.com>
4052
4053 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4054 * testsuite/Makefile.in: Regenerate.
4055
9370ce59 40562011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
9c793f14
RÁE
4057
4058 * plugin.cc (get_view): New.
4059 (Plugin::load): Pass get_view to the plugin.
4060 (Plugin_manager::get_view): New.
4061
9312bb0a
ILT
40622011-03-21 Ian Lance Taylor <iant@google.com>
4063
4064 * testsuite/final_layout.sh: Rewrite to not use dc.
07aead7b 4065 * testsuite/relro_test.sh: Fail if dc is not present.
9312bb0a 4066
7e12ba9e
ST
40672011-03-21 Sriraman Tallam <tmsriram@google.com>
4068
4069 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4070 Change == to -eq.
4071 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4072 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4073 Change == to -eq.
4074 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4075 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4076
fd7a005d
ILT
40772011-03-14 Ian Lance Taylor <iant@google.com>
4078
4079 * script-sections.cc (Sort_output_sections::script_compare):
4080 Rename from is_before, change return type.
4081 (Sort_output_sections::operator()): Adjust accordingly.
4082
ed16fd1b
ILT
40832011-03-11 Jeffrey Yasskin <jyasskin@google.com>
4084
4085 PR gold/12572
4086 * testsuite/odr_violation2.cc: Add comment to make all error line
4087 numbers double digits.
4088 * testsuite/debug_msg.sh: Adjust expected errors.
4089
71ff8986
ILT
40902011-03-09 Jeffrey Yasskin <jyasskin@google.com>
4091
4092 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4093 but mark earlier ones as non-canonical
4094 (offset_to_iterator): Update search target and example
4095 (do_addr2line): Return extra lines in a vector*
4096 (format_file_lineno): Extract from do_addr2line
4097 (one_addr2line): Add vector* out-param
4098 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4099 when a lineno entry appeared last for its instruction
4100 (Dwarf_line_info): Add vector* out-param
4101 * object.cc (Relocate_info): Pass NULL for the vector* out-param
4102 * symtab.cc (Odr_violation_compare): Include the lineno in the
4103 comparison again.
4104 (linenos_from_loc): New. Combine the canonical line for an
4105 address with its other lines.
4106 (True_if_intersect): New. Helper functor to make
4107 std::set_intersection a query.
4108 (detect_odr_violations): Compare sets of lines instead of just
4109 one line for each function. This became less deterministic, but
4110 has fewer false positives.
4111 * symtab.h: Declarations.
4112 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4113 mix an optimized and non-optimized object in the same binary
4114 (odr_violation2.so): Same.
4115 * testsuite/Makefile.in: Regenerate from Makefile.am.
4116 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4117 * testsuite/debug_msg.sh: Update line numbers and add
4118 assertions.
4119 * testsuite/odr_violation1.cc: Use OdrDerived, in a
4120 non-optimized context.
4121 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4122 isn't inlined, and use OdrDerived in an optimized context.
4123 * testsuite/odr_header1.h: Defines OdrDerived, where
4124 optimization will change the
4125 first-instruction-in-the-destructor's file and line number.
4126 * testsuite/odr_header2.h: Defines OdrBase.
4127
a19fefdc
ILT
41282011-03-09 Ian Lance Taylor <iant@google.com>
4129
4130 * fileread.cc (File_read::clear_views): Don't delete the whole
4131 file view.
4132
ecb351e9
ILT
41332011-03-08 Ian Lance Taylor <iant@google.com>
4134
4135 PR gold/12525
4136 * fileread.cc: #include <climits>.
4137 (GOLD_IOV_MAX): Define.
4138 (File_read::read_multiple): Limit number of entries by iov_max.
4139 * fileread.h (class File_read): Always set max_readv_entries to
4140 128.
4141
b821d13c
ILT
41422011-03-07 Ian Lance Taylor <iant@google.com>
4143
4144 PR gold/12525
4145 * options.h (class General_options): Add -dy and -dn.
4146
89243142
CC
41472011-03-02 Cary Coutant <ccoutant@google.com>
4148
4149 * testsuite/script_test_9.t: Add TLS segment.
4150
d0773f31
ILT
41512011-03-02 Simon Baldwin <simonb@google.com>
4152
4153 * configure.ac: Add check for gnu_indirect_function support in
4154 the toolchain building binutils.
4155 * configure: Rebuild.
4156
9370ce59 41572011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
badc8139
RÁE
4158
4159 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4160 plugin only symbols.
4161 (Symbol_table::sized_finalize_symbol) Mark symbol only present
4162 in plugin files as not needed in the symbol table.
4163
4cf7a849
ST
41642011-02-11 Sriraman Tallam <tmsriram@google.com>
4165
4166 * output.cc (Output_section::add_input_section): Delay fill
4167 generation for section ordering.
4168
b578bd7d
ILT
41692011-02-09 Ian Lance Taylor <iant@google.com>
4170
4171 PR gold/12316
4172 * object.h (class Sized_relobj): Remove clear_local_symbols.
4173 * reloc.cc (Sized_relobj::do_relocate): Don't call
4174 clear_local_symbols.
4175
9370ce59 41762011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
84ced98a
RÁE
4177
4178 * plugin.cc (is_visible_from_outside): Return true for symbols
4179 in the -u option.
4180
55382fb7
ILT
41812011-02-04 Jeffrey Yasskin <jyasskin@google.com>
4182
4183 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4184 filename.
4185
4e271fff
ST
41862011-02-02 Sriraman Tallam <tmsriram@google.com>
4187
4188 * icf.h (is_section_foldable_candidate): Change type of parameter
2e702c99 4189 to std::string.
4e271fff 4190 * icf.cc (Icf::find_identical_sections): Change type of local variable
2e702c99 4191 section_name to be std::string.
4e271fff
ST
4192 (is_function_ctor_or_dtor): Change type of parameter to std::string.
4193
d433c3ac
ILT
41942011-01-25 Ian Lance Taylor <iant@google.com>
4195
4196 * script.cc (script_add_extern): Rewrite to use
4197 add_symbol_reference.
4198
880473a6
DK
41992011-01-25 Doug Kwan <dougkwan@google.com>
4200
d433c3ac 4201 * icf.cc (get_section_contents): Always lock section's object.
880473a6 4202
f30f86fa
ILT
42032011-01-24 Ian Lance Taylor <iant@google.com>
4204
4205 * options.h (class General_options): Accept
4206 --no-detect-odr-violations.
4207
8e51a0b9
ILT
42082011-01-24 Ian Lance Taylor <iant@google.com>
4209
4210 * version.cc (version_string): Bump to 1.11.
4211
0f3b89d8
ILT
42122011-01-24 Ian Lance Taylor <iant@google.com>
4213
4214 * plugin.cc (class Plugin_rescan): Define new class.
4215 (Plugin_manager::claim_file): Set any_claimed_.
4216 (Plugin_manager::save_archive): New function.
4217 (Plugin_manager::save_input_group): New function.
4218 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4219 necessary.
4220 (Plugin_manager::new_undefined_symbol): New function.
4221 (Plugin_manager::rescan): New function.
4222 (Plugin_manager::rescannable_defines): New function.
4223 (Plugin_manager::add_input_file): Set any_added_.
4224 * plugin.h (class Plugin_manager): define new fields rescannable_,
4225 undefined_symbols_, any_claimed_, and any_added_. Declare
4226 Plugin_rescan as friend. Declare new functions.
4227 (Plugin_manager::Rescannable): Define type.
4228 (Plugin_manager::Rescannable_list): Define type.
4229 (Plugin_manager::Undefined_symbol_list): Define type.
4230 (Plugin_manager::Plugin_manager): Initialize new fields.
4231 * archive.cc (Archive::defines_symbol): New function.
4232 (Add_archive_symbols::run): Pass archive to plugins if any.
4233 * archive.h (class Archive): Declare defines_symbol.
4234 * readsyms.cc (Input_group::~Input_group): New function.
4235 (Finish_group::run): Pass input_group to plugins if any.
4236 * readsyms.h (class Input_group): Declare destructor.
4237 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4238 any.
4239
3bb951e5
ILT
42402011-01-10 Ian Lance Taylor <iant@google.com>
4241
4242 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4243 section as relro.
4244 (Layout::set_segment_offsets): Reset increase_relro before calling
4245 set_section_addresses a second time.
4246
0aa45fac
CC
42472011-01-04 Cary Coutant <ccoutant@google.com>
4248
4249 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4250 sections before NOBITS sections.
4251
0db46eb4
L
42522011-01-01 H.J. Lu <hongjiu.lu@intel.com>
4253
4254 * version.cc (print_version): Update copyright to 2011.
4255
829c9745
CC
42562010-12-23 Cary Coutant <ccoutant@google.com>
4257
4258 * output.h (Output_data_reloc::add_output_section): Pass OD instead
4259 of OS to this->add. Add OD parameter to second form of the function.
4260
7500420b
ILT
42612010-12-20 Ian Lance Taylor <iant@google.com>
4262
4263 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4264 second of two consecutive entries with same offset.
4265
f8e9a930
RW
42662010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4267
4268 * testsuite/Makefile.am (ifuncmain2static_LDADD)
4269 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4270 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4271 to avoid unneeded links against $(LDADD).
4272 * testsuite/Makefile.in: Regenerate.
4273
2fbb4320
ILT
42742010-12-15 Ian Lance Taylor <iant@google.com>
4275
4276 PR gold/12324
4277 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4278 for R_X86_64_32 and R_X86_64_PC32.
4279 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4280 ver_matching_def_pic.o.
4281 (ver_matching_def_pic.o): New target.
4282
fedb228d
RW
42832010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4284
4285 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4286 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4287 Move definition before File_read::View member definitions.
4288 (File_read::View::~View): Initialize and hold lock before
4289 updating current_mapped_bytes.
4290
9b547ce6
RW
42912010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4292
4293 * dwarf_reader.cc: Remove outdated comment.
4294 * gold-threads.cc: Fix typo in error message.
4295 * archive.cc: Fix typos in comments.
4296 * archive.h: Likewise.
4297 * arm-reloc-property.cc: Likewise.
4298 * arm-reloc-property.h: Likewise.
4299 * arm-reloc.def: Likewise.
4300 * arm.cc: Likewise.
4301 * attributes.h: Likewise.
4302 * cref.cc: Likewise.
4303 * ehframe.cc: Likewise.
4304 * fileread.h: Likewise.
4305 * gold.h: Likewise.
4306 * i386.cc: Likewise.
4307 * icf.cc: Likewise.
4308 * incremental.h: Likewise.
4309 * int_encoding.cc: Likewise.
4310 * layout.h: Likewise.
4311 * main.cc: Likewise.
4312 * merge.h: Likewise.
4313 * object.cc: Likewise.
4314 * object.h: Likewise.
4315 * options.cc: Likewise.
4316 * readsyms.cc: Likewise.
4317 * reduced_debug_output.cc: Likewise.
4318 * reloc.cc: Likewise.
4319 * script-sections.cc: Likewise.
4320 * sparc.cc: Likewise.
4321 * symtab.h: Likewise.
4322 * target-reloc.h: Likewise.
4323 * target.cc: Likewise.
4324 * target.h: Likewise.
4325 * timer.cc: Likewise.
4326 * timer.h: Likewise.
4327 * x86_64.cc: Likewise.
4328
83e17bd5
CC
43292010-12-09 Cary Coutant <ccoutant@google.com>
4330
4331 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4332 stack.
4333 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4334 parameter; change all callers.
4335 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4336 * options.h (warn_execstack): New option.
4337
017257f8
DK
43382010-12-07 Doug Kwan <dougkwan@google.com>
4339
4340 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4341 like function call relocations.
4342
c20cbc06
ILT
43432010-12-07 Ian Lance Taylor <iant@google.com>
4344
4345 * archive.cc (Archive::get_elf_object_for_member): Permit
4346 punconfigured to be NULL.
4347 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4348 (Archive::include_member): Pass NULL to get_elf_object_for_member
4349 if we searched for the archive and this is the first included
4350 object.
4351
4dbfafcc
ILT
43522010-12-01 Ian Lance Taylor <iant@google.com>
4353
4354 * dwarf_reader.h (class Sized_dwarf_line_info): Add
4355 track_relocs_type_ field.
4356 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4357 Set track_relocs_type_.
4358 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4359 contents when using RELA relocs.
4360 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4361 reloc_map_.
4362 * reloc.cc (Track_relocs::next_addend): New function.
4363 * reloc.h (class Track_relocs): Declare next_addend.
4364
e5e19edd
ILT
43652010-12-01 Ian Lance Taylor <iant@google.com>
4366
4367 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4368 virtual destructor.
4369
9a5ce24c
ILT
43702010-12-01 Ian Lance Taylor <iant@google.com>
4371
4372 * README: Update compilers known to work and fail.
4373
c7791212
NC
43742010-11-23 Matthias Klose <doko@ubuntu.com>
4375
4376 * configure.in: For --enable-gold, handle value `default' instead of
4377 `both*'. Always install ld as ld.bfd, install as ld if gold is
4378 not the default.
4379 * configure: Regenerate.
4380
0ad220c9
DK
43812010-11-18 Doug Kwan <dougkwan@google.com>
4382
4383 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4384 and right_alignment to be zero. Store result alignment only if it is
4385 greater than existing alignment.
4386
ab8056e0
CC
43872010-11-16 Cary Coutant <ccoutant@google.com>
4388
4389 PR gold/12220
4390 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4391 Check for ".zdebug_line".
4392
fd064a5b
CC
43932010-11-16 Doug Kwan <dougkwan@google.com>
4394 Cary Coutant <ccoutant@google.com>
4395
4396 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4397 by reference; adjust all callers.
4398 * output.cc (Output_segment::set_section_addresses): Adjust references
4399 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4400 list is empty.
4401 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4402 end at page boundary.
4403
6fc6ea19
CC
44042010-11-16 Cary Coutant <ccoutant@google.com>
4405
4406 PR gold/12220
4407 * layout.cc (Layout::choose_output_section): Transform names of
4408 compressed sections even when using a script with a SECTIONS clause.
4409 (Layout::output_section_name): Remove code to transform
4410 compressed debug section names.
4411 * output.cc (Output_section::add_input_section): Use uncompressed
4412 section size when tracking input sections.
4413
95a2c8d6
RS
44142010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4415
4416 * symtab.h (Symbol::NON_PIC_REF): Remove.
4417 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4418 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4419 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4420 (Symbol::use_plt_offset): Take a flags argument and pass it
4421 directly to needs_dynamic_reloc. Restrict check for undefined
4422 weak symbols to function calls.
4423 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4424 (Target_arm::Scan::global): Use it.
4425 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4426 (Target_arm::Relocate::relocate): Likewise.
4427 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4428 parameter with an r_type parameter. Use get_reference_flags
4429 to get the flags.
4430 (Target_arm::Relocate::relocate): Update accordingly.
4431 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4432 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4433 (Target_i386::Scan::global): Likewise.
4434 (Target_i386::Relocate::relocate): Likewise.
4435 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4436 parameter with an r_type parameter. Use get_reference_flags
4437 to get the flags.
4438 (Target_i386::Relocate::relocate): Update accordingly.
4439 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4440 (Target_powerpc::Scan::global): Use it.
4441 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4442 (Target_powerpc::Relocate::relocate): Likewise.
4443 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4444 (Target_sparc::Scan::global): Use it.
4445 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4446 (Target_sparc::Relocate::relocate): Likewise.
4447 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4448 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4449 (Target_x86_64::Scan::global): Likewise.
4450 (Target_x86_64::Relocate::relocate): Likewise.
4451
f625ae50
DK
44522010-11-08 Doug Kwan <dougkwan@google.com>
4453 Cary Coutant <ccoutant@google.com>
4454
4455 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4456 (Arm_exidx_merge_section::section_contents_): New data member.
4457 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4458 (Arm_input_section::~Arm_input_section): De-allocate memory.
58797674 4459 (Arm_input_section::original_contents_): New data member.
f625ae50
DK
4460 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4461 in parameters instead of calling Object::section_contents without
4462 locking.
4463 (Arm_output_section::group_section): New parameter TASK. Pass it
4464 to callees that need locking objects.
4465 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4466 to lock EXIDX input sections. Fix a formatting issue. Call
4467 Arm_exidx_merged_section::build_contents to create merged section
4468 contents.
4469 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4470 to lock object of stub table owner.
4471 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4472 TEXT_SIZE to initialize data member TEXT_SIZE_.
4473 (Arm_exidx_input_section::addralign): Fix typo in comment.
4474 (Arm_exidx_input_section::text_size): New method.
4475 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4476 that require locking objects. Lock objects before scanning for stubs
4477 and updating local symbols.
4478 (Arm_input_section<big_endian>::init): Copy contents of original
4479 input section.
2e702c99 4480 (Arm_input_section<big_endian>::do_write): Use saved contents of
f625ae50
DK
4481 original input section instead of calling Object::section_contents
4482 without locking.
4483 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4484 size without calling Object::section_size().
4485 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4486 for size. Allocate a buffer for merged EXIDX entries.
4487 (Arm_exidx_merged_section::build_contents): New method.
2e702c99 4488 (Arm_exidx_merged_section::do_write): Move merge section contents
f625ae50
DK
4489 building code to Arm_exidx_merged_section::build_contetns. Write
4490 out contetns in buffer instead of building it on the fly.
4491 (Arm_relobj::make_exidx_input_section): Also pass text section size
4492 to Arm_exidx_input_section constructor.
4493 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4494 (Arm_dynobj::do_read_symbols): Fix memory leak.
4495 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4496 * target.h: (class Task): Add forward declaration.
4497 (Target::relax): Add new parameter TASK and pass it to
4498 Target::do_relax().
4499 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4500
5f9bcf58
CC
45012010-11-05 Cary Coutant <ccoutant@google.com>
4502
4503 PR gold/10708
4504 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4505 object when reading from the file.
4506 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4507 second layout pass.
4508 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4509 when reading section contents.
4510 (get_section_contents): Likewise.
4511 (icf::find_identical_sections): Likewise.
4512 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4513 object when reading from the file.
4514 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4515 the object when doing deferred section layout.
4516
e597fa08
NC
45172010-11-03 Nick Clifton <nickc@redhat.com>
4518
4519 PR gold/12001
4520 * script.h (class Symbol_assignment: name): New member. Returns
4521 the name of the symbol.
4522 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4523 Returns true if the given symbol name is on the list of
4524 assignments wating to be processed.
4525 * archive.cc (should_incldue_member): If the symbol is undefined,
4526 check to see if it is on the list of symbols pending assignment.
4527
3f9a3278
ILT
45282010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4529
4530 * script-sections.cc (Script_sections::find_memory_region): Check
4531 for a NULL output section pointer.
4532
d06fb4d1
DK
45332010-10-29 Doug Kwan <dougkwan@google.com>
4534
4535 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4536 Output_section::add_relaxed_input_section.
4537 * output.cc (Output_section::add_relaxed_input_section): Add new
4538 arguments LAYOUT and NAME. Set section order index.
4539 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4540 Copy section order index.
4541 * output.h (Output_section::add_relaxed_input_section): Add new
4542 arguments LAYOUT and NAME.
4543
90e24de5
ILT
45442010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4545
4546 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2e702c99 4547 NATIVE_OR_CROSS_LINKER.
90e24de5
ILT
4548 * testsuite/Makefile.in: Regenerate.
4549
c9484ea5
DK
45502010-10-20 Doug Kwan <dougkwan@google.com>
4551
4552 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4553 without SHF_LINK_ORDER flags.
4554 * layout.cc (Layout::choose_output_section): Do not filter
4555 SHF_LINK_ORDER flag in a relocatable link.
4556
5bc2f5be
CC
45572010-10-17 Cary Coutant <ccoutant@google.com>
4558
4559 * output.h (Output_segment::set_section_addresses): Change function
4560 signature. Update all callers.
4561 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4562 sections.
4563 (Output_segment::set_section_addresses): Align after last TLS
4564 section. Add padding before last relro section instead of after.
4565
0c91cf04
DK
45662010-10-17 Doug Kwan <dougkwan@google.com>
4567
4568 * gold/arm.cc (Target_arm::got_section): Use correct order and set
4569 GOT output section to be writable.
4570
8c21d9d3
CC
45712010-10-14 Cary Coutant <ccoutant@google.com>
4572
4573 * debug.h (DEBUG_INCREMENTAL): New flag.
2e702c99
RM
4574 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4575 * gold.cc (queue_initial_tasks): Check parameters for incremental link
4576 mode.
4577 * incremental.cc (report_command_line): Ignore all forms of
4578 --incremental.
4579 * layout.cc (Layout::Layout): Check parameters for incremental link
4580 mode.
4581 * options.cc (General_options::parse_incremental): New function.
4582 (General_options::parse_no_incremental): New function.
4583 (General_options::parse_incremental_full): New function.
4584 (General_options::parse_incremental_update): New function.
4585 (General_options::incremental_mode_): New data member.
4586 (General_options::finalize): Check incremental_mode_.
4587 * options.h (General_options): Update help text for --incremental.
4588 Add --no-incremental, --incremental-full, --incremental-update.
4589 (General_options::Incremental_mode): New enum type.
4590 (General_options::incremental_mode): New function.
4591 (General_options::incremental_mode_): New data member.
4592 * parameters.cc (Parameters::incremental_mode_): New data member.
4593 (Parameters::set_options): Set incremental_mode_.
4594 (Parameters::set_incremental_full): New function.
4595 (Parameters::incremental): New function.
4596 (Parameters::incremental_update): New function.
4597 (set_parameters_incremental_full): New function.
4598 * parameters.h (Parameters::set_incremental_full): New function.
4599 (Parameters::incremental): New function.
4600 (Parameters::incremental_update): New function.
4601 (Parameters::incremental_mode_): New data member.
4602 (set_parameters_incremental_full): New function.
4603 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4604 incremental link mode.
4605 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4606 (Sized_relobj::do_relocate_sections): Likewise.
4607 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4608 option.
4609 * testsuite/Makefile.in: Regenerate.
4610 * testsuite/incremental_test.sh: Filter all forms of --incremental.
8c21d9d3 4611
bb32aa18 46122010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
eb373049
ILT
4613
4614 * script-sections.h (class Script_sections): Make
4615 Sections_elements typedef public.
4616 * script-sections.cc (class Sort_output_sections): Add elements_
4617 field. Add constructor which sets it; change all callers.
4618 (Sort_output_sections::is_before): New function.
4619 (Sort_output_sections::operator()): Call is_before.
4620 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4621 conditional.
4622 * testsuite/script_test_10.sh: New test. Test script section
4623 order.
4624 * testsuite/script_test_10.t: Likewise.
4625 * testsuite/script_test_10.s: Likewise.
4626 * testsuite/Makefile.am: Wrap the cross linker tests and the
4627 common tests into NATIVE_OR_CROSS_LINKER.
4628 (check_SCRIPTS): Add script_test_10.sh.
4629 (check_DATA): Add script_test_10.stdout.
4630 (script_test_10.o, script_test_10): New targets.
4631 (script_test_10.stdout): New target.
4632 * configure, testsuite/Makefile.in: Regenerate.
4633
3cef7179
ILT
46342010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4635
4636 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4637 error for the deprecated relocations.
4638 (Target_arm::Scan::global): Likewise.
4639 (Target_arm::Relocate::relocate): Likewise.
4640
7411e9a8
RS
46412010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4642
4643 * fileread.cc (Input_file::find_file): Initialize *found_name
4644 and *namep when using the fallback search for case 4.
4645
6a9da32a
CC
46462010-10-11 Cary Coutant <ccoutant@google.com>
4647
4648 * options.h (class General_options): Redefine -z lazy as an alias for
4649 the negation of -z now.
4650
ac897c20
ILT
46512010-10-11 Ian Lance Taylor <iant@google.com>
4652
4653 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4654 binding.
4655
ea5cae92
NC
46562010-10-06 Nick Clifton <nickc@redhat.com>
4657
4658 * script-sections.cc(class Memory_region): Remove
4659 current_lma_offset_ field. Rename current_vma_offset_ to
4660 current_offset_. Add last_section_ field.
4661 (Memory_region::get_current_vma_address): Rename to
4662 get_current_address.
4663 (Memory_region::get_current_lma_address): Delete.
4664 (Memory_region::increment_vma_offset): Rename to
4665 increment_offset.
4666 (Memory_region::increment_lma_offset): Delete.
4667 (Memory_region::attributes_compatible): New method. Returns
4668 true if the provided section is compatible with the region.
4669 (Memory_region::get_last_section): New method. Returns the last
4670 section to use the region.
4671 (Memory_region::set_last_section): New method. Stores the last
4672 section to use the region.
4673 (Script_sections::block_in_region): New method. Returns true if
4674 a block of memory is contained within a region.
4675 (Script_sections::find_memory_region): New method. Locates a
4676 memory region to be used to set a VMA or LMA address.
4677 (Output_section_definition::set_section_addresses): Add code to
4678 check for addresses set by memory regions.
4679 (Output_segment::set_section_addresses): Remove memory region
4680 walking code.
4681 (Script_sections::create_segment): Add a warning if a header
4682 segment is created outside of any region.
4683 * script-sections.h (class Script_sections): Add prototypes for
4684 find_memory_region and block_in_region methods.
4685 * testsuite/memory_test.s: Use .long instead of .word.
4686 * testsuite/memory_test.t: Add some more output sections.
4687 * testsuite/memory_test.sh: Update expected output.
4688
a9bfd952
DK
46892010-10-02 Doug Kwan <dougkwan@google.com>
4690
4691 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4692 defintion to symtab.h
4693 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4694 declaration to defintion.
4695
bacff3ab
NC
46962010-10-01 Nick Clifton <nickc@redhat.com>
4697
4698 * expression.cc (eval): Replace dummy argument with NULL.
4699 (eval_maybe_dot): Check for a NULL result section pointer.
4700 (Symbol_expression::value): Likewise.
4701 (Dot_expression::value): Likewise.
4702 (BINARY_EXPRESSION): Likewise.
4703 (Max_expression::value): Likewise.
4704 (Min_expression::value): Likewise.
4705 (Absolute_expression::value): Likewise.
4706 (Addr_expression::value_from_output_section): Likewise.
4707 (Loaddddr_expression::value_from_output_section): Likewise.
4708 (Segment_start_expression::value): Likewise.
4709 * script-sections.cc
4710 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4711 argument with NULL.
4712 (Sections_elememt_dot_assignment::set_section_addresses):
4713 Likewise.
4714 (Output_data_expression::do_write_to_buffer): Likewise.
4715 (Output_section_definition::finalize_symbols): Likewise.
4716 (Output_section_definition::set_section_addresses): Likewise.
4717
f81bc8b5
DK
47182010-09-30 Doug Kwan <dougkwan@google.com>
4719
4720 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4721
c95e9f27
ST
47222010-09-28 Sriraman Tallam <tmsriram@google.com>
4723
4724 * target.h (Target::can_icf_inline_merge_sections): New virtual
bacff3ab 4725 function.
c95e9f27
ST
4726 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4727 virtual function.
4728 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4729 virtual function.
4730 * icf.cc (get_section_contents): Inline merge sections only when
4731 target allows it.
4732
3cac54d2
RW
47332010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4734
4735 * configure: Regenerate.
4736
2904037a
ILT
47372010-09-17 Ian Lance Taylor <iant@google.com>
4738
4739 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
d4d91489
ILT
4740 * testsuite/Makefile.am (memory_test.o): New target.
4741 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4742 memory_test.t.
4743 * testsuite/Makefile.in: Rebuild.
2904037a 4744
bca7fb63
DK
47452010-09-17 Doug Kwan <dougkwan@google.com>
4746
4747 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4748 defintion if relocation uses GOT entries of the symbol.
4749 * testsuite/icf_safe_test.sh: Fix test.
4750 * testsuite/icf_safe_so_test.sh: Fix test.
4751
4ef28648
CC
47522010-09-16 Cary Coutant <ccoutant@google.com>
4753
4754 * script_sections.cc (class Memory_region): Remove "NULL" from
4755 vector initializations.
4756
793990de
CC
47572010-09-15 Cary Coutant <ccoutant@google.com>
4758
4759 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4760 Resolve forwarding symbols.
4761
81e015e2
DK
47622010-09-15 Doug Kwan <dougkwan@google.com>
4763
4764 * gold/testsuite/script_test_3.t: Add ARM special sections.
4765 * gold/testsuite/script_test_4.t: Same.
4766 * gold/testsuite/script_test_5.t: Same.
4767 * gold/testsuite/script_test_6.t: Same.
4768 * gold/testsuite/script_test_7.t: Same.
4769 * gold/testsuite/script_test_7.t: Same.
4770 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4771
36171d64
CC
47722010-09-14 Cary Coutant <ccoutant@google.com>
4773
4774 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4775 (Target_x86_64::Relocate::relocate_tls): Replace check for
4776 saw_tls_block_reloc_ with test for executable section.
4777
d89051bd
CC
47782010-09-12 Cary Coutant <ccoutant@google.com>
4779
4780 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4781 position-independent executables to shared libraries need dynamic
4782 relocations.
4783 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4784 position-independent executables.
4785 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4786 * testsuite/Makefile.in: Regenerate.
4787
fca41f0f
NC
47882010-09-10 Nick Clifton <nickc@redhat.com>
4789
4790 PR gold/11997
4791 * testsuite/memory_test.t: Discard any sections that are not
4792 needed.
4793
6695e4b3
L
47942010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4795
4796 PR gold/11996
4797 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4798 "This::" to work around a bug in gcc 4.2.
4799
4800 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4801
0f72bf6f
RÁE
48022010-09-09 Rafael Espindola <espindola@google.com>
4803
4804 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4805 sections with different PF_X flags in the same segment.
4806 (Layout::find_first_load_seg): Search all segments to find the first
4807 one.
4808 * options.h (rosegment): New.
4809
48102010-09-08 Rafael Espindola <espindola@google.com>
a6577478 4811
05a79166 4812 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
a6577478 4813
aa98ff75
DK
48142010-09-08 Doug Kwan <dougkwan@google.com>
4815
4816 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4817 (Arm_relobj::do_relocate_sections): Add new parameter for output
4818 file to match the parent.
4819 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4820 of local symbols instead of input values. Update code to track
4821 changes in gold::relocate_section.
4822 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4823 (Sized_relobj::compute_final_local_value_internal): New methods.
4824 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4825 body into private version of Sized_relobj::compute_final_local_value.
4826 Call the inline method.
4827 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4828 merged symbol value if there is one.
4829 (Symbol_value::has_output_value): New method defintiion.
4830 (Sized_relobj::Compute_final_local_value_status): New enum type.
4831 (Sized_relobj::compute_final_local_value): New methods.
4832 (Sized_relobj::compute_final_local_value_internal): New methods.
4833 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4834 and arm_cortex_a8.sh.
4835 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4836 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4837 New tests.
4838 * Makefile.in: Regenerate.
4839 * testsuite/arm_bl_out_of_range.s: Update test.
4840 * testsuite/thumb_bl_out_of_range.s: Ditto.
4841 * testsuite/thumb_blx_out_of_range.s: Ditto.
4842 * testsuite/arm_branch_out_of_range.sh: New file.
4843 * testsuite/arm_cortex_a8.sh: Ditto.
4844 * testsuite/arm_cortex_a8_b.s: Ditto.
4845 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4846 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4847 * testsuite/arm_cortex_a8_bl.s: Ditto.
4848 * testsuite/arm_cortex_a8_blx.s: Ditto.
4849 * testsuite/arm_cortex_a8_local.s: Ditto.
4850 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4851 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4852
05a79166
L
48532010-09-08 Rafael Espindola <espindola@google.com>
4854
4855 * Makefile.am (memory_test.stdout): Run readelf with -W.
4856 * Makefile.in: Regenerate.
4857 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4858 64 bit output.
4859
33dbc701
RÁE
48602010-09-08 Rafael Espindola <espindola@google.com>
4861
4862 * script-sections.cc (Script_sections::add_memory_region): Convert
4863 field precision to int.
4864 * script.cc (script_set_section_region, script_set_section_region):
4865 Convert field precision to int.
4866
731ca54a
RÁE
48672010-09-08 Rafael Espindola <espindola@google.com>
4868
4869 * arm.cc (do_finalize_sections): Create the __exidx_start and
4870 __exdix_end symbols even when the section is missing.
4871
7f8cd844
NC
48722010-09-08 Nick Clifton <nickc@redhat.com>
4873
4874 * README: Remove claim that MEMORY is not supported.
4875 * expression.cc (script_exp_function_origin)
4876 (script_exp_function_length): Move from here to ...
4877 * script.cc: ... here.
4878 (script_set_section_region, script_add_memory)
4879 (script_parse_memory_attr, script_include_directive): New
4880 functions.
4881 * script-sections.cc
4882 (class Memory_region): New class.
4883 (class Output_section_definition): Add set_memory_region,
4884 set_section_vma, set_section_lma and get_section_name methods.
4885 (class Script_Sections): Add add_memory_region,
4886 find_memory_region, find_memory_region_origin,
4887 find_memory_region_length and set_memory_region methods.
4888 Have set_section_addresses method walk the list of set memory
4889 regions.
4890 Extend the print methos to display memory regions.
4891 * script-sections.h: Add prototypes for new methods.
4892 Add enum for MEMORY region attributes.
4893 * yyscript.y: Add support for parsing MEMORY regions.
4894 * script-c.h: Add prototypes for new functions.
4895 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4896 * testsuite/Makefile.in: Regenerate.
4897 * testsuite/memory_test.sh: New script.
4898 * testsuite/memory_test.s: New assembler source file.
4899 * testsuite/memory_test.t: New linker script.
4900
a4649286
DK
49012010-08-27 Doug Kwan <dougkwan@google.com>
4902
4903 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4904 reference override an existing dynamic weak reference.
4905 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4906 * testsuite/Makefile.in: Regenerate.
4907 * testsuite/dyn_weak_ref.sh: New file.
4908 * testsuite/dyn_weak_ref_1.c: Ditto.
4909 * testsuite/dyn_weak_ref_2.c: Ditto.
4910
b56648ad
ILT
49112010-08-27 Ian Lance Taylor <iant@google.com>
4912
4913 * incremental.h (class Incremental_input_entry): Add virtual
4914 destructor.
4915
809313cb
ILT
49162010-08-27 Ian Lance Taylor <iant@google.com>
4917
4918 * testsuite/start_lib_test_3.c: Mark t3 as used.
4919
11e32464
NC
49202010-08-27 Nick Clifton <nickc@redhat.com>
4921
4922 * options.cc (version_script): Fix small typo in previous
4923 whitespace tidyup.
4924
ca09d69a
NC
49252010-08-25 Nick Clifton <nickc@redhat.com>
4926
4927 * archive.cc: Formatting fixes: Remove whitespace between
4928 typename and following asterisk. Remove whitespace between
4929 function name and opening parenthesis.
4930 * archive.h: Likewise.
4931 * arm.cc: Likewise.
4932 * attributes.cc: Likewise.
4933 * attributes.h: Likewise.
4934 * common.cc: Likewise.
4935 * copy-relocs.cc: Likewise.
4936 * dirsearch.h: Likewise.
4937 * dynobj.cc: Likewise.
4938 * ehframe.cc: Likewise.
4939 * ehframe.h: Likewise.
4940 * expression.cc: Likewise.
4941 * fileread.cc: Likewise.
4942 * fileread.h: Likewise.
4943 * gc.h: Likewise.
4944 * gold-threads.cc: Likewise.
4945 * gold.cc: Likewise.
4946 * i386.cc: Likewise.
4947 * icf.h: Likewise.
4948 * incremental-dump.cc: Likewise.
4949 * incremental.cc: Likewise.
4950 * layout.cc: Likewise.
4951 * layout.h: Likewise.
4952 * main.cc: Likewise.
4953 * merge.cc: Likewise.
4954 * merge.h: Likewise.
4955 * object.cc: Likewise.
4956 * object.h: Likewise.
4957 * options.cc: Likewise.
4958 * options.h: Likewise.
4959 * output.cc: Likewise.
4960 * output.h: Likewise.
4961 * plugin.cc: Likewise.
4962 * plugin.h: Likewise.
4963 * powerpc.cc: Likewise.
4964 * reloc.cc: Likewise.
4965 * script-c.h: Likewise.
4966 * script-sections.cc: Likewise.
4967 * script.cc: Likewise.
4968 * stringpool.cc: Likewise.
4969 * symtab.cc: Likewise.
4970 * symtab.h: Likewise.
4971 * target.cc: Likewise.
4972 * timer.cc: Likewise.
4973 * timer.h: Likewise.
4974 * version.cc: Likewise.
4975 * x86_64.cc: Likewise.
4976
b8fa8750
NC
49772010-08-24 Nick Clifton <nickc@redhat.com>
4978
4979 PR 11899
4980 * layout.cc (segment_precedes): Sort segments by their physical
4981 addresses, if they have been set.
4982
9919d93b
CC
49832010-08-23 Cary Coutant <ccoutant@google.com>
4984
4985 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4986 symbols data.
4987 (Lib_group::include_member): Unlock object after deleting its
4988 symbols data.
4989 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4990 the bug fixed here.
4991
97b4be1c
CC
49922010-08-19 Neil Vachharajani <nvachhar@google.com>
4993 Cary Coutant <ccoutant@google.com>
4994
4995 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4996 constructor, and set_blocker.
4997 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4998 readsyms_blocker_.
4999 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5000 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5001 * testsuite/Makefile.am (start_lib_test): New test case.
5002 * testsuite/Makefile.in: Regenerate.
5003 * testsuite/start_lib_test_main.c: New file.
5004 * testsuite/start_lib_test_1.c: New file.
5005 * testsuite/start_lib_test_2.c: New file.
5006 * testsuite/start_lib_test_3.c: New file.
5007
dd0b1884
ILT
50082010-08-19 Ian Lance Taylor <iant@google.com>
5009
5010 * Makefile.in: Rebuild with automake 1.11.1.
5011 * aclocal.m4: Likewise.
5012 * testsuite/Makefile.in: Likewise.
5013
7223e9ca
ILT
50142010-08-19 Ian Lance Taylor <iant@google.com>
5015
5016 PR 10893
5017 * i386.cc (class Output_data_plt_i386): Update declarations.
5018 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
5019 local_ifuncs_ fields.
5020 (Target_i386::do_plt_section_for_global): New function.
5021 (Target_i386::do_plt_section_for_local): New function.
5022 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5023 parameter; change all callers. Initialize global_ifuncs_ and
5024 local_ifuncs_. If doing a static link define __rel_iplt_start and
5025 __rel_iplt_end.
5026 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5027 (Output_data_plt_i386::add_local_ifunc_entry): New function.
5028 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5029 symbols.
5030 (Target_i386::make_plt_section): New function, broken out of
5031 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
5032 (Target_i386::make_plt_entry): Call make_plt_section.
5033 (Target_i386::make_local_ifunc_plt_entry): New function.
5034 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5035 (Target_i386::Scan::local): Handle IFUNC symbols. Add
5036 R_386_IRELATIVE to switch.
5037 (Target_i386::Scan::global): Likewise.
5038 (Target_i386::Relocate::relocate): Likewise.
5039 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5040 switch.
5041 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5042 (Target_x86_64::do_plt_section_for_global): New function.
5043 (Target_x86_64::do_plt_section_for_local): New function.
5044 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5045 parameter; change all callers. If doing a static link define
5046 __rela_iplt_start and __rela_iplt_end.
5047 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5048 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5049 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5050 to point to .plt.
5051 (Target_x86_64::make_local_ifunc_plt_entry): New function.
5052 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5053 switch.
5054 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5055 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
5056 R_X86_64_IRELATIVE to switch.
5057 (Target_x86_64::Scan::global): Likewise.
5058 (Target_x86_64::Relocate::relocate): Likewise.
5059 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5060 switch.
5061 * target.h (class Target): Add plt_section_for_global and
5062 plt_section_for_local functions. Add do_plt_section_for_global
5063 and do_plt_section_for_local virtual functions.
5064 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
5065 clarifying comments.
5066 (Symbol::use_plt_offset): Handle IFUNC symbol.
5067 * object.cc (Sized_relobj::Sized_relobj): Initialize
5068 local_plt_offsets_.
5069 (Sized_relobj::local_has_plt_offset): New function.
5070 (Sized_relobj::local_plt_offset): New function.
5071 (Sized_relobj::set_local_plt_offset): New function.
5072 (Sized_relobj::do_count): Handle IFUNC symbol.
5073 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
5074 a bit away from input_shndx_ field. Add set_is_func_symbol and
5075 is_ifunc_symbol functions.
5076 (class Sized_relobj): Update declarations. Remove Tls_got_entry
5077 and Local_tls_got_offsets. Define Local_plt_offsets. Add
5078 local_plt_offsets_ field.
5079 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5080 * output.h (class Output_section_data): Add non-const
5081 output_section function.
5082 (class Output_data_got): Update declarations.
5083 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5084 Add use_plt_offset parameter to global and local constructors.
5085 Change all callers. Change local_sym_index_ field to 31 bits.
5086 Change GSYM_CODE and CONSTANT_CODE accordingly.
5087 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5088 doing a static link don't set sh_link field.
5089 (Output_data_got::Got_entry::write): Use PLT offset if
5090 appropriate.
5091 (Output_data_got::add_global_plt): New function.
5092 (Output_data_got::add_local_plt): New function.
5093 * target-reloc.h (relocate_section): Handle IFUNC symbol.
5094 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5095 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5096 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5097 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5098 IFUNC conditional.
5099 * testsuite/ifunc-sel.h: New file.
5100 * testsuite/ifuncmain1.c: New file.
5101 * testsuite/ifuncmain1vis.c: New file.
5102 * testsuite/ifuncmod1.c: New file.
5103 * testsuite/ifuncdep2.c: New file.
5104 * testsuite/ifuncmain2.c: New file.
5105 * testsuite/ifuncmain3.c: New file.
5106 * testsuite/ifuncmod3.c: New file.
5107 * testsuite/ifuncmain4.c: New file.
5108 * testsuite/ifuncmain5.c: New file.
5109 * testsuite/ifuncmod5.c: New file.
5110 * testsuite/ifuncmain6pie.c: New file.
5111 * testsuite/ifuncmod6.c: New file.
5112 * testsuite/ifuncmain7.c: New file.
5113 * configure, testsuite/Makefile.in: Rebuild.
5114
56f75c03
ILT
51152010-08-18 Ian Lance Taylor <iant@google.com>
5116
5117 * incremental.cc
5118 (Output_section_incremental_inputs::write_input_files): Add cast
5119 to avoid signed/unsigned comparison warning.
5120 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5121
55455f89
CC
51222010-08-12 Cary Coutant <ccoutant@google.com>
5123
5124 * common.cc (Sort_commons::operator()): Remove unnecessary code.
5125
e2054bcb
ILT
51262010-08-13 Ian Lance Taylor <iant@google.com>
5127
5128 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5129
74f67560
DK
51302010-08-12 Cary Coutant <ccoutant@google.com>
5131 Doug Kwan <dougkwan@google.com>
5132
5133 * resolve.cc (Symbol_table::should_override): When a weak dynamic
5134 defintion overrides non-weak undef, remember that the original undef
5135 is not weak.
5136 * symtab.cc (Symbol_table::sized_write_global): For undef without
5137 an original weak binding, set binding to global in output.
5138 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5139 * testsuite/Makefile.in: Regenerate.
5140 * testsuite/strong_ref_weak_def.sh: New file.
5141 * testsuite/strong_ref_weak_def_1.c: Ditto.
5142 * testsuite/strong_ref_weak_def_2.c: Ditto.
5143
d1238d12
CC
51442010-08-12 Cary Coutant <ccoutant@google.com>
5145
5146 * testsuite/incremental_test.sh: Rewrite.
5147 * testsuite/incremental_test_1.c: Rewrite.
5148 * testsuite/incremental_test_2.c: Rewrite.
5149
0e70b911
CC
51502010-08-12 Cary Coutant <ccoutant@google.com>
5151
5152 * arm.cc (Target_arm::got_size): Add const.
5153 (Target_arm::got_entry_count): New function.
5154 (Target_arm::plt_entry_count): New function.
5155 (Target_arm::first_plt_entry_offset): New function.
5156 (Target_arm::plt_entry_size): New function.
5157 (Output_data_plt_arm::entry_count): New function.
5158 (Output_data_plt_arm::first_plt_entry_offset): New function.
5159 (Output_data_plt_arm::get_plt_entry_size): New function.
5160 * i386.cc (Target_i386::got_size): Add const.
5161 (Target_i386::got_entry_count): New function.
5162 (Target_i386::plt_entry_count): New function.
5163 (Target_i386::first_plt_entry_offset): New function.
5164 (Target_i386::plt_entry_size): New function.
5165 (Output_data_plt_i386::entry_count): New function.
5166 (Output_data_plt_i386::first_plt_entry_offset): New function.
5167 (Output_data_plt_i386::get_plt_entry_size): New function.
5168 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5169 find_incremental_inputs_sections. Dump incremental_got_plt section.
5170 * incremental.cc: Include target.h.
5171 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5172 parameter. Adjust all callers. Find incremental_got_plt section.
5173 (Incremental_inputs::create_data_sections): Create incremental_got_plt
5174 section.
5175 (Output_section_incremental_inputs::set_final_data_size): Calculate
5176 size of incremental_got_plt section.
5177 (Output_section_incremental_inputs::do_write): Write the
5178 incremental_got_plt section.
5179 (Got_plt_view_info): New struct.
5180 (Local_got_offset_visitor): New class.
5181 (Global_got_offset_visitor): New class.
5182 (Global_symbol_visitor_got_plt): New class.
5183 (Output_section_incremental_inputs::write_got_plt): New function.
5184 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5185 Add parameter. Adjust all callers.
5186 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5187 (Incremental_inputs::got_plt_section): New function.
5188 (Incremental_inputs::got_plt_section_): New data member.
5189 (Incremental_got_plt_reader): New class.
5190 * layout.cc (Layout::create_incremental_info_sections): Add the
5191 incremental_got_plt section.
5192 * object.h (Got_offset_list::get_list): New function.
5193 (Got offset_list::for_all_got_offsets): New function.
5194 (Sized_relobj::local_got_offset_list): New function.
5195 * powerpc.cc (Target_powerpc::got_size): Add const.
5196 (Target_powerpc::got_entry_count): New function.
5197 (Target_powerpc::plt_entry_count): New function.
5198 (Target_powerpc::first_plt_entry_offset): New function.
5199 (Target_powerpc::plt_entry_size): New function.
5200 (Output_data_plt_powerpc::entry_count): New function.
5201 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5202 (Output_data_plt_powerpc::get_plt_entry_size): New function.
5203 * sparc.cc (Target_sparc::got_size): Add const.
5204 (Target_sparc::got_entry_count): New function.
5205 (Target_sparc::plt_entry_count): New function.
5206 (Target_sparc::first_plt_entry_offset): New function.
5207 (Target_sparc::plt_entry_size): New function.
5208 (Output_data_plt_sparc::entry_count): New function.
5209 (Output_data_plt_sparc::first_plt_entry_offset): New function.
5210 (Output_data_plt_sparc::get_plt_entry_size): New function.
5211 * symtab.h (Symbol::got_offset_list): New function.
5212 (Symbol_table::for_all_symbols): New function.
5213 * target.h (Sized_target::got_entry_count): New function.
5214 (Sized_target::plt_entry_count): New function.
5215 (Sized_target::plt_entry_size): New function.
5216 * x86_64.cc (Target_x86_64::got_size): Add const.
5217 (Target_x86_64::got_entry_count): New function.
5218 (Target_x86_64::plt_entry_count): New function.
5219 (Target_x86_64::first_plt_entry_offset): New function.
5220 (Target_x86_64::plt_entry_size): New function.
5221 (Output_data_plt_x86_64::entry_count): New function.
5222 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5223 (Output_data_plt_x86_64::get_plt_entry_size): New function.
5224
09ec0418
CC
52252010-08-12 Cary Coutant <ccoutant@google.com>
5226
5227 * archive.cc: Include incremental.h.
5228 (Archive::Archive): Initialize incremental_info_.
5229 (Archive::include_member): Record archive members in incremental info.
5230 (Add_archive_symbols::run): Record begin and end of an archive in
5231 incremental info.
5232 (Lib_group::include_member): Record objects in incremental info.
5233 * archive.h (Incremental_archive_entry): Forward declaration.
5234 (Archive::set_incremental_info): New member function.
5235 (Archive::incremental_info): New member function.
5236 (Archive::Unused_symbol_iterator): New class.
5237 (Archive::unused_symbols_begin): New member function.
5238 (Archive::unused_symbols_end): New member function.
5239 (Archive::incremental_info_): New data member.
5240 * incremental-dump.cc (find_input_containing_global): New function.
5241 (dump_incremental_inputs): Dump new incremental info sections.
5242 * incremental.cc: Include symtab.h.
5243 (Output_section_incremental_inputs): New class.
5244 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5245 new incremental info sections.
5246 (Sized_incremental_binary::do_check_inputs): Likewise.
5247 (Incremental_inputs::report_archive): Remove.
5248 (Incremental_inputs::report_archive_begin): New function.
5249 (Incremental_inputs::report_archive_end): New function.
5250 (Incremental_inputs::report_object): New function.
5251 (Incremental_inputs::finalize_inputs): Remove.
5252 (Incremental_inputs::report_input_section): New function.
5253 (Incremental_inputs::report_script): Rewrite.
5254 (Incremental_inputs::finalize): Do nothing but finalize string table.
5255 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5256 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5257 (Incremental_inputs::create_data_sections): New function.
5258 (Incremental_inputs::relocs_entsize): New function.
5259 (Output_section_incremental_inputs::set_final_data_size): New function.
5260 (Output_section_incremental_inputs::do_write): New function.
5261 (Output_section_incremental_inputs::write_header): New function.
5262 (Output_section_incremental_inputs::write_input_files): New function.
5263 (Output_section_incremental_inputs::write_info_blocks): New function.
5264 (Output_section_incremental_inputs::write_symtab): New function.
5265 * incremental.h (Incremental_script_entry): Forward declaration.
5266 (Incremental_object_entry): Forward declaration.
5267 (Incremental_archive_entry): Forward declaration.
5268 (Incremental_inputs): Forward declaration.
5269 (Incremental_inputs_header_data): Remove.
5270 (Incremental_inputs_header): Remove.
5271 (Incremental_inputs_header_write): Remove.
5272 (Incremental_inputs_entry_data): Remove.
5273 (Incremental_inputs_entry): Remove.
5274 (Incremental_inputs_entry_write): Remove.
5275 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5276 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5277 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5278 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5279 Likewise.
5280 (Incremental_input_entry): New class.
5281 (Incremental_script_entry): New class.
5282 (Incremental_object_entry): New class.
5283 (Incremental_archive_entry): New class.
5284 (Incremental_inputs::Incremental_inputs): Initialize new data members.
5285 (Incremental_inputs::report_inputs): Remove.
5286 (Incremental_inputs::report_archive): Remove.
5287 (Incremental_inputs::report_archive_begin): New function.
5288 (Incremental_inputs::report_archive_end): New function.
5289 (Incremental_inputs::report_object): Change prototype.
5290 (Incremental_inputs::report_input_section): New function.
5291 (Incremental_inputs::report_script): Change prototype.
5292 (Incremental_inputs::get_reloc_count): New function.
5293 (Incremental_inputs::set_reloc_count): New function.
5294 (Incremental_inputs::create_data_sections): New function.
5295 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5296 (Incremental_inputs::inputs_section): New function.
5297 (Incremental_inputs::symtab_section): New function.
5298 (Incremental_inputs::relocs_section): New function.
5299 (Incremental_inputs::get_stringpool): Add const.
5300 (Incremental_inputs::command_line): Add const.
5301 (Incremental_inputs::inputs): Remove.
5302 (Incremental_inputs::command_line_key): New function.
5303 (Incremental_inputs::input_file_count): New function.
5304 (Incremental_inputs::input_files): New function.
5305 (Incremental_inputs::relocs_entsize): New function.
5306 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5307 (Incremental_inputs::finalize_inputs): Remove.
5308 (Incremental_inputs::Input_info): Remove.
5309 (Incremental_inputs::lock_): Remove.
5310 (Incremental_inputs::inputs_): Change type.
5311 (Incremental_inputs::inputs_map_): Remove.
5312 (Incremental_inputs::current_object_entry_): New data member.
5313 (Incremental_inputs::inputs_section_): New data member.
5314 (Incremental_inputs::symtab_section_): New data member.
5315 (Incremental_inputs::relocs_section_): New data member.
5316 (Incremental_inputs::reloc_count_): New data member.
5317 (Incremental_inputs_reader): New class.
5318 (Incremental_symtab_reader): New class.
5319 (Incremental_relocs_reader): New class.
5320 * layout.cc (Layout::finalize): Move finalization of incremental info
5321 and creation of incremental info sections to follow finalization of
5322 symbol table. Set offsets for postprocessing sections.
5323 (Layout::create_incremental_info_sections): Call
5324 Incremental_inputs::create_data_sections. Add incremental symtab
5325 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
5326 sections to layout after input sections.
5327 * layout.h (struct Timespec): Forward declaration.
5328 (Layout::incremental_inputs): Add const.
5329 (Layout::create_incremental_info_sections): Add parameter.
5330 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5331 * object.cc: Include incremental.h.
5332 (Relobj::finalize_incremental_relocs): New function.
5333 (Sized_relobj::do_layout): Record input sections in incremental info.
5334 * object.h (Object::output_section): New function.
5335 (Object::output_section_offset): Moved from Relobj.
5336 (Object::get_incremental_reloc_base): New function.
5337 (Object::get_incremental_reloc_count): New function.
5338 (Object::do_output_section): New function.
5339 (Object::do_output_section_offset): Moved from Relobj.
5340 (Object::do_get_incremental_reloc_base): New function.
5341 (Object::do_get_incremental_reloc_count): New function.
5342 (Object::Object): Initialize new data members.
5343 (Relobj::output_section): Renamed do_output_section and moved to
5344 protected.
5345 (Relobj::output_section_offset): Moved to Object.
5346 (Relobj::do_get_incremental_reloc_base): New function.
5347 (Relobj::do_get_incremental_reloc_count): New function.
5348 (Relobj::allocate_incremental_reloc_counts): New function.
5349 (Relobj::count_incremental_reloc): New function.
5350 (Relobj::finalize_incremental_relocs): New function.
5351 (Relobj::next_incremental_reloc_index): New function.
5352 (Relobj::reloc_counts_): New data member.
5353 (Relobj::reloc_bases_): New data member.
5354 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
5355 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
5356 (Sized_relobj::incremental_relocs_scan): New function.
5357 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5358 (Sized_relobj::incremental_relocs_write): New function.
5359 (Sized_relobj::incremental_relocs_write_reltype): New function.
5360 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5361 incremental link.
5362 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5363 archives and object files elsewhere.
5364 (Add_symbols::run): Report object files here.
5365 (Finish_group::run): Report end of archive at end of group.
5366 * reloc.cc: Include layout.h, incremental.h.
5367 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5368 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5369 (Sized_relobj::incremental_relocs_scan): New function.
5370 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5371 (Sized_relobj::do_relocate_sections): Write incremental relocations.
5372 (Sized_relobj::incremental_relocs_write): New function.
5373 (Sized_relobj::incremental_relocs_write_reltype): New function.
5374 * script.cc (read_input_script): Rewrite test for incremental link.
5375 Change call to Incremental_inputs::report_script.
5376 * symtab.h (Symbol_table::first_global_index): New function.
5377 (Symbol_table::output_count): New function.
5378
ce0d1972
DK
53792010-08-12 Doug Kwan <dougkwan@google.com>
5380
5381 * arm.cc (Target_arm::merge_object_attributes): Check command line
5382 options --no-wchar-size-warning and --no-enum-size-warning.
5383 * options.h (General_options): Add ld-compatible options
5384 --no-enum-size-warning and --no-wchar-size-warning.
5385
6e5710ce
ILT
53862010-08-04 Ian Lance Taylor <iant@google.com>
5387
5388 * x86_64.cc (Target_x86_64::Scan::local): Use
5389 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5390 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5391 (Target_x86_64::Scan::global): Likewise.
5392 (Target_x86_64::Relocate::relocate): Likewise.
5393 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5394 Likewise.
5395
fef830db
CC
53962010-08-03 Cary Coutant <ccoutant@google.com>
5397
5398 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5399 to reserve space in merged_strings vector. Keep total input size
5400 for stats.
5401 (Output_merge_string::do_print_merge_stats): Print total input size.
5402 * merge.h (Output_merge_string): Add input_size_ field.
5403 * stringpool.cc (Stringpool_template::string_length): Move
5404 implementations out of Stringpool_template class and place in
5405 stringpool.h.
5406 * stringpool.h (string_length): Move out of Stringpool_template.
5407
1e3811b0
ILT
54082010-08-03 Ian Lance Taylor <iant@google.com>
5409
5410 PR 11712
5411 * layout.cc (relaxation_loop_body): If address of load segment is
5412 set, adjust address to include headers if possible.
5413
7af0c620
ILT
54142010-08-03 Ian Lance Taylor <iant@google.com>
5415
5416 * version.cc (version_string): Bump to 1.10.
5417
22f0da72
ILT
54182010-08-03 Ian Lance Taylor <iant@google.com>
5419
5420 PR 11805
5421 * layout.h (enum Output_section_order): Define.
5422 (class Layout): Update declarations.
5423 * layout.cc (Layout::get_output_section): Add order parameter.
5424 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5425 is_first_non_relro parameters. Change all callers.
5426 (Layout::choose_output_section): Likewise.
5427 (Layout::add_output_section_data): Likewise.
5428 (Layout::make_output_section): Likewise. Set order.
5429 (Layout::default_section_order): New function.
5430 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5431 * output.cc (Output_section::Output_section): Initialize order_.
5432 Don't initialize deleted fields.
5433 (Output_segment::Output_segment): Don't initialize deleted
5434 fields.
5435 (Output_segment::add_output_section_to_load): New function
5436 replacing add_output_section. Change all callers to call this or
5437 add_output_section_to_nonload.
5438 (Output_segment::add_output_section_to_nonload): New function.
5439 (Output_segment::remove_output_section): Rewrite.
5440 (Output_segment::add_initial_output_data): Likewise.
5441 (Output_segment::has_any_data_sections): Likewise.
5442 (Output_segment::is_first_section_relro): Likewise.
5443 (Output_segment::maximum_alignment): Likewise.
5444 (Output_segment::has_dynamic_reloc): New function replacing
5445 dynamic_reloc_count. Change all callers.
5446 (Output_segment::has_dynamic_reloc_list): New function replacing
5447 dynamic_reloc_count_list. Change all callers.
5448 (Output_segment::set_section_addresses): Rewrite.
5449 (Output_segment::set_offset): Rewrite.
5450 (Output_segment::find_first_and_last_list): Remove.
5451 (Output_segment::set_tls_offsets): Rewrite.
5452 (Output_segment::first_section_load_address): Likewise.
5453 (Output_segment::output_section_count): Likewise.
5454 (Output_segment::section_with_lowest_load_address): Likewise.
5455 (Output_segment::write_section_headers): Likewise.
5456 (Output_segment::print_sections_to_map): Likewise.
5457 * output.h (class Output_data): Remove dynamic_reloc_count_
5458 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5459 (Output_data::add_dynamic_reloc): Rewrite.
5460 (Output_data::has_dynamic_reloc): New function.
5461 (Output_data::dynamic_reloc_count): Remove.
5462 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5463 is_last_relro_, is_first_non_relro_, is_interp_,
5464 is_dynamic_linker_section_ fields. Add order and set_order
5465 functions. Remove is_relro_local, set_is_relro_local,
5466 is_last_relro, set_is_last_relro, is_first_non_relro,
5467 set_is_first_non_relro functions, is_interp, set_is_interp,
5468 is_dynamic_linker_section, and set_is_dynamic_linker_section
5469 functions.
5470 (class Output_segment): Change Output_data_list from std::list to
5471 std:;vector. Add output_lists_ field. Remove output_data_ and
5472 output_bss_ fields. Update declarations.
5473
3ff2ccb0
ILT
54742010-08-02 Ian Lance Taylor <iant@google.com>
5475
5476 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5477 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5478 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5479
88a4108b
ILT
54802010-08-02 Ian Lance Taylor <iant@google.com>
5481
5482 PR 11855
5483 * script.cc (Script_options::Script_options): Initialize
5484 symbol_definitions_ and symbol_references_.
5485 (Script_options::add_symbol_assignment): Update
5486 symbol_definitions_ and symbol_references_.
5487 (Script_options::add_symbol_reference): New function.
5488 (script_symbol): New function.
5489 * script.h (class Script_options): Add symbol_definitions_ and
5490 symbol_references_ fields.
5491 (Script_options::referenced_const_iterator): New type.
5492 (Script_options::referenced_begin): New function.
5493 (Script_options::referenced_end): New function.
5494 (Script_options::is_referenced): New function.
5495 (Script_options::any_unreferenced): New function.
5496 * script-c.h (script_symbol): Declare.
5497 * yyscript.y (exp): Call script_symbol.
5498 * symtab.cc: Include "script.h".
5499 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5500 Change all callers. Check symbols referenced by scripts.
5501 (Symbol_table::add_undefined_symbols_from_command_line): Add
5502 layout parameter. Change all callers.
5503 (Symbol_table::do_add_undefined_symbols_from_command_line):
5504 Likewise. Break out loop body. Check symbols referenced by
5505 scripts.
5506 (Symbol_table::add_undefined_symbol_from_command_line): New
5507 function broken out of
5508 do_add_undefined_symbols_from_command_line.
5509 * symtab.h (class Symbol_table): Update declarations.
5510 * archive.cc: Include "layout.h".
5511 (Archive::should_include_member): Add layout parameter. Change
5512 all callers. Check for symbol mentioned in expression.
5513 * archive.h (class Archive): Update declaration.
5514 * object.cc (Sized_relobj::do_should_include_member): Add layout
5515 parameter.
5516 * object.h (Object::should_include_member): Add layout parameter.
5517 Change all callers.
5518 (Object::do_should_include_member): Add layout parameter.
5519 (class Sized_relobj): Update declaration.
5520 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5521 parameter.
5522 * dynobj.h (class Sized_dynobj): Update declaration.
5523 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5524 layout parameter.
5525 * plugin.h (class Sized_pluginobj): Update declaration.
5526
5f1ab67a
ILT
55272010-08-02 Ian Lance Taylor <iant@google.com>
5528
5529 PR 11866
5530 * output.cc (Output_segment::set_offset): Search for the first and
5531 last sections rather than assuming that the list is in order.
5532 (Output_segment::find_first_and_last_list): New function.
5533 * output.h (class Output_segment): Update declarations.
5534 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5535 (relro_strip_test_SOURCES): New variable.
5536 (relro_strip_test_DEPENDENCIES): New variable.
5537 (relro_strip_test_LDFLAGS): New variable.
5538 (relro_strip_test_LDADD): New variable.
5539 (relro_strip_test.so): New target.
5540
a8df5856
ILT
55412010-08-02 Ian Lance Taylor <iant@google.com>
5542
5543 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5544 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5545 (Target_i386::got_tlsdesc_section): New function.
5546 (Target_i386::got_section): Create space for GOT entries for
5547 TLSDESC relocations.
5548 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5549 R_386_TLS_GOTDESC.
5550 (Target_i386::Scan::global): Likewise.
5551 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5552 using TLSDESC GOT.
5553 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5554 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5555 (Target_x86_64::got_tlsdesc_section): New function.
5556 (Target_x86_64::got_section): Create space for GOT entries for
5557 TLSDESC relocations.
5558 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5559 R_386_TLS_GOTDESC.
5560 (Target_x86_64::Scan::global): Likewise.
5561 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5562 using TLSDESC GOT.
5563
0c10a0a6
ILT
55642010-08-02 Ian Lance Taylor <iant@google.com>
5565
5566 * testsuite/final_layout.sh: Use dc to convert from hex to
5567 decimal.
5568
41cbeecc
ST
55692010-07-29 Sriraman Tallam <tmsriram@google.com>
5570
5571 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5572 paramter to the call to gold::gc_process_relocs.
5573 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5574 paramter to the call to gold::gc_process_relocs.
5575 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5576 parameter to the call to gold::gc_process_relocs.
5577 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5578 template parameter to the call to gold::gc_process_relocs.
5579 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5580 paramter to the call to gold::gc_process_relocs.
5581 * gc.h (get_embedded_addend_size): New function.
5582 (gc_process_relocs): Save the size of the reloc for use by ICF.
5583 * icf.cc (get_section_contents): Get the addend from the text section
5584 for SHT_REL relocation sections.
5585 * icf.h (Icf::Reloc_addend_size_info): New typedef.
5586 (Icf::Reloc_info): Add new member reloc_addend_size_info.
5587 * int_encoding.h (read_from_pointer): New overloaded function.
5588 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5589 * testsuite/icf_sht_rel_addend_test.sh: New file.
5590 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5591 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5592
6ea55b82
RW
55932010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5594
5595 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5596 * Makefile.in: Regenerate.
5597 * testsuite/Makefile.in: Regenerate.
5598
9691462b
ILT
55992010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5600
5601 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5602 * gold/testsuite/debug_msg.cc: Likewise.
5603 * gold/testsuite/odr_violation1.cc
5604 * gold/testsuite/odr_violation2.cc
5605
76897331
CC
56062010-07-21 Cary Coutant <ccoutant@google.com>
5607
5608 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5609 string, and length fields.
5610 (Output_merge_string::Merged_strings_list): New type.
5611 (Output_merge_string::Merged_strings_lists): New typedef.
5612 (Output_merge_string): Replace merged_strings_ with
5613 merged_strings_lists_.
5614 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5615 Merged_strings_list per input object and section. Don't store pointer
5616 to the string. Don't store length with each merged string entry.
5617 (Output_merge_string::finalize_merged_data): Loop over list of merged
5618 strings lists. Recompute length of each merged string.
5619
78384e8f
CC
56202010-07-15 Cary Coutant <ccoutant@google.com>
5621
5622 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5623 here.
5624
783659f9
ILT
56252010-07-14 Ian Lance Taylor <iant@google.com>
5626
5627 * descriptors.cc (Descriptors::open): Report correct name in error
5628 message.
5629
131687b4
DK
56302010-07-13 Doug Kwan <dougkwan@google.com>
5631
5632 * arm.cc (Arm_input_section::Arm_input_section): For a
5633 SHT_ARM_EXIDX section, always keeps the input sections.
5634 (Arm_input_section::set_exidx_section_link): New method.
5635 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5636 has_errors_ to false.
5637 (Arm_exidx_input_section::has_errors,
5638 Arm_exidx_input_section::set_has_errors): New methods.
5639 (Arm_exidx_input_section::has_errors_): New data member.
5640 (Arm_relobj::get_exidx_shndx_list): New method.
5641 (Arm_output_section::append_text_sections_to_list): Do not skip
5642 section without SHF_EXECINSTR.
5643 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5644 errors.
2e702c99 5645 (Arm_relobj::make_exidx_input_section): Add new parameter for text
131687b4
DK
5646 section header. Make error messages more verbose. Check for
5647 a non-executable section linked to an EXIDX section.
5648 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5649 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5650 check that there is no deferred EXIDX section if we exit early.
5651 Instead of not making an EXIDX section in case of an error, make one
5652 and set the has_errors flag of it.
5653 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5654 in a relocatable link.
5655 (Target_arm::do_relax): Look for the EXIDX output section instead of
5656 assuming that it is called .ARM.exidx.
2e702c99 5657 (Target_arm::fix_exidx_coverage): Add a new parameter for input
131687b4
DK
5658 section list. Do not check for SHF_EXECINSTR section flags but
5659 skip any input section with errors.
5660 * output.cc (Output_section::Output_section): Initialize
5661 always_keeps_input_sections_ to false.
5662 (Output_section::add_input_section): Check for
5663 always_keeps_input_sections_.
5664 * output.h (Output_section::always_keeps_input_sections,
5665 Output_section::set_always_keeps_input_sections): New methods.
5666 (Output_section::always_keeps_input_sections): New data member.
5667
69517287
RÁE
56682010-07-13 Rafael Espindola <espindola@google.com>
5669
5670 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5671 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5672
82742395
ILT
56732010-07-13 Philip Herron <herron.philip@googlemail.com>
5674 Ian Lance Taylor <iant@google.com>
5675
5676 * output.h (Output_section_lookup_maps::add_merge_section):
5677 Correct check of whether value was inserted.
5678 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5679 (Output_section_lookup_maps::add_relaxed_input_section):
5680 Likewise.
5681 * arm.cc (Target_arm::got_section): Remove used local os.
5682 * i386.cc (Target_i386::got_section): Likewise.
5683 * x86_64.cc (Target_x86_64::got_section): Likewise.
5684 * sparc.cc (Target_sparc::got_section): Likewise.
5685 (Target_sparc::relocate): Remove unused local have_got_offset.
5686 * powerpc.cc (Target_powerpc::relocate): Likewise.
5687
f2d707b5
ILT
56882010-07-13 Ian Lance Taylor <iant@google.com>
5689
241531d6
ILT
5690 * compressed_output.cc (zlib_decompress): Fix signature in
5691 !HAVE_ZLIB_H case.
5692
f2d707b5
ILT
5693 * archive.cc (Archive::include_member): Unlock an external member
5694 of a thin archive. Don't bother to delete an object we know is
5695 NULL.
5696
a2e47362
CC
56972010-07-12 Cary Coutant <ccoutant@google.com>
5698
5699 * compressed_output.cc (zlib_decompress): New function.
5700 (get_uncompressed_size): New function.
5701 (decompress_input_section): New function.
5702 * compressed_output.h (get_uncompressed_size): New function.
5703 (decompress_input_section): New function.
5704 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5705 Handle compressed debug sections.
5706 * layout.cc (is_compressed_debug_section): New function.
5707 (Layout::output_section_name): Map compressed section names to
5708 canonical names.
5709 * layout.h (is_compressed_debug_section): New function.
5710 (is_debug_info_section): Recognize compressed debug sections.
5711 * merge.cc: Include compressed_output.h.
5712 (Output_merge_data::do_add_input_section): Handle compressed
5713 debug sections.
5714 (Output_merge_string::do_add_input_section): Handle compressed
5715 debug sections.
5716 * object.cc: Include compressed_output.h.
5717 (Sized_relobj::Sized_relobj): Initialize new data members.
5718 (build_compressed_section_map): New function.
5719 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5720 * object.h (Object::section_is_compressed): New method.
5721 (Object::do_section_is_compressed): New method.
5722 (Sized_relobj::Compressed_section_map): New type.
5723 (Sized_relobj::do_section_is_compressed): New method.
5724 (Sized_relobj::compressed_sections_): New data member.
5725 * output.cc (Output_section::add_input_section): Handle compressed
5726 debug sections.
5727 * reloc.cc: Include compressed_output.h.
5728 (Sized_relobj::write_sections): Handle compressed debug sections.
5729
ce279a62
CC
57302010-07-08 Cary Coutant <ccoutant@google.com>
5731
5732 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5733 weak when resolving to a dynamic def.
5734 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5735 for weak undef/dynamic def cases. Adjust callers.
5736 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5737 undef_binding_weak_.
5738 (Symbol_table::sized_write_globals): Adjust symbol binding.
5739 (Symbol_table::sized_write_symbol): Add binding parameter.
5740 * symtab.h (Symbol::set_undef_binding): New method.
5741 (Symbol::is_undef_binding_weak): New method.
5742 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5743 (Symbol_table::should_override): Add new parameter.
5744 (Symbol_table::sized_write_symbol): Add new parameter.
5745
5746 * testsuite/weak_undef_file1.cc: Add new test case.
5747 * testsuite/weak_undef_file2.cc: Fix header comment.
5748 * testsuite/weak_undef_test.cc: Add new test case.
5749
b2286c10
DK
57502010-06-29 Doug Kwan <dougkwan@google.com>
5751
5752 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5753 Initialize USE_SYMBOL_.
5754 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5755 definition.
5756 (Arm_reloc_property::uses_symbol_): New data member declaration.
5757 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5758 uses symbol value and symbol is undefined but not weakly undefined.
5759
4802450a
RÁE
57602010-06-28 Rafael Espindola <espindola@google.com>
5761
5762 * plugin.cc (Plugin::load): Use dlerror.
5763
e5ca47ba
ILT
57642010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5765
5766 * symtab.cc (detect_odr_violations): When reporting an ODR
5767 violation, report an object where the symbol is defined.
5768
8a75a161
DK
57692010-06-25 Doug Kwan <dougkwan@google.com>
5770
5771 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5772 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5773 definition.
5774 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5775 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5776 target hook to detect function points.
5777 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5778 * icf.h (Icf::check_section_for_function_pointers): Change type of
5779 parameter SECTION_NAME to const reference to std::string. Use
5780 target hook to determine if section may have unsafe pointers.
5781 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5782 method definition.
5783
42218b9f
RÁE
57842010-06-21 Rafael Espindola <espindola@google.com>
5785
5786 * fileread.cc (Input_file::find_fie): New
5787 (Input_file::open): Use Input_file::find_fie.
5788 * fileread.h (Input_file::find_fie): New
5789 * plugin.cc (set_extra_library_path): New.
5790 (Plugin::load): Add set_extra_library_path to the transfer vector.
5791 (Plugin_manager::set_extra_library_path): New.
5792 (Plugin_manager::add_input_file): Use the extra search path if set.
5793 (set_extra_library_path(): New.
5794 * plugin.h (Plugin_manager): Add set_extra_library_path and
5795 extra_search_path_.
5796
a0506cca
CC
57972010-06-19 Cary Coutant <ccoutant@google.com>
5798
5799 * layout.cc (gdb_sections): Add .debug_types.
5800 (lines_only_debug_sections): Likewise.
5801
6508b958
RÁE
58022010-06-18 Rafael Espindola <espindola@google.com>
5803
5804 * plugin.cc (add_input_file,add_input_library)
5805 (Plugin_manager::add_input_file): Make filename arguments const.
5806 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5807 const.
5808
3e235302
DK
58092010-06-16 Doug Kwan <dougkwan@google.com>
5810
5811 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5812 .ARM.attributes section if we have not merged any input
5813 attributes sections.
5814
106e8a6c
DK
58152010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5816
5817 * arm.cc: Allow combining objects with no EABI version
5818 information.
5819
91ff43fe
RÁE
58202010-06-15 Rafael Espindola <espindola@google.com>
5821
5822 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5823
68ed838c
ILT
58242010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5825
5826 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5827 (struct iovec): Correct !HAVE_READV definition.
5828
f3a2388f
CC
58292010-06-10 Cary Coutant <ccoutant@google.com>
5830
5831 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5832 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5833 reloc sections.
5834 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5835
5836 PR 11683
5837 * symtab.h (Symbol::is_placeholder): New member function.
5838 * target-reloc.h (relocate_section): Check for placeholder symbols.
5839
5840 * testsuite/Makefile.am (plugin_test_8): New test.
5841 (plugin_test_9): New test.
5842 * testsuite/Makefile.in: Regenerate.
5843
e1df38aa
NC
58442010-06-09 Nick Clifton <nickc@redhat.com>
5845
5846 * yyscript.y (input_list_element): Allow strings prefixed with
5847 the '-' character. Treat these as libraries.
5848 * script.cc (script_add_library): New function. Adds a library
5849 specified by "-l<name>" found in an input script.
5850 * script-c.h: Add prototype for script_add_library.
5851
25bbe950
DK
58522010-06-07 Doug Kwan <dougkwan@google.com>
5853
5854 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5855 Restrict stub-group size to be within long conditional branch
5856 range when working around cortex-A8 erratum.
5857
0f32ea4c
ILT
58582010-06-07 Damien Diederen <dd@crosstwine.com>
5859
5860 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5861 #ifdef typo.
5862
8fe2a369
ST
58632010-06-03 Sriraman Tallam <tmsriram@google.com>
5864
5865 PR gold/11658
5866 * output.cc
5867 (Output_section::Input_section_sort_entry::compare_section_ordering):
5868 Change to return non-zero correctly.
5869 (Output_section::Input_section_sort_section_order_index_compare
5870 ::operator()): Change to fix ambiguity in comparisons.
5871
6e9ba2ca
ST
58722010-06-01 Sriraman Tallam <tmsriram@google.com>
5873
5874 * gold.h (is_wildcard_string): New function.
5875 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5876 (Layout::layout_eh_frame): Ditto.
5877 (Layout::find_section_order_index): New method.
5878 (Layout::read_layout_from_file): New method.
5879 * layout.h (Layout::find_section_order_index): New method.
5880 (Layout::read_layout_from_file): New method.
5881 (Layout::input_section_position_): New private member.
5882 (Layout::input_section_glob_): New private member.
5883 * main.cc (main): Call read_layout_from_file here.
5884 * options.h (--section-ordering-file): New option.
5885 * output.cc (Output_section::input_section_order_specified_): New
5886 member.
5887 (Output_section::Output_section): Initialize new member.
5888 (Output_section::add_input_section): Add new parameter.
5889 Keep input sections when --section-ordering-file is used.
5890 (Output_section::set_final_data_size): Sort input sections when
5891 section ordering file is specified.
5892 (Output_section::Input_section_sort_entry): Add new parameter.
5893 Check sorting type.
5894 (Output_section::Input_section_sort_entry::compare_section_ordering):
5895 New method.
5896 (Output_section::Input_section_sort_compare::operator()): Change to
5897 consider section_order_index.
5898 (Output_section::Input_section_sort_init_fini_compare::operator()):
5899 Change to consider section_order_index.
5900 (Output_section::Input_section_sort_section_order_index_compare
5901 ::operator()): New method.
5902 (Output_section::sort_attached_input_sections): Change to sort
5903 according to section order when specified.
e1df38aa
NC
5904 (Output_section::add_input_section<32, true>): Add new parameter.
5905 (Output_section::add_input_section<64, true>): Add new parameter.
5906 (Output_section::add_input_section<32, false>): Add new parameter.
5907 (Output_section::add_input_section<64, false>): Add new parameter.
6e9ba2ca
ST
5908 * output.h (Output_section::add_input_section): Add new parameter.
5909 (Output_section::input_section_order_specified): New
5910 method.
5911 (Output_section::set_input_section_order_specified): New method.
5912 (Input_section::Input_section): Initialize section_order_index_.
5913 (Input_section::section_order_index): New method.
5914 (Input_section::set_section_order_index): New method.
5915 (Input_section::section_order_index_): New member.
5916 (Input_section::Input_section_sort_section_order_index_compare): New
5917 struct.
5918 (Output_section::input_section_order_specified_): New member.
5919 * script-sections.cc (is_wildcard_string): Delete and move modified
5920 method to gold.h.
5921 (Output_section_element_input::Output_section_element_input): Modify
5922 call to is_wildcard_string.
5923 (Output_section_element_input::Input_section_pattern
5924 ::Input_section_pattern): Ditto.
5925 (Output_section_element_input::Output_section_element_input): Ditto.
5926 * testsuite/Makefile.am (final_layout): New test case.
5927 * testsuite/Makefile.in: Regenerate.
5928 * testsuite/final_layout.cc: New file.
5929 * testsuite/final_layout.sh: New file.
5930
3537c84b
RÁE
59312010-06-01 Rafael Espindola <espindola@google.com>
5932
5933 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5934
105b6afd
RÁE
59352010-06-01 Rafael Espindola <espindola@google.com>
5936
5937 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5938 visibility of symbols.
5939
29e11421
DK
59402010-05-27 Doug Kwan <dougkwan@google.com>
5941
5942 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5943 from start of output section instead of address for a local symbol
5944 in a merged or relaxed section when doing a relocatable link.
5945
5e0f337e
RÁE
59462010-05-26 Rafael Espindola <espindola@google.com>
5947
703d02da 5948 PR 11604
5e0f337e
RÁE
5949 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5950 adding sections the garbage collector removed.
5951 * gold/testsuite/Makefile.am: Add test.
5952 * gold/testsuite/Makefile.in: Regenerate.
5953 * gold/testsuite/plugin_test_7.sh: New.
5954 * gold/testsuite/plugin_test_7_1.c: New.
5955 * gold/testsuite/plugin_test_7_2.c: New.
5956
f4187277
RÁE
59572010-05-26 Rafael Espindola <espindola@google.com>
5958
5959 * script-sections.cc (Output_section_definition::set_section_addresses):
5960 Check for --section-start.
5961
5c388529
DK
59622010-05-26 Doug Kwan <dougkwan@google.com>
5963
5964 * arm.cc (Arm_scan_relocatable_relocs): New class.
5965 (Target_arm::relocate_special_relocatable): New method.
5966 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5967 (Arm_relocate_functions::thumb_branch_common): Same.
5968 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5969 instead of Default_scan_relocatable_relocs.
5970 * target-reloc.h (relocate_for_relocatable): Let target handle
5971 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5972 * target.h (Sized_target::relocate_special_relocatable): New method.
5973
bca1c3ae
ILT
59742010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5975
5976 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5977
0439c796
DK
59782010-05-23 Doug Kwan <dougkwan@google.com>
5979
5980 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5981 instead of a cast.
5982 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5983 with a direct branch, not a conditional branch, to a stub.
5984 * merge.cc (Output_merge_base::record_input_section): New method
5985 defintion.
5986 (Output_merge_data::do_add_input_section): Record input section if
5987 keeps-input-sections flag is set.
5988 (Output_merge_string::do_add_input_section): Ditto.
5989 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5990 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5991 INPUT_SECTIONS_.
5992 (Output_merge_base::keeps_input_sections,
5993 Output_merge_base::set_keeps_input_sections,
5994 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5995 method definitions.
5996 (Output_merge_base::Input_sections): New type declaration.
5997 (Output_merge_base::input_sections_begin,
5998 Output_merge_base::input_sections_end,
5999 Output_merge_base::do_set_keeps_input_sections): New method definitions.
6000 (Output_merge_base::bool keeps_input_sections_,
6001 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6002 Output_merge_base::input_sections_): New data members.
6003 (Output_merge_data::do_set_keeps_input_sections): New method
6004 defintion.
6005 (Output_merge_string::do_set_keeps_input_sections): Ditto.
6006 * output.cc (Output_section::Input_section::relobj): Move method
6007 defintion from class declaration to here and handle merge sections.
6008 (Output_section::Input_section::shndx): Ditto.
6009 (Output_section::Output_section): Remove initializations of removed
6010 data members and initialize new data member LOOKUP_MAPS_.
6011 (Output_section::add_input_section): Set keeps-input-sections flag
6012 for a newly created merge output section as appropriate. Adjust code
6013 to use Output_section_lookup_maps class.
6014 (Output_section::add_relaxed_input_section): Adjst code for lookup
6015 maps code refactoring.
2e702c99 6016 (Output_section::add_merge_input_section): Add a new parameter
0439c796
DK
6017 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
6018 class. If adding input section to a newly created merge output
6019 section fails, remove the new merge section.
6020 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
e1df38aa 6021 Adjust code for use of the Output_section_lookup_maps class.
2e702c99 6022 (Output_section::find_merge_section): Ditto.
0439c796 6023 (Output_section::build_lookup_maps): New method defintion.
2e702c99 6024 (Output_section::find_relaxed_input_section): Adjust code to use
0439c796
DK
6025 Output_section_lookup_maps class.
6026 (Output_section::get_input_sections): Export merge sections. Adjust
6027 code to use Output_section_lookup_maps class.
6028 (Output_section:::add_script_input_section): Adjust code to use
6029 Output_section_lookup_maps class. Update lookup maps for merge
6030 sections also.
6031 (Output_section::discard_states): Use Output_section_lookup_maps.
6032 (Output_section::restore_states): Same.
6033 * output.h (Merge_section_properties): Move class defintion out of
6034 Output_section.
6035 (Output_section_lookup_maps): New class.
6036 (Output_section::Input_section::is_merge_section): New method
6037 defintion.
6038 (Output_section::Input_section::relobj): Move defintion out of class
6039 defintion. Declare method only.
6040 (Output_section::Input_section::shndx): Ditto.
6041 (Output_section::Input_section::output_merge_base): New method defintion.
2e702c99 6042 (Output_section::Input_section::u2_.pomb): New union field.
0439c796
DK
6043 (Output_section::Merge_section_by_properties_map,
6044 Output_section::Output_section_data_by_input_section_map,
6045 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6046 Remove types.
2e702c99 6047 (Output_section::add_merge_input_section): Add new parameter
0439c796
DK
6048 KEEPS_INPUT_SECTIONS.
6049 (Output_section::build_lookup_maps): New method declaration.
6050 (Output_section::merge_section_map_,
6051 Output_section::merge_section_by_properties_map_,
6052 Output_section::relaxed_input_section_map_,
6053 Output_section::is_relaxed_input_section_map_valid_): Remove data
6054 members.
6055 (Output_section::lookup_maps_): New data member.
6056
76295588
L
60572010-05-21 Doug Kwan <dougkwan@google.com>
6058
6059 PR gold/11619
6060 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6061 avoid a compilation error.
6062
d103a984
RÁE
60632010-05-19 Rafael Espindola <espindola@google.com>
6064
6065 * script-sections.cc (Output_section_definition::allocate_to_segment):
6066 Update the phdrs_list even when the output section is NULL.
6067 * testsuite/Makefile.am: Add test.
6068 * testsuite/Makefile.in: Regenerate.
6069 * testsuite/script_test_9.cc: New.
6070 * testsuite/script_test_9.sh: New.
6071 * testsuite/script_test_9.t: New.
6072
6625d24e
DK
60732010-05-19 Doug Kwan <dougkwan@google.com>
6074
6075 * arm.cc (Arm_input_section::original_size): New method.
6076 (Arm_input_section::do_addralign): Add a cast.
6077 (Arm_input_section::do_output_offset): Remove static cast.
6078 (Arm_input_section::original_addralign,
6079 Arm_input_section::original_size_): Change type to uint32_t.
6080 (Arm_input_section::init): Add safe casts for section alignment
6081 and size.
6082 (Arm_input_section::set_final_data_size): Do not set address and
6083 offset of stub table.
6084 (Arm_output_section::fix_exidx_coverage): Change use of of
6085 Output_section::Simple_input_section to that of
6086 Output_section::Input_section.
6087 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6088 except for the first pass.
6089 * output.cc (Output_section::get_input_sections): Change type of
6090 input_sections to std::list<Input_section>.
6091 (Output_section::add_script_input_section): Rename from
6092 Output_section::add_simple_input_section. Change type of SIS
6093 parameter from Simple_input_section to Input_section.
6094 * output.h (Output_section::Simple_input_section): Remove class.
6095 (Output_section::Input_section): Change class visibility to public.
6096 (Output_section::Input_section::addralign): Use stored alignments
6097 for special input sections if set.
6098 (Output_section::Input_section::set_addralign): New method.
6099 (Output_section::get_input_sections): Change parameter type from
6100 list of Simple_input_section to list of Input_section.
6101 (Output_section::add_script_input_section): Rename from
6102 Output_section::add_simple_input_section. Change first parameter's
6103 type from Simple_input_section to Input_section and remove the
6104 second and third parameters.
6105 * script-sections.cc (Input_section::Input_section_list): Change
6106 type to list of Output_section::Input_section/
6107 (Input_section_info::Input_section_info): Change parameter type of
6108 INPUT_SECTION to Output_section::Input_section.
6109 (Input_section_info::input_section): Change return type.
6110 (Input_section_info::input_section_): Change type to
6111 Output_section::Input_section.
6112 (Output_section_element_input::set_section_addresses): Adjust code
6113 to use Output_section::Input_section instead of
6114 Output_section::Simple_input_section. Adjust code for renaming
6115 of Output_section::add_simple_input_section.
6116 (Orphan_output_section::set_section_addresses): Ditto.
6117
e1e82ea4
RW
61182010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6119
6120 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6121 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6122
91e75c8a
RÁE
61232010-05-18 Rafael Espindola <espindola@google.com>
6124
6125 * options.cc (General_options::finalize): Handle -nostdlib.
6126 * options.h (nostdlib): New option.
6127 * script.cc (script_add_search_dir): Handle -nostdlib.
6128
da59ad79
DK
61292010-05-12 Doug Kwan <dougkwan@google.com>
6130
6131 * arm.cc (Target_arm::do_finalize_sections): Create an empty
6132 attributes section only if there no attributes section after merging.
6133 (Target_arm::merge_object_attributes): Move value of
e1df38aa 6134 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
da59ad79
DK
6135 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6136 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6137 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6138 and arm_attr_merge_7.stdout.
6139 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6140 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6141 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6142 arm_attr_merge_7b.o): New rules.
6143 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6144 arm_attr_merge_7
6145 * testsuite/Makefile.in: Regenerate.
6146 * testsuite/arm_attr_merge.sh: New file.
6147 * testsuite/arm_attr_merge_[67][ab].s: Same.
6148
3e01a7fd
NC
61492010-05-05 Nick Clifton <nickc@redhat.com>
6150
6151 * po/es.po: Updated Spanish translation.
6152
7ad2014a
L
61532010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6154
6155 * Makefile.am (install-exec-local): Properly install gold as
6156 default cross linker.
6157 * Makefile.in: Regenerated.
6158
4fda8867
NC
61592010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6160 Nick Clifton <nickc@redhat.com>
6161
6162 * configure.ac (install_as_default): Define and set to false
6163 unless --enable-gold or --enable-gold=both/gold has been
6164 specified.
6165 * configure: Regenerate.
6166
6167 * Makefile.am (install-exec-local): Install the executable as
6168 'ld.gold'. If install_as_default is true then also install it as
6169 'ld'.
6170 * Makefile.in: Regenerated.
6171
bd288ea2
ILT
61722010-04-24 Ian Lance Taylor <iant@google.com>
6173
6174 * layout.cc (Layout::layout_reloc): In relocatable link don't
6175 combine reloc sections for grouped sections.
6176
ef38fd8a
ST
61772010-04-23 Sriraman Tallam <tmsriram@google.com>
6178
6179 * gc.h (gc_process_relocs): Pass information on relocs pointing to
6180 sections that are not ordinary to icf.
6181 * icf.cc (get_section_contents): Handle relocation pointing to section
6182 with no object or shndx information.
6183 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6184 * testsuite/Makefile.in: Regenerate.
6185 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6186 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6187
f6973bdc
ILT
61882010-04-22 Ian Lance Taylor <iant@google.com>
6189
6190 * expression.cc (Expression::Expression_eval_info): Add
6191 result_alignment_pointer field.
6192 (Expression::eval_with_dot): Add result_alignment_pointer
6193 parameter. Change all callers.
6194 (Expression::eval_maybe_dot): Likewise.
6195 (class Binary_expression): Add alignment_pointer parameter to
6196 left_value and right_value. Change all callers.
6197 (BINARY_EXPRESSION): Set result alignment.
6198 (class Trinary_expression): Add alignment_pointer parameter to
6199 arg2_value and arg3_value. Change all callers.
6200 (Trinary_cond::value): Set result alignment.
6201 (Max_expression::value, Min_expression::value): Likewise.
6202 (Align_expression::value): Likewise.
6203 * script-sections.cc (class Sections_element): Add dot_alignment
6204 parameter to set_section_addresses virtual function. Update
6205 instantiations.
6206 (class Output_section_element): Likewise.
6207 (Script_sections::create_segments): Add dot_alignment parameter.
6208 Change all callers.
6209 (Script_sections::create_segments_from_phdrs_clause): Likewise.
6210 (Script_sections::set_phdrs_clause_addresses): Likewise.
6211 * script-sections.h: Update declarations.
6212 * script.h: Update declarations.
6213 * output.h (Output_segment::set_minimum_p_align): Don't decrease
6214 min_p_align.
6215 * testsuite/script_test_3.t: Set large alignment.
6216 * testsuite/script_test_3.sh: Make sure that at least one LOAD
6217 segment has expected alignment.
6218
9c9c98a5
NC
62192010-04-22 Nick Clifton <nickc@redhat.com>
6220
6221 * po/gold.pot: Updated by the Translation project.
6222 * po/vi.po: Updated Vietnamese translation.
6223
2253bfba
L
62242010-04-22 H.J. Lu <hongjiu.lu@intel.com>
6225
6226 * testsuite/Makefile.am (check_PROGRAMS): Add
6227 icf_virtual_function_folding_test.
6228 * testsuite/Makefile.in: Regenerated.
6229
85fdf906
AH
62302010-04-15 Andrew Haley <aph@redhat.com>
6231
6232 * options.h (merge_exidx_entries): New option.
6233 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6234 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6235 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6236 (Target_arm::merge_exidx_entries): New function.
6237 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6238 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6239 to Arm_exidx_fixup constructor.
6240 Add new arg, merge_exidx_entries.
6241 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6242 Arm_output_section::fix_exidx_coverage.
6243
ce97fa81
ST
62442010-04-18 Sriraman Tallam <tmsriram@google.com>
6245
6246 * icf.cc (get_section_contents): Check for preemptible functions.
6247 Ignore addend when appropriate.
6248 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
6249 section folded.
6250 (add_from_relobj): Check for section folded.
6251 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6252 * symtab.h (should_add_dynsym_entry): Add new parameter.
6253 * target-reloc.h (scan_relocs): Check for section folded.
6254 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6255 Check reloc types for function pointers in shared objects.
6256 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6257 case.
6258 (icf_preemptible_functions_test): New test case.
6259 (icf_string_merge_test): New test case.
6260 * testsuite.Makefile.in: Regenerate.
6261 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6262 bar_glob. Refactor code.
6263 * testsuite/icf_preemptible_functions_test.cc: New file.
6264 * testsuite/icf_preemptible_functions_test.sh: New file.
6265 * testsuite/icf_string_merge_test.cc: New file.
6266 * testsuite/icf_string_merge_test.sh: New file.
6267 * testsuite/icf_virtual_function_folding_test.cc: New file.
6268 * testsuite/icf_virtual_function_folding_test.sh: New file.
6269
04ceb17c
DK
62702010-04-14 Doug Kwan <dougkwan@google.com>
6271
6272 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6273 for local symbol recounting if we remove a section due to ICF.
6274 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6275 there are no regular objects in input.
6276
153e7da4
DK
62772010-04-13 Doug Kwan <dougkwan@google.com>
6278
6279 * arm.cc (Arm_input_section::set_final_data_size): Compute
6280 accurate final data size instead of using current data size.
6281
4dbd9faf
DK
62822010-04-09 Doug Kwan <dougkwan@google.com>
6283
6284 * layout.cc (Layout::choose_output_section): Handle script section
6285 types.
6286 (Layout::make_output_section_for_script): Add section type parameter.
6287 Handle script section types.
6288 * layout.h (Layout::make_output_section_for_script): Add section
6289 type parameter.
6290 * output.cc (Output_section::Output_section): Initialize data member
6291 is_noload_.
6292 (Output_section::do_reset_address_and_file_offset): Do not set address
6293 to 0 if section is a NOLOAD section.
6294 * output.h (Output_section::is_noload): New method.
6295 (Output_section::set_is_noload): Ditto.
6296 (Output_section::is_noload_): New data member.
6297 * script-c.h (Script_section_type): New enum type.
6298 (struct Parser_output_section_header): Add new file section_type.
6299 * script-sections.cc (Sections_element::output_section_name): Add
6300 parameter for returning script section type.
6301 (Output_section_definition::output_section_name): Ditto.
6302 (Output_section_definition::section_type)P; New method.
6303 (Output_section_definiton::script_section_type_name): Ditto.
6304 (Output_section_definition::script_section_type_): New data member.
6305 (Output_section_definition::Output_section_definition): Initialize
6306 data member Output_section_definition::script_section_type_.
6307 (Output_section_definition::create_sections): Pass script section type
6308 to Layout::make_output_section_for_script.
6309 (Output_section_definition::output_section_name): Return script
6310 section type to caller.
6311 (Output_section_definition::set_section_address): Do not advance
6312 dot value and load address if section type is NOLOAD. Set address
6313 of NOLOAD sections regardless of section flags.
6314 (Output_section_definition::print): Print section type if it is
6315 not SCRIPT_SECTION_TYPE_NONE.
6316 (Output_section_definition::section_type): New method.
6317 (Output_section_definition::script_section_type_name): Ditto.
6318 (Script_sections::output_section_name): Add new parameter
6319 PSECTION_TYPE for returning script section type. Pass it to
6320 section elements. Handle discard sections.
6321 (Sort_output_sections::operator()): Handle NOLOAD sections.
6322 * script-sections.h (Script_sections::Section_type): New enum type.
2e702c99 6323 (Script_sections::output_section_name): Add a new parameter for
4dbd9faf
DK
6324 returning script section type.
6325 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6326 INFO and NOLOAD.
6327 * yyscript.y (union): Add new field SECTION_TYPE.
6328 (COPY, DSECT, INFO, NOLOAD): New tokens.
6329 (opt_address_and_section_type): Change type to output_section_header.
6330 (section_type): New non-terminal
6331 (section_header): Handle section type.
2253bfba 6332 (opt_address_and_section_type): Return section type value.
4dbd9faf 6333
721ea635
L
63342010-04-09 H.J. Lu <hongjiu.lu@intel.com>
6335
6336 * testsuite/plugin_common_test_1.c (foo): Add prototype.
6337 * testsuite/plugin_common_test_2.c (foo): Likewise.
6338
6bf924b0
DK
63392010-04-08 Doug Kwan <dougkwan@google.com>
6340
6341 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6342 Output_merge_data.
6343 * output.cc (Output_section::add_merge_input_section): Simplify
6344 code and return status of Output_merge_base::add_input_section.
e1df38aa 6345 Update merge section map only if Output_merge_base::add_input_section
6bf924b0
DK
6346 returns true.
6347
24af6f92
DK
63482010-04-07 Doug Kwan <dougkwan@google.com>
6349
6350 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6351 if section is marked as containing instructions but has no mapping
6352 symbols.
6353 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6354 correct section index.
6355 (Arm_relobj::find_linked_text_section): Ditto.
6356
00698fc5
CC
63572010-04-07 Cary Coutant <ccoutant@google.com>
6358
6359 * archive.cc (include_member): Destroy Read_symbols_data object before
6360 releasing file.
6361 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6362 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6363 (Read_symbols_data::~Read_symbols_data) New destructor.
6364 (Section_relocs::Section_relocs) New constructor.
6365 (Section_relocs::~Section_relocs) New destructor.
6366 (Read_relocs_data::Read_relocs_data) New constructor.
6367 (Read_relocs_data::~Read_relocs_data) New destructor.
6368 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6369 pointers to NULL after deleting.
6370
7296d933
DK
63712010-04-07 Doug Kwan <dougkwan@google.com>
6372
6373 * arm.cc: Replace "endianity" with "endianness" in comments.
6374 (Arm_exidx_cantunwind): Ditto.
6375 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6376 (Arm_relobj::merge_flags_and_attributes): New method.
6377 (Arm_relobj::merge_flags_and_attributes_): New data member.
6378 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6379 (Arm_relobj::scan_sections_for_stubs): Ditto.
6380 (Arm_relobj::do_read_symbols): Check to see if we really want to
6381 merge processor-specific flags and attributes. Exit early if
6382 an object is empty except for section names and the undefined symbol.
6383 (Target_arm::do_finalize_sections): Move check for ELF format to
6384 Arm_relobj::do_read_symbols. Merge processor specific flags and
6385 attributes from a regular object only when we have determined that
6386 it is aapropriate. Do not create an .ARM.attributes section in
6387 output if there is no regular input object.
6388 (Target_arm::merge_processor_specific_flags): Check
6389 --warn-mismatch before printing any error.
6390 (Target_arm::merge_object_attributes): Ditto.
6391 * gold.cc (queue_middle_tasks): Handle the case in which there is
6392 no regular object in input.
6393 * options.cc (General_options::parse_EB): New method.
6394 (General_options::parse_EL): Same.
6395 (General_options::General_options): Initialize endianness_.
6396 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6397 New options.
6398 (General_options::Endianness): New enum.
6399 (General_options::endianness): New method.
6400 (General_options::endianness_): New data member.
6401 * parameters.cc (Parameters::set_options): Check target endianness.
6402 (Parameters::set_target_once): Ditto.
6403 (Parameters::check_target_endianness): New method.
6404 (parameters_force_valid_target): If either -EL or -EB is specified,
6405 use it to define endianness of default target.
6406 * parameters.h (Parameters::check_target_endianness): New method
6407 declaration.
6408 * target.h (class Target): Change "endianity" to "endianness"
6409 in comments.
6410
efc8d4f2
RW
64112010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6412
6413 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6414 * configure: Regenerate.
6415 * Makefile.in: Regenerate.
6416 * testsuite/Makefile.in: Regenerate.
6417
be234d88
CC
64182010-04-06 Cary Coutant <ccoutant@google.com>
6419
6420 gcc PR lto/42757
6421 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6422 prevailing definitions of common symbols.
6423 * testsuite/plugin_test_6.sh: New test case.
6424 * testsuite/plugin_common_test_1.c: New test case.
6425 * testsuite/plugin_common_test_2.c: New test case.
6426 * testsuite/Makefile.am (plugin_test_6): New test case.
6427 * testsuite/Makefile.in: Regenerate.
6428
bd32c6bd
NC
64292010-04-06 Nick Clifton <nickc@redhat.com>
6430
6431 * po/vi.po: New Vietnamese translation.
6432
323c532f
DK
64332010-03-30 Doug Kwan <dougkwan@google.com>
6434
6435 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6436
4fcd97eb
DK
64372010-03-25 Doug Kwan <dougkwan@google.com>
6438
6439 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6440 to avoid a conversion warning on a 32-bit host.
6441
4ebf39db
ILT
64422010-03-24 Ian Lance Taylor <iant@google.com>
6443
6444 * testsuite/script_test_3.t: Add a TLS segment.
6445 * testsuite/Makefile.am (check_PROGRAMS): Add
6446 tls_phdrs_script_test.
6447 (tls_phdrs_script_test_SOURCES): Define.
6448 (tls_phdrs_script_test_DEPENDENCIES): Define.
6449 (tls_phdrs_script_test_LDFLAGS): Define.
6450 (tls_phdrs_script_test_LDADD): Define.
6451 * testsuite/Makefile.in: Rebuild.
6452
4a599bdd
CC
64532010-03-23 Cary Coutant <ccoutant@google.com>
6454
6455 * fileread.cc (find_or_make_view): Fix comment.
6456
6c93b22c
ILT
64572010-03-23 Ian Lance Taylor <iant@google.com>
6458
6459 * script-sections.cc (class Orphan_section_placement): Define
6460 PLACE_TLS and PLACE_TLS_BSS.
6461 (Orphan_section_placement::Orphan_section_placement): Initialize
6462 new places.
6463 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6464 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6465 (tls_script_test_SOURCES): Define.
6466 (tls_script_test_DEPENDENCIES): Define.
6467 (tls_script_test_LDFLAGS): Define.
6468 (tls_script_test_LDADD): Define.
6469 * testsuite/Makefile.in: Rebuild.
6470
a2c7281b
DK
64712010-03-22 Doug Kwan <dougkwan@google.com>
6472
6473 * arm.cc (Arm_relocate_functions::abs8,
6474 Arm_relocate_functions::abs16): Use correct check for overflow
6475 specified in the ARM ELF specs.
6476 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6477 target of a BLX instruction specially.
6478 (Reloc_stub::stub_type_for_reloc): Ditto.
6479 (Relocate::relocate): Use symbolic names instead of numeric relocation
6480 codes to report error.
6481 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6482 workaround.
6483 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6484 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6485 thumb2_blx_out_of_range.stdout
6486 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6487 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6488 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6489 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6490 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6491 thumb2_blx_in_range, thumb2_blx_in_range.o,
6492 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6493 thumb2_blx_out_of_range.o): New rules.
2e702c99 6494 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
a2c7281b
DK
6495 thumb2_blx_in_range and thumb2_blx_out_of_range.
6496 * testsuite/Makefile.in: Regenerate.
6497 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6498 * testsuite/thumb_blx_in_range.s: New file.
6499 * testsuite/thumb_blx_out_of_range.s: New file.
6500
b0193076
RÁE
65012010-03-22 Rafael Espindola <espindola@google.com>
6502
6503 * archive.cc (Should_include): Move to archive.h.
6504 (should_include_member): Make it a member of Archive.
6505 (Lib_group): New.
6506 (Add_lib_group_symbols): New.
6507 * archive.h: Include options.h.
6508 (Archive_member): Moved from Archive.
6509 (Should_include): Moved from archive.cc.
6510 (Lib_group): New.
6511 (Add_lib_group_symbols): New.
6512 * dynobj.cc (do_should_include_member): New.
6513 * dynobj.h (do_should_include_member): New.
6514 * gold.cc (queue_initial_tasks): Update call to queue.
6515 * main.cc (main): Print lib group stats.
6516 * object.cc (do_should_include_member): New.
6517 * object.h: Include archive.h.
6518 (Object::should_include_member): New.
6519 (Object::do_should_include_member): New.
6520 (Sized_relobj::do_should_include_member): New.
6521 * options.cc (General_options::parse_start_lib): New.
6522 (General_options::parse_end_lib): New.
6523 (Input_arguments::add_file): Handle lib groups.
6524 (Input_arguments::start_group): Check we are not in a lib.
6525 (Input_arguments::start_lib): New.
6526 (Input_arguments::end_lib): New.
6527 * options.h (General_options): Add start_lib and end_lib.
6528 (Input_argument::lib_): New.
6529 (Input_argument::lib): New.
6530 (Input_argument::is_lib): New.
6531 (Input_file_lib): New.
6532 (Input_arguments::in_lib_): New.
6533 (Input_arguments::in_lib): New.
6534 (Input_arguments::start_lib): New.
6535 (Input_arguments::end_lib_): New.
6536 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6537 in unused members as preempted.
6538 (Sized_pluginobj::do_should_include_member): New.
6539 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6540 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6541 return the blocker.
6542 (Read_symbols::do_whole_lib_group): New.
6543 (Read_symbols::do_lib_group): New.
6544 (Read_symbols::do_read_symbols): Handle lib groups.
6545 (Read_symbols::get_name): Handle lib groups.
6546 * readsyms.h (Read_symbols): Add an archive member pointer.
6547 (Read_symbols::do_whole_lib_group): New.
6548 (Read_symbols::do_lib_group): New.
6549 (Read_symbols::member_): New.
6550 * script.cc (read_input_script): Update call to queue_soon.
6551
d099120c
DK
65522010-03-19 Doug Kwan <dougkwan@google.com>
6553
6554 * arm.cc (Stub_table::Stub_table): Initialize new data members
6555 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6556 (Stub_table::add_reloc_stub): Assign stub offset and update
6557 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6558 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6559 New data members.
2e702c99 6560 (Stub_table::update_data_size_and_addralign): Use
d099120c
DK
6561 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6562 instead of going over all reloc stubs.
2e702c99 6563 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
d099120c
DK
6564 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6565 Stringpool_template::offset_ to size of Stringpool_char.
2e702c99 6566 (Stringpool_template::new_key_offset): Remove code to initialize
d099120c
DK
6567 Stringpool_template::offset_.
6568 * stringpool.h (Stringpool_template::set_no_zero_null): Set
6569 Stringpool_template::offset_ to zero.
6570
1aa37384
DK
65712010-03-15 Doug Kwan <dougkwan@google.com>
6572
6573 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6574 offset_.
6575 (Stringpool_template::new_key_offset): New method.
6576 (Stringpool_template::add_string): Assign offsets when adding new
6577 strings.
6578 (Stringpool_template::set_string_offsets): Do not set string offsets
6579 when not optimizing.
6580 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6581 member size_.
2e702c99
RM
6582 (Chunked_vector::clear): Clear size_.
6583 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6584 (Chunked_vector::size): Return size_.
6585 (Chunked_vector::push_back): Use size_ to find insert position.
e1df38aa 6586 (Chunked_vector::size_): New data member.
1aa37384
DK
6587 (Stringpool_template::set_no_zero_null): Assert string set is empty.
6588 (Stringpool_template::new_key_offset): New method declaration.
6589 (Stringpool_template::offset_): New data member.
6590
b672b057
RÁE
65912010-03-15 Rafael Espindola <espindola@google.com>
6592
6593 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6594 Add_symbols' constructor.
6595 * readsyms.h (Add_symbols): Remove the input_group member.
6596
b6848d3c
ILT
65972010-03-10 Ian Lance Taylor <iant@google.com>
6598
6599 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6600 target to ask whether a reference to a symbol requires a stack
6601 split.
6602 * target.h (Target::is_call_to_non_split): New function.
6603 (Target::do_is_call_to_non_split): Declare virtual function.
6604 * target.cc: Include "symtab.h".
6605 (Target::do_is_call_to_non_split): New function.
6606 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6607
a2a5469e
CC
66082010-03-10 Cary Coutant <ccoutant@google.com>
6609
6610 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6611 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6612 (File_read::open[2]): Add whole_file_view_ to list of views.
6613 (File_read::make_view): Remove test of whole_file_view_.
6614 (File_read::find_or_make_view): Create whole_file_view_ if
6615 necessary.
6616 (File_read::clear_views): Replace bool parameter with enum;
6617 adjust all callers. Don't delete views with permanent data;
6618 do delete cached views and views from archives if
6619 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6620 if clearing the corresponding view.
6621 * fileread.h (File_read::Clear_views_mode): New enum.
6622 (File_read::View::is_permanent_view): New method.
6623 (File_read::clear_views): Replace bool parameter
6624 with enum; adjust all callers.
6625 * options.h (General_options): Change keep_files_mapped option;
6626 add map_whole_files.
6627 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6628 releasing the file.
6629 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6630 the file.
6631
8861f32b
DM
66322010-03-10 David S. Miller <davem@davemloft.net>
6633
6634 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6635
d62d0f5f
ST
66362010-03-09 Sriraman Tallam <tmsriram@google.com>
6637
6638 * icf.cc (get_section_contents): Add '@' marker after processing the
6639 merge reloc.
6640
9177756d
DK
66412010-03-08 Doug Kwan <dougkwan@google.com>
6642
6643 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6644 due to a conversion warning.
6645 (Arm_relobj::update_output_local_symbol_count): Check for local
6646 symbol with unset output index.
6647
9e9e071b
ILT
66482010-03-05 Ian Lance Taylor <iant@google.com>
6649
6650 * options.h (class General_options): Add --spare-dynamic-tags.
6651 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6652 --spare-dynamic-tags.
6653
a81ee015
ILT
66542010-03-05 Ian Lance Taylor <iant@google.com>
6655
6656 * incremental.cc: Include "libiberty.h".
6657
44ec90b9
RO
66582010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6659
6660 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6661 function, is_info_ member.
6662 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6663 (Versions::Versions): Update caller.
6664 (Versions::define_base_version): Likewise.
6665 (Versions::add_def): Likewise.
6666
0897ed3b
ST
66672010-03-03 Sriraman Tallam <tmsriram@google.com>
6668
6669 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6670 (Scan::possible_function_pointer_reloc): New function.
6671 (Scan::local_reloc_may_be_function_pointer): Change to call
6672 possible_function_pointer_reloc.
6673 (Scan::global_reloc_may_be_function_pointer): Ditto.
6674 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6675 relocations in ".data.rel.ro._ZTV" section.
6676 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6677 * testsuite/icf_safe_so_test.cc: Ditto.
6678 * testsuite/icf_safe_test.cc: Ditto.
6679 * testsuite/icf_safe_test.sh: Ditto.
6680
d3bbad62
ILT
66812010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6682 Ian Lance Taylor <iant@google.com>
6683
6684 * target-reloc.h (relocate_section): Check the symbol table index
6685 for -1U before setting the local symbol index.
6686 (scan_relocatable_relocs): If copying the relocation, record that
6687 the local symbol is required.
6688 * object.h (Symbol_value::is_output_symtab_index_set): New
6689 function.
6690 (Symbol_value::may_be_discarded_from_output_symtab): New
6691 function.
6692 (Symbol_value::has_output_symtab_entry): New function.
6693 (Symbol_value::needs_output_symtab_entry): Remove.
6694 (Symbol_value::output_symtab_index): Make sure the symbol index is
6695 set.
6696 (Symbol_value::set_output_symtab_index): Make sure the symbol
6697 index is not set. Make sure the new index is valid.
6698 (Symbol_value::set_must_have_output_symtab_entry): New function.
6699 (Symbol_value::has_output_dynsym_entry): New function.
6700 (Symbol_value::set_output_dynsym_index): Make sure the new index
6701 is valid.
6702 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6703 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6704 local symbol if permitted.
6705 (Sized_relobj::do_finalize_local_symbols): Call
6706 is_output_symtab_index_set rather than needs_output_symtab_entry.
6707 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6708 rather than needs_output_symtab_entry. Call
6709 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6710 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6711 is_output_symtab_index_set rather than needs_output_symtab_entry.
6712 * testsuite/discard_locals_relocatable_test.c: New file.
6713 * testsuite/discard_locals_test.sh: Test -r.
6714 * testsuite/Makefile.am (check_DATA): Add
6715 discard_locals_relocatable_test1.syms,
6716 discard_local_relocatable_test2.syms.
6717 (MOSTLYCLEANFILES): Likewise. Also add
6718 discard_locals_relocatable_test1.lout and
6719 discard_locals_relocatable_test2.out.
6720 (discard_locals_relocatable_test1.syms): New target.
6721 (discard_locals_relocatable_test.o): New target.
6722 (discard_locals_relocatable_test1.out): New target.
6723 (discard_locals_relocatable_test2.syms): New target.
6724 (discard_locals_relocatable_test2.out): New target.
6725 (various): Add missing ../ld-new dependencies.
6726 * testsuite/Makefile.in: Rebuild.
6727
7e8ccf26
NC
67282010-03-03 Nick Clifton <nickc@redhat.com>
6729
6730 * po/fi.po: New Finnish translation.
6731
2a0ff005
DK
67322010-03-01 Doug Kwan <dougkwan@google.com>
6733
6734 * layout.cc (Layout::Layout): Force section types of .init_array*,
6735 .preinit_array* and .fini_array* sections.
6736 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6737 Fix check of return value of std::string::find.().
6738 (Output_section::Input_section_sort_compare::operator()): Remove
6739 comment about .init_array.
6740 (Output_section::Input_section_sort_init_fini_compare::operator()):
6741 New method.
6742 (Output_section::sort_attached_input_sections): Handle .init_array
6743 and .fini_array specially.
6744 * output.h (Output_section::Inut_section_sort_compare): Update
6745 comment.
6746 (Output_section::Input_section_sort_init_fini_compare): New struct.
6747
c3e4ae29
DK
67482010-02-26 Doug Kwan <dougkwan@google.com>
6749
6750 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6751 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6752 * testsuite/debug_msg.sh: Avoid matching source line number for
6753 use of global variable undef_int.
6754
2fd9ae7a
DK
67552010-02-26 Doug Kwan <dougkwan@google.com>
6756
6757 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6758 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6759 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6760 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6761 * options.cc (General_options::General_options): Initialize member
6762 fix_v4bx_.
6763 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6764 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6765 and rm_no_fix_v4bx.stdout
6766 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6767 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6768 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6769 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6770 and arm_no_fix_v4bx.
6771 * Makefile.in: Regenerate.
6772 * testsuite/arm_fix_v4bx.s: New file.
6773 * testsuite/arm_fix_v4bx.sh: Ditto.
6774
67ec7d0b
DK
67752010-02-24 Doug Kwan <dougkwan@google.com>
6776
6777 * arm.cc (Target_arm::got_section): Make the .got section the first
6778 non RELRO section in the data segment.
6779 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6780 suffixes of section names.
6781
10165461
DK
67822010-02-24 Doug Kwan <dougkwan@google.com>
6783
6784 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6785 flags and attributes merging if an input file is a binary file.
6786 * fileread.cc (Input_file::open): Record format of original file.
6787 * fileread.h (Input_file::Format): New enum type.
2e702c99 6788 (Input_file::Input_file): Initialize data member format_.
10165461
DK
6789 (Input_file::format): New method definition.
6790 (Input_file::format_):: New data member.
6791
4a54abbb
DK
67922010-02-24 Doug Kwan <dougkwan@google.com>
6793
6794 * arm.cc (Arm_output_data_got): New class.
6795 (ARM_TCB_SIZE): New constant
6796 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6797 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6798 If user uses a script with a SECTIONS clause, issue only a warning
6799 for a misplaced EXIDX input section. Otherwise, issue an error.
2e702c99 6800 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4a54abbb
DK
6801 garbage collection.
6802 (Target_arm::got_mode_index_entry): Handle static linking.
6803 (Target_arm::Scan::local): Ditto.
6804 (Target_arm::Scan::global): Ditto.
6805 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6806 all incorrectly implemented relocations.
e1df38aa 6807 (Target_arm::fix_exidx_coverage): Pass layout to
4a54abbb
DK
6808 Arm_output_section::fix_exidx_coverage.
6809 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6810 from ".ARM.exidx." and ".ARM.extab.".
6811
ca419a6f
ILT
68122010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6813
6814 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6815 section if it does not already exist.
6816 * attributes.cc (Attributes_section_data::Attributes_section_data):
6817 Don't crash if size is zero.
6818
135b9c78
ILT
68192010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6820 Ian Lance Taylor <iant@google.com>
6821
6822 * gold.cc (queue_middle_tasks): If no input files were opened,
6823 exit.
6824 * workqueue.h (Task_function::Task_function): Assert that there is
6825 a blocker.
6826
bb0bfe4f
DK
68272010-02-22 Doug Kwan <dougkwan@google.com>
6828
6829 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6830 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6831 types to avoid warnings due to different uint64_t implementations
6832 on different hosts.
6833
2a2b6d42
DK
68342010-02-21 Doug Kwan <dougkwan@google.com>
6835
6836 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6837 handling of the maximum backward branch offset.
2e702c99 6838 (Arm_relocate_functions::thumb_branch_common): Ditto.
2a2b6d42
DK
6839 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6840 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
e1df38aa 6841 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
2a2b6d42
DK
6842 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6843 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6844 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6845 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6846 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6847 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6848 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6849 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6850 thumb2_bl_out_of_range.o): New rules.
6851 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6852 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6853 thumb2_bl_out_of_range
6854 * testsuite/Makefile.in: Regenerate.
6855 * testsuite/arm_bl_in_range.s: New file.
6856 * testsuite/arm_bl_out_of_range.s: Ditto.
6857 * testsuite/arm_branch_in_range.sh: Ditto.
6858 * testsuite/arm_branch_range.t: Ditto.
6859 * testsuite/thumb2_branch_range.t: Ditto.
6860 * testsuite/thumb_bl_in_range.s: Ditto.
6861 * testsuite/thumb_bl_out_of_range.s: Ditto.
6862 * testsuite/thumb_branch_range.t: Ditto.
6863
b487ad64
ST
68642010-02-20 Sriraman Tallam <tmsriram@google.com>
6865
6866 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6867 Add reloc offset information.
6868 * icf.cc (get_section_contents): Change iterators to point to the new
6869 vectors. Add reloc offset information to the contents.
6870 * icf.h (Icf::Sections_reachable_info): New typedef.
6871 (Icf::Sections_reachable_list): New typedef.
6872 (Icf::Offset_info): New typedef.
6873 (Icf::Reloc_info): New struct typedef.
6874 (Icf::Reloc_info_list): New typedef.
6875 (Icf::symbol_reloc_list): Delete method.
6876 (Icf::addend_reloc_list): Delete method.
6877 (Icf::section_reloc_list): Delete method.
6878 (Icf::reloc_info_list): New method.
6879 (Icf::reloc_info_list_): New member.
6880
f96accdf
DK
68812010-02-19 Doug Kwan <dougkwan@google.com>
6882
6883 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6884 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6885 * arm.cc (Arm_relocation_functions): New forward declaration.
6886 (Target_arm::Target_arm): Initialize new data members
6887 got_mod_index_offset_ and tls_base_symbol_defined_.
6888 (Target_arm::Relocate::relocate_tls): New method.
6889 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6890 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6891 New methods.
2e702c99 6892 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
f96accdf
DK
6893 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6894 (Target_arm::got_mod_index_offset_,
6895 Target_arm::tls_base_symbol_defined_): New data members.
6896 (Target_arm::Scan::local, Target::Scan::global,
6897 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6898 relocations.
6899
c8761b9a
DK
69002010-02-18 Doug Kwan <dougkwan@google.com>
6901
6902 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6903 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6904 text section as a parameter becuase some broken tools may not set
6905 the link in section header.
6906 (Target_arm::has_got_section): New method.
6907 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6908 without any mapping symbol as data only. Remove warning.
6909 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6910 link in its section header, try to discover the link by inspecting the
6911 REL31 relocation at the beginning of the section.
6912 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6913 in error message.
6914 (Target_arm::Scan::global): Treat any reference to the symbol
6915 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6916
21bb3914
ST
69172010-02-12 Sriraman Tallam <tmsriram@google.com>
6918
6919 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6920 (Scan::global_reloc_may_be_function_pointer): New function.
6921 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6922 (Scan::global_reloc_may_be_function_pointer): New function.
6923 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6924 (Scan::global_reloc_may_be_function_pointer): New function.
6925 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6926 (Scan::global_reloc_may_be_function_pointer): New function.
6927 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6928 (Scan::global_reloc_may_be_function_pointer): New function.
6929 (Scan::possible_function_pointer_reloc): New function.
6930 (Target_x86_64::can_check_for_function_pointers): New function.
6931 * gc.h (gc_process_relocs): Scan relocation types to determine if
6932 function pointers were taken for targets that support it.
6933 * icf.cc (Icf::find_identical_sections): Include functions for
6934 folding in safe ICF whose pointer is not taken.
6935 * icf.h (Secn_fptr_taken_set): New typedef.
6936 (fptr_section_id_): New member.
6937 (section_has_function_pointers): New function.
6938 (set_section_has_function_pointers): New function.
6939 (check_section_for_function_pointers): New function.
6940 * options.h: Fix comment for safe ICF option.
6941 * target.h (can_check_for_function_pointers): New function.
6942 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6943 Modify icf_safe_test for X86-64.
6944 * testsuite/Makefile.in: Regenerate.
6945 * testsuite/icf_safe_so_test.cc: New file.
6946 * testsuite/icf_safe_so_test.sh: New file.
6947 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6948 (main): Change to take pointer to function kept_func_3.
6949 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6950 folding is done correctly for X86-64.
6951
0da6fa6c
DM
69522010-02-12 David S. Miller <davem@davemloft.net>
6953
6954 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6955 is_symbolless parameter.
6956 (Output_reloc<SHT_REL>::is_symbolless): New.
6957 (Output_reloc<SHT_REL>::is_symbolless_): New.
6958 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6959 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6960 (Output_reloc<SHT_RELA>::is_symbolless): New.
6961 (Output_data_reloc::add_global): Handle is_symbolless.
6962 (Output_data_reloc::add_global_relative): Likewise.
6963 (Output_data_reloc::add_local): Likewise.
6964 (Output_data_reloc::add_local_relative): Likewise.
6965 (Output_data_reloc::add_symbolless_global_addend): New.
6966 (Output_data_reloc::add_symbolless_local_addend): New.
6967 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6968 is_symbolless.
6969 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6970 instead of ->is_relative_
6971 (Output_reloc::write): Likewise.
6972 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6973 (Output_reloc::write_rel): Simplify.
6974
6975 * sparc.cc (Target_sparc::Scan::local): Use
6976 ->add_symbolless_local_addend as needed.
6977 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6978 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6979 based upon relocation offset.
6980
e4782e83
DK
69812010-02-11 Doug Kwan <dougkwan@google.com>
6982
6983 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6984 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6985 beginning of function.
6986 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6987 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6988 parameter is_32bit in calls to should_apply_static_reloc.
6989 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6990 (check_DATA): Add arm_abs_global.stdout.
6991 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6992 arm_abs_global.stdout): New rules.
6993 (MOSTLLYCLEANFILES): Add arm_abs_global
6994 * Makefile.in: Regenerate.
6995 * testsuite/arm_abs_global.s: New file.
6996 * testsuite/arm_abs_global.sh: Ditto.
6997 * testsuite/arm_abs_lib.s: Ditto.
6998
93ceb764
ILT
69992010-02-11 Ian Lance Taylor <iant@google.com>
7000
7001 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7002 Read_relocs task.
7003 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
7004 Allocate_commons_task first.
7005 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7006 task, rather than symtab_lock_.
7007 (Gc_process_relocs::~Gc_process_relocs): New function.
7008 (Gc_process_relocs::is_runnable): Check this_blocker_.
7009 (Gc_process_relocs::locks): Use next_blocker_ rather than
7010 blocker_.
7011 (Scan_relocs::~Scan_relocs): New function.
7012 (Scan_relocs::is_runnable): Check this_blocker_ rather than
7013 symtab_lock_.
7014 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
7015 next_blocker_.
7016 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7017 fields. Add this_blocker_ and next_blocker_ fields. Adjust
7018 constructor accordingly.
7019 (class Gc_process_relocs): Likewise.
7020 (class Scan_relocs): Likewise.
7021 * common.h (class Allocate_commons_task): Remove symtab_lock_
7022 field, and corresponding constructor parameter.
7023 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7024 symtab_lock_.
7025 (Allocate_commons_task::locks): Likewise.
7026
114dfbe1
ILT
70272010-02-11 Ian Lance Taylor <iant@google.com>
7028
7029 * gold-threads.h (class Once): Define.
7030 (class Initialize_lock): Rewrite as child of Once.
7031 * gold-threads.cc (class Once_initialize): Define.
7032 (once_pointer_control): New static variable.
7033 (once_pointer, once_arg): New static variables.
7034 (c_run_once): New static function.
7035 (Once::Once, Once::run_once, Once::internal_run): New functions.
7036 (class Initialize_lock_once): Remove.
7037 (initialize_lock_control): Remove.
7038 (initialize_lock_pointer): Remove.
7039 (initialize_lock_once): Remove.
7040 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7041 (Initialize_lock::initialize): Rewrite.
7042 (Initialize_lock::do_run_once): New function.
7043 * archive.cc (Archive::interpret_header): Only clear name if it is
7044 not already empty.
7045 * fileread.cc: Include "gold-threads.h"
7046 (file_counts_lock): New static variable.
7047 (file_counts_initialize_lock): Likewise.
7048 (File_read::release): Only increment counts when using --stats.
7049 Use a lock around the increment.
7050 * parameters.cc (class Set_parameters_target_once): Define.
7051 (set_parameters_target_once): New static variable.
7052 (Parameters::Parameters): Move here from parameters.h.
7053 (Parameters::set_target): Rewrite.
7054 (Parameters::set_target_once): New function.
7055 (Parameters::clear_target): Move here and rewrite.
7056 * parameters.h (class Parameters): Update declarations. Add
7057 set_parameters_target_once_ field.
7058 (Parameters::Parameters): Move to parameters.cc.
7059 (Parameters::clear_target): Likewise.
7060 * readsyms.cc (Read_symbols::do_group): Create a Start_group
7061 task.
7062 (Start_group::~Start_group): New function.
7063 (Start_group::is_runnable): New function.
7064 (Start_group::locks, Start_group::run): New functions.
7065 (Finish_group::run): Change saw_undefined to size_t.
7066 * readsyms.h (class Start_group): Define.
7067 (class Finish_group): Change saw_undefined_ field to size_t.
7068 (Finish_group::Finish_group): Remove saw_undefined and
7069 this_blocker parameters. Change all callers.
7070 (Finish_group::set_saw_undefined): New function.
7071 (Finish_group::set_blocker): New function.
7072 * symtab.h (class Symbol_table): Change saw_undefined to return
7073 size_t. Change saw_undefined_ field to size_t.
7074 * target-select.cc (Set_target_once::do_run_once): New function.
7075 (Target_selector::Target_selector): Initialize set_target_once_
7076 field. Don't initialize lock_ and initialize_lock_ fields.
7077 (Target_selector::instantiate_target): Rewrite.
7078 (Target_selector::set_target): New function.
7079 * target-select.h (class Set_target_once): Define.
7080 (class Target_selector): Update declarations. Make
7081 Set_target_once a friend. Remove lock_ and initialize_lock_
7082 fields. Add set_target_once_ field.
7083
fa17a3f4
ILT
70842010-02-10 Ian Lance Taylor <iant@google.com>
7085
7086 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7087 queueing any tasks.
7088 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
7089 (queue_middle_tasks): Add all blockers before queueing any tasks.
7090 (queue_final_tasks): Likewise.
7091 * token.h (Task_token::add_blockers): New function.
7092 * object.h (Input_objects::number_of_relobjs): New function.
7093
c7177d31
ILT
70942010-02-10 Ian Lance Taylor <iant@google.com>
7095
5de0e392
ILT
7096 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7097 shared, not if not position independent.
7098 * x86_64.cc (Relocate::relocate_tls): Likewise.
7099 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7100 (tls_pie_pic_test): New target.
7101 * testsuite/Makefile.in: Rebuild.
7102
c7177d31
ILT
7103 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7104 (tls_test_main_pie.o, tls_test_pie.o): New targets.
7105 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7106 * testsuite/Makefile.in: Rebuild.
7107
684b268a
DM
71082010-02-09 David S. Miller <davem@davemloft.net>
7109
7110 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7111 R_SPARC_RELATIVE using ->add_local_relative().
7112 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7113
612a8d3d
DM
7114 * output.h (Output_data_dynamic::add_section_size): New method
7115 that takes two Output_data objects.
7116 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7117 entry param. Handle it in initializers.
7118 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7119 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7120 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7121 arg.
7122 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7123 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7124 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7125 for dynrel_includes_plt.
7126 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7127 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7128 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7129 before .rela.plt
7130 (Target_sparc::do_finalize_sections): Update to pass true for
7131 dynrel_includes_plt.
7132 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7133 output before .rela.plt
7134 (Target_powerpc::do_finalize_sections): Update to pass true for
7135 dynrel_includes_plt when 32-bit.
7136
cb1be87e
DK
71372010-02-08 Doug Kwan <dougkwan@google.com>
7138
7139 * arm.cc (Arm_relobj::simple_input_section_output_address): New
7140 method.
7141 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7142 Arm_relobj::scan_section_for_cortex_a8_stubs,
7143 Arm_relobj::do_relocation_section): Instead of calling
7144 Output_section::output_address, use faster
7145 Arm_relobj::simple_input_section_output_address.
7146
705b5121
DM
71472010-02-08 David S. Miller <davem@davemloft.net>
7148
7149 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7150 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7151 relocation helper function.
7152
024c4466
DM
7153 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7154 just like R_SPARC_GOT{10,13,22}.
7155 (Target_sparc::Scan::local): Likewise.
7156 (Target_sparc::Relocate:relocate): Likewise.
7157
9109c078
ILT
71582010-02-06 Ian Lance Taylor <iant@google.com>
7159
7160 * configure.ac: Rewrite targetobjs duplicate removal code to use
7161 only shell constructs.
7162 * configure: Rebuild.
7163
cf846138
DK
71642010-02-05 Doug Kwan <dougkwan@google.com>
7165
7166 PR 11247
7167 * arm.cc (Arm_relobj::section_is_scannable): New method.
7168 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7169 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7170
6cfaf60b
DK
71712010-02-04 Doug Kwan <dougkwan@google.com>
7172
7173 PR 11247
7174 * arm-reloc-property.cc (cstdio): Include.
7175 * configure.ac (targetobjs): Remove duplicates.
7176 * configure: Regenerate.
7177 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7178 big and little endian version for a given address size.
7179
5c57f1be
DK
71802010-02-03 Doug Kwan <dougkwan@google.com>
7181
7182 * arm-reloc-property.cc
7183 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7184 definition.
7185 * arm-reloc-property.h
7186 (Arm_reloc_property_table::get_implemented_static_reloc_property):
7187 New method definition.
7188 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7189 declaration.
7190 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7191 overflow to N.
7192 (GOT_PREL): Change implemented to Y.
7193 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7194 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7195 (Arm_relocate_functions::movw_abs_nc): Remove method.
7196 (Arm_relocate_functions::movt_abs): Ditto.
7197 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7198 (Arm_relocate_functions::thm_movt_abs): Ditto.
7199 (Arm_relocate_functions::movw_rel_nc): Ditto.
7200 (Arm_relocate_functions::movw_rel): Ditto.
7201 (Arm_relocate_functions::movt_rel): Ditto.
7202 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7203 (Arm_relocate_functions:thm_movw_rel): Ditto.
7204 (Arm_relocate_functions:thm_movt_rel): Ditto.
7205 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7206 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7207 New method definitions.
7208 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7209 (Arm_relocation_functions::arm_grp_ldr): Ditto.
7210 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7211 (Arm_relocation_functions::arm_grp_ldc): Ditto.
7212 (Target_arm::Relocate::relocate): Check for non-static or
7213 unimplemented relocation code and exit early. Change calls to
7214 Target_arm::reloc_uses_thumb_bit and
7215 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7216 instead. Refactor code to handle similar relocations to increase
7217 code sharing. Remove check for unsupported relocation code in switch
7218 statement.
7219 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7220 relocation property table to find out size. Change error message to
7221 print out the name of a relocation code instead of the numeric value.
7222 (Target_arm::scan_reloc_for_stub): Use relocation property table
7223 instead of calling Target_arm::reloc_uses_thumb_bit().
7224
218c5831
DK
72252010-02-02 Doug Kwan <dougkwan@google.com>
7226
7227 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7228 types of relaxed input section.
7229
0d31c79d
DK
72302010-02-02 Doug Kwan <dougkwan@google.com>
7231
7232 * Makefile.am (HFILES): Add arm-reloc-property.h.
7233 (DEFFILES): New.
2e702c99
RM
7234 (TARGETSOURCES): Add arm-reloc-property.cc
7235 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
0d31c79d
DK
7236 (libgold_a_SOURCES): $(DEFFILES)
7237 * Makefile.in: Regenerate.
7238 * arm-reloc-property.cc: New file.
7239 * arm-reloc-property.h: New file.
7240 * arm-reloc.def: New file.
7241 * arm.cc: Update comments.
7242 (arm-reloc-property.h): New included header.
7243 (arm_reloc_property_table): New global variable.
7244 (Target_arm::do_select_as_default_target): New method definition.
7245 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7246 arm-reloc-property to targ_extra_obj.
7247 * parameters.cc (set_parameters_target): Call
7248 Target::select_as_default_target().
7249 * target.h (Target::select_as_default_target): New method definition.
7250 (Target::do_select_as_default_target): Same.
7251
546c7457
DK
72522010-02-01 Doug Kwan <dougkwan@google.com>
7253
7254 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7255 first_output_text_section_.
7256 (Arm_exidx_fixup::first_output_text_section): New method definition.
7257 (Arm_exidx_fixup::first_output_text_section_): New data member.
7258 (Arm_exidx_fixup::process_exidx_section): Record the first text
7259 output section seen.
7260 (Arm_output_section::fix_exidx_coverage): Set correct linked section
7261 and entsize in output section header.
7262
11b861d5
DK
72632010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7264
7265 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7266 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7267 (Arm_relocate_functions::thm_alu11): New Method.
7268 (Arm_relocate_functions::thm_pc8): New Method.
7269 (Arm_relocate_functions::thm_pc12): New Method.
7270 (Target_arm::Scan::local): Handle the relocations.
7271 (Target_arm::Scan::global): Likewise.
7272 (Target_arm::Relocate::relocate): Likewise.
7273 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7274
c9a2c125
DK
72752010-01-29 Doug Kwan <dougkwan@google.com>
7276
7277 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7278 of relocation types as ld.
7279
1521477a
DK
72802010-01-29 Doug Kwan <dougkwan@google.com>
7281
7282 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7283 to public.
7284 (Arm_relocate_functions::thumb_branch_common): Ditto.
7285 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7286 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7287 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7288 Arm_relocate_functions::jump24): Remove.
7289 (Target_arm::Relocate::relocate): Adjust code to call
7290 Arm_relocation_functions::arm_branch_common and
7291 Arm_relocation_functions::thumb_branch_common instead of their removed
e1df38aa 7292 wrappers. Merge switch-cases together to reduce source code size.
1521477a 7293
e7eca48c
DK
72942010-01-29 Doug Kwan <dougkwan@google.com>
7295
7296 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7297 output_local_symbol_count_needs_update_.
7298 (Arm_relobj::output_local_symbol_count_needs_update,
7299 Arm_relobj::set_output_local_symbol_count_needs_update,
7300 Arm_relobj::update_output_local_symbol_count): New methods.
7301 (Arm_relobj::output_local_symbol_count_needs_update_): New data
7302 member.
7303 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7304 of pointed function as in a R_ARM_PREL31 relocation.
7305 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7306 for output local symbol count updating.
7307 (Target_arm::do_relax): Update output local symbol counts in objects
7308 if necessary.
7309 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7310
02961d7e
ILT
73112010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7312
7313 * arm.cc: Added support for the ARM relocations:
7314 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7315 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7316 (Arm_relocate_functions::movw_rel_nc): Renamed (was
7317 movw_prel_nc).
7318 (Arm_relocate_functions::movw_rel): New method.
7319 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7320 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7321 thm_movw_prel_nc).
7322 (Arm_relocate_functions::thm_movw_rel): New method.
7323 (Arm_relocate_functions::thm_movt_rel): Renamed (was
7324 thm_movt_prel).
7325 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7326 relocations.
7327 (Target_arm::Scan::global): Likewise.
7328 (Target_arm::Relocate::relocate): Likewise.
7329 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7330 Likewise.
7331
b10d2873
ILT
73322010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7333
7334 * arm.cc: Added support for ARM group relocations.
7335 (Target_arm::reloc_needs_sym_origin): New method.
7336 (Arm_relocate_functions::calc_grp_kn): New method.
7337 (Arm_relocate_functions::calc_grp_residual): New method.
7338 (Arm_relocate_functions::calc_grp_gn): New method.
7339 (Arm_relocate_functions::arm_grp_alu): New Method.
7340 (Arm_relocate_functions::arm_grp_ldr): New Method.
7341 (Arm_relocate_functions::arm_grp_ldrs): New Method.
7342 (Arm_relocate_functions::arm_grp_ldc): New Method.
7343 (Target_arm::Scan::local): Handle the ARM group relocations.
7344 (Target_arm::Scan::global): Likewise.
7345 (Target_arm::Relocate::relocate): Likewise.
7346 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7347 Likewise.
7348
2b328d4e
DK
73492010-01-26 Doug Kwan <dougkwan@google.com>
7350
7351 * arm.cc (set): Include.
7352 (class Arm_exidx_fixup): Change type of last_input_section_ to const
7353 pointer type.
2e702c99 7354 (Arm_output_section::Text_section_list): New type.
2b328d4e
DK
7355 (Arm_output_section::append_text_sections_to_list): New method.
7356 (Arm_output_section::fix_exidx_coverage): Ditto.
7357 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
2e702c99 7358 (Arm_relobj::convert_input_section_to_relaxed_section): Use
2b328d4e
DK
7359 Relobj::set_section_offset() instead of
7360 Sized_relobj::invalidate_section_offset().
2e702c99 7361 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
2b328d4e
DK
7362 parameter for section headers. Ignore relocation sections for
7363 unallocated sections and EXIDX sections.
7364 (Target_arm::fix_exidx_coverage): New method.
7365 (Target_arm::output_section_address_less_than): New type.
7366 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7367 linked text section instead of the EXIDX section.
7368 (Arm_output_section::create_stub_group): Add an assertion to check
7369 that this is not an EXIDX output section.
7370 (Arm_output_section::append_text_sections_to_list): New method.
7371 (Arm_output_section::fix_exidx_coverage): Ditto.
7372 (Arm_relobj::scan_sections_for_stubs): Adjust call to
2e702c99 7373 Arm_relobj::section_needs_reloc_stub_scanning.
2b328d4e
DK
7374 (Target_arm::do_relax): Fix EXIDX output section coverage in the
7375 first pass.
7376 (Target_arm::fix_exidx_coverage): New method.
7377 * object.h (Relobj::set_output_section): New method.
7378 (Sized_relobj::invalidate_section_offset): Remove method.
7379 (Sized_relobj::do_invalidate_section_offset): Remove method.
7380 (Sized_relobj::do_set_section_offset): Handle offset value -1.
7381
c7f3c371
DK
73822010-01-25 Doug Kwan <dougkwan@google.com>
7383
7384 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7385 Fix warning due to signed and unsigned comparison on a 32-bit host.
7386
8923b24c
DK
73872010-01-22 Doug Kwan <dougkwan@google.com>
7388
7389 * arm.cc (Target_arm::do_relax): Record an output section for section
7390 offset adjustment it contains any stub table that has changed.
7391 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7392 offsets in an output section if necessary.
7393 * output.cc (Output_section::Output_section): Initialize
7394 section_offsets_need_adjustments_.
7395 (Output_section::add_input_section_for_script): Renamed to
7396 Output_section::add_simple_input_section.
7397 (Output_section::save_states): Add a comment.
7398 (Output_section::discard_states): New method defintion.
7399 (Output_section::adjust_section_offsets): Same.
7400 * output.h (Output_section::add_input_section_for_script): Renamed to
7401 Output_section::add_simple_input_section.
7402 (Output_section::discard_states): New method declaration.
7403 (Output_section::adjust_section_offsets): Same.
7404 (Output_section::section_offsets_need_adjustment,
7405 Output_section::set_section_offsets_need_adjustment): New method
7406 definitions.
7407 (Output_section::section_offsets_need_adjustment_): New data member.
7408 * script-sections.cc
7409 (Output_section_element_input::set_section_address): Adjust code for
7410 renaming of Output_section::add_input_section_for_script.
7411 (Orphan_output_section::set_section_address): Same.
7412
9b2fd367
DK
74132010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7414
7415 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7416 Fix_v4bx enum values .
7417 * gold/options.h (General_options): New option definitions.
7418 (General_options::fix_v4bx): New method.
7419 (General_options::Fix_v4bx): New enum.
7420 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7421 (General_options::parse_fix_v4bx_interworking): New method.
7422
80d0d023
DK
74232010-01-22 Doug Kwan <dougkwan@google.com>
7424
7425 * arm.cc (Arm_exidx_fixup): New class.
7426
af2cdeae
DK
74272010-01-21 Doug Kwan <dougkwan@google.com>
7428
7429 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7430 classes.
7431 (Arm_exidx_section_offset_map): New type.
7432
993d07c1
DK
74332010-01-21 Doug Kwan <dougkwan@google.com>
7434
7435 * arm.cc (Arm_exidx_input_section): New class.
7436 (Arm_relobj::exidx_input_section_by_link,
7437 Arm_relobj::exidx_input_section_by_shndx,
7438 Arm_relobj::make_exidx_input_section): New methods.
7439 (read_arm_attributes_section): Remove.
7440 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7441 information about them.
7442 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7443 to here.
7444
5ac169d4
DK
74452010-01-20 Doug Kwan <dougkwan@google.com>
7446
7447 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7448 Input_section_specifier to Section_id.
7449 (Target_arm::new_arm_input_section: Adjust code for change of key
7450 type.
7451 (Target_arm::find_arm_input_section): Ditto.
7452 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7453 (Section_id): Remove.
7454 (Garbage_collection::Section_id_hash): Remove.
7455 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7456 (Section_id): Remove.
7457 (Icf::Section_id_hash): Remove.
7458 * object.h (Section_id, Const_section_id, Section_id_hash,
7459 Const_section_id_hash): New type definitions.
7460 * output.cc (Output_section::add_relaxed_input_section): Change to
7461 use Const_section_id instead of Input_section_specifier as key type.
7462 (Output_section::add_merge_input_section): Ditto.
7463 (Output_section::build_relaxation_map): Change to use Section_id
7464 instead of Input_section_specifier as key type.
2e702c99 7465 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5ac169d4
DK
7466 Ditto.
7467 (Output_section::convert_input_sections_to_relaxed_sections): Change
7468 to use Const_section_id instead of Input_section_specifier as key type.
2e702c99 7469 (Output_section::find_merge_section): Ditto.
5ac169d4
DK
7470 (Output_section::find_relaxed_input_section): Ditto.
7471 * output.h (Input_section_specifier): Remove class.
7472 (Output_section::Output_section_data_by_input_section_map): Change
7473 key type to Const_section_id.
7474 (Output_section::Output_relaxed_input_section_by_input_section_map):
7475 Ditto.
7476 (Output_section::Relaxation_map): Change key type to Section_id.
7477
a2162063
ILT
74782010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7479
7480 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7481 (class Arm_v4bx_stub): New class.
7482 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7483 (Stub_factory::make_arm_v4bx_stub): New method.
7484 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7485 (Stub_table::empty): Handle v4bx stubs.
7486 (Stub_table::add_arm_v4bx_stub): New method.
7487 (Stub_table::find_arm_v4bx_stub): New method.
7488 (Arm_relocate_functions::v4bx): New method.
7489 (Target_arm::fix_v4bx): New method.
7490 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7491 (Stub_table::relocate_stubs): Likewise.
7492 (Stub_table::do_write): Likewise.
7493 (Stub_table::update_data_size_and_addralign): Likewise.
7494 (Stub_table::finalize_stubs): Likewise.
7495 (Target_arm::Scan::local): Likewise.
7496 (Target_arm::Scan::global): Likewise.
7497 (Target_arm::do_finalize_sections): Likewise.
7498 (Target_arm::Relocate::relocate): Likewise.
7499 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7500 Likewise.
7501 (Target_arm::scan_reloc_for_stub): Likewise.
7502 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7503
5696ab0b
ILT
75042010-01-19 Ian Lance Taylor <iant@google.com>
7505
7506 * output.cc (Output_section_headers::do_sized_write): Write large
7507 segment count to sh_info field.
7508 (Output_file_header::do_sized_write): For large segment count,
7509 write PN_XNUM to e_phnum field.
7510
800d0f56
ILT
75112010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7512
7513 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7514 (Arm_relocate_functions::thm_jump8): New function.
7515 (Arm_relocate_functions::thm_jump11): New function.
7516 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7517 R_ARM_THM_JUMP11.
7518 (Target_arm::Scan::global): Likewise.
7519 (Target_arm::Relocate::relocate): Likewise.
7520 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7521 Likewise.
7522
41263c05
DK
75232010-01-14 Doug Kwan <dougkwan@google.com>
7524
7525 * arm.cc (map, utility): Include headers.
7526 (Target_arm::apply_cortex_a8_workaround): New method.
7527 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7528 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7529 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7530 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7531 the --[no-]fix-cortex-a8 command line options.
7532 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7533 (Target_arm::relocate_stub): Use addend in instruction template.
7534 * options.h (DEFINE_bool): Set the user-set flag.
7535 (General_options): Add --[no-]-fix-cortex options.
7536 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
e1df38aa 7537 : Update fast look-up map after conversion.
41263c05 7538
459e9b03
ST
75392010-01-14 Sriraman Tallam <tmsriram@google.com>
7540
7541 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7542 in the first pass of do_layout.
7543
b521dfe4
DK
75442010-01-13 Doug Kwan <dougkwan@google.com>
7545
7546 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7547 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7548 apparent compiler problem of not folding static constant integral
7549 data members of elfcpp::Elf_sizes<32>.
7550
44272192
DK
75512010-01-13 Doug Kwan <dougkwan@google.com>
7552
7553 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7554 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7555 Arm_relobj::scan_section_for_cortex_a8_erratum,
7556 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7557 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7558 sections to scan for relocation stubs into a new method
7559 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7560 relocation and Cortex-A8 stub scanning.
7561 (Target_arm::do_relax): Force stubs to be after stubbed sections
7562 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
e1df38aa 7563 the beginning of a new relaxation pass. Update a comment.
44272192
DK
7564 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7565
44b71ece
ILT
75662010-01-12 Ian Lance Taylor <iant@google.com>
7567
7568 * target-reloc.h (visibility_error): New inline function.
7569 (relocate_section): Call visibility_error.
7570 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7571 (MOSTLYCLEANFILES): Likewise.
7572 (protected_4_pic.o, protected_3.err): New targets.
7573 * testsuite/protected_4.cc: New file.
7574
a120bc7f
DK
75752010-01-12 Doug Kwan <dougkwan@google.com>
7576
7577 * arm.cc (Cortex_a8_reloc): New class.
7578 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7579 and cortex_a8_relocs_info_.
7580 (Target_arm::fix_cortex_a8): New method definition.
7581 (Target_arm::Cortex_a8_relocs_info): New type.
7582 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7583 New data member declarations.
7584 (Target_arm::scan_reloc_for_stub): Record information about
7585 relocations for THUMB branches that might be exempted from the
7586 Cortex-A8 workaround.
7587 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7588 at the beginning of a relaxation pass.
7589
20138696
DK
75902010-01-12 Doug Kwan <dougkwan@google.com>
7591
7592 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7593 (Arm_relobj::Mapping_symbol_position,
7594 Arm_reloj::Mapping_symbol_position_less,
7595 Arm_relobj::Mapping_symbols_info): New types.
7596 (Target_arm::is_mapping_symbol_name): New method definition.
7597 (Arm_relobj::do_count_local_symbols): Save information about mapping
7598 symbols.
7599
089d69dc
DK
76002010-01-11 Doug Kwan <dougkwan@google.com>
7601
7602 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7603 Arm_relocate_functions::thumb32_branch_upper,
7604 Arm_relocate_functions::thumb32_branch_lower,
7605 Arm_relocate_functions::thumb32_cond_branch_offset,
7606 Arm_relocate_functions::thumb32_cond_branch_upper,
7607 Arm_relocate_functions::thumb32_cond_branch_lower,
7608 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7609 branch offset encoding.
7610 (Arm_relocate_functions::thumb_branch_common): Use new branch
7611 offset encoding methods to avoid code duplication.
7612 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7613 (Stub_addend_reader::operator()): Use new branch encoding method
7614 to avoid code duplication.
7615
99e5bff2
DK
76162010-01-11 Doug Kwan <dougkwan@google.com>
7617
7618 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7619 (Target_arm::do_finalize_sections): Define special EXIDX section
7620 symbols only if referenced.
7621 * gc.h (Garbage_collection::add_reference): New method.
7622 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7623 code duplication.
7624
98e090bd
ILT
76252010-01-11 Ian Lance Taylor <iant@google.com>
7626
d0a91bd8
ILT
7627 * script.cc (Version_script_info::build_expression_list_lookup):
7628 Change complaing about duplicate wildcard match from error to
7629 warning.
7630
98e090bd
ILT
7631 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7632 of 2009-12-30.
7633 (Version_script_info::Version_script_info): Initialize globs_,
7634 default_version_, default_is_global_, and exact_. Don't
7635 initialize globals_ or locals_.
7636 (Version_script_info::build_lookup_tables): Build local symbols
7637 first.
7638 (Version_script_info::unquote): New function.
7639 (Version_script_info::add_exact_match): New function.
7640 (Version_script_info::build_expression_list_lookup): Remove lookup
7641 parameter. Add is_global parameter. Change all callers. Handle
7642 wildcard pattern specially. Unquote pattern. Call
7643 add_exact_match.
7644 (Version_script_info::get_name_to_match): New function.
7645 (Version_script_info::get_symbol_version): New function.
7646 (Version_script_info::get_symbol_version_helper): Remove.
7647 (Version_script_info::check_unmatched_names): Call unquote.
7648 * script.h (class Version_script_info): Change get_symbol_version
7649 to be non-inline and add is_global parameter; change all callers.
7650 Rewrite symbol_is_local. Update declarations. Define struct
7651 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7652 Remove globals_ and locals_ members. Add exact_, globs_,
7653 default_version_, is_global_.
7654 (Version_script_info::Glob): Remove pattern, add expression and
7655 is_global. Update constructor. Change all callers.
7656 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7657 default version.
7658 (Versions::symbol_section_contents): If a symbol is undefined, or
7659 defined in a dynamic object, set the version index to
7660 VER_NDX_LOCAL.
7661 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7662 symbol_is_local.
7663 (Symbol_table::add_from_pluginobj): Likewise.
7664 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7665
d56962d3
DK
76662010-01-11 Doug Kwan <dougkwan@google.com>
7667
7668 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7669 (incremental_dump_LDADD): Add linking option for libintl.
7670 * Makefile.in: Regenerate.
7671
94e6ee91
L
76722010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7673
7674 PR gold/11144
7675 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7676 instead of -Ds.
7677 * testsuite/Makefile.in: Regenerated.
7678
e96c574b
DK
76792010-01-10 Doug Kwan <dougkwan@google.com>
7680
7681 * options.h (DEFINE_var): Use parentheses around argument varname__
7682 in macro body to avoid any unintended subsequent substitutions.
7683
7198066b
ILT
76842010-01-10 Ian Lance Taylor <iant@google.com>
7685
ba4d53bf
ILT
7686 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7687 candidates before doing symbol resolution.
7688
7198066b
ILT
7689 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7690 ODR candidates if only one is weak.
7691
a2beed37
ILT
76922010-01-08 Ian Lance Taylor <iant@google.com>
7693
7694 * script.cc (Version_script_info::build_expression_list_lookup):
7695 Don't warn about ambiguous version, just record the ambiguity.
7696 (Version_script_info::get_symbol_version_helper): Give error if
7697 version is ambiguous.
7698
2fb7225c
DK
76992010-01-08 Doug Kwan <dougkwan@google.com>
7700
7701 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
703d02da
AM
7702 prev_data_size_ and prev_addralign_. Remove initializer for
7703 deleted data member has_been_changed_.
7704 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7705 to determine if the table is empty.
7706 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7707 Remove.
7708 (Stub_table::add_reloc_stub): Define method in class definition
7709 instead of just declaring it there.
7710 (Stub_table::add_cortex_a8_stub): New method definition.
7711 (Stub_table::update_data_size_and_addralign): Ditto.
7712 (Stub_table::finalize_stubs): Ditto.
7713 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7714 (Stub_table::do_addralign_): Return address alignment in the
7715 (Stub_table::do_reset_address_and_file_offset): Define method in
7716 class definition instead of declaring it there. Set current data
7717 size to be the data size of the previous pass.
7718 (Stub_table::set_final_data_size): Use current data size as the
7719 final data size.
7720 (Stub_table::relocate_stub): Change parameter type of stub from
7721 Reloc_stub pointer to Stub pointer.
7722 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7723 (Stub_table::Cortex_a8_stub_list): New typedef.
7724 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7725 Stub_table::prev_addralign_): New data member.
7726 (Arm_relobj::Arm_relobj): Initialize data member
7727 section_has_cortex_a8_workaround_.
7728 (Arm_relobj::section_has_cortex_a8_workaround,
7729 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7730 definitions.
7731 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7732 declarations.
7733 (Target_arm::relocate_stub): Change parameter type of stub from
7734 Reloc_stub pointer to Stub pointer.
7735 (Insn_template::size, Insn_template::alignment): Handle
7736 THUMB16_SPECIAL_TYPE.
7737 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7738 Stub_table::update_data_size_and_addralign,
7739 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7740 definitions.
7741 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7742 (Stub_table::do_write): Ditto.
7743 (Target_arm::do_relax): Adjust code for changes in Stub_table.
2fb7225c 7744
880cd20d
ILT
77452010-01-08 Ian Lance Taylor <iant@google.com>
7746
7747 PR 11108
7748 * symtab.h (class Symbol): Remove fields is_target_special_ and
7749 has_plt_offset_. Add field is_defined_in_discarded_section_.
7750 (Symbol::is_defined_in_discarded_section): New function.
7751 (Symbol::set_is_defined_in_discarded_section): New function.
7752 (Symbol::has_plt_offset): Rewrite.
7753 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7754 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7755 Don't initialize is_target_special_ or has_plt_offset_.
7756 Initialize is_defined_in_discarded_section_.
7757 (Symbol_table::add_from_relobj): If appropriate, set
7758 is_defined_in_discarded_section.
7759 * resolve.cc (Symbol::override_base_with_special): Don't test
7760 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7761 * target-reloc.h (relocate_section): Do special handling for
7762 symbols defined in discarded sections for global symbols as well
7763 as local symbols.
7764
2703e3eb
ILT
77652010-01-08 Ian Lance Taylor <iant@google.com>
7766
7767 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7768 the SHT_SYMTAB case.
7769
339d40a3
ILT
77702010-01-08 Ian Lance Taylor <iant@google.com>
7771
7772 * object.cc (Sized_relobj::do_layout): Don't get confused if
7773 layout_eh_frame returns NULL.
7774
abecea76
ILT
77752010-01-08 Ian Lance Taylor <iant@google.com>
7776
7777 PR 11084
7778 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7779 dynamic symbol table, use the normal symbol table.
7780 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7781 symbol table.
7782
6b7dd3f3
ILT
77832010-01-08 Ian Lance Taylor <iant@google.com>
7784
7785 PR 11072
7786 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7787 sections.
7788
36c50e63
L
77892010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7790
7791 * version.cc (print_version): Change to "Copyright 2010".
7792
e291e7b9
ILT
77932010-01-08 Ian Lance Taylor <iant@google.com>
7794
7795 PR 10287
7796 PR 11063
7797 * i386.cc (class Target_i386): Change return type of plt_section
7798 to be non-const.
7799 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7800 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7801 tls_desc_rel_ field.
7802 (Output_data_plt_i386::rel_tls_desc): New function.
7803 (Target_i386::rel_tls_desc_section): New function.
7804 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7805 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7806 R_386_TLS_DESC reloc in rel_tls_desc_section.
7807 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7808 Define struct Tlsdesc_info.
7809 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7810 (Target_x86_64::do_reloc_symbol_index): New function.
7811 (Target_x86_64::add_tlsdesc_info): New function.
7812 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7813 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7814 tlsdesc_rel_ field.
7815 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7816 all callers.
7817 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7818 (Target_x86_64::rela_tlsdesc_section): New function.
7819 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7820 handling.
7821 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7822 (Target_x86_64::do_reloc_addend): New function.
7823 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7824 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7825 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7826 (Output_reloc::type): New function.
7827 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7828 (Output_reloc::is_target_specific): New function.
7829 (Output_reloc::target_arg): New function.
7830 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7831 absolute relocs and target specific relocs.
7832 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7833 add_target_specific.
7834 (class Output_data_reloc) [SHT_RELA]: Likewise.
7835 * output.cc (Output_reloc::Output_reloc): Add four new versions
7836 for absolute relocs and target specific relocs.
7837 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7838 (Output_reloc::get_symbol_index): Likewise.
7839 (Output_reloc::local_section_offset): Check that local_sym_index_
7840 is not TARGET_CODE or 0.
7841 (Output_reloc::symbol_value): Likewise.
7842 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7843 reloc.
7844 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7845 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7846 functions.
7847 * layout.cc (add_target_dynamic_tags): Use output section for
7848 DT_PLTRELSZ and DT_JMPREL.
7849
3a44184e
ILT
78502010-01-07 Ian Lance Taylor <iant@google.com>
7851
7852 PR 11061
7853 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7854 function.
7855 (class Output_data_reloc_generic): Define.
7856 (class Output_data_reloc_base): Change base class to
7857 Output_data_reloc_generic. Change add() method to call
7858 bump_relative_reloc_count for a relative reloc. Remove
7859 sort_relocs_ field.
7860 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7861 to sort_relocs().
7862 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7863 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7864 appropriate.
7865 * layout.h (class Layout): Update declaration.
7866
ea715a34
ILT
78672010-01-07 Ian Lance Taylor <iant@google.com>
7868
7869 * output.h (class Output_data): Add const version of
7870 output_section and do_output_section.
7871 (class Output_section_data): Add const version of
7872 do_output_section.
7873 (class Output_section): Likewise.
7874 * layout.cc (Layout::add_target_dynamic_tags): New function.
7875 * layout.h (class Layout): Update declarations.
7876 * arm.cc (Target_arm::do_finalize_sections): Use
7877 add_target_dynamic_tags.
7878 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7879 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7880 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7881 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7882
659948a4
ILT
78832010-01-07 Ian Lance Taylor <iant@google.com>
7884
7885 PR 11042
7886 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7887 object as needed.
7888
9d3b86f6
ILT
78892010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7890 Ian Lance Taylor <iant@google.com>
7891
7892 PR 11019
7893 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7894 Xindex::read_symtab_xindex.
7895
bb0d3eb0
DK
78962010-01-07 Doug Kwan <dougkwan@google.com>
7897
7898 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7899 (Insn_template::thumb16_bcond_insn): New method declaration.
7900 (Insn_template): Fix spelling.
7901 (Stub::thumb16_special): New method declaration.
7902 (Stub::do_write): Define virtual method which was previously pure
7903 virtual.
7904 (Stub::do_thumb16_special): New method declaration.
7905 (Stub::do_fixed_endian_write): New template member.
7906 (Reloc_stub::do_write): Remove.
7907 (Reloc_stub::do_fixed_endian_write): Remove.
7908 (Cortex_a8_stub): New class definition.
7909 (Stub_factory::make_cortex_a8_stub): New method definition.
7910 (Stub_factory::Stub_factory): Add missing static storage class
7911 qualifier for elf32_arm_stub_a8_veneer_blx.
7912
ffeef7df
ILT
79132010-01-07 Ian Lance Taylor <iant@google.com>
7914
dc3f80fe
ILT
7915 PR 10980
7916 * options.h (class General_options): Add --warn-unresolved-symbols
7917 and --error-unresolved-symbols.
7918 * errors.cc (Errors::undefined_symbol): Implement
7919 --warn-unresolved-symbols.
7920
ffeef7df
ILT
7921 * options.h (class General_options): Add -z text and -z textoff.
7922 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7923
f1ec9ded
ST
79242010-01-06 Sriraman Tallam <tmsriram@google.com>
7925
7926 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7927 (Garbage_collection::cident_sections): New function.
7928 (Garbage_collection::add_cident_section): New function.
7929 (Garbage_collection::cident_sections_): New member.
7930 (gc_process_relocs): Add references to sections whose names are C
7931 identifiers.
7932 * gold.h (cident_section_start_prefix): New constant.
7933 (cident_section_stop_prefix): New constant.
7934 (is_cident): New function.
7935 * layout.cc (Layout::define_section_symbols): Replace string constants
7936 with the newly defined constants.
7937 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7938 C identifiers.
7939 * testsuite/Makefile.am: Add gc_orphan_section_test.
7940 * testsuite/Makefile.in: Regenerate.
7941 * testsuite/gc_orphan_section_test.cc: New file.
7942 * testsuite/gc_orphan_section_test.sh: New file.
7943
6eda8c29
ILT
79442010-01-06 Ian Lance Taylor <iant@google.com>
7945
b9674e17
ILT
7946 PR 10980
7947 * options.h (class General_options): Add --warn-shared-textrel.
7948 * layout.cc (Layout::finish_dynamic_section): Implement
7949 --warn-shared-textrel.
7950
6eda8c29
ILT
7951 PR 10980
7952 * options.h (class General_options): Add --warn-multiple-gp.
7953
32dcd44e
ILT
79542010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7955
7956 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7957 $(THREADSLIB) and $(LIBDL).
7958 * Makefile.in: Rebuild.
7959
a192ba05
ILT
79602010-01-06 Ian Lance Taylor <iant@google.com>
7961
7962 PR 10980
7963 * options.cc (General_options::parse_section_start): New function.
7964 (General_options::section_start): New function.
7965 (General_options::General_options): Initialize all members.
7966 * options.h: Include <map>
7967 (class General_options): Add --section-start. Add section_starts_
7968 member.
7969 * layout.cc (Layout::attach_allocated_section_to_segment): If
7970 --section-start was used, set the address of the segment. Remove
7971 local sort_sections.
7972 (Layout::relaxation_loop_body): If the address of the load segment
7973 has been set by --section-start, don't use it.
7974 * output.h (Output_segment::update_flags_for_output_section): New
7975 function.
7976 * output.cc (Output_segment::add_output_section): Call
7977 update_flags_for_output_section.
7978
dde3f402
ILT
79792010-01-05 Ian Lance Taylor <iant@google.com>
7980
62dfdd4d
ILT
7981 PR 10980
7982 * options.h (class General_options): Add --undefined-version.
7983 * script.cc (struct Version_expression): Add was_matched_by_symbol
7984 field.
7985 (Version_script_info::matched_symbol): New function.
7986 (Version_script_info::get_symbol_version_helper): Call
7987 matched_symbol.
7988 (Version_script_info::check_unmatched_names): New function.
7989 * script.h (class Version_script_info): Update declarations.
7990 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7991
9c4ae156
ILT
7992 * options.h (class General_options): Use DEFINE_bool_alias for
7993 allow_multiple_definition.
7994 * resolve.cc (Symbol_table::should_override): Don't test
7995 allow_multiple_definition.
7996
dde3f402
ILT
7997 PR 10980
7998 * options.h (class General_options): Add --cref.
7999 * main.cc (main): Print cref table if --cref. Don't close mapfile
8000 until after printing cref table.
8001 * cref.cc: Include "symtab.h".
8002 (class Cref_inputs): Define Cref_table_compare and Cref_table.
8003 (Cref_table_compare::operator()): New function.
8004 (Cref_inputs::gather_cref): New function.
8005 (filecol): New static const.
8006 (Cref_inputs::print_cref): New function.
8007 (Cref::print_cref): New function.
8008 * cref.h: Include <cstdio>.
8009 (class Cref): Update declarations.
8010 * mapfile.h (Mapfile::file): New function.
8011 * object.h (class Object): Define Symbols. Declare virtual
8012 do_get_global_symbols.
8013 (Object::get_global_symbols): New function.
8014 * object.cc (Input_objects::add_object): Pass object to cref_ if
8015 --cref.
8016 (Input_objects::archive_start): Likewise.
8017 (Input_objects::archive_stop): Likewise.
8018 (Input_objects::print_cref): New function.
8019 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8020 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8021 --cref.
8022 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8023 function.
8024 * plugin.h (class Sized_pluginobj): Update declarations.
8025
8781f709
ILT
80262010-01-05 Ian Lance Taylor <iant@google.com>
8027
8028 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8029 to is_default_version. Rename insdef to insdefault.
8030 (Symbol_table::add_from_relobj): Rename def to is_default_version
8031 and local to is_forced_local.
8032 (Symbol_table::add_from_pluginobj): Likewise.
8033 (Symbol_table::add_from_dynobj): Likewise.
8034 (Symbol_table::define_special_symbol): Rename insdef to
8035 insdefault.
8036
fe35d28d
ILT
80372010-01-04 Ian Lance Taylor <iant@google.com>
8038
30bc8c46
ILT
8039 PR 10980
8040 * options.h (class General_options): Add
8041 --allow-multiple-definition and -z muldefs.
8042 * resolve.cc (Symbol_table::should_override): Don't warn about a
8043 multiple symbol definition if --allow-multiple-definition or -z
8044 muldefs.
8045
7eaea549
ILT
8046 PR 10980
8047 * options.h (class General_options): Add --add-needed and
8048 --copy-dt-needed-entries. Tweak --as-needed help entry.
8049 * object.cc (Input_objects::check_dynamic_dependencies): Give an
8050 error if --copy-dt-needed-entries aka --add-needed is used and
8051 would cause a change in behaviour.
8052
fe35d28d
ILT
8053 PR 10980
8054 * options.h (class General_options): Add -G as a short version of
8055 --shared. Add no-op options -assert, -g, and -i.
8056
55a2bb35
ST
80572010-01-04 Sriraman Tallam <tmsriram@google.com>
8058
8059 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8060 check for .text or .gnu.linkonce.t sections.
8061 * icf.cc (Icf::find_identical_sections): Ditto.
8062 Change the detection for mangled function name within the section
8063 name.
8064 * icf.h (is_section_foldable_candidate): New function.
8065
719328e1
ILT
80662009-12-30 Ian Lance Taylor <iant@google.com>
8067
8068 PR 10980
8069 * options.h (class General_options): Permit two dashes with
8070 --retain-symbols-file.
8071
d7bb5745
ILT
80722009-12-30 Ian Lance Taylor <iant@google.com>
8073
403a15dd
ILT
8074 PR 10979
8075 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8076 don't put the file header and segment headers in the text
8077 segment.
8078
eda294df
ILT
8079 PR 10979
8080 * common.cc (Sort_commons::operator()): Stabilize sort when both
8081 entries are NULL.
8082 (Symbol_table::do_allocate_commons_list): When allocating common
8083 symbols, skip a symbol which is no longer common.
8084 * symtab.h (Symbol::is_common): Test whether the symbol comes from
8085 an object before checking its type.
8086 * testsuite/common_test_2.c: New file.
8087 * testsuite/common_test_3.c: New file.
8088 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8089 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8090 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8091 (common_test_2_pic.o, common_test_2.so): New targets.
8092 (common_test_3_pic.o, common_test_3.so): New targets.
8093 * testsuite/Makefile.in: Rebuild.
8094
d7bb5745
ILT
8095 PR 10979
8096 * script.cc (read_input_script): If we see a new SECTIONS clause,
8097 and we have added an input section, give an error.
8098 * layout.h (class Layout): Add have_added_input_section function.
8099 Add have_added_input_section_ field.
8100 * layout.cc (Layout::Layout): Initialize
8101 have_added_input_section_.
8102 (Layout::layout): Set have_added_input_section_.
8103 (Layout::layout_eh_frame): Likewise.
8104
fc59c572
ILT
81052009-12-30 Ian Lance Taylor <iant@google.com>
8106
8107 PR 10931
8108 * options.h (class General_options): Add --sort-common option.
8109 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8110 * common.cc (Sort_common): Add sort_order parameter to
8111 constructor. Add sort_order_ field.
8112 (Sort_commons::operator): Check sort_order_.
8113 (Symbol_table::allocate_commons): Determine the sort order.
8114 (Symbol_table::do_allocate_commons): Add sort_order parameter.
8115 Change all callers.
8116 (Symbol_table::do_allocate_commons_list): Likewise.
8117
1c74fab0
ILT
81182009-12-30 Ian Lance Taylor <iant@google.com>
8119
8120 PR 10916
8121 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8122 symbols from this object, don't change the visibility of an
8123 undefined symbol.
8124 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8125
6affe781
ILT
81262009-12-30 Ian Lance Taylor <iant@google.com>
8127
8128 PR 10861
8129 * script.h (class Version_script_info): Define Language enum.
8130 Update declarations. Define Glob, Exact, and Lookup types. Add
8131 new fields globals_, locals_, and is_finalized_.
8132 * script.cc: Various formatting fixes.
8133 (class Parser_closure): Change language_stack_ from a vector of
8134 std::string to one of Version_script_info::Language. Adjust all
8135 uses accordingly.
8136 (class Lazy_demangler): Remove.
8137 (struct Version_expression): Change language from std::string to
8138 Version_script_info::Language.
8139 (Version_script_info::Version_script_info): New function.
8140 (Version_script_info::~Version_script_info): Don't call clear.
8141 (Version_script_info::finalize): New function.
8142 (Version_script_info::build_lookup_tables): New function.
8143 (Version_script_info::build_expression_list_lookup): New
8144 function.
8145 (Version_script_info::get_symbol_version_helper): Rewrite to use
8146 lookup tables.
8147 (Version_script_info::print_expression_list): Adjust to use
8148 Version_script_info::Language.
8149 (script_push_lex_into_version_mode): Check that the version script
8150 has not been finalized.
8151 (version_script_push_lang): Change language string to
8152 Version_script_info::Language.
8153 * options.cc (Command_line::version_script): New function.
8154 * options.h (class General_options): Add finalize_dynamic_list
8155 function. Change version_script from declaration to definition.
8156 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8157 * testsuite/version_script.map: Remove duplicate def of foo.
8158 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8159 version_script.map.
8160 * testsuite/Makefile.in: Rebuild.
8161
818bf354
ILT
81622009-12-30 Ian Lance Taylor <iant@google.com>
8163
8164 PR 10843
8165 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8166 if the input symbol index is 0, make the output symbol index 0.
8167
ebcc8304
ILT
81682009-12-30 Ian Lance Taylor <iant@google.com>
8169
8170 PR 10670
8171 * options.h (class General_options): Add -x/--discard-all.
8172 * object.cc (Sized_relobj::do_count_local_symbols): Handle
8173 --discard-all. If the local symbol needs a dynamic entry, check
8174 that before handling --discard-locals.
8175
176fe33f
ILT
81762009-12-30 Ian Lance Taylor <iant@google.com>
8177
bb321bb1
ILT
8178 PR 10450
8179 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8180 flags to PF_R.
8181 (Output_segment::add_output_section): Don't change the flags if
8182 the type is PT_TLS.
8183
176fe33f
ILT
8184 PR 10450
8185 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8186 GNU hash table if they need a dynamic value. Otherwise, don't add
8187 them if they are defined in a dynamic object or are forced local.
8188
e8cd95c7
ILT
81892009-12-29 Ian Lance Taylor <iant@google.com>
8190
1b81fb71
ILT
8191 PR 10450
8192 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8193 .gnu.hash table for a 32-bit target.
8194
8d6d383d
ILT
8195 PR 10450
8196 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8197 regular and a dynamic object only needs a dynamic symbol table
8198 entry if it is externally visible.
8199
e785ec03
ILT
8200 PR 10450
8201 * i386.cc (class Target_i386): Initialize global_offset_table_ in
8202 constructor. Add global_offset_table_ field.
8203 (Target_i386::got_section): Set global_offset_table_.
8204 (Target_i386::do_finalize_sections): Set global_offset_table_
8205 size.
8206 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8207 in constructor. Add global_offset_table_ field.
8208 (Target_x86_64::got_section): Set global_offset_table_.
8209 (Target_x86_64::do_finalize_sections): Set global_offset_table_
8210 size.
8211
1a2dff53
ILT
8212 * layout.cc (Layout::Layout): Initialize increase_relro_.
8213 (Layout::get_output_section): Add is_relro, is_last_relro, and
8214 is_first_non_relro parameters. Change all callers.
8215 (Layout::choose_output_section): Likewise.
8216 (Layout::add_output_section_data): Likewise.
8217 (Layout::make_output_section): Likewise.
8218 (Layout::set_segment_offsets): Clear increase_relro when using a
8219 linker script.
8220 * layout.h (class Layout): Add increase_relro method. Add
8221 increase_relro_ field. Update declarations.
8222 * output.cc (Output_section::Output_section): Initialize
8223 is_last_relro_ and is_first_non_relro_.
8224 (Output_segment::add_output_section): Group relro sections is
8225 do_sort is true. Handle is_last_relro and is_first_non_relro.
8226 (Output_segment::maximum_alignment): Remove relro handling.
8227 (Output_segment::set_section_addresses): Add increase_relro
8228 parameter. Change all callers. Add initial alignment to align
8229 relro sections on separate page. Remove old relro handling.
8230 (Output_segment::set_section_list_addresses): Remove in_relro
8231 parameter. Change all callers.
8232 (Output_segment::set_offset): Add increase parameter. Change all
8233 callers. Remove old relro handling.
8234 * output.h (class Output_section): Add new methods: is_last_relro,
8235 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8236 Add is_last_relro_ and is_first_non_relro_ fields.
8237 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8238 Create separate .got.plt section. Call increase_relro.
8239 * x86_64.cc (Target_x86_64::got_section): Likewise.
8240 * testsuite/relro_script_test.t: Add .got.plt.
8241
f0ba79e2
ILT
8242 PR 10450
8243 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8244 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8245 (Layout::finalize): Call set_dynamic_symbol_size.
8246 (Layout::set_dynamic_symbol_size): New function.
8247 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
8248 set_dynamic_symbol_size.
8249
e8cd95c7
ILT
8250 PR 10450
8251 * output.h (class Output_section): Add is_entsize_zero_ field.
8252 * output.cc (Output_section::Output_section): Initialize
8253 is_entsize_zero_.
8254 (Output_section::set_entsize): If two different entsizes are
8255 requested, force it to zero.
8256 (Output_section::add_input_section): Set flags for .debug_str
8257 before updating section flags. Set entsize.
8258 (Output_section::update_flags_for_input_section): Set SHF_MERGE
8259 and SHF_STRING if all input sections have those flags.
8260
3e1b9a8a
RÁE
82612009-12-29 Rafael Espindola <espindola@google.com>
8262
8263 * main.cc (main): Fix the sys time reporting.
e8cd95c7
ILT
8264 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8265 reporting.
3e1b9a8a 8266
3dcad376
ST
82672009-12-29 Sriraman Tallam <tmsriram@google.com>
8268
8269 * options.cc (General_options::parse_version): Allow -v to exit
8270 without an error if there is nothing to link.
8271
084e2665
ILT
82722009-12-29 Ian Lance Taylor <iant@google.com>
8273
8274 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8275 using a version of gcc before 4.1.
8276 * configure: Rebuild.
8277
250acde3
CD
82782009-12-28 Chris Demetriou <cgd@google.com>
8279
8280 * attributes.cc (Output_attributes_section_data::do_write): Use
8281 std::vector::front rather than std::vector::data.
8282
99fff23b
ILT
82832009-12-28 Ian Lance Taylor <iant@google.com>
8284
8285 * symtab.h (class Symbol_table): Add enum Defined.
8286 * resolve.cc (Symbol_table::should_override): Add defined
8287 parameter. Change all callers. Test whether object is NULL
8288 before calling a method on it.
8289 (Symbol_table::report_resolve_problem): Add defined parameter.
8290 Change all callers.
8291 (Symbol_table::should_override_with_special): Likewise.
8292 * symtab.cc (Symbol_table::define_in_output_data): Add defined
8293 parameter. Change all callers.
8294 (Symbol_table::do_define_in_output_data): Likewise.
8295 (Symbol_table::define_in_output_segment): Likewise.
8296 (Symbol_table::do_define_in_output_segment): Likewise.
8297 (Symbol_table::define_as_constant): Likewise.
8298 (Symbol_table::do_define_as_constant): Likewise.
8299 * script.h (class Symbol_assignment): Add is_defsym parameter to
8300 constructor; change all callers.
8301 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8302 parameter. Change all callers. Add is_defsym_ field.
8303 (class Parser_closure): Add parsing_defsym parameter to
8304 constructor; change all callers. Add parsing_defsym accessor
8305 function. Add parsing_defsym_ field.
8306
556bd683
ILT
83072009-12-28 Ian Lance Taylor <iant@google.com>
8308
8309 * gold.cc (queue_middle_tasks): Fix formatting.
fa618ee4 8310 * object.cc (Relobj::is_section_name_included): Likewise.
556bd683 8311
1782c879
ILT
83122009-12-23 Ian Lance Taylor <iant@google.com>
8313
8314 * i386.cc (Target_i386::do_calls_non_split): Recognize
8315 -fsplit-stack prologue for a function with a static chain.
cbc999b9
ILT
8316 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8317 -fsplit-stack prologue when using %r11.
1782c879 8318
329ca2b1
ST
83192009-12-21 Sriraman Tallam <tmsriram@google.com>
8320
8321 * options.cc (General_options::parse_version): Make -v continue and do
8322 the link like GNU ld does.
8323
d675ff46
RÁE
83242009-12-17 Rafael Avila de Espindola <espindola@google.com>
8325
8326 * Makefile.am (CCFILES): Add timer.cc.
8327 (HFILES): Add timer.h.
8328 * configure.ac: Check for sysconf and times.
8329 * main.cc: include timer.h.
8330 (main): Use Timer instead of get_run_time.
8331 * timer.cc: New.
8332 * timer.h: New.
8333 * workqueue.cc: include timer.h.
8334 (Workqueue::find_and_run_task):
8335 Report user, sys and wall time.
8336 * Makefile.in: Regenerate.
8337 * config.in: Regenerate.
8338 * configure: Regenerate.
8339
d6344fb5
DK
83402009-12-16 Doug Kwan <dougkwan@google.com>
8341
8342 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8343 sections.
8344 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8345 relaxed input sections.
8346 * output.cc (Output_section::find_relaxed_input_section): Change
8347 return type to Output_relaxed_input_section pointer. Adjust code
8348 for new type of relaxed_input_section_map_.
8349 * output.h (Output_section::find_relaxed_input_section): Change
8350 return type to Output_relaxed_input_section pointer.
8351 (Output_section::Output_relaxed_input_section_by_input_section_map):
8352 New type.
8353 (Output_section::relaxed_input_section_map_): Change type to
8354 Output_section::Output_relaxed_input_section_by_input_section_map.
8355 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8356 input section.
8357
0e0d5469
ILT
83582009-12-15 Ian Lance Taylor <iant@google.com>
8359
8360 * layout.cc (Layout::create_shstrtab): Only write out after input
8361 sections if we are compressing debug sections.
8362
0649a889
ILT
83632009-12-15 Ian Lance Taylor <iant@google.com>
8364
8365 * archive.cc (Archive::add_symbols): Only look up a symbol without
8366 a version if there is, in fact, a version.
8367
2ea97941
ILT
83682009-12-14 Ian Lance Taylor <iant@google.com>
8369
8370 Revert -Wshadow changes, all changes from:
8371 2009-12-11 Doug Kwan <dougkwan@google.com>
8372 2009-12-11 Nick Clifton <nickc@redhat.com>
8373 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8374
b0eec2cc
DK
83752009-12-11 Doug Kwan <dougkwan@google.com>
8376
8377 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8378 due to -Wshadow.
8379 * attributes.cc (Object_attribute::size): Ditto.
8380 (Attributes_section_data::size): Ditto.
8381 (Attributes_section_data::Attributes_section_data): Ditto.
8382 (Output_attributes_section_data::do_write): Ditto.
8383 * attributes.h (Object_attribute::set_type): Ditto.
8384 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8385
91d6fa6a
NC
83862009-12-11 Nick Clifton <nickc@redhat.com>
8387
8388 * archive.cc: Fix shadowed variable warnings.
8389 * arm.cc: Likewise.
8390 * compressed_output.cc: Likewise.
8391 * compressed_output.h: Likewise.
8392 * configure: Likewise.
8393 * dwarf_reader.cc: Likewise.
8394 * dynobj.cc: Likewise.
8395 * dynobj.h: Likewise.
8396 * ehframe.cc: Likewise.
8397 * ehframe.h: Likewise.
8398 * errors.cc: Likewise.
8399 * expression.cc: Likewise.
8400 * fileread.cc: Likewise.
8401 * fileread.h: Likewise.
8402 * freebsd.h: Likewise.
8403 * i386.cc: Likewise.
8404 * icf.cc: Likewise.
8405 * incremental.h: Likewise.
8406 * layout.cc: Likewise.
8407 * layout.h: Likewise.
8408 * mapfile.cc: Likewise.
8409 * merge.cc: Likewise.
8410 * merge.h: Likewise.
8411 * object.cc: Likewise.
8412 * object.h: Likewise.
8413 * options.h: Likewise.
8414 * output.cc: Likewise.
8415 * output.h: Likewise.
8416 * parameters.cc: Likewise.
8417 * plugin.cc: Likewise.
8418 * powerpc.cc: Likewise.
8419 * reduced_debug_output.cc: Likewise.
8420 * reduced_debug_output.h: Likewise.
8421 * reloc.cc: Likewise.
8422 * reloc.h: Likewise.
8423 * resolve.cc: Likewise.
8424 * script-sections.cc: Likewise.
8425 * script.cc: Likewise.
8426 * script.h: Likewise.
8427 * sparc.cc: Likewise.
8428 * symtab.cc: Likewise.
8429 * symtab.h: Likewise.
8430 * target-select.cc: Likewise.
8431 * target-select.h: Likewise.
8432 * token.h: Likewise.
8433 * workqueue.cc: Likewise.
8434 * workqueue.h: Likewise.
8435 * x86_64.cc: Likewise.
8436
a0351a69
DK
84372009-12-10 Doug Kwan <dougkwan@google.com>
8438
8439 * arm.cc (attributes.h): New include.
8440 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8441 (Arm_relobj::~Arm_relobj): Delete object pointed by
8442 attributes_section_data_.
8443 (Arm_relobj::attributes_section_data): New method definition.
8444 (Arm_relobj::attributes_section_data_): New data member declaration.
8445 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8446 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8447 attributes_section_data_.
8448 (Arm_dynobj::attributes_section_data): New method definition.
8449 (Arm_dynobj::attributes_section_data_): New data member declaration.
8450 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8451 initialization value of may_use_blx_ to false.
2e702c99 8452 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
a0351a69
DK
8453 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8454 object attributes to compute results instead of hard-coding.
8455 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8456 Target_arm::get_secondary_compatible_arch,
8457 Target_arm::set_secondary_compatible_arch
8458 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8459 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8460 New method declarations.
8461 (Target_arm::get_aeabi_object_attribute): New method definition.
8462 (Target_arm::attributes_section_data_): New data member declaration.
8463 (read_arm_attributes_section): New template definition.
8464 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8465 (Arm_dynobj::do_read_symbols): Ditto.
8466 (Target_arm::do_finalize_sections): Merge attributes sections from
8467 input. Check for BLX use after attributes section merging.
8468 Fix __exidx_start and __exidx_end visibility. Create an
8469 .ARM.attributes section if necessary.
8470 (Target_arm::get_secondary_compatible_arch,
8471 Target_arm::set_secondary_compatible_arch,
8472 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8473 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
e1df38aa 8474 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
a0351a69
DK
8475 New method definitions.
8476
b59befec
ILT
84772009-12-09 Ian Lance Taylor <iant@google.com>
8478
8479 * plugin.cc (Plugin::load): Don't cast from void* to a function
8480 pointer.
8481
1276bc89
ILT
84822009-12-09 Ian Lance Taylor <iant@google.com>
8483
8484 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8485 information fields.
8486
2f2de248
L
84872009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8488
8489 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8490 Replace two_file_shared_1.so with two_file_shared_2.so.
8491 * testsuite/Makefile.in: Regenerated.
8492
4f787271
DK
84932009-12-08 Doug Kwan <dougkwan@google.com>
8494
8495 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8496 (HFILES): Add attributes.h and int_encoding.h.
8497 * Makefile.in: Regenerate.
8498 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8499 function definitions to int_encoding.cc
8500 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8501 prototypes to int_encoding.h
8502 * reduced_debug_output.cc (int_encoding.h): New include.
8503 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8504 function definitions to int_encoding.cc
8505 (insert_into_vector, read_from_pointer): Move template definitions to
8506 int_encoding.h
8507 * attributes.cc: New file.
8508 * attributes.h: New file.
8509 * int_encoding.cc: New file.
8510 * int_encoding.h: New file.
8511
20b52f1a
RÁE
85122009-12-07 Rafael Avila de Espindola <espindola@google.com>
8513
8514 PR gold/11055
8515 * incremental-dump.cc (dump_incremental_inputs): New.
8516 (main): Use dump_incremental_inputs.
8517
53d7974c
L
85182009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8519
8520 PR gold/10893
8521 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8522 checking elfcpp::STT_FUNC.
8523 (Target_i386::Relocate::relocate): Likewise.
8524 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8525
8526 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8527 symbols from shared libraries into normal FUNC symbols.
8528
8529 * symtab.h (Symbol): Add is_func and use it.
8530
05a352e6
DK
85312009-12-05 Doug Kwan <dougkwan@google.com>
8532
8533 * arm.cc (Target_arm::arm_info): Initialize new fields
8534 attributes_section and attributes_vendor.
8535 * i386.cc (Target_i386::i386_info): Same.
8536 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8537 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8538 fields attributes_section and attributes_vendor.
53d7974c 8539 * sparc.cc (Target_sparc::sparc_info): Same.
05a352e6
DK
8540 * target.h (Target::attributes_section, Target::attributes_vendor,
8541 Target::is_attributes_section, Target::attribute_arg_type,
8542 Target::attributes_order): New method definitions.
8543 (Target::Target_info::attributes_section,
8544 Target::Target_info::attributes_vendor): New fields.
8545 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8546 virtual method definitions.
8547 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8548 attributes_section and attributes_vendor.
8549 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8550
f4e5969c
DK
85512009-12-05 Doug Kwan <dougkwan@google.com>
8552
8553 * arm.cc: Update comments about interworking and stub generation.
8554 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8555 considered as non-PIC.
8556 (Arm_relocate_functions::base_abs): Fix formatting.
8557 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8558 of function to use GOT entry address instead of offset.
8559 (Target_arm::Scan::global): Issue an error if a symbol would need a
8560 PLT does not get one because it is untyped. Remove code to create
8561 dynamic symbols for relative branches.
8562 (Target_arm::Relocate::relocate: Use 0 instead of false since function
8563 takes unsigned integer instead of boolean.
8564
1abce4a6
L
85652009-12-05 H.J. Lu <hongjiu.lu@intel.com>
8566
8567 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8568 (two_file_test_LDADD): Likewise.
8569 (common_test_1_LDADD): Likewise.
8570 (exception_test_LDADD) Likewise.
8571 (weak_test_LDADD): Likewise.
8572 (many_sections_test_LDADD): Likewise.
8573 (initpri1_LDADD): Likewise.
8574 (script_test_1_LDADD): Likewise.
8575 (script_test_2_LDADD): Likewise.
8576 (justsyms_LDADD): Likewise.
8577 (binary_test_LDADD): Likewise.
8578 (large_LDADD): Likewise.
8579 * testsuite/Makefile.in: Regenerated.
8580
adcf2816 85812009-12-04 H.J. Lu <hongjiu.lu@intel.com>
1abce4a6 8582
adcf2816
L
8583 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8584 (Symbol_table::override_with_special): Likewise.
8585 (Symbol_table::add_from_object): Likewise.
8586
28e67f5d
RÁE
85872009-12-04 Rafael Avila de Espindola <espindola@google.com>
8588
8589 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8590 Don't set the data_offset twice.
8591
ae10a101
RÁE
85922009-12-04 Rafael Avila de Espindola <espindola@google.com>
8593
8594 * testsuite/Makefile.in: Regenerate.
8595
f59f41f3
DK
85962009-12-03 Doug Kwan <dougkwan@google.com>
8597
8598 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8599 (Target_arm::do_finalize_sections): Add parameter for symbol table
8600 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8601 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8602 parameter for symbol table pointer.
8603 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8604 an additional parameter for a pointer to symbol table.
8605 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8606 parameter for a symbol table pointer.
8607 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8608 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8609 Ditto.
8610 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8611 parameter for a symbol table pointer.
8612
ca55d848
RÁE
86132009-12-03 Rafael Avila de Espindola <espindola@google.com>
8614
8615 * incremental.cc (Incremental_inputs_header)
8616 (Incremental_inputs_header_write, Incremental_inputs_entry)
8617 (Incremental_inputs_entry_write): Move ...
8618 * incremental.h (Incremental_inputs_header)
8619 (Incremental_inputs_header_write, Incremental_inputs_entry)
8620 (Incremental_inputs_entry_write): here.
8621
3aec4f9c
RÁE
86222009-12-02 Rafael Avila de Espindola <espindola@google.com>
8623
8624 * incremental.cc (make_sized_incremental_binary): Set the target.
8625 Error if it is incompatible.
8626 * output.h (Output_file): Add filename method.
8627
9c0ae74d
RÁE
86282009-12-02 Rafael Avila de Espindola <espindola@google.com>
8629
8630 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8631 from the get_* methods.
8632
a45500ae
RÁE
86332009-12-02 Rafael Avila de Espindola <espindola@google.com>
8634
8635 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8636 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8637 Write 0 for the data_offset of scripts.
8638
325e6408
RÁE
86392009-12-02 Rafael Avila de Espindola <espindola@google.com>
8640
8641 * testsuite/Makefile.am: Add the incremental_test.sh test.
8642 * testsuite/incremental_test.sh: New.
8643 * testsuite/incremental_test_1.c: New.
8644 * testsuite/incremental_test_2.c: New.
8645
954c3e2e
RÁE
86462009-12-01 Rafael Avila de Espindola <espindola@google.com>
8647
703d02da 8648 * incremental-dump.cc (main): Fix typos.
954c3e2e 8649
f8086623
RÁE
86502009-11-27 Rafael Avila de Espindola <espindola@google.com>
8651
8652 PR gold/11025
8653 * incremental-dump.cc (main): Use llu to print 64 bit values.
8654
3b0dd6ac
L
86552009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8656 H.J. Lu <hongjiu.lu@intel.com>
8657
8658 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8659 $(LIBDL).
8660 (incremental_dump_LDADD): Likewise.
8661 * Makefile.in: Regenerated.
8662
a6d1ef57 86632009-11-25 Doug Kwan <dougkwan@google.com>
e1df38aa 8664
a6d1ef57
DK
8665 Revert:
8666
8667 2009-11-25 Doug Kwan <dougkwan@google.com>
8668
8669 * arm.cc (Target_arm::Target_arm): Move method definition
8670 outside of class definition. Add code to handle
8671 --target1-rel, --target1-abs and --target2= options.
8672 (Target_arm::get_reloc_reloc_type): Change method to be
8673 non-static and const.
8674 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8675 New data member declaration.
8676 (Target_arm::Scan::local, Target_arm::Scan::global,
8677 Target_arm::Relocate::relocate,
8678 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8679 Adjust call to Target_arm::get_real_reloc_type.
8680 (Target_arm::get_real_reloc_type): Use command line options
8681 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8682 * options.h (--target1-rel, --target1-abs, --target2): New
8683 ARM-only options.
8684
50aeb7d4
DK
86852009-11-25 Doug Kwan <dougkwan@google.com>
8686
8687 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8688 class definition. Add code to handle --target1-rel, --target1-abs
8689 and --target2= options.
8690 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8691 and const.
8692 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8693 member declaration.
8694 (Target_arm::Scan::local, Target_arm::Scan::global,
8695 Target_arm::Relocate::relocate,
8696 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8697 call to Target_arm::get_real_reloc_type.
8698 (Target_arm::get_real_reloc_type): Use command line options to
8699 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8700 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8701 options.
8702
51938283
DK
87032009-11-25 Doug Kwan <dougkwan@google.com>
8704
8705 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8706 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8707 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8708 formatting.
8709 (Arm_relocate_functions::thm_call): Replace body with a call to
8710 Arm_relocate_functions::thumb_branch_common.
8711 (Arm_relocate_functions::thm_jump24,
8712 Arm_relocate_functions::thm_xpc22): New method definitions.
8713 (Arm_relocate_functions::thumb_branch_common): New method definition.
8714 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8715 operator.
8716 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8717 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8718
e2b8f3c4
RÁE
87192009-11-24 Rafael Avila de Espindola <espindola@google.com>
8720
8721 * Makefile.am: Build incremental-dump
8722 * Makefile.in: Regenerate.
8723 * incremental-dump.cc: New.
8724 * incremental.cc (Incremental_inputs_header_data,
8725 Incremental_inputs_entry_data): Move to incremental.h
8726 * incremental.h: (Incremental_inputs_header_data,
8727 Incremental_inputs_entry_data): Move from incremental.cc
8728
bcba9aec
RÁE
87292009-11-24 Rafael Avila de Espindola <espindola@google.com>
8730
8731 * incremental.cc (Incremental_inputs_header,
8732 Incremental_inputs_header_write, Incremental_inputs_entry,
8733 Incremental_inputs_entry_write): Add a typedef with the data type.
8734
7c3afe08
RÁE
87352009-11-24 Rafael Avila de Espindola <espindola@google.com>
8736
8737 * incremental.cc (Incremental_inputs_header,
8738 Incremental_inputs_header_write, Incremental_inputs_entry,
8739 Incremental_inputs_entry_write): Update comment about which
8740 type has the filed descriptions.
8741
d204b6e9
DK
87422009-11-15 Doug Kwan <dougkwan@google.com>
8743
8744 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8745 (Arm_relocate_functions::arm_branch_common): Change method defintion
8746 in class definition to a method declaration and update list of formal
8747 parameters.
8748 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8749 Arm_relocation_functions::jump24): Adjust call to
8750 Arm_relocate_functions::arm_branch_common. Update list of formal
8751 parameters.
8752 (Arm_relocate_functions::xpc25): New method definition.
8753 (Arm_relocate_functions::arm_branch_common): Move method defintion
8754 out from class definition. Use stubs for mode-switching and extending
8755 branch ranges.
8756 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8757 specially. Change code to enable use of stubs in ARM branches.
8758
43d12afe
DK
87592009-11-10 Doug Kwan <dougkwan@google.com>
8760
8761 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8762 in method declaration.
8763 (Target_arm::relocate_stub): New method declaration.
8764 (Target_arm::default_target): Change to return a pointer instead of
8765 a const reference.
8766 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8767 Target_arm::default_target.
8768 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8769 method definition.
8770 (Target_arm::relocate_section): Adjust view.
8771 (Target_arm::relocate_stub): New method definition.
8772
ac33a407
DK
87732009-11-10 Doug Kwan <dougkwan@google.com>
8774
8775 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8776 a format warning.
8777 * incremental.cc (open_incremental_binary): Initialized local
8778 variables to avoid warnings.
8779 * object.cc (make_elf_object): Ditto.
8780 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8781 a format warning.
e1df38aa 8782
88ee28e9
L
8783009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8784
8785 PR gold/10930
8786 * testsuite/plugin_test.c: Include "config.h".
8787
2daedcd6
DK
87882009-11-09 Doug Kwan <dougkwan@google.com>
8789
8790 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8791 (arm_symbol_value): Remove.
8792 (Arm_relocate_functions::arm_branch_common,
8793 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8794 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8795 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8796 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8797 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8798 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8799 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8800 Arm_relocate_functions::thm_mobw_abs_nc,
8801 Arm_relocate_functions::thm_mov_abs,
8802 Arm_relocate_functions::movw_prel_nc,
8803 Arm_relocate_functions::thm_movt_abs,
8804 Arm_relocate_functions::movt_prel,
8805 Arm_relocate_functions::thm_movw_prel_nc,
8806 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8807 (Target_arm::Relocate::relocate): Only decompose address into two
8808 parts if relocation type uses the thumb-bit and pass the actual
8809 bit instead of a flag indicating that the thumb-bit is used. Adjust
8810 calls to methods in Arm_relocate_functions for this change.
8811
1276bc89 88122009-11-08 Ian Lance Taylor <iant@google.com>
3e4afc80
ILT
8813
8814 PR 10925
8815 * reloc.cc: Instantiate
8816 Sized_relobj::initialize_input_to_output_maps and
8817 Sized_relobj:free_input_to_output_maps.
8818
e53ad1b5
ILT
88192009-11-06 Ian Lance Taylor <iant@google.com>
8820
8821 PR 10876
8822 * defstd.cc (in_segment): Set only_if_ref true for "end".
8823
eb44217c
DK
88242009-11-06 Doug Kwan <dougkwan@google.com>
8825
8826 * arm.cc (class Reloc_stub): Correct a comment.
8827 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8828 (Target_arm::scan_section_for_stubs): New method declaration.
8829 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8830 Change methods from private to protected.
8831 (Target_arm::do_may_relax): New method definition.
8832 (Target_arm::do_relax, Target_arm::group_sections,
8833 Target_arm::scan_reloc_for_stub,
8834 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8835 (Target_arm::arm_input_section_map_): New data member declaration.
8836 (Target_arm::scan_reloc_for_stub,
8837 Target_arm::scan_reloc_section_for_stubs,
8838 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8839 Target_arm::do_relax): New method definitions.
8840
5d329b7d
ILT
88412009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8842
8843 * configure.ac: Check for (struct stat)::st_mtim
8844 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8845 * config.in: Regenerate.
8846 * configure: Regenerate.
8847
96a0d71b
ILT
88482009-11-05 Ian Lance Taylor <iant@google.com>
8849
8850 PR 10910
8851 * output.cc (Output_segment::add_output_section): Add missing
8852 return statement.
8853
594c8e5e
ILT
88542009-11-04 Ian Lance Taylor <iant@google.com>
8855
8856 PR 10880
8857 * object.h (class Object): Add is_needed and set_is_needed
8858 methods. Add is_needed_ field. Make bool fields into bitfields.
8859 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8860 defined in a dynamic object and referenced by a regular object,
8861 set is_needed for the dynamic object.
8862 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8863 if the file is marked with as_needed and it is not needed.
8864
22b127cc
ILT
88652009-11-04 Ian Lance Taylor <iant@google.com>
8866
8867 PR 10887
8868 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8869 tags if data is discarded by linker script.
8870 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8871 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8872 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8873 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8874
f5c870d2
ILT
88752009-11-04 Ian Lance Taylor <iant@google.com>
8876
8877 * layout.cc (Layout::get_output_section): Add is_interp and
8878 is_dynamic_linker_section parameters. Change all callers.
8879 (Layout::choose_output_section): Likewise.
8880 (Layout::make_output_section): Likewise.
8881 (Layout::add_output_section_data): Add is_dynamic_linker_section
8882 parameter. Change all callers.
8883 * layout.h (class Layout): Update declarations.
8884 * output.h (class Output_section): Add is_interp, set_is_interp,
8885 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8886 Add is_interp_, is_dynamic_linker_section_ fields. Change
8887 generate_code_fills_at_write_ to a bitfield.
8888 * output.cc (Output_section::Output_sections): Initialize new
8889 fields.
8890 (Output_segment::add_output_section): Add do_sort parameter.
8891 Change all callers.
8892
1ae4d23b
ILT
88932009-11-03 Ian Lance Taylor <iant@google.com>
8894
8895 PR 10860
8896 * options.h (class General_options): Add --warn-common.
8897 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8898 merging two common symbols.
8899 (Symbol_table::should_override): Handle --warn-common when merging
8900 a common symbol with a defined symbol. Use report_resolve_problem
8901 for multiple definitions.
8902 (Symbol_table::report_resolve_problem): New function.
8903 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8904
55da9579
DK
89052009-11-03 Doug Kwan <dougkwan@google.com>
8906
8907 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8908 stub_factory_.
8909 (Target_arm::stub_factory): New method definition.
8910 (Target_arm::new_arm_input_section,
8911 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8912 Target_arm::reloc_uses_thumb_bit): New method declarations.
e1df38aa 8913 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
55da9579
DK
8914 New type definitions.
8915 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8916 member declarations.
8917 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8918 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8919 New method definitions.
8920
37a9ac43
ILT
89212009-11-03 Ian Lance Taylor <iant@google.com>
8922
8923 * options.h (class General_options): Add --warn_constructors.
8924
b3d6a3d4
ILT
89252009-11-03 Ian Lance Taylor <iant@google.com>
8926
8927 PR 10893
8928 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8929 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8930
934b01dd
ILT
89312009-11-03 Ian Lance Taylor <iant@google.com>
8932
8933 PR 10895
8934 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8935 --msgid-bugs-address.
8936 (install-pdf): New target.
8937 (install-data_yes): Look up one directory to find mkinstalldirs.
8938
03c1939b
L
89392009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8940
8941 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8942 tree.
8943
ebd95253
DK
89442009-10-30 Doug Kwan <dougkwan@google.com>
8945
8946 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8947
e9bbb538
DK
89482009-10-30 Doug Kwan <dougkwan@google.com>
8949
8950 * arm.cc (Stub_addend_reader): New struct template definition
8951 and partial specializations.
8952 (Stub_addend_reader::operator()): New method definition for a
8953 partially specialized template.
8954
d5b40221
DK
89552009-10-30 Doug Kwan <dougkwan@google.com>
8956
8957 * arm.cc (Arm_relobj::processor_specific_flags): New method
8958 definition.
8959 (Arm_relobj::do_read_symbols): New method declaration.
8960 (Arm_relobj::processor_specific_flags_): New data member declaration.
8961 (Arm_dynobj): New class definition.
8962 (Target_arm::do_finalize_sections): Add input_objects parameter.
8963 (Target_arm::do_adjust_elf_header): New method declaration.
8964 (Target_arm::are_eabi_versions_compatible,
8965 (Target_arm::merge_processor_specific_flags): New method declaration.
8966 (Target_arm::do_make_elf_object): New overloaded method definitions
8967 and declaration.
8968 (Arm_relobj::do_read_symbols): New method definition.
8969 (Arm_dynobj::do_read_symbols): Ditto.
8970 (Target_arm::do_finalize_sections): Add input_objects parameters.
8971 Merge processor-specific flags from all input objects.
8972 (Target_arm::are_eabi_versions_compatible,
8973 Target_arm::merge_processor_specific_flags,
8974 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8975 New method definitions.
8976 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8977 Input_objects pointer type parameter.
8978 * layout.cc (Layout::finalize): Pass input objects to target's.
8979 finalize_sections function.
8980 * output.cc (Output_file_header::do_sized_write): Set ELF file
8981 header's processor-specific flags.
8982 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8983 Input_objects pointer type parameter.
8984 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8985 * target.h (Input_objects): New forward class declaration.
8986 (Target::processor_specific_flags,
8987 Target::are_processor_specific_flags_sect): New method definitions.
8988 (Target::finalize_sections): Add input_objects parameter.
8989 (Target::Target): Initialize processor_specific_flags_ and
8990 are_processor_specific_flags_set_.
8991 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8992 parameter.
8993 (Target::set_processor_specific_flags): New method definition.
8994 (Target::processor_specific_flags_,
8995 Target::are_processor_specific_flags_set_): New data member
8996 declarations.
8997 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8998 Input_objects pointer type parameter.
8999
ebabffbd
DK
90002009-10-30 Doug Kwan <dougkwan@google.com>
9001
9002 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9003
ad0f2072
ILT
90042009-10-28 Ian Lance Taylor <iant@google.com>
9005
9006 * object.h (class Relobj): Drop options parameter from
9007 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9008 do_scan_relocs, do_relocate. Change all callers.
9009 (class Sized_relobj): Drop options parameters from
9010 do_gc_process_relocs, do_scan_relocs, do_relocate,
9011 do_relocate_sections, relocate_sections, emit_relocs_scan,
9012 emit_relocs_scan_reltype. Change all callers.
9013 (struct Relocate_info): Remove options field and all references to
9014 it.
9015 * reloc.h (class Read_relocs): Remove options constructor
9016 parameter and options_ field. Change all callers.
9017 (class Gc_process_relocs, class Scan_relocs): Likewise.
9018 (class Relocate_task): Likewise.
9019 * target-reloc.h (scan_relocs): Remove options parameter. Change
9020 all callers.
9021 (scan_relocatable_relocs): Likewise.
9022 * target.h (class Sized_target): Remove options parameter from
9023 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
9024 all callers.
9025 * gc.h (gc_process_relocs): Remove options parameter. Change all
9026 callers.
9027 * arm.cc: Update functions to remove options parameters.
9028 * i386.cc: Likewise.
9029 * powerpc.cc: Likewise.
9030 * sparc.cc: Likewise.
9031 * x86_64.cc: Likewise.
9032 * testsuite/testfile.cc: Likewise.
9033
8ffa3667
DK
90342009-10-28 Doug Kwan <dougkwan@google.com>
9035
9036 * arm.cc (Arm_relobj): New class definition.
e1df38aa 9037 (Arm_relobj::scan_sections_for_stubs,
8ffa3667
DK
9038 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9039 New method definitions.
9040
40f36857
CC
90412009-10-28 Cary Coutant <ccoutant@google.com>
9042
9043 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9044 (Plugin::cleanup_done_): New member.
9045 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9046 (Plugin_manager::cleanup_done_): Remove.
9047 (Plugin_manager::add_input_file): Edit error message.
9048 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9049 (Plugin_manager::cleanup): Remove use of cleanup_done_.
9050
2c849493
ILT
90512009-10-27 Mikolaj Zalewski <mikolajz@google.com>
9052
9053 * fileread.cc: (File_read::View::~View): Use the new
9054 data_ownership_ filed.
9055 (File_read::~File_read): Dispose the new whole_file_view_.
9056 (File_read::open): Mmap the whole file if needed.
9057 (File_read::open): Use whole_file_view_ instead of contents_.
9058 (File_read::find_view): Use whole_file_view_ if applicable.
9059 (File_read::do_read): Use whole_file_view_ instead of contents_.
9060 (File_read::make_view): Use whole_file_view_ instead of contents_,
9061 update File_read::View::View call.
9062 (File_read::find_or_make_view): Update File_read::View::View
9063 call.
9064 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9065 remove contents_
9066 (File_read::View::Data_ownership): New enum.
9067 (File_read::View::View): Replace bool mapped_ with Data_ownership
9068 argument.
9069 (File_read::View::mapped_): Remove (replaced by data_ownership_).
9070 (File_read::View::data_ownership_): New field.
9071 (File_read::contents_): Remove (replaced by whole_file_view_).
9072 (File_read::whole_file_view_): New field.
9073 * options.h (class General_options): Add --keep-files-mapped.
9074
24998053
CC
90752009-10-27 Cary Coutant <ccoutant@google.com>
9076
9077 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9078 * testsuite/Makefile.am (plugin_test_5): New test case.
9079 * testsuite/Makefile.in: Regenerate.
9080
72adc4fa
DK
90812009-10-25 Doug Kwan <dougkwan@google.com>
9082
9083 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9084 from private to protected to allow access by child class.
9085 (Sized_relobj::do_relocate_sections): New method declaration.
9086 (Sized_relobj::relocate_sections): Virtualize.
e1df38aa 9087 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
72adc4fa
DK
9088 Sized_relobj::relocate_sections. Instantiate template explicitly
9089 for different target sizes and endianity.
9090
07f508a2
DK
90912009-10-24 Doug Kwan <dougkwan@google.com>
9092
9093 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9094 (Arm_input_section::as_arm_input_section): New method.
9095 (Arm_output_section): New class definition.
9096 (Arm_output_section::create_stub_group,
9097 Arm_output_section::group_sections): New method definitions.
9098
10ad9fe5
DK
90992009-10-22 Doug Kwan <dougkwan@google.com>
9100
9101 * arm.cc (Arm_input_section): New class definition.
9102 (Arm_input_section::init, Arm_input_section:do_write,
9103 Arm_input_section::set_final_data_size,
9104 Arm_input_section::do_reset_address_and_file_offset): New method
9105 definitions.
9106
56ee5e00
DK
91072009-10-21 Doug Kwan <dougkwan@google.com>
9108
9109 * arm.cc (Stub_table, Arm_input_section): New forward class
9110 declarations.
9111 (Stub_table): New class defintion.
9112 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9113 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9114 New method definition.
9115
b569affa
DK
91162009-10-21 Doug Kwan <dougkwan@google.com>
9117
9118 * arm.cc: Update copyright comments.
9119 (Target_arm): New forward class template declaration.
9120 (Arm_address): New type.
9121 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9122 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9123 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9124 constants.
9125 (Insn_template): Same.
9126 (DEF_STUBS): New macro.
9127 (Stub_type): New enum type.
9128 (Stub_template): New class definition.
9129 (Stub): Same.
9130 (Reloc_stub): Same.
9131 (Stub_factory): Same.
9132 (Target_arm::Target_arm): Initialize may_use_blx_ and
9133 should_force_pic_veneer_.
9134 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9135 Target_arm::should_force_pic_veneer,
9136 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9137 Target_arm::using_thumb_only, Target_arm:;default_target): New
9138 method defintions.
9139 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9140 New data member declarations.
9141 (Insn_template::size, Insn_template::alignment): New method defintions.
9142 (Stub_template::Stub_template): New method definition.
9143 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9144 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9145 (Stub_factory::Stub_factory): New method definition.
9146 * gold.h (string_hash): New template.
9147 * output.h (Input_section_specifier::hash_value): Use
9148 gold::string_hash.
9149 (Input_section_specifier::string_hash): Remove.
9150 * stringpool.cc (Stringpool_template::string_hash): Use
9151 gold::string_hash.
9152
6c172549
DK
91532009-10-20 Doug Kwan <dougkwan@google.com>
9154
9155 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9156 symbols of relaxed input sections.
9157 * output.h (Output_section::find_relaxed_input_section): Make
9158 method public.
9159
c5617f2f
DK
91602009-10-16 Doug Kwan <dougkwan@google.com>
9161
9162 * dynobj.cc (Versions::Versions): Initialize version_script_.
9163 Only insert base version symbol definition for a shared object
9164 if version script defines any version versions.
9165 (Versions::define_base_version): New method definition.
9166 (Versions::add_def): Check that base version is not needed.
9167 (Versions::add_need): Define base version lazily.
9168 * dynobj.h (Versions::define_base_version): New method declaration.
9169 (Versions::needs_base_version_): New data member declaration.
9170 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9171 (check_DATA): Add no_version_test.stdout.
9172 (libno_version_test.so, no_version_test.o no_version_test.stdout):
9173 New make rules.
9174 * testsuite/Makefile.in: Regenerate.
9175 * testsuite/no_version_test.c: New file.
9176 * testsuite/no_version_test.sh: Ditto.
9177
3c12dcdb
DK
91782009-10-16 Doug Kwan <dougkwan@google.com>
9179
9180 * expression.cc (class Segment_start_expression): New class definition.
9181 (Segment_start_expression::value): New method definition.
9182 (script_exp_function_segment_start): Return a new
9183 Segment_start_expression.
9184 * gold/script-c.h (script_saw_segment_start_expression): New function
9185 prototype.
9186 * script-sections.cc (Script_sections::Script_sections): Initialize
9187 SAW_SEGMENT_START_EXPRESSION_ to false.
9188 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9189 and -Tbbs options to specify section addresses if given in
9190 command line and no SEGMENT_START expression is seen in a script.
9191 * script-sections.h (Script_sections::saw_segment_start_expression,
9192 Script_sections::set_saw_segment_start_expression): New method
9193 definition.
9194 (Script_sections::saw_segment_start_expression_): New data member
9195 declaration.
9196 * script.cc (script_saw_segment_start_expression): New function.
9197 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9198 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9199 script_test_7.sh and script_test_8.sh.
9200 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9201 script_test_8.stdout.
9202 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9203 (script_test_6, script_test_6.stdout, script_test_7,
9204 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9205 * Makefile.in: Regenerate.
9206 * testsuite/script_test_6.sh: New file.
9207 * testsuite/script_test_6.t: Same.
9208 * testsuite/script_test_7.sh: Same.
9209 * testsuite/script_test_7.t: Same.
9210 * testsuite/script_test_8.sh: Same.
9211
64b1ae37
DK
92122009-10-16 Doug Kwan <dougkwan@google.com>
9213
9214 * output.cc (Output_segment::set_section_list_address): Cast
9215 expressions to unsigned long long type to avoid format warnings.
9216
661be1e2
ILT
92172009-10-15 Ian Lance Taylor <iant@google.com>
9218
12edd763 9219 * script.cc (Script_options::add_symbol_assignment): Always add a
b3d6a3d4 9220 dot assignment to script_sections_.
12edd763
ILT
9221 * script-sections.cc (Script_sections::add_dot_assignment):
9222 Initialize if necessary.
9223
68b6574b
ILT
9224 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9225 program headers with no load segment if there is a linker script.
9226
661be1e2
ILT
9227 * layout.cc (Layout::set_segment_offsets): Align the file offset
9228 to the segment aligment for -N or -n with no load segment.
9229 * output.cc (Output_segment::add_output_section): Don't crash if
9230 the first section is a TLS section.
9231 (Output_segment::set_section_list_addresses): Print an error
9232 message if the address moves backward in a linker script.
9233 * script-sections.cc
9234 (Output_section_element_input::set_section_addresses): Don't
9235 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9236 (Orphan_output_section::set_section_addresses): Likewise.
9237
f15f61a7
DK
92382009-10-15 Doug Kwan <dougkwan@google.com>
9239
9240 * layout.cc (Layout::finish_dynamic_section): Generate tags
9241 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9242 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9243 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9244
82bb573a
ILT
92452009-10-14 Ian Lance Taylor <iant@google.com>
9246
9247 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9248 fields.
9249 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9250 data_shdr fields of relinfo.
9251 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9252 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
9253 R_386_TLS_LDO_32, adjust based on section flags.
9254 (Target_i386::Relocate::fix_up_ldo): Remove.
9255
374ad285
ILT
92562009-10-13 Ian Lance Taylor <iant@google.com>
9257
9258 Add support for -pie.
9259 * options.h (class General_options): Add -pie and
9260 --pic-executable.
9261 (General_options::output_is_position_independent): Test -pie.
9262 (General_options::output_is_executable): Return true if not shared
9263 and not relocatable.
9264 (General_options::output_is_pie): Remove.
9265 * options.cc (General_options::finalize): Reject incompatible uses
9266 of -pie.
9267 * gold.cc (queue_middle_tasks): A -pie link is not static.
9268 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9269 * symtab.cc (Symbol::final_value_is_known): Return false if
9270 output_is_position_independent.
9271 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9272 output_is_position_independent.
9273 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9274 output_is_position_independent.
9275 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9276 output_is_position_independent.
9277 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9278 two_file_pie_test.
9279 (basic_pie_test.o, basic_pie_test): New targets.
9280 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9281 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9282 (two_file_pie_test): New target.
9283 * testsuite/Makefile.in: Rebuild.
9284 * README: Remove note saying that -pie is not supported.
9285
c6585162
ILT
92862009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
9287
9288 * options.h (class General_options): Add -init and -fini.
9289 * layout.cc (Layout::finish_dynamic_section): Emit
9290 given init and fini functions.
9291
032ce4e9
ST
92922009-10-13 Sriraman Tallam <tmsriram@google.com>
9293
9294 * gc.h (gc_process_relocs): Check if icf is enabled using new
9295 function.
9296 * gold.cc (queue_initial_tasks): Likewise.
9297 (queue_middle_tasks): Likewise.
9298 * object.cc (do_layout): Likewise.
9299 * symtab.cc (is_section_folded): Likewise.
9300 * main.cc (main): Likewise.
9301 * reloc.cc (Read_relocs::run): Likewise.
9302 (Sized_relobj::do_scan_relocs): Likewise.
9303 * icf.cc (is_function_ctor_or_dtor): New function.
9304 (Icf::find_identical_sections): Check if function is ctor or dtor when
9305 safe icf is chosen.
9306 * options.h (General_options::icf): Change option to be an enum.
9307 (Icf_status): New enum.
9308 (icf_enabled): New method.
9309 (icf_safe_folding): New method.
9310 (set_icf_status): New method.
9311 (icf_status_): New variable.
9312 * (options.cc) (General_options::finalize): Set icf_status_.
9313 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9314 icf_test and icf_keep_unique_test to use the --icf enum flag.
9315 * testsuite/icf_safe_test.sh: New file.
e1df38aa 9316 * testsuite/icf_safe_test.cc: New file.
032ce4e9 9317
f345227a
ST
93182009-10-12 Sriraman Tallam <tmsriram@google.com>
9319
9320 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9321 includes to gc.h and icf.h.
9322 * arm.cc: Include gc.h.
9323 * gold.cc: Likewise.
9324 * i386.cc: Likewise.
9325 * powerpc.cc: Likewise.
9326 * sparc.cc: Likewise.
9327 * x86_64.cc: Likewise.
9328 * gc.h: Include icf.h.
9329
1c7814ed
ILT
93302009-10-11 Ian Lance Taylor <iant@google.com>
9331
9332 * plugin.cc: Include "gold.h" before other header files.
9333
ae3b5189
CD
93342009-10-10 Chris Demetriou <cgd@google.com>
9335
9336 * options.h (Input_file_argument::Input_file_type): New enum.
9337 (Input_file_argument::is_lib_): Replace with...
9338 (Input_file_argument::type_): New member.
9339 (Input_file_argument::Input_file_argument): Take Input_file_type
9340 'type' rather than boolean 'is_lib' as second argument.
9341 (Input_file_argument::is_lib): Use type_.
9342 (Input_file_argument::is_searched_file): New function.
9343 (Input_file_argument::may_need_search): Handle is_searched_file.
9344 * options.cc (General_options::parse_library): Support -l:filename.
9345 (General_options::parse_just_symbols): Update for Input_file_argument
9346 changes.
9347 (Command_line::process): Likewise.
9348 * archive.cc (Archive::get_file_and_offset): Likewise.
9349 * plugin.cc (Plugin_manager::release_input_file): Likewise.
9350 * script.cc (read_script_file, script_add_file): Likewise.
9351 * fileread.cc (Input_file::Input_file): Likewise.
9352 (Input_file::will_search_for): Handle is_searched_file.
9353 (Input_file::open): Likewise.
9354 * readsyms.cc (Read_symbols::get_name): Likewise.
9355 * testsuite/Makefile.am (searched_file_test): New test.
9356 * testsuite/Makefile.in: Regenerate.
9357 * testsuite/searched_file_test.cc: New file.
9358 * testsuite/searched_file_test_lib.cc: New file.
9359
f3048a1d
ILT
93602009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9361 Ian Lance Taylor <iant@google.com>
9362
9363 * descriptor.cc: Include <cstdio> and "binary-io.h".
9364 (Descriptors::open): Open the files in binary mode always.
9365 * script.cc (Lex::get_token): Treat \r as whitespace.
9366
d4780e57
ILT
93672009-10-09 Ian Lance Taylor <iant@google.com>
9368
9369 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9370
d9a893b8
ILT
93712009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9372 Ian Lance Taylor <iant@google.com>
9373
9374 * configure.ac: Check for readv function also.
9375 * fileread.cc (readv): Define if not HAVE_READV.
9376 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9377 does not exist.
9378 * config.in: Regenerate.
9379 * configure: Regenerate.
9380
c0a62865
DK
93812009-10-09 Doug Kwan <dougkwan@google.com>
9382
9383 * layout.cc (Layout::make_output_section): Call target hook to make
9384 ordinary output section.
9385 (Layout::finalize): Adjust parameter list of call the
9386 Target::may_relax().
9387 * layout.h (class Layout::section_list): New method.
9388 * merge.h (Output_merge_base::entsize): Change visibility to public.
9389 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9390 New methods.
9391 (Output_merge_string::do_is_string): New method.
9392 * object.cc (Sized_relobj::do_setup): renamed from
9393 Sized_relobj::set_up.
9394 * object.h (Sized_relobj::adjust_shndx,
9395 Sized_relobj::initializ_input_to_output_maps,
9396 Sized_relobj::free_input_to_output_maps): Change visibilities to
9397 protected.
9398 (Sized_relobj::setup): Virtualize.
9399 (Sized_relobj::do_setup): New method declaration.
9400 (Sized_relobj::invalidate_section_offset,
9401 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9402 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9403 * options.cc (parse_int): New function.
9404 * options.h (parse_int): New declaration.
9405 (DEFINE_int): New macro.
9406 (stub_group_size): New option.
9407 * output.cc (Output_section::Output_section): Initialize memebers
9408 merge_section_map_, merge_section_by_properties_map_,
9409 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9410 (Output_section::add_input_section): Handled deferred code-fill
9411 generation and remove an old comment.
9412 (Output_section::add_relaxed_input_section): New method definition.
9413 (Output_section::add_merge_input_section): Use merge section by
9414 properties map to speed to search. Update merge section maps
9415 as appropriate.
9416 (Output_section::build_relaxation_map): New method definition.
9417 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9418 Same.
9419 (Output_section::relax_input_section): Renamed to
9420 Output_section::convert_input_sections_to_relaxed_sections and change
9421 interface to take a vector of pointers to relaxed sections.
9422 (Output_section::find_merge_section,
9423 Output_section::find_relaxed_input_section): New method definitions.
9424 (Output_section::is_input_address_mapped,
9425 Output_section::output_offset, Output_section::output_address):
9426 Use output section data maps to speed up searching.
9427 (Output_section::find_starting_output_address): Add comments.
9428 (Output_section::do_write,
9429 Output_section::write_to_postprocessing_buffer): Do code-fill
9430 generation as appropriate.
9431 (Output_section::get_input_sections): Invalidate relaxed input section
9432 map.
9433 (Output_section::restore_states): Adjust type of checkpoint .
9434 Invalidate relaxed input section map.
9435 * output.h (Output_merge_base): New class declaration.
9436 (Input_section_specifier): New class defintion.
9437 (class Output_relaxed_input_section) Change base class to
9438 Output_section_data_build.
9439 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9440 base class initializer.
9441 (Output_section::add_relaxed_input_section): New method declaration.
9442 (Output_section::Input_section): Change visibility to protected.
2e702c99 9443 (Output_section::Input_section::relobj,
c0a62865
DK
9444 Output_section::Input_section::shndx): Handle relaxed input sections.
9445 Output_section::input_sections) Change visibility to protected. Also
9446 define overload to return a non-const pointer.
9447 (Output_section::Merge_section_properties): New class defintion.
9448 (Output_section::Merge_section_by_properties_map,
9449 Output_section::Output_section_data_by_input_section_map,
9450 Output_section::Relaxation_map): New types.
9451 (Output_section::relax_input_section): Rename method to
9452 Output_section::convert_input_sections_to_relaxed_sections and change
9453 interface to take a vector of relaxed section pointers.
9454 (Output_section::find_merge_section,
9455 Output_section::find_relaxed_input_section,
9456 Output_section::build_relaxation_map,
9457 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9458 New method declarations.
9459 (Output_section::merge_section_map_
9460 Output_section::merge_section_by_properties_map_,
9461 Output_section::relaxed_input_section_map_,
9462 Output_section::is_relaxed_input_section_map_valid_,
9463 Output_section::generate_code_fills_at_write_): New data members.
9464 * script-sections.cc
9465 (Output_section_element_input::set_section_addresses): Call
9466 current_data_size and addralign methods of relaxed input sections.
9467 (Orphan_output_section::set_section_addresses): Call current_data_size
9468 and addralign methods of relaxed input sections.
9469 * symtab.cc (Symbol_table::compute_final_value): Extract template
9470 from the body of Symbol_table::sized_finalize_symbol.
9471 (Symbol_table::sized_finalized_symbol): Call
9472 Symbol_table::compute_final_value.
9473 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9474 (Symbol_table::compute_final_value): New templated method declaration.
9475 * target.cc (Target::do_make_output_section): New method defintion.
9476 * target.h (Target::make_output_section): New method declaration.
9477 (Target::relax): Add more parameters for input objects, symbol table
9478 and layout. Adjust call to do_relax.
9479 (Target::do_make_output_section): New method declaration.
9480 (Target::do_relax): Add parameters for input objects, symbol table
9481 and layout.
9482
d446d6c4
ILT
94832009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9484
9485 * pread.c: Include stdio.h.
9486
bc06c745
ILT
94872009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9488
9489 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9490 defined.
9491
75aea3d0
ILT
94922009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9493
9494 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9495 Change read_shndx type to unsigned int.
9496 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9497 int.
9498 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9499 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9500 Change read_shndx type to unsigned int.
9501 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9502 int.
9503 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9504 * layout.cc (Layout::create_symtab_sections): Cast the result of
9505 local_symcount * symsize to off_t in the gold_assert.
9506
be8fcb75
ILT
95072009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9508
9509 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9510 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9511 R_ARM_BASE_ABS.
9512 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9513 (Arm_relocate_functions::thm_abs5): New function.
9514 (Arm_relocate_functions::abs12): New function.
9515 (Arm_relocate_functions::abs16): New function.
9516 (Arm_relocate_functions::base_abs): New function.
9517 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9518 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9519 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9520 R_ARM_BASE_ABS.
9521 (Scan::global): Likewise.
9522 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9523 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9524 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9525 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9526 R_ARM_BASE_ABS.
9527
c2a122b6
ILT
95282009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9529
9530 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9531 (Arm_relocate_functions::movt_prel): New function.
9532 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9533 (Arm_relocate_functions::thm_movt_prel): New function.
9534 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9535 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9536 (Scan::global, Relocate::relocate): Likewise.
9537 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9538
c4aa1e2d
ILT
95392009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9540
9541 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9542 Incremental_checker.
9543 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9544 unsigned int.
9545 (class Incremental_inputs_header): New class.
9546 (Incremental_inputs_header_writer): Edit comment.
9547 (Incremental_inputs_entry): New class.
9548 (Incremental_inputs_entry_writer): Edit comment.
9549 (Sized_incremental_binary::do_find_incremental_inputs_section):
9550 Add *strtab_shndx parameter, fill it.
9551 (Sized_incremental_binary::do_check_inputs): New method.
9552 (Incremental_checker::can_incrementally_link_output_file): Use
9553 Sized_incremental_binary::check_inputs.
9554 (Incremental_inputs::report_command_line): Save command line in
9555 command_line_.
9556 * incremental.h:
9557 (Incremental_binary::find_incremental_inputs_section): New
9558 method.
9559 (Incremental_binary::do_find_incremental_inputs_section): Add
9560 strtab_shndx parameter.
9561 (Incremental_binary::do_check_inputs): New pure virtual method.
9562 (Sized_incremental_binary::do_check_inputs): Declare.
9563 (Incremental_checker::Incremental_checker): Add incremental_inputs
9564 parameter, use it to initialize incremental_inputs_.
9565 (Incremental_checker::incremental_inputs_): New field.
9566 (Incremental_checker::command_line): New method.
9567 (Incremental_checker::inputs): New method.
9568 (Incremental_checker::command_line_): New field.
9569
c549a694
ILT
95702009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9571
9572 * incremental.cc: Include <cstdarg> and "target-select.h".
9573 (vexplain_no_incremental): New function.
9574 (explain_no_incremental): New function.
9575 (Incremental_binary::error): New method.
9576 (Sized_incremental_binary::do_find_incremental_inputs_section): New
9577 method.
9578 (make_sized_incremental_binary): New function.
9579 (open_incremental_binary): New function.
9580 (can_incrementally_link_file): Add checks if output is ELF and has
9581 inputs section.
9582 * incremental.h: Include "elfcpp_file.h" and "output.h".
9583 (Incremental_binary): New class.
9584 (Sized_incremental_binary): New class.
9585 (open_incremental_binary): Declare.
9586 * object.cc (is_elf_object): Use
9587 elfcpp::Elf_recognizer::is_elf_file.
9588 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9589 * output.h (Output_file::filesize): New method.
9590
fd3c5f0b
ILT
95912009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9592
9593 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9594 New function.
9595 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9596 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9597 function.
9598 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9599 function.
9600 (Arm_relocate_functions::movw_abs_nc): New function.
9601 (Arm_relocate_functions::movt_abs): New function.
9602 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9603 (Arm_relocate_functions::thm_movt_abs): New function.
9604 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9605 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9606 (Scan::global): Likewise.
9607 (Relocate::relocate): Likewise.
9608 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9609
7f5309a5
ILT
96102009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9611
9612 * arm.cc (Arm_relocate_functions::got_prel) New function.
9613 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9614 (Relocate::relocate): Likewise.
9615 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9616
364c7fa5
ILT
96172009-10-06 Ian Lance Taylor <iant@google.com>
9618
9619 * options.h (class General_options): Define
9620 split_stack_adjust_size parameter.
9621 * object.h (class Object): Add uses_split_stack_ and
9622 has_no_split_stack_ fields. Add uses_split_stack and
9623 has_no_split_stack accessor functions. Declare
9624 handle_split_stack_section.
9625 (class Reloc_symbol_changes): Define.
9626 (class Sized_relobj): Define Function_offsets. Declare
9627 split_stack_adjust, split_stack_adjust_reltype, and
9628 find_functions.
9629 * object.cc (Object::handle_split_stack_section): New function.
9630 (Sized_relobj::do_layout): Call handle_split_stack_section.
9631 * dynobj.cc (Sized_dynobj::do_layout): Call
9632 handle_split_stack_section.
9633 * reloc.cc (Sized_relobj::relocate_sections): Call
9634 split_stack_adjust for executable sections in split_stack
9635 objects. Pass reloc_map to relocate_section.
9636 (Sized_relobj::split_stack_adjust): New function.
9637 (Sized_relobj::split_stack_adjust_reltype): New function.
9638 (Sized_relobj::find_functions): New function.
9639 * target-reloc.h: Include "object.h".
9640 (relocate_section): Add reloc_symbol_changes parameter. Change
9641 all callers.
9642 * target.h (class Target): Add calls_non_split method. Declare
9643 do_calls_non_split virtual method. Declare match_view and
9644 set_view_to_nop.
9645 * target.cc: Include "elfcpp.h".
9646 (Target::do_calls_non_split): New function.
9647 (Target::match_view): New function.
9648 (Target::set_view_to_nop): New function.
9649 * gold.cc (queue_middle_tasks): Give an error if mixing
9650 split-stack and non-split-stack objects with -r.
9651 * i386.cc (Target_i386::relocate_section): Add
9652 reloc_symbol_changes parameter.
9653 (Target_i386::do_calls_non_split): New function.
9654 * x86_64.cc (Target_x86_64::relocate_section): Add
9655 reloc_symbol_changes parameter.
9656 (Target_x86_64::do_calls_non_split): New function.
9657 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9658 parameter.
9659 * powerpc.cc (Target_powerpc::relocate_section): Add
9660 reloc_symbol_changes parameter.
9661 * sparc.cc (Target_sparc::relocate_section): Add
9662 reloc_symbol_changes parameter.
9663 * configure.ac: Call AM_CONDITIONAL for the default target.
9664 * configure: Rebuild.
9665 * testsuite/Makefile.am (TEST_AS): New variable.
9666 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9667 (check_DATA): Add split_i386 and split_x86_64 files.
9668 (SPLIT_DEFSYMS): Define.
9669 (split_i386_[1234n].o): New targets.
9670 (split_i386_[124]): New targets.
9671 (split_i386_[1234r].stdout): New targets.
9672 (split_x86_64_[1234n].o): New targets.
9673 (split_x86_64_[124]): New targets.
9674 (split_x86_64_[1234r].stdout): New targets.
9675 (MOSTLYCLEANFILES): Add new executables.
9676 * testsuite/split_i386.sh: New file.
9677 * testsuite/split_x86_64.sh: New file.
9678 * testsuite/split_i386_1.s: New file.
9679 * testsuite/split_i386_2.s: New file.
9680 * testsuite/split_i386_3.s: New file.
9681 * testsuite/split_i386_4.s: New file.
9682 * testsuite/split_i386_n.s: New file.
9683 * testsuite/split_x86_64_1.s: New file.
9684 * testsuite/split_x86_64_2.s: New file.
9685 * testsuite/split_x86_64_3.s: New file.
9686 * testsuite/split_x86_64_4.s: New file.
9687 * testsuite/split_x86_64_n.s: New file.
9688 * testsuite/testfile.cc (Target_test): Update relocation_section
9689 function.
9690 * testsuite/Makefile.in: Rebuild.
9691
e8a9fcda
ILT
96922009-10-06 Ian Lance Taylor <iant@google.com>
9693
9694 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9695 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9696 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9697 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9698 the address on ldo_addrs_.
9699 (Target_i386::Relocate::fix_up_ldo): New function.
9700
e99daf92
ILT
97012009-10-06 Rafael Espindola <espindola@google.com>
9702
9703 * plugin.cc (add_input_library): New.
9704 (Plugin::load): Add add_input_library to tv.
9705 (Plugin_manager::add_input_file): Add the is_lib argument.
9706 (add_input_file): Update call to Plugin_manager::add_input_file.
9707 (add_input_library): New.
9708 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9709
966d4097
DK
97102009-09-30 Doug Kwan <dougkwan@google.com>
9711
9712 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9713 symbol and call Symbol::may_need_copy_reloc to determine if
9714 a copy reloc is needed.
9715 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9716 nocopyreloc is given in command line.
9717 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9718 given in command line.
9719 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9720 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9721 of the removed Target_i386::may_need_copy_reloc.
9722 * options.h (copyreloc): New option with default value false.
9723 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9724 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9725 instead of the removed Target_powerpc::may_need_copy_reloc.
9726 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9727 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9728 instead of the removed Target_sparc::may_need_copy_reloc.
9729 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9730 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9731 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9732 instead of the removed Target_x86_64::may_need_copy_reloc.
9733
029ba973
ILT
97342009-09-30 Ian Lance Taylor <iant@google.com>
9735
9736 * object.h (class Object): Remove target_ field, and target,
9737 sized_target, and set_target methods.
9738 (Object::sized_target): Remove.
9739 (class Sized_relobj): Update declarations. Remove sized_target.
9740 * object.cc (Sized_relobj::setup): Remove target parameter.
9741 Change all callers.
9742 (Input_objects::add_object): Don't do anything with the target.
9743 (make_elf_sized_object): Add punconfigured parameter. Change all
9744 callers. Set or test parameter target.
9745 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9746 Change all callers.
9747 * parameters.cc (Parameters::set_target): Change parameter type to
9748 be non-const.
9749 (Parameters::default_target): Remove.
9750 (set_parameters_target): Change parameter type to be non-const.
9751 (parameters_force_valid_target): New function.
9752 (parameters_clear_target): New function.
9753 * parameters.h (class Parameters): Update declarations. Remove
9754 default_target method. Add sized_target and clear_target
9755 methods. Change target_ to be non-const.
9756 (set_parameters_target): Update declaration.
9757 (parameters_force_valid_target): Declare.
9758 (parameters_clear_target): Declare.
9759 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9760 as NULL if we aren't searching.
9761 (Add_symbols::run): Don't check for compatible target.
9762 * fileread.cc (Input_file::open_binary): Call
9763 parameters_force_valid_target.
9764 * gold.cc (queue_middle_tasks): Likewise.
9765 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9766 set_target on object.
9767 * dynobj.h (class Sized_dynobj): Update declarations.
9768 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9769 make_elf_object returns NULL.
9770 (Archive::include_member): Don't check whether object target is
9771 compatible.
9772 * output.cc (Output_section::add_input_section): Get target from
9773 parameters.
9774 (Output_section::relax_input_section): Likewise.
9775 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9776 parameters.
9777 (Sized_relobj::do_scan_relocs): Likewise.
9778 (Sized_relobj::relocate_sections): Likewise.
9779 * resolve.cc (Symbol_table::resolve): Likewise.
9780 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9781 parameter. Change all callers.
9782 (Symbol_table::add_from_object): Get target from parameters.
9783 (Symbol_table::add_from_relobj): Don't check object target.
9784 (Symbol_table::add_from_dynobj): Likewise.
9785 (Symbol_table::define_special_symbol): Get target from
9786 parameters.
9787 * symtab.h (class Symbol_table): Update declaration.
9788 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9789 parameter. Change all callers. Clear parameter target.
9790 (Binary_test): Test target here.
9791 * testsuite/object_unittest.cc (gold_testsuite): Remove
9792 target_test_pointer parameter. Change all callers.
9793 (Object_test): Test target here.
9794
a6a22b83
ILT
97952009-09-26 Ian Lance Taylor <iant@google.com>
9796
9797 * testsuite/initpri1.c: Don't try to use constructor priorities if
9798 compiling with gcc before 4.3.
9799
6a8f49fe
ILT
98002009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9801
9802 * testsuite/retain_symbols_file_test.sh (check_present): Change
9803 output file name to retain_symbols_file_test.stdout.
9804 (check_absent): Likewise.
9805
8c604651
CS
98062009-09-18 Craig Silverstein <csilvers@google.com>
9807
9808 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9809 * options.cc: Include <cerrno> and <fstream>.
9810 (General_options::finalize): Parse -retain-symbols-file tag.
9811 * options.h: New flag.
9812 (General_options): New method should_retain_symbol, new
9813 variable symbols_to_retain.
9814 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9815 should_retain_symbol map.
9816 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9817 * testsuite/Makefile.in: Regenerate.
9818 * testsuite/retain_symbols_file_test.sh: New file.
9819
ca58b19f
NC
98202009-09-18 Nick Clifton <nickc@redhat.com>
9821
9822 * po/es.po: Updated Spanish translation.
9823
20e6d0d6
DK
98242009-09-17 Doug Kwan <dougkwan@google.com>
9825
9826 * debug.h (DEBUG_RELAXATION): New constant.
9827 (DEBUG_ALL): Add DEBUG_RELAXATION.
9828 (debug_string_to_enum): Add relaxation debug option.
9829 * layout.cc
9830 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9831 Layout::Relaxation_debug_check::read_sections,
9832 Layout::Relaxation_debug_check::read_sections): New method definitions.
9833 (Layout::Layout): Initialize data members
9834 record_output_section_data_from_scrips_,
9835 script_output_section_data_list_ and relaxation_debug_check_.
9836 (Layout::save_segments, Layout::restore_segments,
9837 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9838 Layout::relaxation_loop_body): New method definitions.
9839 (Layout::finalize): Support relaxation. Move section layout code to
9840 Layout::relaxation_loop_body.
9841 (Layout::set_asection_address_from_script): Move code for orphan
9842 section placement out.
9843 (Layout::place_orphan_sections_in_script): New method definition.
9844 * layout.h (Output_segment_headers, Output_file_header):
9845 New forward class declarations.
9846 (Layout::~Layout): Define.
9847 (Layout::new_output_section_data_from_script): New method definition.
9848 (Layout::place_orphan_sections_in_script): New method declaration.
9849 (Layout::Segment_states): New type declaration.
9850 (Layout::save_segments, Layout::restore_segments,
9851 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9852 Layout::relaxation_loop_body): New method declarations.
9853 (Layout::Output_section_data_list): New type declaration.
9854 (Layout::Relaxation_debug_check): New class definition.
9855 (Layout::record_output_section_data_from_script_,
9856 Layout::script_output_section_data_list_, Layout::segment_states_,
9857 Layout::relaxation_debug_check_): New data members.
9858 * output.cc: (Output_section_headers::do_size): New method definition.
9859 (Output_section_headers::Output_section_headers): Move size
9860 computation to Output_section_headers::do_size.
9861 (Output_segment_headers::do_size): New method definition.
e1df38aa 9862 (Output_file_header::Output_file_header): Move size computation to
20e6d0d6
DK
9863 Output_file_header::do_size and call it.
9864 (Output_file_header::do_size): New method definition.
9865 (Output_data_group::Output_data_group): Adjust call to
9866 Output_section_data.
9867 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9868 (Output_symtab_xindex::do_write): Add array bound check.
2e702c99 9869 (Output_section::Input_section::print_to_mapfile): Handle
20e6d0d6
DK
9870 RELAXED_INPUT_SECTION_CODE.
9871 (Output_section::Output_section): Initialize data member checkpoint_.
9872 (Output_section::~Output_section): Delete checkpoint object pointed
9873 by checkpoint_.
9874 (Output_section::add_input_section): Always add an Input_section if
9875 relaxing.
9876 (Output_section::add_merge_input_section): Add assert.
9877 (Output_section::relax_input_section): New method definition.
9878 (Output_section::set_final_data_size): Set load address to zero for
9879 an unallocated section.
9880 (Output_section::do_address_and_file_offset_have_reset_values):
9881 New method definition.
9882 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9883 Handle relaxed input section.
9884 (Output_section::sort_attached_input_sections): Checkpoint input
9885 section list lazily.
9886 (Output_section::get_input_sections): Change type of input_sections to
9887 list of Simple_input_section pointers. Checkpoint input section list
9888 lazily. Also handle relaxed input sections.
9889 (Output_section::add_input_section_for_script): Take a reference to
9890 a Simple_input_section object instead of Relobj pointer and section
9891 index as parameter. Handle relaxed input sections.
9892 (Output_section::save_states, Output_section::restore_states): New
9893 method definitions.
9894 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9895 (Output_data::is_data_size_fixed): New method definition.
9896 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9897 if it is fixed.
9898 (Output_data::address_and_file_offset_have_reset_values): New method
9899 definition.
9900 (Output_data::do_address_and_file_offset_have_reset_values): New method
9901 definition.
9902 (Output_data::set_data_size): Check that data size is not fixed.
9903 (Output_data::fix_data_size): New method definition.
9904 (Output_data::is_data_size_fixed_): New data member.
9905 (Output_section_headers::set_final_data_size): New method definition.
9906 (Output_section_headers::do_size): New method declaration.
9907 (Output_segment_headers::set_final_data_size): New method definition.
9908 (Output_segment_headers::do_size): New method declaration.
9909 (Output_file_header::set_final_data_size)::New method definition.
9910 (Output_file_header::do_size)::New method declaration.
9911 (Output_section_data::Output_section_data): Add new parameter
9912 is_data_size_fixed and use it to fix data size.
9913 (Output_data_const::Output_data_const): Adjust call to base class
9914 constructor and fix data size.
9915 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9916 base class constructor and fix data size.
9917 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9918 base class constructor and fix data size.
9919 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9920 class constructor and fix data size.
9921 (Output_data_group::set_final_data_size): New method definition.
9922 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9923 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9924 class constructor and fix data size.
9925 (Output_relaxed_input_section): New class definition.
9926 (Output_section::Simple_input_section): New class definition.
9927 (Output_section::get_input_sections): Adjust parameter list.
9928 (Output_section::add_input_section_for_script): Same.
9929 (Output_section::save_states, Output_section::restore_states,
9930 Output_section::do_address_and_file_offset_have_reset_values,
9931 (Output_section::Input_section::Input_section): Handle
9932 RELAXED_INPUT_SECTION_CODE. Add new overload for
9933 Output_relaxed_input_section.
9934 (Output_section::Input_section::is_input_section,
9935 Output_section::Input_section::set_output_section): Handle relaxed
9936 input section.
9937 (Output_section::Input_section::is_relaxed_input_section,
9938 Output_section::Input_section::output_section_data,
9939 Output_section::Input_section::relaxed_input_section): New method
9940 definitions.
9941 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9942 value.
9943 (Output_section::Input_section::u1_): Update comments.
9944 (Output_section::Input_section::u2_): Add new union member poris.
9945 (Output_section::Checkpoint_output_section): New classs definition.
9946 (Output_section::relax_input_section): New method declaration.
9947 (Output_section::checkpoint_): New data member.
9948 (Output_segment): Update comments.
9949 (Output_segment::Output_segment): Un-privatize copy constructor.
9950 (Output_segment::operator=): Un-privatize.
9951 * script-sections.cc (Output_section_element::Input_section_list):
9952 Change element type to Output_section::Simple_input_section.
9953 (Output_section_element_dot_assignment::set_section_addresses):
9954 Register output section data for relaxation clean up.
9955 (Output_data_exression::Output_data_expression): Adjust call to base
9956 constructor to fix data size.
9957 (Output_section_element_data::set_section_addresses): Register
9958 Output_data_expression object for relaxation clean up.
9959 (struct Input_section_info): Replace Relobj pointer and section index
9960 pair with Output_section::Simple_input_section and Convert struct to a
9961 class.
9962 (Input_section_sorter::operator()): Adjust access to
e1df38aa 9963 Input_section_info data member to use accessors.
20e6d0d6
DK
9964 (Output_section_element_input::set_section_addresses): Use layout
9965 parameter. Adjust code to use Output_section::Simple_input_section
9966 and Input_secction_info classes. Register filler for relaxation
9967 clean up.
9968 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9969 and section index pair with Output_section::Simple_input_section
9970 class. Adjust code accordingly.
9971 (Phdrs_element::release_segment): New method definition.
9972 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9973 segment list.
9974 (Script_sections::release_segments): New method definition.
9975 * gold/script-sections.h (Script_sections::release_segments): New
9976 method declaration.
9977 * gold/target.h (Target::may_relax, Target::relax,
9978 Target::do_may_relax, Target::do_relax): New method definitions.
9979
5e445df6
ILT
99802009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9981
9982 * arm.cc (has_signed_unsigned_overflow): New function.
9983 (Arm_relocate_functions::abs8): New function.
9984 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9985 (Target_arm::Scan::global): Likewise.
9986 (Target_arm::relocate::relocate): Likewise.
9987 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9988 Likewise.
9989
8c604651 99902009-09-16 Cary Coutant <ccoutant@google.com>
72fef11a
CC
9991
9992 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9993 * testsuite/Makefile.in: Regenerate.
9994
1e9cc1c2
NC
99952009-09-11 Nick Clifton <nickc@redhat.com>
9996
9997 * po/gold.pot: Updated by the Translation project.
9998
6a89f575
CC
99992009-09-08 Cary Coutant <ccoutant@google.com>
10000
10001 * output.cc (Output_file::open): Add execute permission to empty file.
10002 * testsuite/Makefile.am (permission_test): New test.
10003 * testsuite/Makefile.in: Regenerate.
10004
fdcac5af
ILT
100052009-09-02 Ian Lance Taylor <iant@google.com>
10006
10007 * output.cc (Output_file::resize): Call map_no_anonymous rather
10008 than map.
10009
44453f85
ILT
100102009-09-01 Mikolaj Zalewski <mikolajz@google.com>
10011
10012 * gold.cc: Include "incremental.h".
10013 (queue_initial_tasks): Call Incremental_checker methods.
10014 * incremental.cc: Include "output.h".
10015 (Incremental_checker::can_incrementally_link_output_file): New
10016 method.
10017 * incremental.h (Incremental_checker): New class.
10018
10019 * output.cc (Output_file::open_for_modification): New method.
10020 (Output_file::map_anonymous): Changed return type to bool. Record
10021 map in base_ field.
10022 (Output_file::map_no_anonymous): New method, broken out of map.
10023 (Output_file::map): Use map_no_anonymous and map_anonymous.
10024 * output.h (class Output_file): Update declarations.
10025
293c1386
CC
100262009-08-24 Cary Coutant <ccoutant@google.com>
10027
10028 * options.h (Command_line::Pre_options): New class.
10029 (Command_line::pre_options): New member.
10030 * options.cc (gold::options::ready_to_register): New variable.
10031 (One_option::register_option): Do nothing if not registering options.
10032 Assert if same short option registered twice.
10033 (General_options::General_options): Turn off option registration when
10034 done constructing.
10035 (Command_line::Pre_options::Pre_options): New constructor.
10036
f773f3d2
CC
100372009-08-24 Cary Coutant <ccoutant@google.com>
10038
06a73cfe
CC
10039 * options.h (General_options::no_keep_memory): Remove incorrect
10040 short option.
f773f3d2 10041
a15af8e2
RW
100422009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10043
10044 * Makefile.am (am__skiplex, am__skipyacc): New.
10045 * Makefile.in: Regenerate.
10046
c462b41b
RW
100472009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10048
14ec8efd
RW
10049 * Makefile.am (AM_CPPFLAGS): Renamed from ...
10050 (INCLUDES): ... this.
10051 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10052 (AM_CPPFLAGS): Renamed from ...
10053 (INCLUDE): ... this.
10054 * Makefile.in, testsuite/Makefile.in: Regenerate.
10055
81ecdfbb
RW
10056 * Makefile.in: Regenerate.
10057 * aclocal.m4: Likewise.
10058 * config.in: Likewise.
10059 * configure: Likewise.
10060 * testsuite/Makefile.in: Likewise.
10061
c462b41b
RW
10062 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10063 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10064 * Makefile.in: Regenerate.
10065 * testsuite/Makefile.in: Regenerate.
10066
2da73f13
CC
100672009-08-19 Cary Coutant <ccoutant@google.com>
10068
10069 * resolve.cc (Symbol_table::resolve): Don't complain about defined
10070 symbols in shared libraries overridden by hidden or internal symbols
10071 in the main program.
10072
2db70501
CD
100732009-08-19 Chris Demetriou <cgd@google.com>
10074
10075 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10076 checking source file names in error messages.
10077
f733487b
DK
100782009-08-18 Doug Kwan <dougkwan@google.com>
10079
10080 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10081 an elcpp::Ehdr as parameter. Adjust call to set_target.
10082 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10083 an elfcpp::Ehdr as parameter.
10084 * object.cc (Object::set_target): Remove the version that looks up
10085 a target and sets it.
10086 (Sized_relobj::setup): Take a Target object instead of
10087 an elfcpp::Ehdr as parameter. Adjust call to set_target.
10088 (make_elf_sized_object): Find target and ask target to
10089 make an ELF object.
10090 * object.h: (Object::set_target): Remove the version that looks up
10091 a target and sets it.
10092 (Sized_relobj::setup): Take a Target object instead of
10093 an elfcpp:Ehdr as parameter.
10094 * target.cc: Include dynobj.h.
10095 (Target::do_make_elf_object_implementation): New.
2e702c99 10096 (Target::do_make_elf_object): New.
f733487b
DK
10097 * target.h (Target::make_elf_object): New template declaration.
10098 (Target::do_make_elf_object): New method declarations.
10099 (Target::do_make_elf_object_implementation): New template declaration.
10100
cc70f101
ILT
101012009-08-14 Ian Lance Taylor <iant@google.com>
10102
10103 * gold.h (FUNCTION_NAME): Define.
10104 (gold_unreachable): Use FUNCTION_NAME.
10105
ef5e0cb1
ST
101062009-08-12 Sriraman Tallam <tmsriram@google.com>
10107
10108 * icf.cc (Icf::find_identical_sections): Issue a warning when a
10109 symbol in the --keep-unique list is not found.
10110
48c187ce
ST
101112009-08-12 Sriraman Tallam <tmsriram@google.com>
10112
10113 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10114 been maked as --keep-unique.
10115 (Icf::unfold_section): New function.
10116 * icf.h (Icf::unfold_section): New function.
10117 * options.h (General_options::keep_unique): New option.
10118 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10119 * testsuite/Makefile.in: Regenerate.
10120 * testsuite/icf_keep_unique_test.sh: New file.
10121 * testsuite/icf_keep_unique_test.cc: New file.
10122
645afe0c
CC
101232009-08-12 Cary Coutant <ccoutant@google.com>
10124
10125 PR 10471
10126 * resolve.cc (Symbol_table::resolve): Check for references from
10127 dynamic objects to hidden and internal symbols.
10128 * testsuite/Makefile.am (hidden_test.sh): New test.
10129 * testsuite/Makefile.in: Regenerate.
10130 * testsuite/hidden_test.sh: New script.
10131 * testsuite/hidden_test_1.c: New test source.
10132 * testsuite/hidden_test_main.c: New test source.
10133
11af873f
DK
101342009-08-11 Doug Kwan <dougkwan@google.com>
10135
10136 * arm.cc: Update comments.
10137 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10138 segment to locate the .ARM.exidx section if present.
10139
b9f7d72d
DK
101402009-08-09 Doug Kwan <dougkwan@google.com>
10141
10142 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10143 patch.
10144
ddd3c53c
ST
101452009-08-07 Sriraman Tallam <tmsriram@google.com>
10146 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10147 compiler warnings.
10148
27721062
ST
101492009-08-06 Sriraman Tallam <tmsriram@google.com>
10150
10151 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10152 valid tls_segment only for non-debug-section relocations.
10153 * testsuite/Makefile.am: Add gc_tls_test.
10154 * testsuite/Makefile.in: Regenerate.
10155 * testsuite/gc_tls_test.cc: New file.
10156 * testsuite/gc_tls_test.sh: New file.
10157
ef15dade 101582009-08-05 Sriraman Tallam <tmsriram@google.com>
e1df38aa 10159
ef15dade
ST
10160 * icf.cc: New file.
10161 * icf.h: New file.
10162 * Makefile.am (CCFILES): Add icf.cc.
10163 (HFILES): Add icf.h
10164 * Makefile.in: Regenerate.
10165 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10166 * gc.h (gc_process_relocs): Populate lists used by icf to contain
10167 section, symbol and addend information for the relocs.
10168 * gold.cc (queue_middle_tasks): Call identical code folding.
10169 * gold.h: Add defines for multimap.
10170 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10171 to the call of finalize_local_symbols.
10172 * main.cc (main): Create object of class Icf.
10173 * object.cc (Sized_relobj::do_layout): Allow this function to be
10174 called twice during icf.
10175 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10176 to sections marked as identical by icf.
10177 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10178 when available.
10179 (Sized_relobj::do_section_entsize): New function.
10180 * object.h (Object::section_entsize): New function.
10181 (Object::do_section_entsize): New pure virtual function.
10182 (Relobj::finalize_local_symbols): Add new parameter.
10183 (Relobj::do_section_entsize): New function.
10184 * options.h (General_options::icf): New option.
10185 (General_options::icf_iterations): New option.
10186 (General_options::print_icf_sections): New option.
10187 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10188 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10189 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10190 icf.
10191 * symtab.cc (Symbol_table::is_section_folded): New function.
10192 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
10193 to sections marked as identical by icf.
10194 * symtab.h (Symbol_table::set_icf): New function.
10195 (Symbol_table::icf): New function.
10196 (Symbol_table::is_section_folded): New function.
10197 (Symbol_table::icf_): New data member.
10198 * target-reloc.h (relocate_section): Ignore sections folded by icf.
10199 * testsuite/Makefile.am: Add commands to build icf_test.
10200 * testsuite/Makefile.in: Regenerate.
10201 * testsuite/icf_test.sh: New file.
10202 * testsuite/icf_test.cc: New file.
10203
c3b65ac4
CD
102042009-07-24 Chris Demetriou <cgd@google.com>
10205
10206 * layout.cc (is_compressible_debug_section): Fix incorrect
10207 comment about compressed section names.
10208
1caf2c51
ILT
102092009-07-20 Ian Lance Taylor <ian@airs.com>
10210
10211 PR 10419
10212 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10213
1ef4d87f
ILT
102142009-07-16 Ian Lance Taylor <iant@google.com>
10215
10216 PR 10400
10217 * layout.h: #include <map>.
10218 (class Kept_section): Change from struct to class. Add accessors
10219 and setters. Add section size to Comdat_group mapping. Change
10220 Comdat_group to std::map. Add is_comdat_ field. Add
10221 linkonce_size field in union.
10222 (class Layout): Update declaration of find_or_add_kept_section.
10223 Don't declare find_kept_object.
10224 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10225 parameter. Add object, shndx, is_comdat, and is_group_name
10226 parameters. Change all callers. Adjust for new Kept_section.
10227 (Layout::find_kept_object): Remove.
10228 * object.cc (Sized_relobj::include_section_group): Update use of
10229 Kept_section. Rename secnum to shndx. Only record
10230 Kept_comdat_section if sections are the same size.
10231 (Sized_relobj::include_linkonce_section): Update use of
10232 Kept_section. Only record Kept_comdat_section if sections are the
10233 same size. Set size of linkonce section.
10234 (Sized_relobj::map_to_kept_section): Update call to
10235 get_kept_comdat_section.
10236 * object.h (class Sized_relobj): Rename fields in
10237 Kept_comdat_section to drop trailing underscores; change object
10238 field to Relobj*. Change Kept_comdat_section_table to store
10239 struct rather than pointer.
10240 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10241 Add kept_object and kept_shndx parameters. Change all callers.
10242 (Sized_relobj::get_kept_comdat_section): Change return type to
10243 bool. Add kept_object and kept_shndx parameters. Change all
10244 callers.
10245 * plugin.cc (Pluginobj::include_comdat_group): Update call to
10246 Layout::find_or_add_kept_section.
10247
37c3b7b0
ILT
102482009-07-09 Ian Lance Taylor <iant@google.com>
10249
10250 * merge.cc (Object_merge_map::initialize_input_to_output_map):
10251 Reserve space in the hash table.
10252
98fa85cb
ILT
102532009-07-06 Mikolaj Zalewski <mikolajz@google.com>
10254
10255 * fileread.cc (File_read::get_mtime): New method.
10256 * fileread.h (Timespec): New structure.
10257 (File_read::get_mtime): New method.
10258 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10259 Renamed from timestamp_nsec.
10260 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10261 Elf_Xword.
e1df38aa 10262 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
98fa85cb 10263 timestamp_nsec.
e1df38aa 10264 (Incremental_inputs::report_archive): Save mtime; style fix.
98fa85cb
ILT
10265 (Incremental_inputs::report_obejct): Save mtime; style fix.
10266 (Incremental_inputs::report_script): Save mtime; style fix.
10267 (Incremental_inputs::finalize_inputs): Style fix.
10268 (Incremental_inputs::finalize): Style fix.
10269 (Incremental_inputs::create_input_section_data): Store inputs
10270 mtime.
10271 * incremental.h (Incremental_inputs::report_script): Add mtime
10272 argument.
10273 (Incremental_inputs::Input_info::Input_info): Intialize only one
10274 union member.
10275 (Incremental_inputs::Input_info::archive): Move to nameless
10276 union.
10277 (Incremental_inputs::Input_info::obejct): Move to nameless union.
10278 (Incremental_inputs::Input_info::script): Move to nameless union.
10279 (Incremental_inputs::mtime): New field.
10280 * script.cc (read_input_script): Pass file mtime to
10281 Incremental_input.
10282 * script.h (Script_info::inputs): Style fix.
10283
c9d70757
ILT
102842009-07-01 Ian Lance Taylor <ian@airs.com>
10285
10286 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10287 instead of 32.
10288
9c547ec3
ILT
102892009-06-24 Ian Lance Taylor <iant@google.com>
10290
10291 PR 10156
10292 * layout.cc (Layout::choose_output_section): If we find an
10293 existing section, update the flags.
10294 (Layout::create_notes): New function, broken out of
10295 Layout::finalize.
10296 (Layout::finalize): Don't create note sections.
10297 (Layout::create_note): Don't crash if linker script discards
10298 section.
10299 (Layout::create_gold_note): Likewise.
10300 (Layout::create_build_id): Likewise. Don't set
10301 after_input_sections on the section.
10302 (Layout::create_executable_stack_info): Remove target parameter.
10303 Change caller.
10304 * layout.h (class Layout): Declare create_notes. Update
10305 declaration of create_executable_stack_info.
10306 * gold.cc (queue_middle_tasks): Call create_notes.
10307 * output.cc (Output_section::update_flags_for_input_section): Move
10308 here from output.h. If SHF_ALLOC flag is newly set, mark address
10309 invalid.
10310 * output.h (Output_data::mark_address_invalid): New function.
10311 (class Output_section): Only declare, not define,
10312 update_flags_for_input_section. Remove set_flags.
10313
55458500
ILT
103142009-06-24 Ian Lance Taylor <iant@google.com>
10315
10316 * script-sections.cc (Output_section_definition::
10317 set_section_addresses): Rename shadowing local load_address to
10318 laddr.
10319
1307d6cd
ILT
103202009-06-24 Ian Lance Taylor <iant@google.com>
10321
10322 PR 10244
10323 * reloc.cc (relocate_sections): Skip empty relocation sections.
10324
ec3f783e
ILT
103252009-06-23 Ian Lance Taylor <iant@google.com>
10326
10327 PR 10156
10328 * layout.cc (Layout::create_note): Use choose_output_section
10329 rather than make_output_section.
10330
459c9f1c
ILT
103312009-06-23 Ian Lance Taylor <iant@google.com>
10332
10333 PR 10237
10334 * options.cc (General_options::parse_V): Set printed_version_.
10335 (General_options::General_options): Initialize printed_version_.
10336 * options.h (class General_options): Add printed_version_ field.
10337 * gold.cc (queue_initial_tasks): If there are no input files,
10338 don't give a fatal error if we printed the version information.
10339 (queue_middle_tasks): If using -r with a shared object, give a
10340 fatal error rather than an ordinary error.
10341
1518dc8f
ILT
103422009-06-23 Ian Lance Taylor <iant@google.com>
10343
10344 PR 10219
10345 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10346 (Layout::make_output_section): Set have_stabstr_section_ if we see
10347 a .stab*str section.
10348 (Layout::finalize): Call link_stabs_sections.
10349 (Layout::link_stabs_sections): New file.
10350 * layout.h (class Layout): Add have_stabstr_section_ field.
10351 Declare link_stabs_sections.
10352
3d857b98
DK
103532009-06-23 Doug Kwan <dougkwan@google.com>
10354
10355 * Makefile.am (libgold_a_LIBADD): New.
10356 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
2e702c99 10357 * Makefile.in: Regenerate.
3d857b98
DK
10358 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10359 * configure: Regenerate.
10360 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10361 * fileread.cc: Include sys/state.h
10362 * gold.h: Declare memmem and strndup if found missing.
10363 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10364
0639a6f6
ILT
103652009-06-23 Ian Lance Taylor <iant@google.com>
10366
10367 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10368 * configure: Rebuild.
10369
8d63875c
ILT
103702009-06-23 Ian Lance Taylor <iant@google.com>
10371
10372 PR 10147
10373 * object.cc (Object::section_contents): Don't try to get a view if
10374 the section has length zero.
10375 (Object::handle_gnu_warning_section): If the section is empty, use
10376 the name of the section as the warning.
10377
f7c8a183
ILT
103782009-06-23 Ian Lance Taylor <iant@google.com>
10379
10380 PR 10133
10381 * stringpool.h (class Stringpool_template): Add optimize_ field.
10382 (Stringpool_template::set_optimize): New function.
10383 * stringpool.cc (Stringpool_template::Stringpool_template):
10384 Initialize optimize_ field.
10385 (Stringpool_template::set_string_offsets): Test local optimize
10386 fild rather than parameter.
10387 * layout.cc (Layout::Layout): Call set_optimize on the section
10388 name stringpool.
10389
e6a307ba
ILT
103902009-06-22 Ian Lance Taylor <iant@google.com>
10391
10392 PR 10030
10393 * yyscript.y: Parse TARGET.
10394 * script.cc (script_set_target): New function.
10395 * script-c.h (script_set_target): Declare.
10396 * options.cc (General_options::string_to_object_format): Rename
10397 from string_to_object_format in anonymous namespace. Change
10398 callers.
10399 * options.h (class General_options): Declare
10400 string_to_object_format.
10401
3ee173de
ILT
104022009-06-22 Ian Lance Taylor <iant@google.com>
10403
10404 * script-sections.cc (Script_sections::create_segments): Don't put
10405 program headers in a PT_LOAD segment if -n or -N.
10406
104072009-06-22 Ian Lance Taylor <iant@google.com>
e1c74d60
ILT
10408
10409 PR 10141
10410 * options.h (class General_options): Add -z lazy and -z now. Sort
10411 -z options into alphabetical order.
10412 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10413
cd6739a1 104142009-06-21 Ian Lance Taylor <iant@google.com>
8a5e3e08
ILT
10415
10416 * layout.cc (Layout::make_output_section): Call
10417 Target::new_output_section.
10418 (Layout::attach_allocated_section_to_segment): Put large section
10419 sections in a separate load segment with the large segment flag
10420 set.
10421 (Layout::segment_precedes): Sort large data segments after other
10422 load segments.
10423 (align_file_offset): New static function.
10424 (Layout::set_segment_offsets): Use align_file_offset.
10425 * output.h (class Output_section): Add is_small_section_ and
10426 is_large_section_ fields.
10427 (Output_section::is_small_section): New function.
10428 (Output_section::set_is_small_section): New function.
10429 (Output_section::is_large_section): New function.
10430 (Output_section::set_is_large_section): New function.
10431 (Output_section::is_large_data_section): New function.
10432 (class Output_segment): Add is_large_data_segment_ field.
10433 (Output_segment::is_large_data_segment): New function.
10434 (Output_segment::set_is_large_data_segment): New function.
10435 * output.cc (Output_section::Output_section): Initialize new
10436 fields.
10437 (Output_segment::Output_segment): Likewise.
10438 (Output_segment::add_output_section): Add assertion that large
10439 data sections always go in large data segments. Force small data
10440 sections to the end of the list of data sections. Force small BSS
10441 sections to the start of the list of BSS sections. For large BSS
10442 sections to the end of the list of BSS sections.
10443 * symtab.h (class Symbol): Declare is_common_shndx.
10444 (Symbol::is_defined): Check Symbol::is_common_shndx.
10445 (Symbol::is_common): Likewise.
10446 (class Symbol_table): Define enum Commons_section_type. Update
10447 declarations. Add small_commons_ and large_commons_ fields.
10448 * symtab.cc (Symbol::is_common_shndx): New function.
10449 (Symbol_table::Symbol_table): Initialize new fields.
10450 (Symbol_table::add_from_object): Put small and large common
10451 symbols in the right list.
10452 (Symbol_table::sized_finalized_symbol): Check
10453 Symbol::is_common_shndx.
10454 (Symbol_table::sized_write_globals): Likewise.
10455 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10456 common symbol lists. Don't call do_allocate_commons_list if the
10457 list is empty.
10458 (Symbol_table::do_allocate_commons_list): Remove is_tls
10459 parameter. Add comons_section_type parameter. Change all
10460 callers. Handle small and large common symbols.
10461 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10462 Symbol::is_common_shndx.
10463 * resolve.cc (symbol_to_bits): Likewise.
10464 * target.h (Target::small_common_shndx): New function.
10465 (Target::small_common_section_flags): New function.
10466 (Target::large_common_shndx): New function.
10467 (Target::large_common_section_flags): New function.
10468 (Target::new_output_section): New function.
10469 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10470 small_common_section_flags, and large_common_section_flags
10471 fields.
10472 (Target::do_new_output_section): New virtual function.
10473 * arm.cc (Target_arm::arm_info): Initialize new fields.
10474 * i386.cc (Target_i386::i386_info): Likewise.
10475 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10476 Likewise.
10477 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10478 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10479 (Target_x86_64::do_new_output_section): New function.
10480 * configure.ac: Define conditional MCMODEL_MEDIUM.
10481 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10482 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10483 (large_LDFLAGS): Define.
10484 * testsuite/large.c: New file.
10485 * testsuite/testfile.cc (Target_test::test_target_info):
10486 Initialize new fields.
10487 * configure, testsuite/Makefile.in: Rebuild.
10488
bb04269c
DK
104892009-06-05 Doug Kwan <dougkwan@google.com>
10490
10491 * Makefile.am (CCFILES): Add target.cc.
e1df38aa 10492 * Makefile.in: Regenerate.
bb04269c
DK
10493 * i386.cc (class Target_i386): Define new virtual method to
10494 override do_is_local_label_name in parent.
10495 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10496 local symbols if --discard-locals or -X is given.
10497 * options.h (class General_options): Declare new options
10498 '--discard-locals' and '-X' for discarding locals.
10499 * target.h (class Target): Define new methods is_local_label_name.
10500 Declare new virtual method do_is_local_label_name.
10501 * target.cc: New file.
10502 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10503 (check_SCRIPTS): Add discard_locals_test.sh.
10504 (check_DATA): Add discard_local_tests.syms.
10505 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10506 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10507 * testsuite/Makefile.in: Regenerate.
10508 * testsuite/discard_locals_test.c: New file.
10509 * testsuite/discard_locals_test.sh: Same.
10510
805bb01c
DK
105112009-06-05 Doug Kwan <dougkwan@google.com>
10512
10513 * object.cc (Sized_relobj::Sized_relobj): Initialize
10514 discarded_eh_frame_shndx_ to -1U.
10515 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10516 section.
10517 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10518 a discarded .eh_frame section.
10519 (Sized_relobj::do_finalize_local_symbols): Ditto.
10520 * object.h (class Sized_relobj): Declare new member
10521 discarded_eh_frame_shndx_.
10522 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10523 (local_labels_test.o, local_labels_test): New rules.
10524 * testsuite/Makefile.in: Regenerate.
10525
1dcd334d
DK
105262009-06-04 Doug Kwan <dougkwan@google.com>
10527
10528 * layout.cc (Layout::section_name_mapping): Add mapping for
10529 special ARM sections.
10530
96d49306
DK
105312009-06-03 Doug Kwan <dougkwan@google.com>
10532
10533 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10534 (utils::has_overflow): Same.
10535
dff16297
ILT
105362009-06-03 Ian Lance Taylor <iant@google.com>
10537
10538 * layout.cc (Layout::section_name_mapping): New array, replacing
10539 Layout::linkonce_mapping.
10540 (Layout::section_name_mapping_count): New variable, replacing
10541 Layout::linkonce_mapping_count.
10542 (Layout::linkonce_output_name): Remove.
10543 (Layout::output_section_name): Rewrite.
10544 * layout.h (class Layout): Rename Linkonce_mapping to
10545 Section_name_mapping, linkonce_mapping to section_name_mapping,
10546 linkonce_mapping_count to section_name_mapping_count. Don't
10547 declare linkonce_output_name.
10548
c121c671
DK
105492009-06-03 Doug Kwan <dougkwan@google.com>
10550
10551 * gold/arm.cc (namespace utils): New.
10552 (Target_arm::reloc_is_non_pic): Define new method.
10553 (class Arm_relocate_functions): New.
10554 (Target_arm::Relocate::relocate): Handle relocation types used by
10555 Android.
10556
07800fab
ILT
105572009-06-03 Ian Lance Taylor <iant@google.com>
10558
10559 * arm.cc (Target_arm::scan::global): Use || instead of |.
10560
c121c671
DK
105612009-06-02 Doug Kwan <dougkwan@google.com>
10562
10563 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
10564 issued_non_pic_error_.
10565 (class Target_arm::Scan): Declare new method check_non_pic.
10566 Define new method symbol_needs_plt_entry.
10567 Declare new data member issued_non_pic_error_.
10568 (class Target_arm::Relocate): Declare new method
10569 should_apply_static_reloc.
10570 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10571 (Target_arm::Scan::check_non_pic): Define new method.
10572 (Target_arm::Scan::local): Handle a small subset of reloc types used
10573 by Android.
10574 (Target_arm::Scan::local): Same.
10575 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10576
b19b0c6d
ILT
105772009-05-31 Mikolaj Zalewski <mikolajz@google.com>
10578
10579 * incremental.cc (Incremental_inputs::report_command_line): Filter
10580 out --incremental-* options.
10581
94cdfcff
DK
105822009-05-29 Doug Kwan <dougkwan@google.com>
10583
10584 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10585 template class.
10586 (class Target_arm): Update comment.
10587 (Target_arm::Target_arm): Initialize new data members GOT_,
10588 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10589 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10590 and Target_arm::rel_dyn_section.
10591 Declare new_enum Target_arm::Got_type.
10592 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10593 and DYNBSS_.
10594 Update commments for member do_dynsym_value.
10595 (Target_arm::got_size, Target_arm::plt_section,
10596 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10597 new methods inside class defintion.
10598 (Target_arm::got_section): Define new method.
10599 (Target_arm::rel_dyn_section): Same.
10600 (Output_data_plt_arm): New template class.
10601 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10602 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10603 (Output_data_plt_arm::add_entry): Same.
10604 (Output_data_plt_arm::first_plt_entry): Define new
10605 static data member for PLT instruction template.
10606 (Output_data_plt_arm::plt_entry): Same.
10607 (Output_data_plt_arm::do_write): Define new method.
10608 (Target_arm::make_plt_entry): Same.
10609 (Target_arm::do_finalize_sections): Same.
10610 (Target_arm::do_dynsym_value): Same.
10611
4a657b0d
DK
106122009-05-28 Doug Kwan <dougkwan@google.com>
10613
10614 * Makefile.am (TARGETSOURCES): Add arm.cc.
10615 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10616 * Makefile.in: Regenerate.
10617 * arm.cc: New file.
10618 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10619
e7ae8c36
DK
106202009-05-26 Doug Kwan <dougkwan@google.com>
10621
10622 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10623 (General_options::check_excluded_libs): Strip off directories in
10624 archive name before matching like GNU ld does.
10625 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10626 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10627 (exclude_libs_test_LDFLAGS): Add linker option
10628 -Wl,--exclude-libs,libexclude_libs_test_3
10629 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10630 an explicit archive without using -l.
10631 (alt/libexclude_libs_test_3.a): New make rule.
10632 * testsuite/Makefile.in: Regenerate.
10633 * testsuite/exclude_libs_test.c : Declare lib3_default().
10634 (main): Call it.
10635 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10636 * exclude_libs_test_3.c: New file.
10637
f12e7348
NC
106382009-05-26 Nick Clifton <nickc@redhat.com>
10639
10640 * po/id.po: New Indonesian translation.
10641 * po/gold.pot: Updated template file.
10642
4daadc0d
ST
106432009-05-22 Sriraman Tallam <tmsriram@google.com>
10644
e1df38aa 10645 * testsuite/Makefile.am: Add -ffunction-sections to compile
4daadc0d
ST
10646 gc_comdat_test files. Add -Wl,--gc-sections to build
10647 gc_comdat_test.
10648 * testsuite/Makefile.in: Regenerate.
10649 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10650
531813ad
ST
106512009-05-21 Sriraman Tallam <tmsriram@google.com>
10652
10653 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10654 kept comdat section was garbage collected.
10655 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10656 * testsuite/Makefile.in: Regenerate.
10657 * testsuite/gc_comdat_test.sh: New file.
10658 * testsuite/gc_comdat_test_1.cc: New file.
10659 * testsuite/gc_comdat_test_2.cc: New file.
10660
65514900
CC
106612009-05-19 Doug Kwan <dougkwan@google.com>
10662
10663 * archive.cc (Archive::Archive): Move constructor from archive.h
10664 to here. Initialize no_export_.
10665 (Archive::get_elf_object_for_member): Set no_export flag of object.
10666 * archive.h (Archive::Archive): Move constructor body to
10667 archive.cc.
10668 (Archive::no_export): New method.
10669 (Archive::no_export_): New field.
10670 * object.h (Object::Object): Initialize no_export_ to false.
10671 (Object::no_export, Object::set_no_export): New methods.
10672 (Object::no_export_): New field.
10673 * options.cc (General_options::parse_exclude_libs): New method.
10674 (General_options::check_excluded_libs) Same.
10675 * options.h (exclude_libs): New option.
10676 (General_options::check_excluded_libs): New method declaration.
10677 (General_options::excluded_libs_): New field.
10678 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10679 default or protected visibility if an object has no-export flag set.
10680 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10681 (check_SCRIPTS): Add exclude_libs_test.sh.
10682 (check_DATA): Add exclude_libs_test.syms.
10683 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10684 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10685 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10686 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10687 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10688 libexclude_libs_test_2.a): New rules.
10689 * testsuite/Makefile.in: Regenerate.
10690 * testsuite/exclude_libs_test.c: New file.
10691 * testsuite/exclude_libs_test.sh: Ditto.
10692 * testsuite/exclude_libs_test_1.c: Ditto.
10693 * testsuite/exclude_libs_test_2.c: Ditto.
10694
1b77ea50
ILT
106952009-05-15 Ian Lance Taylor <iant@google.com>
10696
10697 * configure.ac: Check for declarations for cases where libiberty.h
10698 checks HAVE_DECL_xxx.
10699 * configure, config.in: Rebuild.
10700
072fe7ce
ILT
107012009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10702
10703 * gold.h (Incremental_argument_list): Remove (invalid) forward
10704 declaration.
10705 * incremental.cc (Incremental_inputs::report_achive): New method.
10706 (Incremental_inputs::report_object): New method.
10707 (Incremental_inputs::report_script): New method.
10708 (Incremental_inputs::finalize_inputs): New method.
10709 (Incremental_inputs::finalize): Call finalize_inputs().
10710 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10711 Create inputs entries.
10712 * incremental.h (Incremental_input_type): New enum.
10713 (Incremental_inputs::Incremental_input): Initialize new fields.
10714 (Incremental_inputs::report_inputs): New method.
10715 (Incremental_inputs::report_achive): New method.
10716 (Incremental_inputs::report_object): New method.
10717 (Incremental_inputs::report_script): New method.
10718 (Incremental_inputs::finalize_inputs): New method.
10719 (Incremental_inputs::Input_info): New struct.
10720 (Incremental_inputs::Input_info_map): New typedef.
10721 (Incremental_inputs::lock_): New field.
10722 (Incremental_inputs::Inputs_): New field.
10723 (Incremental_inputs::Inputs_map): New field.
10724 * main.cc (main): Call Incremental_input::report_inputs.
10725 * options.h (Input_argument_list): Typedef moved from
10726 Input_arguments.
10727 (Input_file_group::Files): Remove, use ::Input_argument_list.
10728 (Input_file_group::Input_argument_list): Remove, use
10729 ::Input_argument_list.
10730 * plugin.cc (Plugin_manager::add_input_file): Add error in
10731 incremental build.
10732 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10733 functions.
10734 * script.cc (read_input_script): Call
10735 Incremental_input::report_script.
10736 * script.h (Script_info): New class.
10737
b0481b0b
ILT
107382009-04-27 Ian Lance Taylor <iant@google.com>
10739
10740 * x86_64.cc (do_adjust_output_section): Set entsize to
10741 plt_entry_size.
10742
b22a5a41 107432009-04-23 Elliott Hughes <enh@google.com>
6d1e3092
CD
10744
10745 * output.cc (Output_file::close): After short writes, continue
10746 writing from the correct offset in the buffer being written.
10747
40fde488
CD
107482009-04-23 Chris Demetriou <cgd@google.com>
10749
10750 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10751 * configure: Regenerate.
10752 * config.in: Regenerate.
10753 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10754 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10755
3ce2c28e
ILT
107562009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10757
10758 * incremental.cc (Incremental_inputs_header_data): Renamed from
10759 Incremental_input_header_data.
10760 (Incremental_inputs_header_data::data_size): New field.
10761 (Incremental_inputs_header_data::put_input_file_count): Renamed
10762 from input_file_count.
10763 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10764 from command_line_offset.
10765 (Incremental_inputs_header_data::put_reserved): Renamed from
10766 put_reserved.
10767 (Incremental_inputs_entry_data): Renamed from
10768 Incremental_input_entry_data.
10769 (Incremental_inputs_entry_data::data_size): New field.
10770 (Incremental_inputs::report_command_line): New method.
10771 (Incremental_inputs::finalize): New method.
10772 (Incremental_inputs::create_incremental_inputs_data): New method.
10773 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10774 * incremental.h: New file.
10775 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
703d02da 10776 (Layout::finalize): Create incremental inputs section in
3ce2c28e 10777 incremental builds.
703d02da 10778 (Layout::create_incremental_info_sections): New method.
3ce2c28e 10779 * layout.h (Layout::incremental_inputs): New method.
703d02da
AM
10780 (Layout::create_incremental_info_sections): New method.
10781 (Layout::incremental_inputs_): New field.
3ce2c28e
ILT
10782 * main.cc (main): Notify Incremental_input of the command line.
10783
e55bde5e
ILT
107842009-04-01 Ian Lance Taylor <iant@google.com>
10785 Mikolaj Zalewski <mikolajz@google.com>
10786
10787 * gold.h (reserve_unordered_map): Define, three versions, one for
10788 each version of Unordered_map.
10789 * layout.cc (Layout::Layout): Remove options parameter. Add
10790 number_of_input_files parameter. Don't initialize options_.
10791 Initialize number_of_input_files_ and resized_signatures_. Move
10792 sections_are_attached_.
10793 (Layout::layout_group): Reserve space for group_signatures_.
10794 (Layout::find_or_add_kept_section): Change name parameter to be a
10795 reference. Resize signatures_ map when it gets large enough.
10796 (Layout::layout_eh_frame): Use parameters->options() instead of
10797 this->options_.
10798 (Layout::make_output_section): Likewise.
10799 (Layout::attach_allocated_section_to_segment): Likewise.
10800 (Layout::finalize, Layout::create_executable_stack): Likewise.
10801 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10802 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10803 * layout.h (class Layout): Update declarations. Remove options_
10804 field. Add number_of_input_files_ and resized_signatures_
10805 fields. Move sections_are_attached_ field.
10806 * main.cc (main): Pass number of input files to Layout
10807 constructor. Don't pass options.
10808
154b857c
ILT
108092009-03-30 Ian Lance Taylor <iant@google.com>
10810
10811 * ffsll.c (ffsll): Correct implementation.
10812
2f35ab9b
ILT
108132009-03-27 Ian Lance Taylor <iant@google.com>
10814
fd03461a
ILT
10815 * ffsll.c: New file.
10816 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10817 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10818 * ftruncate.c (ftruncate): Declare before definition.
10819 * mremap.c (mremap): Likewise.
10820 * pread.c (pread): Likewise.
10821 * configure, Makefile.in, config.in: Rebuild.
10822
2f35ab9b
ILT
10823 * mremap.c: New file.
10824 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10825 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10826 (mremap): Declare if HAVE_MREMAP is not defined.
10827 * configure, Makefile.in, config.in: Rebuild.
10828
33aea2fd
CC
108292009-03-27 Cary Coutant <ccoutant@google.com>
10830
10831 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10832 position independent.
10833 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10834 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10835
6d479619
CC
108362009-03-24 Cary Coutant <ccoutant@google.com>
10837
10838 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10839 an executable.
10840 (needs_dynamic_reloc): Likewise.
10841
afc06bb8
ILT
108422009-03-24 Ian Lance Taylor <iant@google.com>
10843
10844 * yyscript.y (file_cmd): Recognize EXTERN.
10845 (extern_name_list, extern_name_list_body): New nonterminals.
10846 * script.cc (script_add_extern): Define.
10847 * script-c.h (script_add_extern): Declare.
10848
f6060a4d
ILT
108492009-03-24 Rafael Avila de Espindola <espindola@google.com>
10850
10851 * object.cc (is_elf_object): Define.
10852 * object.h (is_elf_object): Declare.
10853 * archive.cc (Archive::get_elf_object_for_member): Call
10854 is_elf_object.
33aea2fd 10855 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
f6060a4d 10856
26736d8e
ILT
108572009-03-24 Elliott Hughes <enh@google.com>
10858
10859 * output.cc (Output_file::map_anonymous): Define.
10860 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10861 try an anonymous one. Report the size if the mmap fails.
10862 * output.h (class Output_file): Declare map_anonymous.
10863
22fd9730
ILT
108642009-03-24 Ian Lance Taylor <iant@google.com>
10865
10866 * target-select.cc (instantiate_target): Don't acquire the lock if
10867 the instantiated_target_ field has already been set.
10868
cb010894
ILT
108692009-03-23 Ian Lance Taylor <iant@google.com>
10870
7f055c20
ILT
10871 * gold-threads.h (class Initialize_lock): Define.
10872 * gold-threads.cc (class Initialize_lock_once): Define.
10873 (initialize_lock_control): New static variable.
10874 (initialize_lock_pointer): New static variable.
10875 (initialize_lock_once): New static function.
10876 (Initialize_lock::Initialize_lock): Define.
10877 (Initialize_lock::initialize): Define.
10878 * target-select.h: Include "gold-threads.h".
10879 (class Target_selector): Add lock_ and initialize_lock_ fields.
10880 Don't define instantiate_target, just declare it.
10881 * target-select.cc (Target_selector::Target_selector): Initialize
10882 new fields.
10883 (Target_selector::instantiate_target): Define.
10884 * descriptors.h: Include "gold-threads.h".
10885 (class Descriptors): Add initialize_lock_ field.
10886 * descriptors.cc (Descriptors::Descriptors): Initialize new
10887 field.
10888 (Descriptors::open): Use initialize_lock_ field
10889 * errors.h (class Errors): Add initialize_lock_ field.
10890 * errors.cc (Errors::Errors): Initialize new field.
10891 (Errors::initialize_lock): Use initialize_lock_ field.
10892 * powerpc.cc (class Target_selector_powerpc): Remove
10893 instantiated_target_ field. In do_recognize call
10894 instantiate_target rather than do_instantiate_target. In
10895 do_instantiate_target just allocate a new target.
10896 * sparc.cc (class Target_selector_sparc): Likewise.
10897
36959681
ILT
10898 * freebsd.h: New file.
10899 * i386.cc: Include "freebsd.h".
10900 (Target_i386): Derive from Target_freebsd rather than
10901 Sized_target.
10902 (Target_selector_i386): Derive from Target_selector_freebsd rather
10903 than Target_selector.
10904 * x86_64.cc: Include "freebsd.h".
10905 (Target_x86_64): Derive from Target_freebsd rather than
10906 Sized_target.
10907 (Target_selector_x86_64): Derive from Target_selector_freebsd
10908 rather than Target_selector.
10909 * target.h (class Target): Add adjust_elf_header and
10910 do_adjust_elf_header.
10911 * output.cc (Output_file_header:: do_sized_write): Call target
10912 adjust_elf_header routine.
10913 * configure.tgt: Set targ_osabi.
10914 * configure.ac: Define GOLD_DEFAULT_OSABI.
10915 * parameters.cc (Parameters::default_target): Pass
10916 GOLD_DEFAULT_OSABI to select_target.
10917 * target-select.h (class Target_selector): Make instantiate_target
10918 protected rather than private.
10919 * Makefile.am (HFILES): Add freebsd.h.
10920 * configure, Makefile.in, config.in: Rebuild.
10921
cb010894
ILT
10922 * merge.cc (do_add_input_section): Correct pend value. Change
10923 message about last entry not being null terminated from error to
10924 warning.
10925
0e879927
ILT
109262009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10927
10928 * incremental.cc: New file.
10929 * Makefile.am (CCFILES): Add incremental.cc.
10930 * Makefile.in: Rebuild.
10931
41105937
PP
109322009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10933
10934 * layout.cc (Layout::output_section_name): Preserve names
10935 of '.note.' sections.
e1df38aa 10936
60439920
ILT
109372009-03-19 Ian Lance Taylor <iant@google.com>
10938
10939 * descriptors.cc (Descriptors::open): Check that the options are
10940 valid before using them.
10941
0d371ad3
ILT
109422009-03-18 Ian Lance Taylor <iant@google.com>
10943
10944 * script-sections.h: Include <list>.
10945 (class Script_sections): Change Sections_elements from std::vector
10946 to std::list. Typedef public Elements_iterator. Add
10947 orphan_section_placement_, data_segment_align_start_, and
10948 saw_data_segment_align_ fields. Remove data_segment_align_index_
10949 field.
10950 * script-sections.cc (class Orphan_section_placement): New class.
10951 (class Sections_element): Add virtual functions is_relro and
10952 orphan_section_init. Remove virtual function place_orphan_here.
10953 (class Output_section_definition): Add is_relro and
10954 orphan_section_init. Remove place_orphan_here.
10955 (class Orphan_output_section): Likewise.
10956 (Script_sections::Script_sections): Update for field changes.
10957 (Script_sections::data_segment_align): Set saw_data_segment_align_
10958 and data_segment_align_start_, not data_segment_align_index.
10959 (Script_sections::data_segment_relro_end): Check
10960 saw_data_segment_align_. Use data_segment_align_start_ rather
10961 than data_segment_align_index_.
10962 (Script_sections::place_orphan): Rewrite to use
10963 Orphan_section_placement.
10964
9201d894
ILT
109652009-03-17 Ian Lance Taylor <iant@google.com>
10966
9c5b8369
ILT
10967 * archive.cc (Archive::add_symbols): Check for a version attached
10968 to the symbol name in the archive map.
10969 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10970 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10971 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10972 (ver_test_11.a): New target.
10973 * testsuite/Makefile.in: Rebuild.
10974
9201d894
ILT
10975 * configure.ac: Check for chsize and posix_fallocate. Replace
10976 ftruncate.
10977 * ftruncate.c: New file, from gnulib.
10978 * output.cc (posix_fallocate): Define dummy version if not
10979 HAVE_POSIX_FALLOCATE.
10980 (Output_file::map): Call posix_fallocate rather than lseek and
10981 write.
10982 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10983 * configure, Makefile.in, config.in: Rebuild.
10984
ef4ab7a8 109852009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
e1df38aa 10986
ef4ab7a8
PP
10987 * layout.h (Layout::create_note): Add section_name parameter.
10988 * layout.cc (Layout::create_note): Likewise.
10989 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
e1df38aa 10990
8c500701
ILT
109912009-03-17 Ian Lance Taylor <iant@google.com>
10992
e85b18e1
ILT
10993 * descriptors.cc: Include "options.h".
10994 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10995 (Descriptors::open): Always use O_CLOEXEC when opening a new
10996 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10997 then set FD_CLOEXEC.
10998
9efe6174
ILT
10999 * sparc.cc (class Target_sparc): Add has_got_section.
11000 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11001 make sure we have a GOT section.
11002
11003 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11004 (Target_sparc::Scan::local): Likewise.
11005 (Target_sparc::Scan::global): Likewise.
11006 (Target_sparc::Relocate::relocate): Likewise.
11007 (Target_sparc::Relocate::relocate_tls): Likewise.
11008
8c500701
ILT
11009 * symtab.cc (Symbol_table::define_default_version): New function,
11010 broken out of add_from_object.
11011 (Symbol_table::add_from_object): Call define_default_version.
11012 (Symbol_table::define_special_symbol): Add resolve_oldsym
11013 parameter. Change all callers. If the version for a symbol comes
11014 from a version script, resolve it with the symbol with the same
11015 name with no version. Also add the symbol without a version if
11016 appropriate.
11017 (do_define_in_output_data): If resolving with oldsym, don't delete
11018 sym.
11019 (do_define_in_output_segment): Likewise.
11020 (do_define_as_constant): Likewise.
11021 * symtab.h (class Symbol_table): Update declarations.
11022
f1ed28fb
ILT
110232009-03-13 Ian Lance Taylor <iant@google.com>
11024
15f8229b
ILT
11025 * readsyms.cc (Read_symbols::incompatible_warning): New function.
11026 (Read_symbols::requeue): New function.
11027 (Read_symbols::do_read_symbols): If make_elf_object fails because
11028 the target type is not configured, and the file was searched for,
11029 issue a warning and retry with the next directory.
11030 (Add_symbols::run): If the file has an incompatible format, and
11031 it was searched for, requeue the Read_symbols task. On error,
11032 release the object.
11033 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
11034 dirindex parameter to constructor. Change all callers. Declare
11035 incompatible_warning and requeue.
11036 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11037 input_argument_ and input_group_ fields. Add them to
11038 constructor. Change all callers.
11039 (class Read_script): Add dirindex_ field. Add it to constructor.
11040 Change all callers.
11041 * archive.cc (Archive::setup): Remove input_objects parameter.
11042 Change all callers.
11043 (Archive::get_file_and_offset): Likewise.
11044 (Archive::read_all_symbols): Likewise.
11045 (Archive::read_symbols): Likewise.
11046 (Archive::get_elf_object_for_member): Remove input_objects
11047 parameter. Add punconfigured parameter. Change all callers.
11048 (Archive::add_symbols): Change return type to bool. Check return
11049 value of include_member.
11050 (Archive::include_all_members): Likewise.
11051 (Archive::include_member): Change return type to bool. Return
11052 false if first included object has incompatible target. Set
11053 included_member_ field.
11054 (Add_archive_symbols::run): If add_symbols returns false, requeue
11055 Read_symbols task.
11056 * archive.h (class Archive): Add included_member_ field.
11057 Initialize it in constructor. Add input_file and searched_for
11058 methods. Update declarations.
11059 (class Add_archive_symbols): Add dirpath_, dirindex_, and
11060 input_argument_ fields. Add them to constructor. Change all
11061 callers.
11062 * script.cc: Include "target-select.h".
11063 (class Parser_closure): Add skip_on_incompatible_target_ and
11064 found_incompatible_target_ fields. Add
11065 skip_on_incompatible_target parameter to constructor. Change all
11066 callers. Add methods skip_on_incompatible_target,
11067 clear_skip_on_incompatible_target, found_incompatible_target, and
11068 set_found_incompatible_target.
11069 (read_input_script): Add dirindex parameter. Change all callers.
11070 If parser finds an incompatible target, requeue Read_symbols
11071 task.
11072 (script_set_symbol): Clear skip_on_incompatible_target in
11073 closure.
11074 (script_add_assertion, script_parse_option): Likewise.
11075 (script_start_sections, script_add_phdr): Likewise.
11076 (script_check_output_format): New function.
11077 * script.h (read_input_script): Update declaration.
11078 * script-c.h (script_check_output_format): Declare.
11079 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11080 (ignore_cmd): Remove OUTPUT_FORMAT.
11081 * fileread.cc (Input_file::Input_file): Add explicit this.
11082 (Input_file::will_search_for): New function.
11083 (Input_file::open): Add pindex parameter. Change all callers.
11084 * fileread.h (class Input_file): Add input_file_argument method.
11085 Declare will_search_for. Update declarations.
11086 * object.cc (make_elf_object): Add punconfigured parameter.
11087 Change all callers.
11088 * object.h (class Object): Make input_file public. Add
11089 searched_for method.
11090 (make_elf_object): Update declaration.
11091 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
11092 restart search.
11093 * dirsearch.h (class Dirsearch): Update declaration.
11094 * options.h (class General_options): Add --warn-search-mismatch.
11095 * parameters.cc (Parameters::is_compatible_target): New function.
11096 * parameters.h (class Parameters): Declare is_compatible_target.
11097 * workqueue.cc (Workqueue::add_blocker): New function.
11098 * workqueue.h (class Workqueue): Declare add_blocker.
11099
f1ed28fb
ILT
11100 * fileread.cc (Input_file::open): Remove options parameter.
11101 Change all callers.
11102 (Input_file::open_binary): Likewise.
11103 * script.cc (read_input_script): Likewise.
11104 * readsyms.h (class Read_symbols): Remove options_ field. Remove
11105 options parameter from constructor. Change all callers.
11106 (class Read_script): Likewise.
11107 * fileread.h (class Input_file): Update declarations.
11108 * script.h (read_input_script): Update declaration.
11109
34dd024a
NC
111102009-03-10 Nick Clifton <nickc@redhat.com>
11111
11112 * po/es.po: New Spanish translation.
11113
6d71b17c
CC
111142009-03-06 Cary Coutant <ccoutant@google.com>
11115
11116 * options.cc (parse_short_option): Keep dash_z from registering itself.
11117
031cdbed
ILT
111182009-03-03 Ian Lance Taylor <iant@google.com>
11119
11120 PR 9918
11121 * target-reloc.h (relocate_section): Pass output_section to
11122 relocate.
11123 * i386.cc (Target_i386::should_apply_static_reloc): Add
11124 output_section parameter. Change all callers.
11125 (Target_i386::Relocate::relocate): Add output_section parameter.
11126 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11127 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11128 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11129 * testsuite/two_file_shared.sh: New script.
11130 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11131 (check_DATA): Add two_file_shared.dbg.
11132 (two_file_shared.dbg): New target.
11133 * testsuite/Makefile.in: Rebuild.
11134
15d5fa16
ILT
111352009-03-01 Ian Lance Taylor <iant@google.com>
11136
11137 * configure.ac: Check for byteswap.h.
11138 * configure: Rebuild.
11139 * config.in: Rebuild.
11140
8a4c0b0d
ILT
111412009-03-01 Mikolaj Zalewski <mikolajz@google.com>
11142
11143 * layout.cc (Layout::find_or_add_kept_section): New function.
11144 (Layout::add_comdat): Removed.
11145 * layout.h (struct Kept_section): Move out of class Layout.
11146 Remove trailing underscores from field names. Add group_sections
11147 field. Rename group_ field to is_group. Change all uses.
11148 (class Layout): Declare find_or_add_kept_section, not add_comdat.
11149 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11150 comdat_groups_ field.
11151 (Sized_relobj::include_section_group): Use
11152 find_or_add_kept_section and Kept_section::group_sections.
11153 (Sized_relobj::include_linkonce_section): Likewise.
11154 * object.cc (class Sized_relobj): Don't define Comdat_group or
11155 Comdat_group_table. Remove find_comdat_group and
11156 add_comdat_group. Remove comdat_groups_ field.
11157 * plugin.cc (include_comdat_group): Use
11158 Layout::find_or_add_kept_section.
11159
b4ecf66b
ILT
111602009-02-28 Ian Lance Taylor <iant@google.com>
11161
14359ca0
ILT
11162 * README: --gc-sections and map files are now supported. Document
11163 some build requirements.
11164
b4ecf66b
ILT
11165 PR 6992
11166 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11167 relocatable link set the value of the section symbol to zero.
11168 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11169 relocatable link don't include the section address in the local
11170 symbol value.
11171
0602e05a
ILT
111722009-02-27 Ian Lance Taylor <iant@google.com>
11173
fd9d194f
ILT
11174 PR 6811
11175 * options.h (class Search_directory): Add is_system_directory.
11176 (class General_options): Declare is_in_system_directory.
11177 * options.cc (get_relative_sysroot): Make static.
11178 (get_default_sysroot): Make static.
11179 (General_optoins::is_in_system_directory): New function.
11180 * fileread.cc (Input_file::is_in_system_directory): New function.
11181 * fileread.h (class Input_file): Declare is_in_system_directory.
11182 * object.h (class Object): Add is_in_system_directory.
11183 (class Input_objects): Remove system_library_directory_ field.
11184 * object.cc (Input_objects::add_object): Don't set
11185 system_library_directory_.
11186 (input_objects::found_in_system_library_directory): Remove.
11187 * symtab.cc (Symbol_table::write_globals): Remove input_objects
11188 parameter. Change all callers.
11189 (Symbol_table::sized_write_globals): Likewise.
11190 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11191 Call Object::is_in_system_directory.
11192 * symtab.h (class Symbol_table): Update declarations.
11193
61edd21f
ILT
11194 PR 5990
11195 * descriptors.h (Open_descriptor): Add is_on_stack field.
11196 * descriptors.cc (Descriptors::open): If the descriptor is on the
11197 top of the stack, remove it. Initialize is_on_stack field.
11198 (Descriptors::release): Only add pod to stack if it is not on the
11199 stack already.
11200 (Descriptors::close_some_descriptor): Clear stack_next and
11201 is_on_stack fields.
11202
e29e076a
ILT
11203 PR 7091
11204 * output.cc (Output_section::find_starting_output_address): Rename
11205 from starting_output_address; add PADDR parameter; change return
11206 type.
11207 * output.h (class Output_section): Declare
11208 find_starting_output_address instead of starting_output_address.
11209 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11210 section symbol for which we can't find a merge section.
11211
0602e05a
ILT
11212 PR 9836
11213 * symtab.cc (Symbol_table::add_from_object): If the visibility is
11214 hidden or internal, force the symbol to be local.
11215 * resolve.cc (Symbol::override_visibility): Define.
11216 (Symbol::override_base): Use override_visibility.
11217 (Symbol_table::resolve): Likewise.
11218 (Symbol::override_base_with_special): Likewise.
11219 (Symbol_table::override_with_special): If the visibility is hidden
11220 or internal, force the symbol to be local.
11221 * symtab.h (class Symbol): Add set_visibility and
11222 override_visibility.
11223 * testsuite/ver_test_1.sh: New file.
11224 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11225 (check_DATA): Add ver_test_1.syms.
11226 (ver_test_1.syms): New target.
11227 * testsuite/Makefile.in: Rebuild.
11228
401a9a73
CC
112292009-02-25 Cary Coutant <ccoutant@google.com>
11230
11231 * layout.cc (Layout::choose_output_section): Don't rename sections
11232 when using a linker script that has a SECTIONS clause.
11233 * Makefile.in: Regenerate.
11234
11235 * testsuite/Makefile.am (script_test_5.sh): New test case.
11236 * testsuite/Makefile.in: Regenerate.
11237 * testsuite/script_test_5.cc: New file.
11238 * testsuite/script_test_5.sh: New file.
11239 * testsuite/script_test_5.t: New file.
11240
f488e4b0
CC
112412009-02-13 Rafael Avila de Espindola <espindola@google.com>
11242
11243 * archive.cc (Archive::include_member): Update calls to add_symbols.
11244 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11245 the Layout argument.
11246 * dynobj.h (do_add_symbols): Add the Layout argument.
11247 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11248 Layout argument.
11249 * object.h (Object::add_symbols): Add the Layout argument.
11250 (Object::do_add_symbols): Add the Layout argument.
11251 (Sized_relobj::do_add_symbols): Add the Layout argument.
11252 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11253 Unify the two versions.
11254 (Add_plugin_symbols): Remove.
11255 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11256 (Sized_pluginobj::do_add_symbols): Unify the two versions.
11257 (Add_plugin_symbols): Remove.
11258 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11259 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11260 (Add_symbols::run): Make it work with Pulginobj.
11261
89dd1680
ILT
112622009-02-06 Ian Lance Taylor <iant@google.com>
11263
11264 * object.cc (Sized_relobj::do_layout): Make info message start
11265 with lower case letter.
11266
266d0a74
ILT
112672009-02-06 Mikolaj Zalewski <mikolajz@google.com>
11268
602b464e
ILT
11269 * binary.cc: Fix file comment.
11270
266d0a74
ILT
11271 * options.h (enum Incremental_disposition): Define.
11272 (class General_options): Add new options: --incremental,
11273 --incremental_changed, --incremental_unchanged,
11274 --incremental_unknown. Add incremental_disposition_ and
11275 implicit_incremental_ fields.
11276 (General_options::incremental_disposition): New function.
11277 (class Position_dependent_options): Add incremental_disposition
11278 option.
11279 (Position_dependent_options::copy_from_options): Set incremental
11280 dispositions.
11281 * options.cc (General_options::parse_incremental_changed): New
11282 function.
2e702c99
RM
11283 (General_options::parse_incremental_unchanged): New function.
11284 (General_options::parse_incremental_unknown): New function.
11285 (General_options::General_options): Initialize new fields
266d0a74 11286 incremental_disposition_ and implicit_incremental_.
2e702c99 11287 (General_options::finalize): Check for uasge of --incremental-*
266d0a74
ILT
11288 without --incremental.
11289
f073bbf7
CD
112902009-02-06 Chris Demetriou <cgd@google.com>
11291
11292 * gold.h (gold_undefined_symbol): Change to take only a Symbol
11293 pointer and to report location as the file name associated with
11294 the symbol.
11295 (gold_undefined_symbol_at_location): New function to replace the
11296 old gold_undefined_symbol functionality.
11297 * target-reloc.h (relocate_section): Update to use
11298 gold_undefined_symbol_at_location.
11299 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11300 Call gold_undefined_symbol function rather than gold_error.
11301 * errors.h (Errors::undefined_symbol): Take location as a
11302 string, rather than calculating it from a relocation.
11303 * errors.cc (Errors::fatal): Print "fatal error:" before the
11304 formatted message.
11305 (Errors::error, Errors::error_at_location): Print "error: "
11306 before the formatted message.
11307 (Errors::undefined_symbol): Take location as a string, rather
11308 than calculating it from a relocation.
11309 (gold_undefined_symbol_at_location): New function akin to
11310 old gold_undefined_symbol, calculates location from relocation.
11311 (gold_undefined_symbol): Change to take only a Symbol pointer
11312 and to report location as the file name associated with the symbol.
11313 * testsuite/debug_msg.sh: Update for changed error messages.
11314 * testsuite/undef_symbol.sh: Likewise.
11315
8e94a90c
ILT
113162009-02-04 Duncan Sands <baldrick@free.fr>
11317
11318 PR 9812
11319 * reduced_debug_output.h
11320 (Output_reduced_debug_abbrev_section::failed): Use format for
11321 gold_warning.
11322 (Output_reduced_debug_info_section::faild): Likewise.
11323
88a0e15b
ILT
113242009-01-31 Mikolaj Zalewski <mikolajz@google.com>
11325
11326 * script.cc (Lazy_demangler): New class.
2e702c99 11327 (Version_script_info::get_symbol_version_helper): Demangle a
88a0e15b
ILT
11328 symbol only once.
11329
5efc7cd2
CC
113302009-01-29 Cary Coutant <ccoutant@google.com>
11331
11332 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11333 to __tls_get_addr.
11334 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11335
e0ebcf42
ILT
113362009-01-28 Ian Lance Taylor <iant@google.com>
11337
5efc7cd2 11338 * version.cc (version_string): Bump to 1.9.
75fe7426 11339
e0ebcf42
ILT
11340 * gold.h: Include <cstring> and <stdint.h>.
11341 * version.cc: Include <cstdio>.
11342 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11343 warning.
11344 * reduced_debug_output.cc (insert_into_vector): Rename from
11345 Insert_into_vector; change all callers. Use Swap_unaligned to
11346 avoid aliasing issue; remove union since it is unnecessary.
11347
8e2813be 113482009-01-27 Sriraman Tallam <tmsriram@google.com>
6d03d481
ST
11349
11350 * Makefile.am (CCFILES): Add gc.cc.
11351 (HFILES): Add gc.h.
11352 * Makefile.in: Regenerate.
11353 * gold.cc (Gc_runner): New class.
11354 (queue_initial_tasks): Call garbage collection related tasks
11355 when corresponding options are invoked.
11356 (queue_middle_gc_tasks): New function.
11357 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11358 processed early before laying out sections during garbage collection.
11359 * gold.h (queue_middle_gc_tasks): New function.
11360 (is_prefix_of): Move from "layout.cc".
11361 * i386.cc (Target_i386::gc_process_relocs): New function.
11362 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11363 * main.cc (main): Create object of class "Garbage_collection".
11364 * object.cc (Relobj::copy_symbols_data): New function.
11365 (Relobj::is_section_name_included): New function.
e1df38aa
NC
11366 (Sized_relobj::do_layout): Allow this function to be called twice
11367 during garbage collection and defer layout of section during the
6d03d481
ST
11368 first call.
11369 * object.h (Relobj::get_symbols_data): New function.
11370 (Relobj::is_section_name_included): New function.
11371 (Relobj::copy_symbols_data): New function.
11372 (Relobj::set_symbols_data): New function.
11373 (Relobj::get_relocs_data): New function.
11374 (Relobj::set_relocs_data): New function.
11375 (Relobj::is_output_section_offset_invalid): New pure virtual function.
11376 (Relobj::gc_process_relocs): New function.
11377 (Relobj::do_gc_process_relocs): New pure virtual function.
11378 (Relobj::sd_): New data member.
11379 (Sized_relobj::is_output_section_offset_invalid): New function.
11380 (Sized_relobj::do_gc_process_relocs): New function.
11381 * options.h (General_options::gc_sections): Modify to not be a no-op.
11382 (General_options::print_gc_sections): New option.
11383 * plugin.cc (Plugin_finish::run): Remove function call to
11384 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11385 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11386 * reloc.cc (Read_relocs::run): Add task to process relocs and
11387 determine unreferenced sections when doing garbage collection.
11388 (Gc_process_relocs): New class.
11389 (Sized_relobj::do_gc_process_relocs): New function.
11390 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11391 sections that are garbage collected.
11392 * reloc.h (Gc_process_relocs): New class.
11393 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11394 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11395 symbols whose corresponding sections are garbage collected.
11396 (Symbol_table::Symbol_table): Add new parameter for the garbage
11397 collection object.
11398 (Symbol_table::gc_mark_undef_symbols): New function.
11399 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11400 (Symbol_table::gc_mark_dyn_syms): New function.
11401 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11402 as garbage.
11403 (Symbol_table::add_from_object): Likewise.
11404 (Symbol_table::add_from_relobj): When building shared objects, do not
11405 treat externally visible symbols as garbage.
11406 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11407 table information for static and relocatable links.
11408 * symtab.h (Symbol_table::set_gc): New function.
11409 (Symbol_table::gc): New function.
11410 (Symbol_table::gc_mark_undef_symbols): New function.
11411 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11412 (Symbol_table::gc_mark_dyn_syms): New function.
11413 (Symbol_table::gc_): New data member.
e1df38aa 11414 * target.h (Sized_target::gc_process_relocs): New pure virtual
6d03d481
ST
11415 function.
11416 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11417 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11418
3b293544
CF
114192009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11420
11421 * options.h (General_options::gc_sections): Define as a no-op for now.
11422 (General_options::no_keep_memory): Ditto.
11423 (General_options::Bshareable): Define.
11424 * options.cc (General_options::finalize): Honor -Bshareable.
11425
83d22aa8
AS
114262009-01-20 Andreas Schwab <schwab@suse.de>
11427
11428 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11429 read the value in the contents, since we don't use it. Use the
11430 template endianness when writing.
11431 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11432
cd536b21
AS
114332009-01-19 Andreas Schwab <schwab@suse.de>
11434
11435 * configure.tgt (powerpc64-*): Fix targ_obj.
11436
99e9a495
ILT
114372009-01-15 Ian Lance Taylor <iant@google.com>
11438
11439 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11440 local symbols when stripping all symbols.
11441
bbbfea06
CC
114422009-01-14 Cary Coutant <ccoutant@google.com>
11443
99e9a495 11444 * output.cc (Output_reloc): Add explicit instantiations.
bbbfea06 11445
0f7c0701
CC
114462009-01-14 Cary Coutant <ccoutant@google.com>
11447
11448 * archive.cc (Archive::get_elf_object_for_member): Remove call
11449 to File_read::claim_for_plugin.
11450 * descriptors.cc (Descriptors::open): Remove reference to
11451 is_claimed.
11452 (Descriptors::claim_for_plugin): Remove.
11453 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11454 (Descriptors::is_claimed): Remove.
11455 (claim_descriptor_for_plugin): Remove.
11456 * fileread.cc (File_read::claim_for_plugin): Remove.
11457 * fileread.h (File_read::claim_for_plugin): Remove.
11458 (File_read::descriptor): Reopen descriptor if necessary.
11459 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11460 (Plugin_manager::all_symbols_read): Add task parameter. Change
11461 all callers.
11462 (Plugin_manager::get_input_file): New function.
11463 (Plugin_manager::release_input_file): New function.
11464 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11465 corresponding data member.
11466 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11467 and pass to base constructor. Change all callers.
11468 (get_input_file, release_input_file): New functions.
11469 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11470 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11471 (Plugin_manager::all_symbols_read): Add task parameter.
11472 (Plugin_manager::get_input_file): New function.
11473 (Plugin_manager::release_input_file): New function.
11474 (Plugin_manager::task_): New data member.
11475 (Pluginobj::Pluginobj): Add filesize parameter.
11476 (Pluginobj::filename): New function.
11477 (Pluginobj::descriptor): New function.
11478 (Pluginobj::filesize): New function.
11479 (Pluginobj::filesize_): New data member.
11480 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11481 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11482 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11483
11484 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11485 with archive libraries.
11486 * testsuite/Makefile.in: Regenerate.
11487 * testsuite/plugin_test.c (struct sym_info): New type.
11488 (get_input_file, release_input_file): New static variables.
11489 (onload): Capture new transfer vector entries.
11490 (claim_file_hook): Stop reading at end of file according to filesize.
11491 Factor out parsing of readelf output into separate function.
11492 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11493 APIs and get the source file name from the symbol table. Convert
11494 source file name to corresponding object file name. Print info
11495 message when adding new input files.
11496 (parse_readelf_line): New function.
11497 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11498 * testsuite/plugin_test_2.sh: Likewise.
11499 * testsuite/plugin_test_3.sh: Likewise.
11500 * testsuite/plugin_test_4.sh: New test case.
11501
62a6d109
ILT
115022009-01-07 Ian Lance Taylor <iant@google.com>
11503
11504 * version.cc (version_string): Bump to 1.8.
11505
483620e8
CC
115062008-12-23 Cary Coutant <ccoutant@google.com>
11507
11508 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11509 * plugin.cc (Plugin_manager::finish): Rename as
11510 layout_deferred_objects. Move cleanup to separate function.
11511 (Plugin_manager::cleanup): New function.
11512 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11513 separately.
11514 * plugin.h (Plugin_manager::finish): Rename as
11515 layout_deferred_objects.
11516 (Plugin_manager::cleanup): New function.
11517 (Plugin_manager::cleanup_done): New field.
11518
d66a9eb3
CC
115192008-12-23 Cary Coutant <ccoutant@google.com>
11520
11521 * plugin.cc (is_visible_from_outside): New function.
11522 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11523 so we don't return "IR only" status for exported symbols or -r links.
11524
11525 * testsuite/Makefile.am (plugin_test_3): New test case.
11526 * testsuite/Makefile.in: Regenerate.
11527 * testsuite/plugin_test_3.sh: New file.
11528
5995b570
CC
115292008-12-22 Cary Coutant <ccoutant@google.com>
11530
11531 * object.cc (Sized_relobj::layout_section): New function.
11532 (Sized_relobj::do_layout): Defer layout of input sections until after
11533 plugin has provided replacement files.
11534 (Sized_relobj::do_layout_deferred_sections): New function.
11535 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11536 (Relobj::layout_deferred_sections): New function.
11537 (Relobj::do_layout_deferred_sections): New function.
11538 (Sized_relobj::do_layout_deferred_sections): New function.
11539 (Sized_relobj::layout_section): New function.
11540 (Sized_relobj::Deferred_layout): New structure.
11541 (Sized_relobj::deferred_layout_): New field.
11542 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11543 Change all callers. Layout deferred sections.
11544 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11545 references.
11546 (Plugin_hook::run): Move code from do_plugin_hook inline.
11547 (Plugin_hook::do_plugin_hook): Remove.
11548 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11549 (Plugin_manager::finish): Renamed, was cleanup.
11550 (Plugin_manager::should_defer_layout): New function.
11551 (Plugin_manager::add_deferred_layout_object): New function.
11552 (Plugin_manager::Deferred_layout_list): New type.
11553 (Plugin_manager::deferred_layout_objects_): New field.
11554 (Plugin_hook::do_plugin_hook): Remove.
11555
ee769c88
ILT
115562008-12-17 Ian Lance Taylor <iant@google.com>
11557
11558 * options.h (class General_options): Add --no case for
11559 --export-dynamic.
11560
abc8dcba
CC
115612008-12-16 Cary Coutant <ccoutant@google.com>
11562
11563 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11564 vector.
11565 (Plugin_manager::claim_file): Create plugin object even if
11566 plugin did not call the add_symbols callback.
11567 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11568 asking for more symbols than were added.
11569 * testsuite/Makefile.am (plugin_test_1): Add test case with
11570 no global symbols.
11571 (empty.syms): New target.
11572 * testsuite/Makefile.in: Regenerate.
11573 * testsuite/plugin_test.c (claim_file_hook): Add new debug
11574 message. Don't call add_symbols if no globals.
11575 (all_symbols_read_hook): Don't provide replacement for empty
11576 claimed file.
11577
b0074644
ILT
115782008-12-12 Ian Lance Taylor <iant@google.com>
11579
68943102
ILT
11580 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11581 r_type == 0 for a local symbol with r_sym == 0.
11582 (scan_relocatable_relocs): Pass r_sym to
11583 local_non_section_strategy.
11584 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11585 r_sym parameter.
11586
b0074644
ILT
11587 * configure.ac: Update test for TLS descriptors: they are
11588 supported as of glibc 2.9.
11589 * configure: Rebuild.
11590
c2508178
ILT
115912008-12-11 Ian Lance Taylor <iant@google.com>
11592
11593 PR 7091
11594 * target-reloc.h (Default_scan_relocatable_relocs): For each
11595 function, map r_type == 0 to RELOC_DISCARD.
11596
2756a258
CC
115972008-12-10 Cary Coutant <ccoutant@google.com>
11598
11599 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11600 object to override a kept COMDAT group from a plugin object.
11601
bb6f53d3
ILT
116022008-12-09 Ian Lance Taylor <iant@google.com>
11603
fbc558e1
ILT
11604 PR 7088
11605 * yyscript.y (file_cmd): Handle INPUT.
11606
bb6f53d3
ILT
11607 * testsuite/initpri1.c: Change all declarations to be full
11608 prototypes by adding void, to avoid compiler warnings.
11609
4674ecfc
CC
116102008-12-05 Rafael Avila de Espindola <espindola@google.com>
11611
11612 * options.cc (General_options::parse_plugin_opt): New.
11613 (General_options::add_plugin): The argument now is just the filename.
11614 (General_options::add_plugin_option): New.
11615 * options.h (plugin_opt): New.
11616 (add_plugin): Change argument name.
11617 (add_plugin_option): New.
11618 * plugin.cc (Plugin::load): Don't parse the plugin option.
11619 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11620 (Plugin::add_option): New.
11621 (Plugin::args_): Change type.
11622 (Plugin::filename_): New.
11623 (Plugin_manager::add_plugin_option): New.
11624 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11625 * testsuite/Makefile.in: Regenerate.
11626
fd06b4aa
CC
116272008-12-05 Cary Coutant <ccoutant@google.com>
11628
11629 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11630 Handle --strip-lto-sections option.
11631 * options.h (strip_lto_sections): New option.
11632
6c52134c
CC
116332008-12-01 Cary Coutant <ccoutant@google.com>
11634
11635 * plugin.cc (ld_plugin_message): Change format parameter to const.
11636 Fix mismatch between new[] and delete.
11637
a45248e0
CC
116382008-11-14 Cary Coutant <ccoutant@google.com>
11639
11640 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11641 instead of -1U.
11642
c82fbeee
CS
116432008-11-05 Craig Silverstein <csilvers@google.com>
11644
11645 * options.cc (General_options::parse_dynamic_list): New function.
11646 * options.h (General_options): New flags dynamic_list,
11647 dynamic_list_data, dynamic_list_cpp_new, and
11648 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11649 (General_options::in_dynamic_list): New function.
11650 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11651 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11652 (Lex::can_continue_name): Likewise.
11653 (yylex): Likewise.
11654 (read_script_file): New parameter script_options.
11655 (read_dynamic_list): New function.
11656 (Script_options::define_dynamic_list): New function.
11657 (dynamic_list_keyword_parsecodes): New variable.
11658 (dynamic_list_keywords): New variable.
11659 * script.h (Script_options::define_dynamic_list): New function
11660 prototype.
11661 (read_dynamic_list): New function prototype.
11662 * symtab.cc (strprefix): New macro.
11663 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11664 dynamic_list_data, dynamic_list_cpp_new, and
11665 dynamic_list_cpp_typeinfo.
11666 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11667 (dynamic_list_expr): New rule.
11668 (dynamic_list_nodes): Likewise.
11669 (dynamic_list_node): Likewise.
11670 * testsuite/Makefile.am (dynamic_list): New test.
11671 * testsuite/Makefile.in: Regenerated.
11672 * testsuite/dynamic_list.t: New file.
11673 * testsuite/dynamic_list.sh: New file.
11674
e0bb29a5
CS
116752008-11-05 Craig Silverstein <csilvers@google.com>
11676
11677 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11678 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11679 (t11_last): Likewise.
11680 * testsuite/ver_test_6.c (main): Likewise.
11681
4e1e25e0
CC
116822008-10-07 Cary Coutant <ccoutant@google.com>
11683
11684 * options.c (General_options::finalize): Add check for -static and
11685 -shared.
11686 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11687 is not empty.
11688
92f03fcb
CC
116892008-10-02 Cary Coutant <ccoutant@google.com>
11690
11691 * plugin.cc (make_sized_plugin_object): Fix conditional
11692 compilation to work when not all targets are enabled.
11693
fbd8a257
CC
116942008-09-29 Cary Coutant <ccoutant@google.com>
11695
11696 * archive.cc (Archive::get_file_and_offset): Use filename instead
11697 of name to get library path.
11698 (Archive::include_member): Unlock external member of a thin archive.
11699
11700 * testsuite/Makefile.am (TEST_AR): New variable.
11701 (thin_archive_test_1): New test.
11702 (thin_archive_test_2): New test.
81636b3f
CC
11703 * testsuite/Makefile.in: Regenerate.
11704 * testsuite/thin_archive_main.cc: New file.
11705 * testsuite/thin_archive_test_1.cc: New file.
11706 * testsuite/thin_archive_test_2.cc: New file.
11707 * testsuite/thin_archive_test_3.cc: New file.
11708 * testsuite/thin_archive_test_4.cc: New file.
fbd8a257 11709
eff45813
CC
117102008-09-29 Cary Coutant <ccoutant@google.com>
11711
11712 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11713 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11714 instead of -1U.
11715 (Sized_relobj::do_finalize_local_symbols): Likewise.
11716 (Sized_relobj::map_to_kept_section): Likewise.
11717 * object.h (Sized_relobj::invalid_address): New constant.
11718 (Sized_relobj::do_output_section_offset): Check for invalid_address
11719 and return -1ULL.
11720 * output.cc (Output_reloc::local_section_offset): Use constant
11721 invalid_address instead of -1U.
11722 (Output_reloc::get_address): Likewise.
11723 (Output_section::output_address): Change -1U to -1ULL.
11724 * output.h (Output_reloc::invalid_address): New constant.
11725 * reloc.cc (Sized_relobj::write_sections): Use constant
11726 invalid_address instead of -1U.
11727 (Sized_relobj::relocate_sections): Likewise.
11728 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11729 values for merge sections.
11730 * target-reloc.h (relocate_for_relocatable): Use constant
11731 invalid_address instead of -1U.
11732
89fc3421
CC
117332008-09-19 Cary Coutant <ccoutant@google.com>
11734
11735 Add plugin functionality for link-time optimization (LTO).
11736 * configure.ac (plugins): Add --enable-plugins option.
11737 * configure: Regenerate.
11738 * config.in: Regenerate.
11739 * Makefile.am (LIBDL): New variable.
11740 (CCFILES): Add plugin.cc.
11741 (HFILES): Add plugin.h.
11742 (ldadd_var): Add LIBDL.
11743 * Makefile.in: Regenerate.
11744
11745 * archive.cc: Include "plugin.h".
11746 (Archive::setup): Don't preread archive symbols when using a plugin.
11747 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11748 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11749 files.
11750 (Archive::include_member): Add symbols from plugin objects.
11751 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11752 * descriptors.cc (Descriptors::open): Check for file descriptors
11753 abandoned by plugins.
11754 (Descriptors::claim_for_plugin): New function.
11755 * descriptors.h (Descriptors::claim_for_plugin): New function.
11756 (Open_descriptor::is_claimed): New field.
11757 (claim_descriptor_for_plugin): New function.
11758 * fileread.cc (File_read::claim_for_plugin): New function.
11759 * fileread.h (File_read::claim_for_plugin): New function.
11760 (File_read::descriptor): New function.
11761 * gold.cc: Include "plugin.h".
11762 (queue_initial_tasks): Add task to call plugin hooks for generating
11763 new object files.
11764 * main.cc: Include "plugin.h".
11765 (main): Load plugin libraries.
11766 * object.h (Pluginobj): Declare.
11767 (Object::pluginobj): New function.
11768 (Object::do_pluginobj): New function.
11769 (Object::set_target): New function.
11770 * options.cc: Include "plugin.h".
11771 (General_options::parse_plugin): New function.
11772 (General_options::General_options): Initialize plugins_ field.
11773 (General_options::add_plugin): New function.
11774 * options.h (Plugin_manager): Declare.
11775 (General_options): Add --plugin option.
11776 (General_options::has_plugins): New function.
11777 (General_options::plugins): New function.
11778 (General_options::add_plugin): New function.
11779 (General_options::plugins_): New field.
11780 * plugin.cc: New file.
11781 * plugin.h: New file.
11782 * readsyms.cc: Include "plugin.h".
11783 (Read_symbols::do_read_symbols): Check for archive before checking
11784 for ELF file. Call plugin hooks to claim files.
11785 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11786 from a real object file; force override when processing replacement
11787 files.
11788 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11789 (Symbol::init_base_object): Likewise.
11790 (Symbol::init_base_output_data): Likewise.
11791 (Symbol::init_base_output_segment): Likewise.
11792 (Symbol::init_base_constant): Likewise.
11793 (Symbol::init_base_undefined): Likewise.
11794 (Symbol::output_section): Assert that object is not a plugin.
11795 (Symbol_table::add_from_pluginobj): New function.
11796 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11797 undefined.
11798 (Symbol_table::sized_write_globals): Likewise.
11799 (Symbol_table::add_from_pluginobj): Instantiate template.
11800 * symtab.h (Sized_pluginobj): Declare.
11801 (Symbol::in_real_elf): New function.
11802 (Symbol::set_in_real_elf): New function.
11803 (Symbol::in_real_elf_): New field.
11804 (Symbol_table::add_from_pluginobj): New function.
11805
11806 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11807 (LIBDL): New variable.
11808 (LDADD): Add LIBDL.
11809 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11810 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11811 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11812 (MOSTLYCLEANFILES): Likewise.
11813 * testsuite/Makefile.in: Regenerate.
11814 * testsuite/plugin_test.c: New file.
11815 * testsuite/plugin_test_1.sh: New file.
11816 * testsuite/plugin_test_2.sh: New file.
11817
de31bda5
ILT
118182008-09-16 Ian Lance Taylor <iant@google.com>
11819
9c2d0ef9
ILT
11820 * target-reloc.h (relocate_section): Check whether a symbol is
11821 defined by the ABI before reporting an undefined symbol error.
11822 * target.h (Target::is_defined_by_abi): Make parameter const.
11823 (Target::do_is_defined_by_abi): Likewise.
11824 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11825 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11826 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11827 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11828 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11829 * testsuite/Makefile.in: Rebuild.
11830
de31bda5
ILT
11831 * fileread.cc (make_view): Add casts to avoid warning.
11832
9fa33bee
AO
118332008-09-16 Alexandre Oliva <aoliva@redhat.com>
11834
11835 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11836 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11837
183fd0e3
AO
118382008-09-16 Alexandre Oliva <aoliva@redhat.com>
11839
11840 * options.h (General_options::output_is_executable): New.
11841 (General_options::output_is_pie): New.
11842 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11843 for shared libraries.
11844 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11845
7be8330a
CD
118462008-09-11 Chris Demetriou <cgd@google.com>
11847
11848 * options.h (origin): New -z option.
11849 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11850 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11851 in DT_FLAGS_1.
11852
a9caad02
CC
118532008-09-05 Cary Coutant <ccoutant@google.com>
11854
11855 * fileread.cc (File_read::make_view): Add check for attempt to map
11856 beyond end of file.
11857
ae6dce4d
CC
118582008-09-05 Cary Coutant <ccoutant@google.com>
11859
11860 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11861 explicit instantiations.
11862
d7ab2a47
KVH
118632008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11864
11865 PR gold/6858
11866 * options.cc (General_options::finalize): Allow undefined symbols
11867 in shlibs if linking -shared.
11868
11869 PR gold/6859
11870 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11871 symbols as not needing a dynsym entry.
11872
1e52a9c1
CS
118732008-08-20 Craig Silverstein <csilvers@google.com>
11874
11875 * fileread.cc (File_read::open): Do not lock the file unless it
11876 was successfully opened.
11877
d85c80a3
CC
118782008-08-14 Cary Coutant <ccoutant@google.com>
11879
11880 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11881 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11882 * testsuite/tls_test.cc (struct int128): 128-bit struct
11883 for testing TLS relocs with non-zero addend.
11884 (v12): New TLS variable.
11885 (t12): New test.
11886 (t_last): Add check for v12.
11887 * testsuite/tls_test.h (t12): New function.
11888 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11889
2d924fd9
ILT
118902008-08-13 Ian Lance Taylor <iant@google.com>
11891
11892 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11893 set tls_segment_ or relro_segment_.
11894 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11895 when appropriate.
11896 * output.h (Output_section::clear_is_relro): New function.
11897 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11898 sections specially even when output_data_ is empty.
11899 (Output_segment::maximum_alignment): When first section is relro,
11900 only force alignment for PT_LOAD segments.
11901 * script.cc (script_data_segment_align): New function.
11902 (script_data_segment_relro_end): New function.
11903 * script-c.h (script_data_segment_align): Declare.
11904 (script_data_segment_relro_end): Declare.
11905 * script-sections.h (class Script_sections): Declare
11906 data_segment_align and data_segment_relro_end. Add fields
11907 segment_align_index_ and saw_relro_end_.
11908 * script-sections.cc (class Sections_element): Add set_is_relro
11909 virtual function. Add new bool* parameter to place_orphan_here.
11910 Add get_output_section virtual function.
11911 (class Output_section_definition): Add set_is_relro. Add new
11912 bool* parameter to place_orphan_here. Add get_output_section.
11913 Add is_relro_ field.
11914 (Output_section_definition::Output_section_definition): Initialize
11915 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11916 and is_relro_ fields.
11917 (Output_section_definition::place_orphan_here): Add is_relro
11918 parameter.
11919 (Output_section_definition::set_section_addresses): Set relro for
11920 output section.
11921 (Output_section_definition::alternate_constraint): Likewise.
11922 (class Orphan_output_section): Add new bool* parameter to
11923 place_orphan_here. Add get_output_section.
11924 (Orphan_output_section::place_orphan_here): Add is_relro
11925 parameter.
11926 (Script_sections::Script_sections): Initialize
11927 data_segment_align_index_ and saw_relro_end_.
11928 (Script_sections::data_segment_align): New function.
11929 (Script_sections::data_segment_relro_end): New function.
11930 (Script_sections::place_orphan): Set or clear is_relro.
11931 (Script_sections::set_section_addresses): Force alignment of first
11932 TLS section.
11933 * yyscript.y (exp): Call script_data_segment_align and
11934 script_data_segment_relro_end.
11935 * testsuite/relro_script_test.t: New file.
11936 * testsuite/relro_test.cc (using_script): Declare.
11937 (t1, t2): Test using_script.
11938 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11939 (relro_script_test_SOURCES): Define.
11940 (relro_script_test_DEPENDENCIES): Define.
11941 (relro_script_test_LDFLAGS): Define.
11942 (relro_script_test_LDADD): Define.
11943 (relro_script_test.so): New target.
11944 * testsuite/Makefile.in: Rebuild.
11945
f827c9a9
CC
119462008-08-06 Cary Coutant <ccoutant@google.com>
11947
11948 * archive.cc (Archive::total_archives, Archive::total_members)
11949 (Archive::total_members_loaded): New variables.
11950 (Archive::setup): Add parameter. Add option to preread
11951 archive symbols.
11952 (Archive::read_armap): Add counter.
11953 (Archive::get_file_and_offset): New function.
11954 (Archive::get_elf_object_for_member): New function.
11955 (Archive::read_all_symbols): New function.
11956 (Archive::read_symbols): New function.
11957 (Archive::add_symbols): Add counters.
11958 (Archive::include_all_members): Use armap to find members if it's
11959 already built.
11960 (Archive::include_member): Skip reading symbols if already read.
11961 Factored code into Archive::get_file_and_offset and
11962 Archive::get_elf_object_for_member. Changed call to
11963 Mapfile::report_include_archive_member.
11964 (Archive::print_stats): New function.
11965 * archive.h: Declare Object and Read_symbols_data classes.
11966 (Archive::Archive): Add initializers for new members.
11967 (Archive::setup): Add parameter.
11968 (Archive::print_stats): New function.
11969 (Archive::total_archives, Archive::total_members)
11970 (Archive::total_members_loaded): New variables.
11971 (Archive::get_file_and_offset): New function.
11972 (Archive::get_elf_object_for_member): New function.
11973 (Archive::read_all_symbols): New function.
11974 (Archive::read_symbols): New function.
11975 (Archive::Archive_member): New class.
11976 (Archive::members_): New member.
11977 (Archive::num_members_): New member.
11978 * main.cc: Include archive.h.
11979 (main): Call Archive::print_stats.
11980 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11981 archive parameter; member_name is now the fully-decorated name.
11982 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11983 * options.h: (General_options): Add --preread-archive-symbols option.
11984 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11985 Archive::setup.
11986
de4c45bd
ILT
119872008-08-04 Ian Lance Taylor <iant@google.com>
11988
11989 * symtab.h (Symbol::use_plt_offset): New function.
11990 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11991 * powerpc.cc (Relocate::relocate): Likewise.
11992 * sparc.cc (Relocate::relocate): Likewise.
11993 * x86_64.cc (Relocate::relocate): Likewise.
11994 * testsuite/weak_plt.sh: New test.
11995 * testsuite/weak_plt_main.cc: New test.
11996 * testsuite/weak_plt_shared.cc: New test.
11997 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11998 (check_PROGRAMS): Add weak_plt.
11999 (check_DATA): Add weak_plt_shared.so.
12000 (weak_plt_main_pic.o, weak_plt): New targets.
12001 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12002 * testsuite/Makefile.in: Rebuild.
12003
12004 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12005 gcctestdir/ld.
12006 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12007 * testsuite/Makefile.in: Rebuild.
12008
323ee3f4
AM
120092008-08-04 Alan Modra <amodra@bigpond.net.au>
12010
12011 * Makefile.am (POTFILES.in): Set LC_ALL=C.
12012 * Makefile.in: Regenerate.
12013 * po/POTFILES.in: Regenerate.
12014
7c07ecec
ILT
120152008-07-29 Ian Lance Taylor <iant@google.com>
12016
12017 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12018 symbols before other symbols.
12019 * testsuite/script_test_2.cc (test_addr): Declare.
12020 (test_addr_alias): Declare.
12021 (main): Check that test_addr and test_addr_alias have the right
cd536b21 12022 values.
7c07ecec
ILT
12023 * testsuite/script_test_2.t: Define test_addr_alias and
12024 test_addr.
12025
5778530e
ILT
120262008-07-24 Ian Lance Taylor <iant@google.com>
12027
2a00e4fb
ILT
12028 PR 5990
12029 * descriptors.cc: New file.
12030 * descriptors.h: New file.
12031 * gold-threads.h (class Hold_optional_lock): New class.
12032 * fileread.cc: Include "descriptors.h".
12033 (File_read::~File_read): Release descriptor rather than closing
12034 it.
12035 (File_read::open) [file]: Call open_descriptor rather than open.
12036 Set is_descriptor_opened_.
12037 (File_read::open) [memory]: Assert that descriptor is not open.
12038 (File_read::reopen_descriptor): New function.
12039 (File_read::release): Release descriptor.
12040 (File_read::do_read): Make non-const. Reopen descriptor.
12041 (File_read::read): Make non-const.
12042 (File_read::make_view): Reopen descriptor.
12043 (File_read::do_readv): Likewise.
12044 * fileread.h (class File_read): Add is_descriptor_opened_ field.
12045 Update declarations.
12046 * layout.cc: Include "descriptors.h".
12047 (Layout::create_build_id): Use open_descriptor rather than open.
12048 * output.cc: Include "descriptors.h".
12049 (Output_file::open): Use open_descriptor rather than open.
12050 * archive.cc (Archive::const_iterator): Change Archive to be
12051 non-const.
12052 (Archive::begin, Archive::end): Make non-const.
12053 (Archive::count_members): Likewise.
12054 * archive.h (class Archive): Update declarations.
12055 * object.h (Object::read): Make non-const.
12056 * Makefile.am (CCFILES): Add descriptors.cc.
12057 (HFILES): Add descriptors.h.
12058 * Makefile.in: Rebuild.
12059
801647d1
ILT
12060 PR 6716
12061 * gold.h: Always include <clocale>. Add Solaris workarounds
12062 following code in binutils/sysdep.h.
12063
5edd166e
ILT
12064 PR 6048
12065 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12066 this->eh_frame_hdr_ is NULL before using it.
12067
c89ad728
ILT
12068 * dynobj.cc (Versions::Versions): Update comment.
12069
aa86f06b
ILT
12070 * dynobj.cc (Versions::Versions): If there is an soname, use it as
12071 the base version name.
12072
5778530e
ILT
12073 * stringpool.cc (Stringpool_template::add_with_length): Set key to
12074 array size plus one.
12075 (Stringpool_template::set_string_offsets): Subtract one from key
12076 before using it as an array index.
12077 (Stringpool_template::get_offset_with_length): Likewise.
12078 (Stringpool_template::write_to_buffer): Likewise.
12079 * stringpool.h (Stringpool_template::get_offset_from_key):
12080 Likewise.
12081
057ead22
ILT
120822008-07-23 Ian Lance Taylor <iant@google.com>
12083
7f649c59
ILT
12084 PR 6658
12085 * object.h (Merged_symbol_value::value): Do our best to handle a
12086 negative addend.
12087
057ead22
ILT
12088 PR 6647
12089 * script.cc (Version_script_info::get_versions): Don't add empty
12090 version tag to return value.
12091 (Version_script_info::get_symbol_version_helper): Change return
12092 type to bool. Add pversion parameter. Change all callers.
12093 (script_register_vers_node): Don't require a non-NULL tag.
12094 * script.h (class Version_script_info): Update declarations.
12095 (Version_script_info::get_symbol_version): Change return type to
12096 bool. Add version parameter. Change all callers.
12097 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12098 handling. Handle an empty version from a version script.
12099 (Symbol_table::define_special_symbol): Likewise.
12100 * testsuite/ver_test_10.script: New file.
12101 * testsuite/ver_test_10.sh: New file.
12102 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12103 (check_DATA): Add ver_test_10.syms.
12104 (ver_test_10.syms, ver_test_10.so): New target.
12105 * testsuite/Makefile.in: Rebuild.
12106
58e54ac2
CD
121072008-07-23 Simon Baldwin <simonb@google.com>
12108
12109 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12110 to zero for undefined symbols from dynamic libraries.
12111
95d14cd3
ILT
121122008-07-23 Ian Lance Taylor <iant@google.com>
12113
12114 * symtab.cc (Symbol_table::resolve): Remove version parameter.
12115 Change all callers.
12116 * symtab.h (class Symbol_table): Update declaration.
12117 * testsuite/ver_test_9.cc: New file.
12118 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12119 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12120 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12121 (ver_test_9.so, ver_test_9.o): New targets.
12122 * testsuite/Makefile.in: Rebuild.
12123
92de84a6
ILT
121242008-07-22 Ian Lance Taylor <iant@google.com>
12125
34810851
ILT
12126 * options.h (class General_options): Define --check-sections.
12127 * layout.cc (Layout::set_segment_offsets): Handle
12128 --check-sections.
12129
af6156ef
ILT
12130 * options.h (class General_options): Define -n/--nmagic and
12131 -N/--omagic.
12132 * options.cc (General_options::finalize): For -n/--nmagic or
12133 -N/--omagic, set -static.
12134 * layout.cc (Layout::attach_allocated_section_to_segment): If
12135 -N/--omagic, don't put read-only and read-write sections in
12136 different segments.
12137 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12138 finding a read-only segment.
12139 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12140 don't set the minimum segment alignment to the common page size,
12141 and don't set the file offset to the address modulo the page size.
12142 * script-sections.cc (Script_sections::create_segments): If
12143 -n/--omagic, don't put read-only and read-write sections in
12144 different segments.
12145
92de84a6
ILT
12146 * cref.cc: New file.
12147 * cref.h: New file.
12148 * options.h (class General_options): Add --print-symbol-counts.
12149 * main.cc (main): Issue defined symbol report if requested.
12150 * archive.cc (Archive::interpret_header): Make into a const member
12151 function.
12152 (Archive::add_symbols): Call Input_objects::archive_start and
12153 archive_stop.
12154 (Archive::const_iterator): Define new class.
12155 (Archive::begin, Archive::end): New functions.
12156 (Archive::include_all_members): Rewrite to use iterator.
12157 (Archive::count_members): New function.
12158 * archive.h (class Archive): Update declarations.
12159 (Archive::filename): New function.
12160 * object.cc: Include "cref.h".
12161 (Sized_relobj::Sized_relobj): Initialize defined_count_.
12162 (Sized_relobj::do_get_global_symbol_counts): New function.
12163 (Input_objects::add_object): Add object to cross-referencer.
12164 (Input_objects::archive_start): New function.
12165 (Input_objects::archive_stop): New function.
12166 (Input_objects::print_symbol_counts): New function.
12167 * object.h: Declare Cref and Archive.
12168 (Object::get_global_symbol_counts): New function.
12169 (Object::do_get_global_symbol_counts): New pure virtual function.
12170 (class Sized_relobj): Add defined_count_ field. Update
12171 declarations.
12172 (class Input_objects): Add cref_ field. Update constructor.
12173 Update declarations.
12174 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12175 defined_count_.
12176 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12177 symbol counts.
12178 (Sized_dynobj::do_get_global_symbol_counts): New function.
12179 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12180 defined_count_. Update declarations. Define Symbols typedef.
12181 * symtab.cc (Symbol_table::add_from_relobj): Add defined
12182 parameter. Change all callers.
12183 (Symbol_table::add_from_dynobj): Add sympointers and defined
12184 parameters. Change all callers.
12185 * symtab.h (class Symbol_table): Update declarations.
12186 * Makefile.am (CCFILES): Add cref.cc.
12187 (HFILES): Add cref.h.
12188 * Makefile.in: Rebuild.
12189
3f7c5e1d
CD
121902008-07-22 Simon Baldwin <simonb@google.com>
12191
12192 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12193 to zero when writing undefined symbols.
12194
e0b64032
ILT
121952008-07-22 Ian Lance Taylor <iant@google.com>
12196
12197 * output.cc (Output_section::add_input_section): Don't try to
12198 merge empty merge sections.
12199
096b02cf
CS
122002008-07-21 Craig Silverstein <csilvers@google.com>
12201
12202 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12203 Include symbol version in error message.
cd536b21 12204
1d1f116d
CD
122052008-07-20 Chris Demetriou <cgd@google.com>
12206
cd536b21 12207 * configure.ac (gold_cv_c_random_seed): New configured variable.
1d1f116d
CD
12208 (RANDOM_SEED_CFLAGS): New substituted variable.
12209 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12210 * configure: Rebuild.
12211 * Makefile.in: Likewise.
12212 * testsuite/Makefile.in: Likewise.
12213
a18f591e
ILT
122142008-07-18 Ian Lance Taylor <iant@google.com>
12215
12216 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12217 where we see NAME/NULL and NAME/VERSION as separate symbols.
12218 * testsuite/ver_test_main.cc (main): Call t4.
12219 (t4, t4_2a): Define.
12220 * testsuite/ver_test_2.cc (t4_2): Define.
12221 * testsuite/ver_test_2.script: Put t4_2a in VER2.
12222 * testsuite/ver_test_4.cc (t4_2a): Define.
12223 * testsuite/ver_test_4.script: Put t4_2a in VER2.
12224 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12225
c6e3f6ed
ILT
122262008-07-17 Ian Lance Taylor <iant@google.com>
12227
12228 * dynobj.cc (Versions::add_def): If we give an error about a
12229 missing version, go ahead and create the version anyhow.
12230
ef9beddf
ILT
122312008-07-10 Ian Lance Taylor <iant@google.com>
12232
12233 Handle output sections with more than 0x7fffffff bytes.
12234 * object.h (class Relobj): Change map_to_output_ to
12235 output_sections_, and just keep a section pointer. Change all
12236 uses. Move comdat group support to Sized_relobj.
12237 (Relobj::is_section_specially_mapped): Remove.
12238 (Relobj::output_section): Remove poff parameter. Change all
12239 callers.
12240 (Relobj::output_section_offset): New function.
12241 (Relobj::set_section_offset): Rewrite.
12242 (Relobj::map_to_output): Remove.
12243 (Relobj::output_sections): New function.
12244 (Relobj::do_output_section_offset): New pure virtual function.
12245 (Relobj::do_set_section_offset): Likewise.
12246 (class Sized_relobj): Add section_offsets_ field. Add comdat
12247 group support from Relobj. Update declarations.
12248 (Sized_relobj::get_output_section_offset): New function.
12249 (Sized_relobj::do_output_section_offset): New function.
12250 (Sized_relobj::do_set_section_offset): New function.
12251 * object.cc (Relobj::output_section_address): Remove.
12252 (Sized_relobj::Sized_relobj): Initialize new fields.
12253 (Sized_relobj::include_section_group): Cast find_kept_object to
12254 Sized_relobj.
12255 (Sized_relobj::include_linkonce_section): Likewise.
12256 (Sized_relobj::do_layout): Use separate arrays for output section
12257 and output offset.
12258 (Sized_relobj::do_count_local_symbols): Change map_to_output to
12259 output_sections.
12260 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12261 output_sections and section_offsets.
12262 (Sized_relobj::write_local_symbols): Likewise.
12263 (map_to_kept_section): Compute output address directly.
12264 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12265 output_sections and section_offsets.
12266 (Sized_relobj::write_sections): Likewise.
12267 (Sized_relobj::relocate_sections): Likewise.
12268 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12269 * output.h (class Output_reloc): Update declarations. Change
12270 u2_.relobj to Sized_relobj*.
12271 (class Output_data_reloc): Change add functions to use
12272 Sized_relobj*.
12273 * output.cc (Output_reloc::Output_reloc): Change relobj to
12274 Sized_relobj*.
12275 (Output_reloc::local_section_offset): Change return type to
12276 Elf_Addr. Use get_output_section_offset.
12277 (Output_reloc::get_address): Likewise.
12278 (Output_section::is_input_address_mapped): Don't call
12279 is_section_specially_mapped.
12280 (Output_section::output_offset): Likewise.
12281 (Output_section::output_address): Likewise.
12282 (Output_section::starting_output_address): Likewise.
12283 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12284 parameter to Sized_relobj*.
12285 (Copy_relocs::need_copy_reloc): Likewise.
12286 (Copy_relocs::save): Likewise.
12287 * copy-relocs.h (class Copy_relocs): Update declarations.
12288 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12289 Sized_relobj*. Change relobj_ field to Sized_relobj*.
12290 * target-reloc.h (relocate_for_relocatable): Change
12291 offset_in_output_section type to Elf_Addr. Change code that uses
12292 it as well.
12293 * layout.cc (Layout::layout): Always set *off.
12294 * mapfile.cc (Mapfile::print_input_section): Use
12295 output_section_offset.
12296 * i386.cc (Target_i386::copy_reloc): Change object parameter to
12297 Sized_relobj*.
12298 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12299 * sparc.cc (Target_sparc::copy_reloc): Likewise.
12300 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12301
5cb66f97
ILT
123022008-07-03 Ian Lance Taylor <iant@google.com>
12303
12304 * layout.cc (Layout::include_section): Do not discard unrecognized
12305 SHT_STRTAB sections.
12306
afe47622
CS
123072008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
12308
12309 * script.cc (Lex::can_continue_name): Make '?' allowable in
12310 version-script names.
12311 * testsuite/version_script.map: Change glob pattern to use '?'
12312
5adf9721
ILT
123132008-06-30 Manish Singh <yosh@gimp.org>
12314
12315 PR 6585
12316 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12317 Correct typo.
12318
e6fde208
ILT
123192008-06-30 Ian Lance Taylor <iant@google.com>
12320
12321 PR 6660
12322 PR 6682
12323 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12324 versions]: Don't try to read the value in the contents, since we
12325 don't use it. Use the template endianness when writing.
12326
3f2e6a2d
CC
123272008-06-25 Cary Coutant <ccoutant@google.com>
12328
12329 * fileread.cc (File_read::make_view): Assert on zero-length view.
12330 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12331 symbol table when there are no symbols to read.
12332
c43d3a48
CS
123332008-06-23 Craig Silverstein <csilvers@google.com>
12334
12335 * version.cc (version_string): Bump to 1.7
12336
5f494ea0
CS
123372008-06-18 Craig Silverstein <csilvers@google.com>
12338
12339 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12340 constant 0xFFFF to type Valtype.
12341 (Powerpc_relocate_functions::rel16_ha): Likewise.
12342
c42e122e
ILT
123432008-06-17 Ian Lance Taylor <iant@google.com>
12344
f34787f8
ILT
12345 * output.h (Output_section::Input_section): Initialize p2align_ to
12346 zero for Output_section_data constructors.
12347 (Output_section::Input_section::addralign): If not an input
12348 section, return the alignment of the Output_section_data.
12349 * testsuite/copy_test.cc: New file.
12350 * testsuite/copy_test_1.cc: New file.
12351 * testsuite/copy_test_2.cc: New file.
12352 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12353 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12354 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12355 (copy_test_1_pic.o, copy_test_1.so): New targets.
12356 (copy_test_2_pic.o, copy_test_2.so): New targets.
12357 * testsuite/Makefile.in: Rebuild.
12358
c42e122e
ILT
12359 * script-sections.cc (Script_sections::place_orphan): Initialize
12360 local variable exact.
12361
ce3ac18a
DE
123622008-06-13 David Edelsohn <edelsohn@gnu.org>
12363
12364 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12365
42cacb20
DE
123662008-06-12 David Edelsohn <edelsohn@gnu.org>
12367 David S. Miller <davem@davemloft.net>
12368
12369 * powerpc.cc: New file.
12370 * Makefile.am (TARGETSOURCES): Add powerpc.cc
12371 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12372 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12373 * Makefile.in: Rebuild.
12374
7b308235
ILT
123752008-06-09 Ian Lance Taylor <iant@google.com>
12376
12377 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12378 <exception>.
12379 (throwing, orig_terminate): New static variables.
12380 (terminate_handler): New static function.
12381 (t2): Set terminate handler.
12382
f0b886e3
ILT
123832008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12384
12385 PR 6584
cd536b21 12386 * binary.cc (Binary_to_elf::sized_convert): Fix .data
f0b886e3
ILT
12387 alignment.
12388
3e90f135
CC
123892008-05-30 Cary Coutant <ccoutant@google.com>
12390
12391 * archive.cc (Archive::include_all_members) Correct to step
12392 over symbol table and extended name table in thin archives.
12393
e09ad04a
ILT
123942008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12395
12396 PR 6407
12397 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12398 calculation.
12399
62b01cb5
ILT
124002008-05-28 Caleb Howe <cshowe@google.com>
12401
12402 * reduced_debug_output.cc: New file.
12403 * reduced_debug_output.h: New file.
92de84a6 12404 * options.h (class General_options): Add --strip-debug-non-line.
62b01cb5
ILT
12405 * options.cc (General_options::finalize): Add strip_debug_non_line
12406 to the strip heirarchy.
12407 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12408 fields.
12409 * layout.cc: Include "reduced_debug_output.h".
12410 (Layout::Layout): Initialize new fields.
12411 (line_only_debug_sections): New static array.
12412 (is_lines_only_debug_sections): New static inline function.
12413 (Layout::include_section): Handle --strip-debug-non-line.
12414 (Layout::make_output_section): If --strip-debug-non-line, build
12415 new output sections for .debug_abbrev and .debug_info.
12416 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12417 gold. Warn about possible overflow.
12418 (read_signed_LEB_128): Likewise.
12419 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12420 (read_signed_LEB_128): Declare.
12421 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12422 (HFILES): Add reduced_debug_output.h.
12423 * Makefile.in: Rebuild.
12424
7d9e3d98
ILT
124252008-05-21 Ian Lance Taylor <iant@google.com>
12426
12427 * mapfile.cc: New file.
12428 * mapfile.h: New file.
12429 * options.h (class General_options): Add -M/--print-map and -Map.
12430 * options.cc (General_options::finalize): Make -M equivalent to
12431 -Map -.
12432 * main.cc: Include <cstdio> and "mapfile.h".
12433 (main): Open mapfile if requested.
12434 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12435 constructor. Change caller.
12436 (queue_initial_tasks): Add mapfile parameter. Change caller.
12437 (queue_middle_tasks): Likewise.
12438 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12439 declarations.
12440 * archive.cc: Include "mapfile.h".
12441 (Archive::add_symbols): Add mapfile parameter. Change all
12442 callers. Pass mapfile, symbol, and reason to include_member.
12443 (Archive::include_all_members): Add mapfile parameter. Change all
12444 callers.
12445 (Archive::include_member): Add mapfile, sym, and why parameters.
12446 Change all callers. Report inclusion to map file.
12447 * archive.h: Include "fileread.h".
12448 (class Archive): Update declarations.
12449 (Archive::file): New const method.
12450 (class Add_archive_symbols): Add mapfile_ field. Update
12451 constructor. Change all callers.
12452 * readsyms.h (class Read_symbols): Likewise.
12453 (class Finish_group): Likewise.
12454 (class Read_script): Likewise.
12455 * common.cc: Include "mapfile.h".
12456 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12457 all callers.
12458 (Symbol_table::do_allocate_commons): Likewise.
12459 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12460 symbol allocation to mapfile.
12461 * common.h (class Allocate_commons_task): Add mapfile_ field.
12462 Update constructor. Change all callers.
12463 * symtab.h (class Symbol_table): Update declarations.
12464 * layout.cc: Include "mapfile.h".
12465 (Layout_task_runner::run): Print information to mapfile.
12466 (Layout::create_gold_note): Change Output_data_fixed_space to
12467 Output_data_zero_fill.
12468 (Layout::create_build_id): Likewise.
12469 (Layout::print_to_mapfile): New function.
12470 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12471 constructor. Change caller.
12472 (class Layout): Declare print_to_mapfile.
12473 * output.cc (Output_section::Input_section::print_to_mapfile): New
12474 function.
12475 (Output_section::add_input_section): If producing a map, always
12476 add to input_sections_ list.
12477 (Output_section::do_print_to_mapfile): New function.
12478 (Output_segment::print_sections_to_mapfile): New function.
12479 (Output_segment::print_section_list_to_mapfile): New function.
12480 * output.h: Include "mapfile.h".
12481 (Output_data::print_to_mapfile): New function.
12482 (Output_data::do_print_to_mapfile): New virtual function.
12483 (Output_segment_headers::do_print_to_mapfile): New function.
12484 (Output_file_header::do_print_to_mapfile): New function.
12485 (Output_data_const::do_print_to_mapfile): New function.
12486 (class Output_data_const_buffer): Add map_name_ field. Update
12487 constructor. Change all callers. Add do_print_to_mapfile
12488 function.
12489 (class Output_data_fixed_space): Likewise.
12490 (class Output_data_space): Likewise.
12491 (class Output_data_zero_fill): New class.
12492 (Output_data_strtab::do_print_to_mapfile): New function.
12493 (Output_data_reloc_base::do_print_to_mapfile): New function.
12494 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12495 (Output_data_group::do_print_to_mapfile): New function.
12496 (Output_data_got::do_print_to_mapfile): New function.
12497 (Output_data_dynamic::do_print_to_mapfile): New function.
12498 (Output_symtab_xindex::do_print_to_mapfile): New function.
12499 (class Output_section): Declare do_print_to_mapflie. Declare
12500 print_to_mapfile in Input_section.
12501 (class Output_segment): Declare new functions.
12502 * object.h (Sized_relobj::symbol_count): New function.
12503 * script-sections.cc
12504 (Output_section_element_dot_assignment::set_section_addresses):
12505 Change Output_data_fixed_space to Output_data_zero_fill.
12506 (Output_data_expression::do_print_to_mapfile): New function.
12507 * script.cc (read_input_script): Add mapfile parameter. Change
12508 all callers.
12509 * script.h (read_input_script): Update declaration.
12510 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12511 (Eh_frame::do_print_to_mapfile): New function.
12512 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12513 (Output_merge_string::do_print_to_mapfile): New function.
12514 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12515 function.
12516 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12517 function.
12518 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12519 function.
12520 * Makefile.am (CCFILES): Add mapfile.cc.
12521 (HFILES): Add mapfile.h.
12522 * Makefile.in: Rebuild.
12523
9f1d377b
ILT
125242008-05-19 Ian Lance Taylor <iant@google.com>
12525
12526 * options.h (class General_options): Add -z relro.
12527 * layout.cc (Layout::Layout): Initialize relro_segment_.
12528 (Layout::add_output_section_data): Return the output section.
12529 (Layout::make_output_section): Rcognize relro sections and mark
12530 them appropriately.
12531 (Layout::attach_allocated_section_to_segment): Put relro sections
12532 in a PT_GNU_RELRO segment.
12533 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12534 section as relro.
12535 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12536 PT_TLS segments.
12537 (Layout::linkonce_mapping): Map d.rel.ro.local to
12538 .data.rel.ro.local.
12539 (Layout::output_section_name): Us .data.rel.ro.local for any
12540 section which begins with that.
12541 * layout.h (class Layout): Update add_output_section_data
12542 declaration. Add relro_segment_ field.
12543 * output.cc (Output_section::Output_section): Initialize is_relro_
12544 and is_relro_local_ fields.
12545 (Output_segment::add_output_section): Group relro sections.
12546 (Output_segment::is_first_section_relro): New function.
12547 (Output_segment::maximum_alignment): If there is a relro section,
12548 align the segment to the common page size.
12549 (Output_segment::set_section_addresses): Track whether we are
12550 looking at relro sections. If the last section is a relro
12551 section, align to the common page size.
12552 (Output_segment::set_section_list_addresses): Add in_relro
12553 parameter. Change all callers. Align to the page size when
12554 moving from relro to non-relro section.
12555 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12556 segment.
12557 * output.h (class Output_section): Add is_relro_ and
12558 is_relro_local_ fields.
12559 (Output_section::is_relro): New function.
12560 (Output_section::set_is_relro): New function.
12561 (Output_section::is_relro_local): New function.
12562 (Output_section::set_is_relro_local): New function.
12563 (class Output_segment): Update declarations.
12564 * i386.cc (Target_i386::got_section): Mark .got section as relro.
12565 * sparc.cc (Target_sparc::got_section): Likewise.
12566 * x86_64.cc (Target_x86_64::got_section): Likewise.
12567 * testsuite/relro_test_main.cc: New file.
12568 * testsuite/relro_test.cc: New file.
12569 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12570 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12571 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12572 (relro_test.so, relro_test_pic.o): New targets.
12573 * testsuite/Makefile.in: Rebuild.
12574
a984ee1d
ILT
125752008-05-16 Ian Lance Taylor <iant@google.com>
12576
01676dcd
ILT
12577 * output.cc (Output_segment::add_output_section): Remove front
12578 parameter.
12579 * output.h (class Output_segment): Remove
12580 add_initial_output_section and overloaded add_output_section.
12581 Update declaration of remaining add_output_section.
12582 * layout.cc (Layout::create_interp): Call add_output_section
12583 rather than add_initial_output_section.
12584 (Layout::finish_dynamic_section): Likewise.
12585
497897f9
ILT
12586 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12587 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
12588 know the dynamic type.
12589 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12590 field. Initialize it in constructor.
12591 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12592 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12593 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12594 reloc.
12595
a984ee1d
ILT
12596 * output.cc (Output_reloc::get_address): Change return type to
12597 Elf_Addr.
12598 * output.h (class Output_reloc): Update get_address declaration.
12599 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12600 for section addresses.
12601
55ba0940
ILT
126022008-05-09 Ian Lance Taylor <iant@google.com>
12603
12604 PR 6493
12605 * gold.cc (gold_nomem): Use return value of write.
12606
75517b77
ILT
126072008-05-08 Ian Lance Taylor <iant@google.com>
12608
12609 * symtab.c (Symbol::init_base_output_data): Add version
12610 parameter. Change all callers.
12611 (Symbol::init_base_output_segment): Likewise.
12612 (Symbol::init_base_constant): Likewise.
12613 (Symbol::init_base_undefined): Likewise.
12614 (Sized_symbol::init_output_data): Likewise.
12615 (Sized_symbol::init_output_segment): Likewise.
12616 (Sized_symbol::init_constant): Likewise.
12617 (Sized_symbol::init_undefined): Likewise.
12618 (Symbol_table::do_define_in_output_data): If the new symbol has a
12619 version, mark it as the default.
12620 (Symbol_table::do_define_in_output_segment): Likewise.
12621 (Symbol_table::do_define_as_constant): Likewise.
12622 * symtab.h (class Symbol): Update declarations.
12623 (class Sized_symbol): Likewise.
12624 * resolve.cc (Symbol::override_version): New function.
c42e122e 12625 (Symbol::override_base): Call override_version.
75517b77
ILT
12626 (Symbol::override_base_with_special): Likewise.
12627 * testsuite/ver_script_8.script: New file.
12628 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12629 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12630 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12631 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12632
f1f70eae
ILT
126332008-05-06 Ian Lance Taylor <iant@google.com>
12634
f3e9c5c5
ILT
12635 PR 6049
12636 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12637 functions.
12638 (class General_options): Remove existing --undefined, and add
12639 --no-undefined instead. Add new --undefined as synonym for -u.
12640 * archive.cc (Archive::add_symbols): Check whether symbol was
12641 named with -u.
12642 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12643 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12644 all uses. Add IS_UNDEFINED. Update declarations to split
12645 different versions of init_base. Declare init_base_undefined.
12646 (Symbol::is_defined): Handle IS_UNDEFINED.
12647 (Symbol::is_undefined): Likewise.
12648 (Symbol::is_weak_undefined): Call is_undefined.
12649 (Symbol::is_absolute): Handle IS_CONSTANT.
12650 (class Sized_symbol): Update declarations to split different
12651 versions of init. Declare init_undefined.
12652 (class Symbol_table): Declare new functions.
12653 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12654 Change all callers.
12655 (Symbol::init_base_output_data): Likewise.
12656 (Symbol::init_base_output_segment): Likewise.
12657 (Symbol::init_base_constant): Likewise.
12658 (Symbol::init_base_undefined): New function.
12659 (Sized_symbol::init_object): Rename from init. Change all
12660 callers.
12661 (Sized_symbol::init_output_data): Likewise.
12662 (Sized_symbol::init_output_segment): Likewise.
12663 (Sized_symbol::init_constant): Likewise.
12664 (Sized_symbol::init_undefined): New function.
12665 (Symbol_table::add_undefined_symbols_from_command_line): New
12666 function.
12667 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12668 function.
12669 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12670 (Symbol::output_section): Likewise.
12671 (Symbol::set_output_section): Likewise.
12672 (Symbol_table::sized_finalize_symbol): Likewise.
12673 (Symbol_table::sized_write_globals): Likewise.
12674 * resolve.cc (Symbol_table::should_override): Likewise.
12675 (Symbol::override_base_with_special): Likewise.
12676
8bdcdf2c
ILT
12677 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12678 symbol, change it to have default visibility.
12679 * testsuite/protected_1.cc: New file.
12680 * testsuite/protected_2.cc: New file.
12681 * testsuite/protected_3.cc: New file.
12682 * testsuite/protected_main_1.cc: New file.
12683 * testsuite/protected_main_2.cc: New file.
12684 * testsuite/protected_main_3.cc: New file.
12685 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12686 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12687 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12688 (protected_1.so): New target.
12689 (protected_1_pic.o, protected_2_pic.o): New targets.
12690 (protected_3_pic.o): New target.
12691 (check_PROGRAMS): Add protected_2.
12692 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12693 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12694 * testsuite/Makefile.in: Rebuild.
12695
2b706932
ILT
12696 * options.h (DEFINE_var): Add set_user_set_##varname__.
12697 (DEFINE_bool_alias): New macro.
12698 (class General_options): Define -Bstatic using DEFINE_bool_alias
12699 rather than DEFINE_special. Add --undefined as an alias for -z
12700 defs.
12701 * options.cc (General_options::parse_Bstatic): Remove.
12702
d82a5bcc
ILT
12703 * options.h (class General_options): Add --fatal-warnings.
12704 * main.cc (main): Implement --fatal-warnings.
12705 * errors.h (Errors::warning_count): New function.
12706
f1f70eae
ILT
12707 * options.h (class General_options): Add -Bsymbolic-functions.
12708 * symtab.h (Symbol::is_preemptible): Check for
12709 -Bsymbolic-functions.
12710
8825ac63
ILT
127112008-05-05 Ian Lance Taylor <iant@google.com>
12712
d98bc257
ILT
12713 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12714 as noVARNAME rather than no-VARNAME.
12715 (class General_options): Add option -z combreloc.
12716 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12717 get_address.
12718 (Output_reloc::sort_before) [SHT_REL]: New function.
12719 (Output_reloc::sort_before) [SHT_RELA]: New function.
12720 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12721 Sort_relocs_comparison.
12722 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12723 parameter. Change all callers.
12724 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12725 sort_relocs parameter. Change all callers.
12726 * output.cc (Output_reloc::get_address): New function, broken out
12727 of write_rel.
12728 (Output_reloc::write_rel): Call it.
12729 (Output_reloc::compare): New function.
12730 (Output_data_reloc_base::do_write): Optionally sort relocs.
12731
60b2b4e7
ILT
12732 * configure.ac: If targ_extra_obj is set, link it in.
12733 * configure.tgt: Initialize all variables.
12734 (x86_64*): Set targ_extra_obj and targ_extra_size.
12735 * configure: Rebuild.
12736
8825ac63
ILT
12737 * object.cc (Sized_relobj::include_section_group): Adjust section
12738 indexes read from group data. Build vector to pass to
12739 layout_group.
12740 * layout.cc (Layout::layout_group): Add flags and shndxes
12741 parameters. Remove contents parameter. Change caller. Update
12742 explicit instantiations.
12743 * layout.h (class Layout): Update layout_group declaration.
12744 * output.cc (Output_data_group::Output_data_group): Add flags and
12745 input_shndxes parameters. Remove contents parameter. Change
12746 caller.
12747 (Output_data_group::do_write): Change input_sections_ to
12748 input_shndxes_.
12749 * output.h (class Output_data_group): Update constructor
12750 declaration. Rename input_sections_ to input_shndxes_.
12751 * testsuite/many_sections_test.cc: Add template.
12752
e94cf127
CC
127532008-04-30 Cary Coutant <ccoutant@google.com>
12754
4418b2d5
CC
12755 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12756
e94cf127
CC
12757 * layout.cc (Layout::include_section): Refactored check for debug
12758 info section.
12759 (Layout::add_comdat): Add new parameters. Change type
12760 of signature parameter. Add object and shndx to signatures table.
12761 (Layout::find_kept_object): New function.
12762 * layout.h: Include <cstring>.
12763 (Layout::is_debug_info_section): New function.
12764 (Layout::add_comdat): Add new parameters.
12765 (Layout::find_kept_object): New function.
12766 (Layout::Kept_section): New struct.
12767 (Layout::Signatures): Change type of map range.
12768 * object.cc (Relobj::output_section_address): New function.
12769 (Sized_relobj::include_section_group): Add new parameters. Change
12770 calls to Layout::add_comdat. Change to build table of kept comdat
12771 groups and table mapping discarded sections to kept sections.
12772 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12773 (Sized_relobj::do_layout): Change calls to include_section_group and
12774 include_linkonce_section.
12775 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12776 value to zero when section is discarded.
12777 (Sized_relobj::map_to_kept_section): New function.
12778 * object.h (Relobj::output_section_address): New function.
12779 (Relobj::Comdat_group): New type.
12780 (Relobj::find_comdat_group): New function.
12781 (Relobj::Comdat_group_table): New type.
12782 (Relobj::Kept_comdat_section): New type.
12783 (Relobj::Kept_comdat_section_table): New type.
12784 (Relobj::add_comdat_group): New function.
12785 (Relobj::set_kept_comdat_section): New function.
12786 (Relobj::get_kept_comdat_section): New function.
12787 (Relobj::comdat_groups_): New field.
12788 (Relobj::kept_comdat_sections_): New field.
12789 (Symbol_value::input_value): Update comment.
12790 (Sized_relobj::map_to_kept_section) New function.
12791 (Sized_relobj::include_linkonce_section): Add new parameter.
12792 * target-reloc.h (Comdat_behavior): New type.
12793 (get_comdat_behavior): New function.
12794 (relocate_section): Add code to map a discarded section to the
12795 corresponding kept section when applying a relocation.
12796
e4e5049b
CS
127972008-04-30 Craig Silverstein <csilvers@google.com>
12798
12799 * dwarf_reader.cc (next_generation_count): New static var.
12800 (Addr2line_cache_entry): New struct.
12801 (addr2line_cache): New static var.
12802 (Dwarf_line_info::one_addr2line): Added caching.
12803 (Dwarf_line_info::clear_addr2line_cache): New function.
12804 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12805 cache-size parameter.
12806 (Dwarf_line_info::one_addr2line_cache): New function.
12807 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12808 new cache-size argument to one_addr2line(), and clear cache.
12809
d09e9154
CC
128102008-04-28 Cary Coutant <ccoutant@google.com>
12811
12812 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12813 R_386_PC8 relocations.
12814
7ef73768
ILT
128152008-04-23 Ian Lance Taylor <iant@google.com>
12816
55438702
ILT
12817 * object.cc (Sized_relobj::include_section_group): Check for
12818 invalid section group.
12819
c165fb93
ILT
12820 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12821 header size.
12822
7ef73768
ILT
12823 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12824 than read for file header.
12825 * archive.cc (Archive::include_member): Likewise.
12826
6194aaab
L
128272008-04-23 Paolo Bonzini <bonzini@gnu.org>
12828
12829 * aclocal.m4: Regenerate.
12830 * configure: Regenerate.
12831
d491d34e
ILT
128322008-04-19 Ian Lance Taylor <iant@google.com>
12833
5ea2bac6
ILT
12834 * version.cc (version_string): Bump to 1.6.
12835
7bc3e21a
ILT
12836 * testsuite/Makefile.am (many_sections_r_test): New target.
12837 (many_sections_r_test_SOURCES): Remove.
12838 (many_sections_r_test_DEPENDENCIES): Remove.
12839 (many_sections_r_test_LDFLAGS): Remove.
12840 (many_sections_r_test_LDADD): Remove.
12841
7fcd3aa9
ILT
12842 * object.cc (Sized_relobj::do_add_symbols): Always pass
12843 local_symbol_count_ to add_from_relobj.
12844
4c94d6ae
ILT
12845 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12846 every thousand variables.
12847 * testsuite/Makefile.in: Rebuild.
12848
d491d34e
ILT
12849 * object.cc (Xindex::initialize_symtab_xindex): New function.
12850 (Xindex::read_symtab_xindex): New function.
12851 (Xindex::sym_xindex_to_shndx): New function.
12852 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12853 available.
12854 (Sized_relobj::do_initialize_xindex): New function.
12855 (Sized_relobj::do_read_symbols): Adjust section links.
12856 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12857 parameter. Change all callers.
12858 (Sized_relobj::include_section_group): Adjust section links and
12859 symbol section indexes.
12860 (Sized_relobj::do_layout): Adjust section links.
12861 (Sized_relobj::do_count_local_symbols): Adjust section links and
12862 symbol section indexes.
12863 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12864 ordinary and special symbols.
12865 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12866 dynsym_xindex parameters. Change all callers. Adjust section
12867 links. Use SHN_XINDEX when needed.
12868 (Sized_relobj::get_symbol_location_info): Adjust section links.
12869 Don't get fooled by special symbols.
12870 * object.h (class Xindex): Define.
12871 (class Object): Add xindex_ parameter. Declare virtual functoin
12872 do_initialize_xindex.
12873 (Object::adjust_sym_shndx): New function.
12874 (Object::set_xindex): New protected function.
12875 (class Symbol_value): Add is_ordinary_shndx_ field.
12876 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12877 (Symbol_value::value): Assert ordinary section.
12878 (Symbol_value::initialize_input_to_output_map): Likewise.
12879 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12880 Change all callers.
12881 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12882 all callers.
12883 (class Sized_relobj): Update declarations.
12884 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12885 parameter. Change all callers.
12886 (Sized_relobj::adjust_shndx): New function.
12887 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12888 field.
12889 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12890 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12891 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12892 (Sized_dynobj::read_dynsym_section): Adjust section links.
12893 (Sized_dynobj::read_dynamic): Likewise.
12894 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12895 section links.
12896 (Sized_dynobj::do_initialize_xindex): New function.
12897 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12898 do_initialize_xindex.
12899 (Sized_dynobj::adjust_shndx): New function.
12900 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12901 dynsym_xindex_ fields.
12902 (Layout::finalize): Add a call to set_section_indexes before
12903 creating the symtab sections.
12904 (Layout::set_section_indexes): Don't do anything if the section
12905 already has a section index.
12906 (Layout::create_symtab_sections): Add shnum parameter. Change
12907 caller. Create .symtab_shndx section if needed.
12908 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12909 caller.
12910 (Layout::allocated_output_section_count): New function.
12911 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12912 needed.
12913 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12914 fields. Update declarations.
12915 (Layout::symtab_xindex): New function.
12916 (Layout::dynsym_xindex): New function.
12917 (class Write_symbols_task): Add layout_ field.
12918 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12919 Change caller.
12920 * output.cc (Output_section_headers::Output_section_headers): Add
12921 shstrtab_section parameter. Change all callers.
12922 (Output_section_headers::do_sized_write): Store overflow values
12923 for section count and section string table section index in
12924 section header zero.
12925 (Output_file_header::do_sized_write): Check for overflow of
12926 section count and section string table section index.
12927 (Output_symtab_xindex::do_write): New function.
12928 (Output_symtab_xindex::endian_do_write): New function.
12929 * output.h (class Output_section_headers): Add shstrtab_section_.
12930 Update declarations.
12931 (class Output_symtab_xindex): Define.
12932 (Output_section::has_out_shndx): New function.
12933 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12934 field.
12935 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12936 Change all callers.
12937 (Sized_symbol::init): Likewise.
12938 (Symbol::output_section): Check for ordinary symbol.
12939 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12940 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12941 callers.
12942 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12943 Change all callers. Simplify handling of symbols from sections
12944 not included in the link.
12945 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12946 distinction.
12947 (Weak_alias_sorter::operator()): Assert that symbols are
12948 ordinary.
12949 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12950 distinction.
12951 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12952 parameters. Change all callers.
12953 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12954 symbol distinction. Use SHN_XINDEX when needed.
12955 (Symbol_table::write_section_symbol): Add symtab_xindex
12956 parameter. Change all callers.
12957 (Symbol_table::sized_write_section_symbol): Likewise. Use
12958 SHN_XINDEX when needed.
12959 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12960 declarations.
12961 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12962 (Symbol::is_defined): Check is_ordinary.
12963 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12964 (Symbol::is_absolute, Symbol::is_common): Likewise.
12965 (class Sized_symbol): Update declarations.
12966 (class Symbol_table): Update declarations.
12967 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12968 parameters. Change all callers.
12969 (Sized_symbol::override): Likewise.
12970 (Symbol_table::override): Likewise.
12971 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12972 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12973 is_ordinary, and orig_st_shndx parameters. Change all callers.
12974 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12975 to be in an ordinary section.
12976 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12977 object and is_ordinary parameters. Change all callers.
12978 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12979 Change all callers. Don't add undefined or non-ordinary symbols
12980 to reloc_map_.
12981 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12982 Change all callers.
12983 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12984 declarations.
12985 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12986 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12987 (Sized_relobj::relocate_sections): Likewise.
12988 * target-reloc.h (scan_relocs): Adjust section symbol index.
12989 (scan_relocatable_relocs): Likewise.
12990 * i386.cc (Scan::local): Check for ordinary symbols.
12991 * sparc.cc (Scan::local): Likewise.
12992 * x86_64.cc (Scan::local): Likewise.
12993 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12994 to symbol_section_and_value.
12995 * testsuite/many_sections_test.cc: New file.
12996 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12997 (check_PROGRAMS): Add many_sections_test.
12998 (many_sections_test_SOURCES): Define.
12999 (many_sections_test_DEPENDENCIES): Define.
13000 (many_sections_test_LDFLAGS): Define.
13001 (BUILT_SOURCES): Add many_sections_define.h.
13002 (many_sections_define.h): New target.
13003 (BUILT_SOURCES): Add many_sections_check.h.
13004 (many_sections_check.h): New target.
13005 (check_PROGRAMS): Add many_sections_r_test.
13006 (many_sections_r_test_SOURCES): Define.
13007 (many_sections_r_test_DEPENDENCIES): Define.
13008 (many_sections_r_test_LDFLAGS): Define.
13009 (many_sections_r_test_LDADD): Define.
13010 (many_sections_r_test.o): New target.
13011 * testsuite/Makefile.in: Rebuild.
13012
c5818ff1
CC
130132008-04-17 Cary Coutant <ccoutant@google.com>
13014
13015 * errors.cc (Errors::info): New function.
13016 (gold_info): New function.
13017 * errors.h (Errors::info): New function.
13018 * gold.h (gold_info): New function.
13019 * object.cc (Input_objects::add_object): Print trace output.
13020 * options.cc (options::parse_set): New function.
13021 (General_options::parse_wrap): Deleted.
13022 (General_options::General_options): Deleted initializer.
13023 * options.h (options::String_set): New typedef.
13024 (options::parse_set): New function.
13025 (DEFINE_set): New macro.
13026 (General_options::wrap): Changed to use DEFINE_set. Changed
13027 callers of any_wrap_symbols and is_wrap_symbol.
13028 (General_options::trace, General_options::trace_symbol):
13029 New options.
13030 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13031 (General_options::wrap_symbols_): Deleted.
13032 * symtab.cc (Symbol_table::add_from_object): Print trace output.
13033
b5be4a7c
DM
130342008-04-17 David S. Miller <davem@davemloft.net>
13035
13036 * options.cc (General_options::parse_V): New function.
13037 * options.h: Add entries for -V and -Qy.
13038
155a0dd7
ILT
130392008-04-17 Ian Lance Taylor <iant@google.com>
13040
13041 * common.cc (Symbol_table::allocate_commons): Remove options
13042 parameter. Change caller.
13043 (Symbol_table::do_allocate_commons): Remove options parameter.
13044 Change caller. Just call do_allocate_commons_list twice.
13045 (Symbol_table::do_allocate_commons_list): New function, broken out
13046 of do_allocate_commons.
13047 * common.h (class Allocate_commons_task): Remove options_ field.
13048 Update constructor.
13049 * symtab.cc (Symbol_table::Symbol_table): Initialize
13050 tls_commons_.
13051 (Symbol_table::add_from_object): Put TLS common symbols on
13052 tls_commons_ list.
13053 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13054 which are IN_OUTPUT_DATA.
13055 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
13056 allocate_commons and do_allocate_commons declarations. Declare
13057 do_allocate_commons_list.
13058 * gold.cc (queue_middle_tasks): Update creation of
13059 Allocate_commons_task to not pass options.
13060 * testsuite/Makefile.am (INCLUDES): Add -I.. .
13061 (TLS_TEST_C_FLAGS): New variable.
13062 (tls_test_c_pic.o): New target.
13063 (tls_test_shared.so): Link in tls_test_c_pic.o.
13064 (tls_test_c_pic_ie.o): New target.
13065 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13066 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13067 (tls_test_c.o): New target.
13068 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13069 (tls_pic_test_LDADD): Likewise.
13070 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13071 (tls_shared_gd_to_ie_test_LDADD): Likewise.
13072 (tls_test_c_gnu2.o): New target.
13073 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13074 tls_test_c_gnu2.o.
13075 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13076 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13077 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13078 * testsuite/tls_test.cc: Include "config.h".
13079 (t_last): Call t11_last.
13080 * testsuite/tls_test.h (t11, t11_last): Declare.
13081 * testsuite/tls_test_c.c: New file.
13082 * testsuite/tls_test_main.cc (thread_routine): Call t11.
13083 * configure.ac: Check for OpenMP support.
13084 * configure, config.in, Makefile.in: Rebuild.
13085 * testsuite/Makefile.in: Rebuild.
13086
edfbb029
CC
130872008-04-16 Cary Coutant <ccoutant@google.com>
13088
13089 * i386.cc (Target_i386::define_tls_base_symbol): New function.
13090 (Target_i386::tls_base_symbol_defined_): New field.
13091 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13092 (Target_i386::Scan::global): Likewise.
13093 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13094 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13095 (Target_x86_64::tls_base_symbol_defined_): New field.
13096 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13097 (Target_x86_64::Scan::global): Likewise.
13098
f3c69fca
CC
130992008-04-16 Cary Coutant <ccoutant@google.com>
13100
13101 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13102 (Symbol::needs_plt_entry): Allow weak undefined symbols.
13103 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13104 building shared libraries.
13105 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13106 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13107 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13108 * testsuite/Makefile.in: Rebuild.
13109 * testsuite/weak_undef.h: New file.
13110 * testsuite/weak_undef_file1.cc: Add extra test cases.
13111 * testsuite/weak_undef_file2.cc: Likewise.
13112 * testsuite/weak_undef_test.cc: Likewise.
13113
7c414435
DM
131142008-04-16 David S. Miller <davem@davemloft.net>
13115
32b769e1
DM
13116 * sparc.cc (Target_sparc::Scan): Change from struct to class.
13117 Add issued_non_pic_error_ field. Declare check_non_pic.
13118 (Target_sparc::Scan::check_non_pic): New function.
13119 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13120 (Target_sparc::Scan::global): Likewise.
13121
11936fb1
DM
13122 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13123 * configure: Rebuild.
13124
7c414435
DM
13125 * options.h (DEFINE_enable): New macro.
13126 (new_dtags): New enable option.
13127 (initfirst, interpose, loadfltr, nodefaultlib,
13128 nodelete, nodlopen, nodump): New -z options.
13129 * layout.cc (Layout:finish_dynamic_section): If new
13130 dtags enabled, emit DT_RUNPATH. Also, emit a
13131 DT_FLAGS_1 containing any specified -z flags.
13132
85c7bf8b
ILT
131332008-04-16 Ian Lance Taylor <iant@google.com>
13134
12c0daef
ILT
13135 * copy-relocs.cc: New file.
13136 * copy-relocs.h: New file.
13137 * reloc.cc: Remove Copy_relocs code.
13138 * reloc.h: Likewise.
13139 * reloc-types.h (struct Reloc_types) [both versions]: Add
13140 get_reloc_addend_noerror.
13141 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13142 variants of add_global which take an addend which must be zero.
13143 * i386.cc: Include "copy-relocs.h".
13144 (class Target_i386): Change type of copy_relocs_ to variable,
13145 update initializer.
13146 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13147 Change all callers.
13148 (Target_i386::do_finalize_sections): Change handling of
13149 copy_relocs_.
13150 * sparc.cc: Include "copy-relocs.h".
13151 (class Target_sparc): Change type of copy_relocs_ to variable,
13152 update initializer.
13153 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13154 Change all callers.
13155 (Target_sparc::do_finalize_sections): Change handling of
13156 copy_relocs_.
13157 * x86_64.cc: Include "copy-relocs.h".
13158 (class Target_x86_64): Change type of copy_relocs_ to variable,
13159 update initializer.
13160 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13161 class. Change all callers.
13162 (Target_x86_64::do_finalize_sections): Change handling of
13163 copy_relocs_.
13164 * Makefile.am (CCFILES): Add copy-relocs.cc.
13165 (HFILES): Add copy-relocs.h.
13166
4f4995b6
ILT
13167 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13168
85c7bf8b
ILT
13169 * testsuite/script_test_4.sh: Permit leading zeroes.
13170
4f2a9edd
ILT
131712008-04-15 Ian Lance Taylor <iant@google.com>
13172
e6188289
ILT
13173 * script-sections.cc (Script_sections::create_segments): Use
13174 header_size_adjustment even when there is enough room for the
13175 headers.
13176 * testsuite/script_test_4.sh: New file.
13177 * testsuite/script_test_4.t: New file.
13178 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13179 (check_DATA): Add script_test_4.stdout.
13180 (MOSTLYCLEANFILES): Likewise.
13181 (script_test_4): New target.
13182 (script_test_4.stdout): New target.
13183 * testsuite/Makefile.in: Rebuild.
13184
4f2a9edd
ILT
13185 * sparc.cc: Add definitions for Output_data_plt_sparc class
13186 constants.
13187
f5314dd5
DM
131882008-04-14 David S. Miller <davem@davemloft.net>
13189
13190 * sparc.cc: New file.
13191 * Makefile.am (TARGETSOURCES): Add sparc.cc
13192 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13193 * configure.tgt: Document targ_extra_size and
13194 targ_extra_big_endian. Add entries for sparc-* and
13195 sparc64-*.
13196 * configure.ac: Handle targ_extra_size and
13197 targ_extra_big_endian.
13198 * Makefile.in: Rebuild.
13199 * configure: Likewise.
13200 * po/POTFILES.in: Likewise.
13201 * po/gold.pot: Likewise.
13202
154e0e9a
ILT
132032008-04-14 Ian Lance Taylor <iant@google.com>
13204
13205 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13206 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13207 in the name/type/flags to section mapping. Don't call
13208 allocate_output_section.
13209 (Layout::choose_output_section): Change parameter from adjust_name
13210 to is_input_section. Don't permit input sections after sections
13211 are attached to segments. Don't call allocate_output_section.
13212 (Layout::layout_eh_frame): Call update_flags_for_input_section,
13213 not write_enable_output_section.
13214 (Layout::make_output_section): Don't push to
13215 unattached_section_list_ nor call attach_to_segment. Call
13216 attach_section_to_segment if sections are attached.
13217 (Layout::attach_sections_to_segments): New function.
13218 (Layout::attach_section_to_segment): New function.
13219 (Layout::attach_allocated_section_to_segment): Rename from
13220 attach_to_segment. Remove flags parameter.
13221 (Layout::allocate_output_section): Remove function.
13222 (Layout::write_enable_output_section): Remove function.
13223 * layout.h (class Layout): Update for above changes. Add new
13224 field sections_are_attached_.
13225 * output.h (Output_section::update_flags_for_input_section): New
13226 function.
13227 * output.cc (Output_section::add_input_section): Call
13228 update_flags_for_input_section.
13229 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13230
009a67a2
CC
132312008-04-11 Cary Coutant <ccoutant@google.com>
13232
13233 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13234 thought unnecessary.
13235 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13236
759b1a24
ILT
132372008-04-11 Ian Lance Taylor <iant@google.com>
13238
13239 * output.h (class Output_section_data): Remove inline definition
13240 of set_addralign.
13241 * output.cc (Output_section_data::set_addralign): New function.
13242
c2b45e22
CC
132432008-04-11 Cary Coutant <ccoutant@google.com>
13244
13245 Add support for TLS descriptors for i386 and x86_64.
13246 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13247 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13248 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13249 GOT_TYPE_TLS_DESC.
13250 (Target_i386::got_mod_index_entry): Remove unnecessary code.
13251 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13252 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
13253 relocations.
13254 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13255 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13256 Fix problem with initial-exec relocations.
13257 (Target_i386::Relocate::relocate_tls): Likewise.
13258 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13259 relaxation.
13260 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13261 support for section-plus-offset dynamic table entries.
13262 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13263 (Output_data_dynamic::Dynamic_entry): Add support for
13264 section-plus-offset dynamic table entries.
13265 (Output_data_dynamic::Classification): Likewise.
13266 (Output_data_dynamic::classification_): Renamed offset_.
13267 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13268 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13269 (Target_x86_64::make_plt_section): New function.
13270 (Target_x86_64::reserve_tlsdesc_entries): New function.
13271 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13272 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13273 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13274 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13275 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13276 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13277 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13278 add extra PLT entry for TLS descriptors.
13279 (Output_data_plt_x86_64::got_): New field.
13280 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13281 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13282 fields.
13283 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13284 descriptors.
13285 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13286 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13287 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13288 R_386_TLS_DESC_CALL relocations.
13289 (Target_x86_64::Scan::global): Likewise.
13290 (Target_x86_64::do_finalize_sections): Add dynamic table entries
13291 for TLS descriptors.
13292 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13293 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13294 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13295 GD-to-IE relaxation.
13296 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13297 and TLS_DESCRIPTORS.
13298 * Makefile.in: Rebuild.
13299 * configure: Rebuild.
13300 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13301 (tls_test_shared2.so): New target.
13302 (tls_shared_gd_to_ie_test_SOURCES): New variable.
13303 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13304 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13305 (tls_shared_gd_to_ie_test_LDADD): New variable.
13306 (tls_shared_gnu2_gd_to_ie_test): New target.
13307 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13308 New targets.
13309 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13310 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13311 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13312 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13313 (tls_shared_gnu2_test): New target.
13314 (tls_test_gnu2_shared.so): New target.
13315 (tls_shared_gnu2_test_SOURCES): New variable.
13316 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13317 (tls_shared_gnu2_test_LDFLAGS): New variable.
13318 (tls_shared_gnu2_test_LDADD): New variable.
13319 * testsuite/Makefile.in: Rebuild.
13320 * testsuite/Makefile.
13321
83bfb6b7
ILT
133222008-04-11 Ian Lance Taylor <iant@google.com>
13323
13324 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13325 justsyms.t.
13326 * testsuite/Makefile.in: Rebuild.
13327
13328 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13329 long.
13330 * testsuite/script_test_2.cc (main): Adjust test.
13331
706e1f5e
ILT
133322008-04-11 David S. Miller <davem@davemloft.net>
13333 Ian Lance Taylor <iant@google.com>
13334
13335 * options.h (General_options): Add entries for '-Y' and
13336 '-relax'.
13337 * options.cc (General_options:finalize): If -Y was used, add those
13338 entries to the library path instead of the default "/lib" and
13339 "/usr/lib".
13340
7c98e6bb
DM
133412008-04-11 David S. Miller <davem@davemloft.net>
13342
13343 * testsuite/justsyms.t: Start at 0x100.
13344 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
83bfb6b7
ILT
13345 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13346 long.
13347 * testsuite/script_test_2.cc: Adjust string and section length
13348 checks.
7c98e6bb 13349
99a37bfd
ILT
133502008-04-09 Ian Lance Taylor <iant@google.com>
13351
2cefc357
ILT
13352 PR gold/5996
13353 * script-sections.cc (Sections_element::allocate_to_segment): Add
13354 orphan parameter.
13355 (Output_section_definition::allocate_to_segment): Likewise.
13356 (Orphan_output_section::allocate_to_segment): Likewise.
13357 (Script_sections::attach_sections_using_phdrs_clause): Don't
13358 propagate non-PT_LOAD segments to orphan sections.
13359 * testsuite/Makefile.am (script_test_3.stdout): Generate using
13360 readelf rather than objdump.
13361 * testsuite/script_test_3.sh: Adjust accordingly. Test that
13362 .interp section and PT_INTERP segment are the same size.
13363 * testsuite/Makefile.in: Rebuild.
13364
99a37bfd
ILT
13365 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13366 aliases for symbols defined in the same object.
13367 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13368 (weak_alias_test_SOURCES): New variable.
13369 (weak_alias_test_DEPENDENCIES): New variable.
13370 (weak_alias_test_LDFLAGS): New variable.
13371 (weak_alias_test_LDADD): New variable.
13372 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13373 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13374 (weak_alias_test_3.o): New target.
13375 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13376 * testsuite/weak_alias_test_main.cc: New file.
13377 * testsuite/weak_alias_test_1.cc: New file.
13378 * testsuite/weak_alias_test_2.cc: New file.
13379 * testsuite/weak_alias_test_3.cc: New file.
13380
780e49c5
ILT
133812008-04-08 Ian Lance Taylor <iant@google.com>
13382
cdb0b8f5
ILT
13383 * options.h (class General_options): Add --noinhibit-exec option.
13384 * main.cc (main): Check --noinhibit-exec.
13385
0864d551
ILT
13386 * options.h (class General_options): Define --wrap as a special
13387 option. Add wrap_symbols_ field.
13388 (General_options::any_wrap_symbols): New function.
13389 (General_options::is_wrap_symbol): New function.
13390 * options.cc (General_options::parse_wrap): New function.
13391 (General_options::General_options): Initialize wrap_symbols_.
13392 * symtab.cc (Symbol_table::wrap_symbol): New function.
13393 (Symbol_table::add_from_object): Handle --wrap.
13394 * symtab.h (class Symbol_table): Declare wrap_symbol.
13395 * target.h (Target::wrap_char): New function.
13396 (Target::Target_info): Add wrap_char field.
13397 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13398 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13399 * testsuite/testfile.cc (Target_test::test_target_info):
13400 Likewise.
13401
789aa6de
ILT
13402 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13403 there is one.
13404
2c38906f
ILT
13405 * layout.h (class Layout): Add added_eh_frame_data_ field.
13406 * layout.cc (Layout::Layout): Initialize new field.
13407 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13408 output section until we find a section we merged successfully.
13409 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13410 that the size be non-zero.
13411
780e49c5
ILT
13412 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13413 qualifier.
13414
7fcd0256
ILT
134152008-04-08 Craig Silverstein <csilvers@google.com>
13416
13417 * configure.ac: Export new conditional variable HAVE_ZLIB.
13418 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13419 on HAVE_ZLIB.
13420 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13421 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13422
6835af53
ILT
134232008-04-07 Ian Lance Taylor <iant@google.com>
13424
e24f324c
ILT
13425 * version.cc (version_string): Set to "1.5".
13426
a036edd8
ILT
13427 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13428 Add issued_non_pic_error_ field. Declare check_non_pic.
13429 (Target_x86_64::Scan::check_non_pic): New function.
13430 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13431 (Target_x86_64::Scan::global): Likewise.
13432
624f8810
ILT
13433 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13434 addend parameter. Change caller. Handle merge sections.
13435 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13436 Address to Addend. Don't add in the result of
13437 local_section_offset, pass down the addend and use the returned
13438 value.
13439 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13440 Update declarations of local_section_offset and symbol_value.
13441 * testsuite/two_file_test_1.cc (t18): New function.
13442 * testsuite/two_file_test_2.cc (f18): New function.
13443 * testsuite/two_file_test_main.cc (main): Call t18.
13444 * testsuite/two_file_test.h (t18, f18): Declare.
13445
6835af53
ILT
13446 * configure.ac: Don't test for objdump, c++filt, or readelf.
13447 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13448 conditionals.
13449 (TEST_READELF): New variable.
13450 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13451 (check_PROGRAMS): Add two_file_strip_test.
13452 (two_file_strip_test): New target.
13453 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13454 (two_file_same_shared_strip_test_SOURCES): New variable.
13455 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13456 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13457 (two_file_same_shared_strip_test_LDADD): New variable.
13458 (two_file_shared_strip.so): New target.
13459 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13460 (ver_test_5.syms, ver_test_7.syms): Likewise.
13461 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13462 (strip_test_3.stdout): Use TEST_OBJDUMP.
13463 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13464
86925eef
CC
134652008-04-04 Cary Coutant <ccoutant@google.com>
13466
13467 * symtab.h (Symbol::is_weak_undefined): New function.
13468 (Symbol::is_strong_undefined): New function.
13469 (Symbol::is_absolute): New function.
13470 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13471 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13472 absolute symbols.
13473 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13474 (weak_undef_test): New target.
13475 * testsuite/Makefile.in: Rebuild.
13476 * testsuite/weak_undef_file1.cc: New file.
13477 * testsuite/weak_undef_file2.cc: New file.
13478 * testsuite/weak_undef_test.cc: New file.
13479
126f3ece
ILT
134802008-04-03 Craig Silverstein <csilvers@google.com>
13481
13482 * compressed_output.h (class Output_compressed_section): Use
13483 unsigned buffer.
13484 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13485 add zlib header.
13486 (zlib_compressed_suffix): Removed.
13487 (Output_compressed_section::set_final_data_size): Use unsigned
13488 buffers.
13489 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13490 Fix linker invocation.
13491 (flagstest_o_specialfile_and_compress_debug_sections):
13492 Likewise.
13493 * testsuite/Makefile.in: Regenerated.
13494
deae2a14
DM
134952008-04-02 David S. Miller <davem@davemloft.net>
13496
13497 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13498 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13499
70752818
ILT
135002008-04-02 Craig Silverstein <csilvers@google.com>
13501
13502 * TODO: New file.
13503
39d0cb0e
ILT
135042008-04-02 Ian Lance Taylor <iant@google.com>
13505
13506 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13507 parameters. Update for new key type to views_. Change all
13508 callers.
13509 (File_read::read): Adjust for byteshift in returned view.
13510 (File_read::add_view): New function, broken out of
13511 find_and_make_view.
13512 (File_read::make_view): New function, broken out of
13513 find_and_make_view.
13514 (File_read::find_or_make_view): Add offset and aligned
13515 parameters. Rewrite accordingly. Change all callers.
13516 (File_read::get_view): Add offset and aligned parameters. Adjust
13517 for byteshift in return value.
13518 (File_read::get_lasting_view): Likewise.
13519 * fileread.h (class File_read): Update declarations.
13520 (class File_read::View): Add byteshift_ field. Add byteshift to
13521 constructor. Add byteshift method.
13522 * archive.h (Archive::clear_uncached_views): New function.
13523 (Archive::get_view): Add aligned parameter. Change all callers.
13524 * object.h (Object::get_view): Add aligned parameter. Change all
13525 callers.
13526 (Object::get_lasting_view): Likewise.
13527
13528 * fileread.cc (File_read::release): Don't call clear_views if
13529 there are multiple objects.
13530 * fileread.h (File_read::clear_uncached_views): New function.
13531 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13532 on the archive.
13533
a1207466
CC
135342008-03-31 Cary Coutant <ccoutant@google.com>
13535
13536 Add thin archive support.
13537 * archive.cc (Archive::armagt): New const.
13538 (Archive::setup): Remove task parameter and calls to unlock.
13539 (Archive::unlock_nested_archives): New function.
13540 (Archive::read_header): Add nested_off parameter. Change
13541 all callers.
13542 (Archive::interpret_header): Likewise.
13543 (Archive::include_all_members): Change to handle thin
13544 archives.
13545 (Archive::include_member): Likewise.
13546 * archive.h (Archive::Archive): Add new parameters and
13547 initializers.
13548 (Archive::armagt): New const.
13549 (Archive::setup): Remove task parameter.
13550 (Archive::unlock_nested_archives): New function.
13551 (Archive::read_header): Add nested_off parameter.
13552 (Archive::interpret_header): Likewise.
13553 (Archive::Nested_archive_table): New typedef.
13554 (Archive::is_thin_archive_): New field.
13555 (Archive::nested_archives_): New field.
13556 (Archive::options_): New field.
13557 (Archive::dirpath_): New field.
13558 (Archive::task_): New field.
13559 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13560 for thin archives. Pass additional parameters to
13561 Archive::Archive. Unlock the archive file after calling
13562 Archive::setup.
cd536b21 13563
479f6503
ILT
135642008-03-29 Ian Lance Taylor <iant@google.com>
13565
686c8caf
ILT
13566 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13567 version symbol to be local.
13568 * testsuite/ver_test_4.sh: New file.
13569 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13570 (check_DATA): Add ver_test_4.syms.
13571 (ver_test_4.syms): New target.
13572 * testsuite/Makefile.in: Rebuild.
13573
ab794b6b
ILT
13574 * output.cc
13575 (Output_section::Input_section_sort_entry::has_priority): New
13576 function.
13577 (Output_section::Input_section_sort_entry::match_file_name): New
13578 function.
13579 (Output_section::Input_section_sort_entry::match_section_name):
13580 Remove.
13581 (Output_section::Input_section_sort_entry::match_section_name_prefix):
13582 Remove.
13583 (Output_section::Input_section_sort_entry::match_section_file):
13584 Remove.
13585 (Output_section::Input_section_sort_compare::operator()): Rewrite
13586 using new Input_section_sort_entry functions. Sort crtbegin and
13587 crtend first. Sort sections with no priority before sections with
13588 a priority.
13589 * testsuite/initpri1.c (d3): Check j != 4.
13590 (cd5): New constructor/destructor function.
13591 (main): Check j != 2.
13592
479f6503
ILT
13593 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13594 new symbol when resolving, don't call set_is_default.
13595 * testsuite/ver_test_7.cc: New file.
13596 * testsuite/ver_test_7.sh: New file.
13597 * testsuite/Makefile.am (ver_test_7.so): New target.
13598 (ver_test_7.o): New target.
13599 (check_SCRIPTS): Add ver_test_7.sh.
13600 (check_DATA): Add ver_test_7.syms.
13601 (ver_test_7.syms): New target.
13602
2fd32231
ILT
136032008-03-28 Ian Lance Taylor <iant@google.com>
13604
13605 * layout.cc (Layout::layout): If we see an input section with a
13606 name that needs sorting, set the must_sort flag for the output
13607 section.
13608 (Layout::make_output_section): If the name of the output section
13609 indicates that it might require sorting, set the may_sort flag.
13610 * output.h (Output_section::may_sort_attached_input_sections): New
13611 function.
13612 (Output_section::set_may_sort_attached_input_sections): New
13613 function.
13614 (Output_section::must_sort_attached_input_sections): New
13615 function.
13616 (Output_section::set_must_sort_attached_input_sections): New
13617 function.
13618 (class Output_section): Declare Input_section_sort_entry. Define
13619 Input_section_sort_compare. Declare
13620 sort_attached_input_sections. Add new fields:
13621 may_sort_attached_input_sections_,
13622 must_sort_attached_input_sections_,
13623 attached_input_sections_are_sorted_.
13624 * output.cc (Output_section::Output_section): Initialize new
13625 fields.
13626 (Output_section::add_input_section): Add an entry to
13627 input_sections_ if may_sort or must_sort are true.
13628 (Output_section::set_final_data_size): Call
13629 sort_attached_input_sections if necessary.
13630 (Output_section::Input_section_sort_entry): Define new class.
13631 (Output_section::Input_section_sort_compare::operator()): New
13632 function.
13633 (Output_section::sort_attached_input_sections): New function.
13634 * configure.ac: Check whether the compiler supports constructor
13635 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13636 * testsuite/initpri1.c: New file.
13637 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13638 CONSTRUCTOR_PRIORITY.
13639 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13640 (initpri1_LDFLAGS): New variable.
13641 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13642
18e6b24e
ILT
136432008-03-27 Ian Lance Taylor <iant@google.com>
13644
49bdd526
ILT
13645 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13646 * testsuite/common_test_1.c: New file.
13647 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13648 (common_test_1_SOURCES): New variable.
13649 (common_test_1_DEPENDENCIES): New variable.
13650 (common_test_1_LDFLAGS): New variable.
13651
18e6b24e
ILT
13652 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13653 and commons_ correctly when NAME/VERSION does not override
13654 NAME/NULL.
13655 * testsuite/ver_test_6.c: New file.
13656 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13657 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13658 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13659
04bf7072
ILT
136602008-03-26 Ian Lance Taylor <iant@google.com>
13661
5871526f
ILT
13662 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13663 of an undefined symbol from a version script.
13664 * testsuite/Makefile.am (ver_test_5.so): New target.
13665 (ver_test_5.o): New target.
13666 (check_SCRIPTS): Add ver_test_5.sh.
13667 (check_DATA): Add ver_test_5.syms.
13668 (ver_test_5.syms): New target.
13669 * testsuite/ver_test_5.cc: New file.
13670 * testsuite/ver_test_5.script: New file.
13671 * testsuite/ver_test_5.sh: New file.
13672 * Makefile.in, testsuite/Makefile.in: Rebuild.
13673
04bf7072
ILT
13674 PR gold/5986
13675 Fix problems building gold with gcc 4.3.0.
13676 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13677 (gold_error_at_location, gold_warning_at_location): Use it.
13678 * configure.ac: Check whether we can compile and use a template
13679 function with a printf attribute.
13680 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13681 when jumping over bytes.
13682 * object.cc: Instantiate Object::read_section_data.
13683 * debug.h: Include <cstring>
13684 * dwarf_reader.cc: Include <algorithm>
13685 * main.cc: Include <cstring>.
13686 * options.cc: Include <cstring>.
13687 * output.cc: Include <cstring>.
13688 * script.cc: Include <cstring>.
13689 * script.h: Include <string>.
13690 * symtab.cc: Include <cstring> and <algorithm>.
13691 * target-select.cc: Include <cstring>.
13692 * version.cc: Include <string>.
13693 * testsuite/testmain.cc: Include <cstdlib>.
13694 * configure, config.in: Rebuild.
13695
874c5b28
ILT
136962008-03-25 Ian Lance Taylor <iant@google.com>
13697
819d6c3a
ILT
13698 * options.cc: Include "../bfd/bfdver.h".
13699 (options::help): Print bug reporting address.
13700
f4b2c6f5
ILT
13701 * version.cc (print_version): Adjust output for current value of
13702 BFD_VERSION_STRING.
13703
13704 * NEWS: New file.
13705
e96caa79
ILT
13706 * options.cc (options::help): Print list of supported targets.
13707 * target-select.h: Include <vector>.
13708 (class Target_selector): Make machine_, size_, and is_big_endian_
13709 fields const. Add bfd_name_ and instantiated_target_ fields.
13710 (Target_selector::Target_selector): Add bfd_name parameter.
13711 (Target_selector::recognize): Make non-virtual, call
13712 do_recognize.
13713 (Target_selector::recognize_by_name): Make non-virtual, call
13714 do_recognize_by_name.
13715 (Target_selector::supported_names): New function.
13716 (Target_selector::bfd_name): New function.
13717 (Target_selector::do_instantiate_target): New pure virtual
13718 function.
13719 (Target_selector::do_recognize): New virtual function.
13720 (Target_selector::do_recognize_by_name): New virtual function.
13721 (Target_selector::instantiate_target): New private function.
13722 (supported_target_names): Declare.
13723 * target-select.cc (Target_selector::Target_selector): Update for
13724 new parameter and fields.
13725 (select_target_by_name): Check that the name matches before
13726 calling recognize_by_name.
13727 (supported_target_names): New function.
13728 * i386.cc (class Target_selector_i386): Update Target_selector
13729 constructor call. Remove recognize and recognize_by_name. Add
13730 do_instantiate_target.
13731 * x86_64.cc (class Target_selector_x86_64): Likewise.
13732 * testsuite/testfile.cc (class Target_selector_test): Update for
13733 changes to Target_selector.
13734
874c5b28
ILT
13735 * README: Rewrite, with some notes on unsupported features.
13736
0a65a3a7
CC
137372008-03-24 Cary Coutant <ccoutant@google.com>
13738
13739 * i386.cc (Target_i386::Got_type): New enum declaration.
13740 (Target_i386::Scan::local): Updated callers of Output_data_got
13741 member functions.
13742 (Target_i386::Scan::global): Likewise.
13743 (Target_i386::Relocate::relocate): Likewise.
13744 (Target_i386::Relocate::relocate_tls): Likewise.
13745 * object.h (Got_offset_list): New class.
13746 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13747 (Sized_relobj::local_got_offset): Likewise.
13748 (Sized_relobj::set_local_got_offset): Likewise.
13749 (Sized_relobj::local_has_tls_got_offset): Removed.
13750 (Sized_relobj::local_tls_got_offset): Removed.
13751 (Sized_relobj::set_local_tls_got_offset): Removed.
13752 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13753 * output.cc (Output_data_got::add_global): Added got_type parameter.
13754 (Output_data_got::add_global_with_rel): Likewise.
13755 (Output_data_got::add_global_with_rela): Likewise.
13756 (Output_data_got::add_global_pair_with_rel): New function.
13757 (Output_data_got::add_global_pair_with_rela): New function.
13758 (Output_data_got::add_local): Added got_type parameter.
13759 (Output_data_got::add_local_with_rel): Likewise.
13760 (Output_data_got::add_local_with_rela): Likewise.
13761 (Output_data_got::add_local_pair_with_rel): New function.
13762 (Output_data_got::add_local_pair_with_rela): New function.
13763 (Output_data_got::add_global_tls): Removed.
13764 (Output_data_got::add_global_tls_with_rel): Removed.
13765 (Output_data_got::add_global_tls_with_rela): Removed.
13766 (Output_data_got::add_local_tls): Removed.
13767 (Output_data_got::add_local_tls_with_rel): Removed.
13768 (Output_data_got::add_local_tls_with_rela): Removed.
13769 * output.h (Output_data_got::add_global): Added got_type parameter.
13770 (Output_data_got::add_global_with_rel): Likewise.
13771 (Output_data_got::add_global_with_rela): Likewise.
13772 (Output_data_got::add_global_pair_with_rel): New function.
13773 (Output_data_got::add_global_pair_with_rela): New function.
13774 (Output_data_got::add_local): Added got_type parameter.
13775 (Output_data_got::add_local_with_rel): Likewise.
13776 (Output_data_got::add_local_with_rela): Likewise.
13777 (Output_data_got::add_local_pair_with_rel): New function.
13778 (Output_data_got::add_local_pair_with_rela): New function.
13779 (Output_data_got::add_global_tls): Removed.
13780 (Output_data_got::add_global_tls_with_rel): Removed.
13781 (Output_data_got::add_global_tls_with_rela): Removed.
13782 (Output_data_got::add_local_tls): Removed.
13783 (Output_data_got::add_local_tls_with_rel): Removed.
13784 (Output_data_got::add_local_tls_with_rela): Removed.
13785 * resolve.cc (Symbol::override_base_with_special): Removed
13786 reference to has_got_offset_ field.
13787 * symtab.cc (Symbol::init_fields): Replaced initialization
13788 of got_offset_ with got_offsets_. Removed initialization
13789 of has_got_offset_
53fcba31 13790 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
0a65a3a7
CC
13791 (Symbol::got_offset): Likewise.
13792 (Symbol::set_got_offset): Likewise.
13793 (Symbol::has_tls_got_offset): Removed.
13794 (Symbol::tls_got_offset): Removed.
13795 (Symbol::set_tls_got_offset): Removed.
13796 (Symbol::got_offset_): Removed.
13797 (Symbol::tls_mod_got_offset_): Removed.
13798 (Symbol::tls_pair_got_offset_): Removed.
13799 (Symbol::got_offsets_): New field.
13800 (Symbol::has_got_offset): Removed.
13801 (Symbol::has_tls_mod_got_offset): Removed.
13802 (Symbol::has_tls_pair_got_offset): Removed.
13803 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13804 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13805 member functions.
13806 (Target_x86_64::Scan::global): Likewise.
13807 (Target_x86_64::Relocate::relocate): Likewise.
13808 (Target_x86_64::Relocate::relocate_tls): Likewise.
13809
bd52eafb
BE
138102008-03-25 Ben Elliston <bje@au.ibm.com>
13811
13812 * yyscript.y: Fix spelling error in comment.
13813
8b105e34
ILT
138142008-03-24 Ian Lance Taylor <iant@google.com>
13815
8ed814a9
ILT
13816 * options.h (class General_options): Define build_id option.
13817 * layout.h (class Layout): Declare write_build_id, create_note,
13818 create_build_id. Add build_id_note_ member.
13819 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13820 "libiberty.h", "md5.h", "sha1.h".
13821 (Layout::Layout): Initialize eh_frame_data_,
13822 eh_frame_hdr_section_, and build_id_note_.
13823 (Layout::finalize): Call create_build_id.
13824 (Layout::create_note): New function, broken out of
13825 Layout::create_gold_note.
13826 (Layout::create_gold_note): Call create_note.
13827 (Layout::create_build_id): New function.
13828 (Layout::write_build_id): New function.
13829 (Close_task_runner::run): Call write_build_id.
13830
8b105e34
ILT
13831 * x86_64.cc: Correct license to GPLv3.
13832
086a1841
ILT
138332008-03-23 Ian Lance Taylor <iant@google.com>
13834
13835 * options.cc: Include "demangle.h".
13836 (parse_optional_string): New function.
13837 (parse_long_option): Handle takes_optional_argument.
13838 (parse_short_option): Update dash_z initializer. Handle
13839 takes_optional_argument.
13840 (General_options::General_options): Initialize do_demangle_.
13841 (General_options::finalize): Set do_demangle_. Handle demangling
13842 style.
13843 * options.h (parse_optional_string): Declare.
13844 (struct One_option): Add optional_arg field. Update constructor.
13845 Update call constructor calls. Add takes_optional_argument
13846 function.
13847 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13848 (DEFINE_optional_string): Define.
13849 (General_options::demangle): Change from DEFINE_bool to
13850 DEFINE_optional_string.
13851 (General_options::no_demangle): New function.
13852 (General_options::do_demangle): New function.
13853 (General_options::set_do_demangle): New function.
13854 (General_options::execstack_status_): Move definition to end of
13855 class definition.
13856 (General_options::static_): Likewise.
13857 (General_options::do_demangle_): New field.
13858 * object.cc (big_endian>::get_symbol_location_info): Call
13859 Options::do_demangle, not Options::demangle.
13860 * symtab.cc (demangle): Likewise.
13861
cbb93e63
ILT
138622008-03-22 Ian Lance Taylor <iant@google.com>
13863
13864 * gold.h: Include <cstddef> and <sys/types.h>
13865 * options.h: Include <cstring>.
13866
ec531623
ILT
138672008-03-21 Ian Lance Taylor <iant@google.com>
13868
13869 * Added source code to GNU binutils.
This page took 0.821557 seconds and 4 git commands to generate.