gold/
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2012-11-01 Roland McGrath <mcgrathr@google.com>
2
3 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
4
5 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
6
7 * gold.cc (Target_arm::do_adjust_elf_header): Add the
8 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
9 in EABI_VER5.
10
11 2012-10-29 Cary Coutant <ccoutant@google.com>
12
13 * dwp.cc (usage): Add file and exit status parameters;
14 add --help and --version options.
15 (print_version): New function.
16 (main): Add --help and --version options.
17
18 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
19
20 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
21 final_layout_sequence.txt.
22 * testsuite/Makefile.in: Regenerated.
23
24 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
25
26 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
27 COMPILE generated by automake.
28 (LINK1): Likewise.
29 (CXXCOMPILE1): Likewise.
30 (CXXLINK1): Likewise.
31 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
32 (LINK): Likewise.
33 (CXXCOMPILE): Likewise.
34 (CXXLINK): Likewise.
35 * testsuite/Makefile.in: Regenerated.
36
37 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
38
39 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
40 on bad fwrite return.
41
42 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
43
44 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
45 on val.
46
47 2012-10-23 Cary Coutant <ccoutant@google.com>
48
49 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
50 * testsuite/Makefile.in: Regenerate.
51 * testsuite/dwp_test.h: New source file.
52 * testsuite/dwp_test_1.cc: New source file.
53 * testsuite/dwp_test_1.s: New source file.
54 * testsuite/dwp_test_1.sh: New source file.
55 * testsuite/dwp_test_1b.cc: New source file.
56 * testsuite/dwp_test_1b.s: New source file.
57 * testsuite/dwp_test_2.cc: New source file.
58 * testsuite/dwp_test_2.s: New source file.
59 * testsuite/dwp_test_2.sh: New source file.
60 * testsuite/dwp_test_main.cc: New source file.
61 * testsuite/dwp_test_main.s: New source file.
62
63 2012-10-23 Cary Coutant <ccoutant@google.com>
64
65 * dwp.h: New header file.
66 * dwp.cc: New source file.
67 * gold.h: Move shared declarations to system.h.
68 * system.h: New header file.
69 * Makefile.am: Add dwp.
70 * Makefile.in: Regenerate.
71
72 2012-10-23 Cary Coutant <ccoutant@google.com>
73
74 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
75 Dwarf_info_reader::read_from_pointer.
76 (Dwarf_pubnames_table::read_header): Likewise.
77 (Dwarf_pubnames_table::next_name): Likewise.
78 (Dwarf_die::read_attributes): Likewise.
79 (Dwarf_die::skip_attributes): Likewise.
80 (Dwarf_info_reader::read_from_pointer): New function template.
81 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
82 (Dwarf_pubnames_table): Likewise.
83 (Dwarf_info_reader::read_from_pointer): New function template.
84 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
85 Dwarf_pubnames_table ctor.
86
87 2012-10-23 Cary Coutant <ccoutant@google.com>
88
89 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
90 abbrev_shndx.
91 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
92 abbrev_shndx_.
93 (Dwarf_info_reader::set_abbrev_shndx): New method.
94 (Dwarf_info_reader::abbrev_shndx_): New data member.
95
96 2012-10-23 Cary Coutant <ccoutant@google.com>
97
98 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
99 from object, not parameters.
100 (Dwarf_info_reader::parse): Likewise.
101 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
102 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
103 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
104 methods.
105
106 2012-10-23 Cary Coutant <ccoutant@google.com>
107
108 * fileread.cc (Input_file::Input_file): New constructor.
109 * fileread.h (class Input_file): Add new constructor.
110
111 2012-10-18 Alan Modra <amodra@gmail.com>
112
113 PR gold/14727
114 * object.cc (Relobj::is_section_name_included): Also match
115 .sdata personality section.
116
117 2012-10-18 Alan Modra <amodra@gmail.com>
118
119 * target-reloc.h (class Default_comdat_behavior): New, package up..
120 (get_comdat_behaviour): ..this.
121 (relocate_section): Add Relocate_comdat_behavior template arg,
122 adjust code to suit.
123 * arm.cc (Target_arm::relocate_section): Adjust to suit.
124 (Target_arm::scan_reloc_section): Likewise.
125 * i386.cc (Target_i386::relocate_section): Likewise.
126 * sparc.cc (Target_sparc::relocate_section): Likewise.
127 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
128 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
129 * powerpc.cc (class Relocate_comdat_behavior): New.
130 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
131 gold::relocate_section with new template arg.
132
133 2012-10-18 Alan Modra <amodra@gmail.com>
134
135 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
136 dynamic relocs for GOT_TPREL got entries, without symbol if
137 resolving locally.
138 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
139 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
140 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
141
142 2012-10-17 Alan Modra <amodra@gmail.com>
143
144 PR gold/14726
145 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
146
147 2012-10-16 Sriraman Tallam <tmsriram@google.com>
148
149 * layout.cc (Layout::include_section): Keep sections marked
150 SHF_EXCLUDE when doing relocatable links.
151
152 2012-10-16 Alan Modra <amodra@gmail.com>
153
154 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
155 (Target_powerpc::do_finalize_sections): Call it.
156 (Output_data_save_res): New class and supporting functions.
157 (Target_powerpc::symval_for_branch): Only look up .opd entry for
158 normal symbols defined in object files.
159
160 2012-10-12 Alan Modra <amodra@gmail.com>
161
162 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
163 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
164 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
165 section if scan_opd_relocs not yet called.
166 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
167
168 2012-10-12 Alan Modra <amodra@gmail.com>
169
170 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
171 add_local_ifunc_entry): Revert last change.
172 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
173
174 2012-10-05 Alan Modra <amodra@gmail.com>
175
176 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
177 do_plt_address_for_global): New functions.
178 (Output_data_got_powerpc::do_write): Don't segfault when linking
179 statically.
180 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
181 add_local_ifunc_entry): Return true on adding entry..
182 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
183 glink->add_entry call. Remove unused symtab param. Adjust calls.
184 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
185 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
186 set up symbols here.
187 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
188 syms here. Do so even when no .iplt. Don't segfault when linking
189 statically.
190 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
191 new variants without reloc param.
192 (Glink_sym_ent::Glink_sym_ent): Likewise.
193 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
194 reloc when refs will resolve to plt call stub.
195 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
196 R_PPC_PLTREL24 to resolve locally.
197 (Target_powerpc::Scan::global): Correct ifunc handling.
198 (Target_powerpc::Relocate::relocate): Correct local sym glink
199 lookup. Don't destroy "value" when we have a plt call stub,
200 and when checking plt call validity.
201 (Target_powerpc::do_dynsym_value): Simplify.
202
203 2012-10-05 Alan Modra <amodra@gmail.com>
204
205 * i386.cc (Output_data_plt_i386::address_for_global,
206 address_for_local): Add plt offset to returned value. Adjust uses.
207 * sparc.cc (Output_data_plt_sparc::address_for_global,
208 address_for_local): Likewise.
209 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
210 address_for_local): Likewise.
211 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
212 address_for_local): Likewise.
213 * target.h (Target::plt_address_for_global, plt_address_for_local):
214 Update comment.
215 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
216 (Output_data_got::Got_entry::write): Nor here.
217 * output.h: Comment fix.
218
219 2012-10-02 Jiong Wang <jiwang@tilera.com>
220
221 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
222 global_offset_table_ value for larget got.
223 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
224
225 2012-09-29 Alan Modra <amodra@gmail.com>
226
227 * powerpc.cc (Target_powerpc::iplt_): New output section.
228 (Target_powerpc::iplt_section, make_iplt_section,
229 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
230 (Target_powerpc::make_plt_entry): Handle ifunc syms.
231 Target_powerpc::plt_entry_count): Count iplt entries too.
232 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
233 reloc section in constructor. New params.
234 (Target_powerpc::make_plt_section): Create reloc section here instead.
235 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
236 functions.
237 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
238 (Output_data_glink::add_entry, find_entry): New functions to
239 deal with local syms.
240 (Glink_sym_ent): Add support for local syms.
241 (Output_data_glink::do_write): Handle ifunc plt entries.
242 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
243 (Target_powerpc::Scan::local, global): Handle ifunc syms.
244 (Target_powerpc::Relocate::relocate): Likewise.
245 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
246
247 2012-09-25 Alan Modra <amodra@gmail.com>
248
249 * object.h (Sized_relobj_file::adjust_local_symbol,
250 do_adjust_local_symbol): New functions.
251 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
252 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
253 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
254 and irregular opd entry spacing.
255 (Powerpc_relobj::do_read_relocs): Add opd size checks.
256 (Global_symbol_visitor_opd): New functor.
257 (Target_powerpc::do_finalize_sections): Omit global symbols defined
258 on deleted opd entries.
259
260 2012-09-15 Jiong Wang <jiwang@tilera.com>
261
262 * tilegx.cc: New file.
263 * Makefile.am (TARGETSOURCES): Add tilegx.cc
264 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
265 * configure.tgt: Add entries for tilegx*.
266 * configure.ac: Likewise.
267 * Makefile.in: Rebuild.
268 * configure: Likewise.
269 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
270 tilegx.
271
272 2012-09-13 Alan Modra <amodra@gmail.com>
273
274 * target-reloc.h (scan_relocs): Call scan.local for relocs
275 against symbols in discarded sections. Pass is_discarded
276 param.
277 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
278 Add is_discarded param.
279 * powerpc (Target_powerpc::Scan::local): Likewise. Use
280 is_discarded to flag opd entry as discarded. Don't emit dyn
281 relocs on such entries.
282 (Target_powerpc::Scan::global): Similarly detect and handle
283 such opd entries.
284 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
285 opd_ent_. Update all uses.
286 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
287 (Target_powerpc::relocate_section): Zero out discarded opd
288 entry relocs.
289
290 2012-09-12 Ian Lance Taylor <iant@google.com>
291
292 PR gold/14570
293 * output.cc: Rename Output_data_got template parameter from size
294 to got_size for all functions. Compile all variants of
295 Output_data_got.
296 (Output_data_got::Got_entry::write): Correct use of size for
297 symbol value. Use local_is_tls rather than casting to
298 Sized_relobj_file.
299 * object.h (class Object): Add local_is_tls and do_local_is_tls.
300 (class Sized_relobj_file): Add do_local_is_tls.
301 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
302
303 2012-09-11 Alan Modra <amodra@gmail.com>
304
305 PR gold/14566
306 * layout.cc (Layout::set_segment_offsets): When using
307 common-page-size alignment, ensure we are on a new max-page-size
308 page.
309 * output.cc (Output_segment::set_section_addresses): Use
310 abi_pagesize, not common_pagesize for relro boundary.
311 (Output_segment::set_offset): Likewise.
312
313 2012-09-11 Alan Modra <amodra@gmail.com>
314
315 * output.h (Output_data_got::add_global_tls, add_local_tls,
316 add_local_tls_pair): New functions.
317 (Output_data_got::add_local_pair_with_rel): Remove second
318 reloc param. Expand comment.
319 (Output_data_got::Got_entry): Rename use_plt_offset_ to
320 use_plt_or_tls_offset_, similarly for constructor param.
321 (Output_data_got::Got_entry::write): Add got_index param.
322 * output.cc (Output_data_got::add_global_tls, add_local_tls,
323 add_local_tls_pair): New functions.
324 (Output_data_got::Got_entry::write): Handle tls symbols
325 with use_plt_or_tls_offset_ set specially.
326 (Output_data_got::add_local_pair_with_rel): Only one reloc.
327 (Output_data_got::do_write): Replace iterator with index, pass
328 index to entry write function.
329 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
330 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
331 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
332 call.
333 * i386.cc (Target_i386::Scan::local): Likewise.
334 * sparc.cc (Target_sparc::Scan::local): Likewise.
335 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
336 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
337 do_tls_offset_for_global): New functions.
338 (Target_powerpc::Scan::local): Correct TLS relocations and got
339 entry values.
340 (Target_powerpc::Scan::global): Don't emit unnecessary
341 dynamic relocations on TLS GOT entries.
342
343 2012-09-10 Matthias Klose <doko@ubuntu.com>
344
345 * config.in: Disable sanity check for kfreebsd.
346
347 2012-09-10 Sterling Augustine <saugustine@google.com>
348
349 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
350 (Gdb_index::pubtypes_read): New parameter.
351 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
352 to calls.
353 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
354 pubtypes_object_.
355
356 2012-09-09 Alan Modra <amodra@gmail.com>
357
358 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
359 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
360 * gc.h (gc_process_relocs): Call target gc_add_reference.
361 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
362 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
363 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
364 unnecessary cast.
365 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
366 to cater for when we don't need code offset. Update use.
367 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
368 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
369 set_opd_valid): New functions.
370 (Target_powerpc::do_gc_add_reference): New function.
371 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
372 stashed refs.
373 (Target_powerpc::do_gc_mark_symbol): New function.
374
375 2012-09-06 Cary Coutant <ccoutant@google.com>
376
377 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
378 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
379 (Dwarf_die::skip_attributes): Likewise.
380 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
381 * testsuite/gdb_index_test.cc (inline_func_1): New function.
382 (main): Call it.
383 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
384
385 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
386
387 * testsuite/script_test_3.t: Add .got.plt output section
388 statement.
389 * testsuite/script_test_4.t: Likewise.
390
391 2012-09-05 Alan Modra <amodra@gmail.com>
392
393 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
394 update all uses and lose "enum" when using type.
395
396 2012-09-05 Alan Modra <amodra@gmail.com>
397
398 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
399 * configure: Regenerate.
400 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
401 (plugin_final_layout.stdout): Likewise.
402 (memory_test): Set page sizes to 0x1000.
403 * testsuite/Makefile.in: Regenerate.
404 * testsuite/discard_locals_test.sh: Add FIXME comment.
405 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
406 * testsuite/pr14265.t: Add .got output section statement.
407 * testsuite/script_test_2.t: Likewise.
408 * testsuite/script_test_3.t: Likewise.
409 * testsuite/script_test_4.t: Likewise.
410 * testsuite/script_test_5.t: Likewise.
411 * testsuite/script_test_6.t: Likewise.
412 * testsuite/script_test_7.t: Likewise.
413 * testsuite/script_test_9.t: Likewise.
414
415 2012-09-05 Alan Modra <amodra@gmail.com>
416
417 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
418 (Powerpc_relocate_functions::Status): New typedef.
419 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
420 (Target_powerpc::Scan::local): Handle REL64.
421 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
422 for REL32 and REL64.
423 (Target_powerpc::symval_for_branch): New function, extracted from..
424 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
425 checks. Report overflow errors.
426
427 2012-09-05 Alan Modra <amodra@gmail.com>
428
429 * object.h (Sized_relobj_file::emit_relocs): Delete.
430 (Sized_relobj_file::emit_relocs_reltype): Delete.
431 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
432 relocate_relocs for --emit-relocs.
433 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
434 * output.h: Update comment.
435 (Output_segment::first_section): New function.
436 (Output_segment::first_section_load_address): Use first_section.
437 * output.cc (Output_segment::first_section): New function extracted..
438 (Output_segment::first_section_load_address): ..from here. Delete.
439 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
440 * target.h (Sized_target::relocate_for_relocatable): Likewise.
441 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
442 adjust call to target.h function.
443 * i386.cc (Target_i386): Likewise.
444 * sparc.cc (Target_sparc): Likewise.
445 * x86_64.cc (Target_x86_64): Likewise.
446 * powerpc.cc (Target_powerpc): Likewise.
447 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
448 first tls section has section symbol for optimised local dynamic
449 output relocs.
450 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
451 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
452 optimised tls code.
453 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
454 Rename to relocate_relocs. Update error message.
455
456 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
457
458 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
459 --just-symbols.
460
461 2012-08-31 Alan Modra <amodra@gmail.com>
462
463 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
464 (Powerpc_relobj::toc_base_offset): New stub function.
465 (Target_powerpc): Add tp_offset, dtp_offset. Rename
466 got_mod_index_offset to tlsld_got_offset. Update all refs.
467 (Target_powerpc::Relocate::enum skip_tls): New.
468 (Target_powerpc::call_tls_get_addr_): New var.
469 (Target_powerpc::is_branch_reloc): Move to file scope.
470 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
471 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
472 New functions.
473 (Target_powerpc::enum Got_type): Delete old values, add new ones.
474 (powerpc_info): Correct common_pagesize for ppc64.
475 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
476 (Powerpc_relocate_functions): Add overflow check enums and functions.
477 Add non-shift version of rela, rela_ua. Delete all rel public
478 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
479 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
480 addr16_ha3, addr14 functions.
481 (Output_data_got_powerpc::add_constant_pair): New function.
482 (Output_data_got_powerpc::got_base_offset): Likewise.
483 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
484 (instruction constants): Sort, add some more.
485 (Output_data_glink::do_write): Add and use Address typedef. Use
486 object->toc_base_offset() stub for 64-bit.
487 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
488 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
489 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
490 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
491 Always treat .opd relocs as against locally defined symbol.
492 Correct condition for RELATIVE relocs.
493 (Target_powerpc::do_finalize_sections): Test for NULL sections.
494 (Target_powerpc::Relocate::relocate): Use plt call stub as value
495 for 32-bit syms with a plt entry. Correct ppc64 toc base
496 calculations. Handle TLS relocs, and more. Add overflow
497 checking and adjust for Powerpc_relocate_functions changes.
498 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
499 Reinstate --emit-relocs code with FIXME.
500
501 2012-08-30 Alan Modra <amodra@gmail.com>
502
503 * layout.cc (Layout::set_segment_offsets): Set p_align to
504 abi_pagesize, not common_pagesize.
505 (Layout::relaxation_loop_body): Similarly use abi_pagesize
506 to determine whether file header can go in segment.
507
508 2012-08-30 Alan Modra <amodra@gmail.com>
509
510 * output.h (Output_reloc::Output_reloc <output section>): Add
511 is_relative param. Adjust calls.
512 (Output_reloc::add_output_section_relative): New functions.
513 * output.cc (Output_reloc::Output_reloc <output section>): Handle
514 is_relative.
515 (Output_reloc::symbol_value): Handle SECTION_CODE.
516
517 2012-08-24 Sriraman Tallam <tmsriram@google.com>
518
519 * gold.cc (queue_middle_tasks): Call layout again when unique
520 segments for sections is desired.
521 * layout.cc (Layout::Layout): Initialize new members.
522 (Layout::get_output_section_flags): New function.
523 (Layout::choose_output_section): Call get_output_section_flags.
524 (Layout::layout): Make output section for mapping to a unique segment.
525 (Layout::insert_section_segment_map): New function.
526 (Layout::attach_allocated_section_to_segment): Make unique segment for
527 output sections marked so.
528 (Layout::segment_precedes): Check for unique segments when sorting.
529 * layout.h (Layout::Unique_segment_info): New struct.
530 (Layout::Section_segment_map): New typedef.
531 (Layout::insert_section_segment_map): New function.
532 (Layout::get_output_section_flags): New function.
533 (Layout::is_unique_segment_for_sections_specified): New function.
534 (Layout::set_unique_segment_for_sections_specified): New function.
535 (Layout::unique_segment_for_sections_specified_): New member.
536 (Layout::section_segment_map_): New member.
537 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
538 Rename is_gc_pass_one to is_pass_one.
539 Rename is_gc_pass_two to is_pass_two.
540 Rename is_gc_or_icf to is_two_pass.
541 Check for which pass based on whether symbols data is present.
542 Make it two pass when unique segments for sections is desired.
543 * output.cc (Output_section::Output_section): Initialize new
544 members.
545 * output.h (Output_section::is_unique_segment): New function.
546 (Output_section::set_is_unique_segment): New function.
547 (Output_section::is_unique_segment_): New member.
548 (Output_section::extra_segment_flags): New function.
549 (Output_section::set_extra_segment_flags): New function.
550 (Output_section::extra_segment_flags_): New member.
551 (Output_section::segment_alignment): New function.
552 (Output_section::set_segment_alignment): New function.
553 (Output_section::segment_alignment_): New member.
554 (Output_segment::Output_segment): Initialize is_unique_segment_.
555 (Output_segment::is_unique_segment): New function.
556 (Output_segment::set_is_unique_segment): New function.
557 (Output_segment::is_unique_segment_): New member.
558 * plugin.cc (allow_unique_segment_for_sections): New function.
559 (unique_segment_for_sections): New function.
560 (Plugin::load): Add new functions to transfer vector.
561 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
562 * Makefile.in: Regenerate.
563 * testsuite/plugin_final_layout.sh: Check if unique segment
564 functionality works.
565 * testsuite/plugin_section_order.c (onload): Check if new interfaces
566 are available.
567 (allow_unique_segment_for_sections): New global.
568 (unique_segment_for_sections): New global.
569 (claim_file_hook): Call allow_unique_segment_for_sections.
570 (all_symbols_read_hook): Call unique_segment_for_sections.
571
572 2012-08-22 Cary Coutant <ccoutant@google.com>
573
574 * layout.cc (Layout::include_section): Don't assert on GROUP
575 sections with --emit-relocs.
576
577 2012-08-21 Cary Coutant <ccoutant@google.com>
578
579 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
580 if --export-dynamic-symbol names an undef symbol.
581
582 2012-08-18 Alan Modra <amodra@gmail.com>
583
584 * powerpc.cc: Formatting and white space.
585 (Powerpc_relobj): Rename got2_section_ to special_.
586 Add opd_ent_shndx_ and opd_ent_off_ vectors.
587 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
588 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
589 (Target_powerpc): Add Address typedef and invalid_address. Use
590 throughout.
591 (Target_powerpc::is_branch_reloc): New function.
592 (Powerpc_relocate_functions): Add Address typedef, use throughout.
593 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
594 for dst_mask, value and addend.
595 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
596 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
597 (Output_data_glink::do_write): Correct toc base. Don't try to use
598 uint16_t for 24-bit offset. Use get_output_section_offset and
599 check return.
600 (Target_powerpc::Scan::local): Handle more relocs.
601 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
602 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
603 Plug in toc restoring insn after plt calls. Translate branches
604 to function descriptor symbols to corresponding entry point.
605 (Target_powerpc::relocate_for_relocatable): Check return from
606 get_output_section_offset.
607 * symtab.h: Comment typo.
608
609 2012-08-14 Ian Lance Taylor <iant@google.com>
610
611 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
612 unsupported_relocal_local to call unsupported_reloc_global.
613
614 2012-08-14 Nick Clifton <nickc@redhat.com>
615
616 PR ld/14265
617 * script-sections.cc (Sections_element::output_section_name): Add
618 keep return parameter.
619 (Output_section_element::match_name): Add keep return parameter.
620 Return the value of the keep_ member.
621 * script-sections.h (class Output_section): Update
622 output_section_name prototype.
623 * layout.cc (Layout::keep_input_section): New public member
624 function.
625 (Layout::choose_output_section): Pass keep parameter to
626 output_section_name.
627 * layout.h (class Layout): Add keep_input_section.
628 * object.cc (Sized_relobj_file::do_layout): Check for kept input
629 sections.
630 * testsuite/Makefile.am: Add a test.
631 * testsuite/Makefile.in: Regenerate.
632 * testsuite/pr14265.c: Source file for the test.
633 * testsuite/pr14265.t: Linker script for the test.
634 * testsuite/pr14265.sh: Shell script for the test.
635
636 2012-08-14 Alan Modra <amodra@gmail.com>
637
638 * target.h (Target::output_section_name): New function.
639 (Target::do_output_section_name): New function.
640 * layout.cc (Layout::choose_output_section): Call the above.
641 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
642
643 2012-08-14 Alan Modra <amodra@gmail.com>
644
645 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
646 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
647 for replace_constant call.
648 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
649 (Output_data_glink::do_print_to_mapfile): New function.
650 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
651 (Target_powerpc::Relocate::relocate): Likewise.
652
653 2012-08-14 Alan Modra <amodra@gmail.com>
654
655 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
656 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
657 (Output_data_glink::add_entry,find_entry): Remove shndx param.
658 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
659 all references to shndx_. Handle special case for R_PPC_PLTREL24
660 here.
661 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
662 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
663 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
664 here.
665 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
666 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
667
668 2012-08-12 Alan Modra <amodra@gmail.com>
669
670 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
671 (glink insn constants): Use uint32_t.
672 (Output_data_glink::add_entry): Use insert, not [] operator.
673
674 2012-08-11 Alan Modra <amodra@gmail.com>
675
676 * object.h (Sized_relobj_file::find_shdr): New function.
677 (Sized_relobj_file::find_special_sections): New function.
678 * object.cc (Sized_relobj_file::find_shdr): New function.
679 (Sized_relobj_file::find_eh_frame): Use find_shdr.
680 (Sized_relobj_file::find_special_sections): New function, split out..
681 (Sized_relobj_file::do_read_symbols): ..from here.
682 * output.h (Output_data_got::replace_constant): New function.
683 (Output_data_got::num_entries): New function.
684 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
685 (Output_data_got::got_offset): Protected rather than private.
686 (Output_data_got::replace_got_entry): New function.
687 * output.cc (Output_data_got::replace_got_entry): New function.
688 * powerpc.cc (class Powerpc_relobj): New.
689 (class Powerpc_relocate_functions): Delete all psymval variants or
690 convert to value,addend type. Delete pcrela, pcrela_unaligned.
691 Implement _ha functions using corresponding _hi function.
692 (Powerpc_relobj::find_special_sections): New function.
693 (Target_powerpc::do_make_elf_object): New function.
694 (class Output_data_got_powerpc): New.
695 (class Output_data_glink): New.
696 (class Powerpc_scan_relocatable_reloc): New.
697 Many more changes througout file.
698
699 2012-08-09 Nick Clifton <nickc@redhat.com>
700
701 * po/vi.po: Updated Vietnamese translation.
702
703 2012-08-07 Ian Lance Taylor <iant@google.com>
704
705 * layout.cc (Layout::add_target_dynamic_tags): If
706 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
707 plt_rel.
708
709 2012-07-30 Nick Clifton <nickc@redhat.com>
710
711 * po/gold.pot: Updated template.
712 * po/es.po: Updated Spanish translation.
713
714 2012-07-18 Cary Coutant <ccoutant@google.com>
715
716 PR gold/14344
717 * configure.ac: Add check for -gpubnames support.
718 * configure: Regenerate.
719 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
720 support; force -gno-pubnames.
721 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
722 support.
723 (gdb_index_test_4): New test.
724 * testsuite/Makefile.in: Regenerate.
725 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
726 * testsuite/gdb_index_test_2.sh: Likewise.
727 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
728 * testsuite/gdb_index_test_4.sh: New script.
729 * testsuite/gdb_index_test_comm.sh: New script with common code;
730 don't look for space after colon.
731
732 2012-07-16 Sriraman Tallam <tmsriram@google.com>
733
734 * gold.cc (queue_middle_tasks): Update function order only after
735 deferred objects due to plugins are processed.
736
737 2012-07-11 Ian Lance Taylor <iant@google.com>
738
739 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
740 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
741 (Target_arm::scan_reloc_for_stub): Likewise.
742 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
743 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
744 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
745 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
746 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
747
748 2012-07-10 Dodji Seketeli <dodji@redhat.com>
749 Ian Lance Taylor <iant@google.com>
750
751 PR gold/14309
752 * configure.ac: Test whether std::tr1::hash<off_t> works.
753 * gold.h: Add a specialization for std::tr1::hash<off_t> if
754 needed.
755 * output.h (class Output_fill): Add virtual destructor.
756 * configure, config.in: Rebuild.
757
758 2012-06-22 Roland McGrath <mcgrathr@google.com>
759
760 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
761
762 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
763
764 * plugin.cc (Plugin::load): Handle position independent executables.
765
766 2012-06-06 Cary Coutant <ccoutant@google.com>
767
768 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
769 add .debug_macro.
770 (lines_only_debug_sections): Likewise.
771 (gdb_fast_lookup_sections): New static array.
772 (is_gdb_debug_section): Rename formal parameter.
773 (is_lines_only_debug_section): Likewise.
774 (is_gdb_fast_lookup_section): New function.
775 (Layout::include_section): Check for ".zdebug_" prefix; pass
776 section name suffix to is_gdb_debug_section, et al.; check for
777 fast-lookup sections when building .gdb_index.
778 * options.h (--strip-debug-gdb): Update GDB version number.
779
780 2012-06-06 Cary Coutant <ccoutant@google.com>
781
782 * configure.ac: Add check for fallocate.
783 * configure: Regenerate.
784 * config.in: Regenerate.
785
786 * options.h (class General_options): Add --mmap-output-file and
787 --posix-fallocate options.
788 * output.cc: (posix_fallocate): Remove; replace with...
789 (gold_fallocate): New function.
790 (Output_file::map_no_anonymous): Call gold_fallocate.
791 (Output_file::map): Check --mmap-output-file option.
792
793 2012-06-05 Jing Yu <jingyu@google.com>
794
795 * gold.h (textdomain): Add do {} to empty while(0).
796 (bindtextdomain): Likewise.
797
798 2012-06-04 Cary Coutant <ccoutant@google.com>
799
800 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
801 has_dynsym_index.
802
803 2012-05-25 Sriraman Tallam <tmsriram@google.com>
804
805 * symtab.cc (Symbol_table::define_special_symbol):
806 Initialize *poldsym to prevent uninitialized variable errors.
807
808 2012-05-23 Cary Coutant <ccoutant@google.com>
809
810 * layout.cc (Layout::section_name_mapping): Add rules to handle
811 exact match on .data.rel.ro.local or .data.rel.ro.
812 (Layout::output_section_name): Check for exact matches.
813
814 2012-05-23 Cary Coutant <ccoutant@google.com>
815
816 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
817 more carefully.
818
819 2012-05-22 Cary Coutant <ccoutant@google.com>
820
821 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
822 object before exporting symbol.
823
824 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
825
826 * testsuite/tls_test.cc: Include "config.h" first.
827 * testsuite/tls_test_c.c: Likewise.
828
829 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
830 Nick Clifton <nickc@redhat.com>
831
832 PR 14072
833 * configure.in: Add check that sysdep.h has been included before
834 any system header files.
835 * configure: Regenerate.
836 * config.in: Regenerate.
837
838 2012-05-14 Cary Coutant <ccoutant@google.com>
839
840 * layout.cc (Layout::make_output_section): Mark .tdata section
841 as RELRO.
842 * testsuite/relro_test.cc: Add a TLS variable.
843
844 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
845
846 PR gold/14091
847 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
848 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
849 R_X86_64_64.
850
851 2012-05-08 Cary Coutant <ccoutant@google.com>
852
853 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
854 (lines_only_debug_sections): Likewise.
855
856 2012-05-02 Roland McGrath <mcgrathr@google.com>
857
858 * nacl.cc: New file.
859 * nacl.h: New file.
860 * Makefile.am (CCFILES, HFILES): Add them.
861 * Makefile.in: Regenerate.
862 * i386.cc (Output_data_plt_i386_nacl): New class.
863 (Output_data_plt_i386_nacl_exec): New class.
864 (Output_data_plt_i386_nacl_dyn): New class.
865 (Target_i386_nacl): New class.
866 (Target_selector_i386_nacl): New class.
867 (target_selector_i386): Use it instead of Target_selector_i386.
868 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
869 (Target_x86_64_nacl): New class.
870 (Target_selector_x86_64_nacl): New class.
871 (target_selector_x86_64, target_selector_x32): Use it instead of
872 Target_selector_x86_64.
873 * arm.cc (Output_data_plt_arm_nacl): New class.
874 (Target_arm_nacl): New class.
875 (Target_selector_arm_nacl): New class.
876 (target_selector_arm, target_selector_armbe): Use it instead of
877 Target_selector_arm.
878
879 * target-select.cc (select_target): Take new Input_file* and off_t
880 arguments, pass them on to recognize method of selector.
881 * object.cc (make_elf_sized_object): Update caller.
882 * parameters.cc (parameters_force_valid_target): Likewise.
883 * incremental.cc (make_sized_incremental_binary): Likewise.
884 * target-select.h: Update decl.
885 (Target_selector::recognize): Take new Input_file* argument,
886 pass it on to do_recognize.
887 (Target_selector::do_recognize): Take new Input_file* argument.
888 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
889 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
890 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
891 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
892
893 * target.h (Target::Target_info): New members isolate_execinstr
894 and rosegment_gap.
895 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
896 * arm.cc (Target_arm::arm_info): Update initializer.
897 * i386.cc (Target_i386::i386_info): Likewise.
898 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
899 * sparc.cc (Target_sparc::sparc_info): Likewise.
900 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
901 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
902 * layout.cc (Layout::attach_allocated_section_to_segment):
903 Take new const Target* argument. If target->isolate_execinstr(), act
904 like --rosegment.
905 (Layout::find_first_load_seg): Take new const Target* argument;
906 if target->isolate_execinstr(), reject PF_X segments.
907 (Layout::relaxation_loop_body): Update caller.
908 (Layout::set_segment_offsets): If target->isolate_execinstr(),
909 reset file offset to zero when we hit LOAD_SEG, and then do a second
910 loop over the segments before LOAD_SEG to reassign offsets after
911 addresses have been determined. Handle target->rosegment_gap().
912 (Layout::attach_section_to_segment): Take new const Target* argument;
913 pass it to attach_allocated_section_to_segment.
914 (Layout::make_output_section): Update caller.
915 (Layout::attach_sections_to_segments): Take new const Target* argument;
916 pass it to attach_section_to_segment.
917 * gold.cc (queue_middle_tasks): Update caller.
918 * layout.h (Layout): Update method decls with new arguments.
919
920 * arm.cc (Target_arm::Target_arm): Take optional argument for the
921 Target_info pointer to use.
922 (Target_arm::do_make_data_plt): New virtual method.
923 (Target_arm::make_data_plt): New method that calls it.
924 (Target_arm::make_plt_entry): Use it.
925 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
926 for the section alignment.
927 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
928 method.
929 (Output_data_plt_arm::first_plt_entry_offset): Call it.
930 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
931 method.
932 (Output_data_plt_arm::get_plt_entry_size): Call it.
933 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
934 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
935 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
936 method.
937 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
938 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
939 method instead of sizeof(plt_entry).
940 (Output_data_plt_arm::add_entry): Likewise.
941 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
942 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
943 than static method.
944 (Target_arm::plt_entry_size): Likewise.
945 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
946 Move to ...
947 (Output_data_plt_arm_standard): ... here, new class.
948 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
949 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
950 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
951
952 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
953 Take additional argument for the PLT entry size.
954 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
955 Use get_plt_entry_size method rather than plt_entry_size variable.
956 (Output_data_plt_x86_64::reserve_slot): Likewise.
957 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
958 (Output_data_plt_x86_64::add_entry): Likewise.
959 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
960 (Output_data_plt_x86_64::address_for_global): Likewise.
961 (Output_data_plt_x86_64::address_for_local): Likewise.
962 (Output_data_plt_x86_64::set_final_data_size): Likewise.
963 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
964 Make method non-static.
965 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
966 method.
967 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
968 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
969 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
970 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
971 virtual method.
972 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
973 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
974 virtual method.
975 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
976 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
977 virtual method.
978 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
979 (Output_data_plt_x86_64::plt_entry_size)
980 (Output_data_plt_x86_64::first_plt_entry)
981 (Output_data_plt_x86_64::plt_entry)
982 (Output_data_plt_x86_64::tlsdesc_plt_entry)
983 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
984 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
985 (Output_data_plt_x86_64_standard): ... here, new class.
986 (Target_x86_64::Target_x86_64): Take optional argument for the
987 Target_info pointer to use.
988 (Target_x86_64::do_make_data_plt): New virtual method.
989 (Target_x86_64::make_data_plt): New method to call it.
990 (Target_x86_64::init_got_plt_for_update): Use that.
991 Call this->plt_->add_eh_frame method here.
992 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
993 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
994 rather than static method.
995 (Target_x86_64::plt_entry_size): Likewise.
996 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
997 rather than plt_entry_size variable. Move guts of PLT filling to...
998 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
999 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1000 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1001
1002 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1003 additional argument for the section alignment.
1004 Don't do add_eh_frame_for_plt here.
1005 (Output_data_plt_i386::first_plt_entry_offset): Make the method
1006 non-static. Use get_plt_entry_size method rather than plt_entry_size
1007 variable.
1008 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1009 method.
1010 (Output_data_plt_i386::get_plt_entry_size): Call it.
1011 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1012 (Output_data_plt_i386::add_eh_frame): New method to call it.
1013 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1014 method.
1015 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1016 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1017 method.
1018 (Output_data_plt_i386::fill_plt_entry): New method to call it.
1019 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1020 method instead of plt_entry_size.
1021 (Output_data_plt_i386::plt_entry_size)
1022 (Output_data_plt_i386::plt_eh_frame_fde_size)
1023 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1024 (Output_data_plt_i386_standard): ... here, new class.
1025 (Output_data_plt_i386_exec): New class.
1026 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1027 (Output_data_plt_i386_exec::first_plt_entry): ... here.
1028 (Output_data_plt_i386::exec_plt_entry): Move to ...
1029 (Output_data_plt_i386_exec::plt_entry): ... here.
1030 (Output_data_plt_i386_dyn): New class.
1031 (Output_data_plt_i386::first_plt_entry): Move to ...
1032 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1033 (Output_data_plt_i386::dyn_plt_entry): Move to ...
1034 (Output_data_plt_i386_dyn::plt_entry): ... here.
1035 (Target_i386::Target_i386): Take optional argument for the Target_info
1036 pointer to use.
1037 (Target_i386::do_make_data_plt): New virtual method.
1038 (Target_i386::make_data_plt): New method to call it.
1039 (Target_i386::make_plt_section): Use that.
1040 Call this->plt_->add_eh_frame method here.
1041 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1042 rather than plt_entry_size variable.
1043 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1044 (Output_data_plt_i386::address_for_local): Likewise.
1045 (Output_data_plt_i386::do_write): Likewise.
1046 Move guts of PLT filling to...
1047 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1048 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1049 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1050 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1051
1052 2012-05-01 Cary Coutant <ccoutant@google.com>
1053
1054 * dwarf_reader.cc (Dwarf_die::read_attributes)
1055 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1056 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1057 * reduced_debug_output.cc
1058 (Output_reduced_debug_info_section::get_die_end): Remove
1059 DW_FORM_GNU_ref_index. Add default case.
1060
1061 2012-04-26 Mark Wielaard <mjw@redhat.com>
1062
1063 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1064 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1065 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1066 DW_AT_high_pc as offset from DW_AT_low_pc.
1067
1068 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1069 * testsuite/Makefile.in: Regenerate.
1070 * testsuite/gdb_index_test_3.c: New test source file.
1071 * testsuite/gdb_index_test_3.sh: New test source file.
1072
1073 2012-04-25 Ian Lance Taylor <iant@google.com>
1074
1075 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1076 pointer.
1077 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1078 as a class, not a struct.
1079 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1080 (Target_arm::apply_cortex_a8_workaround): Likewise.
1081 * gc.h: Declare Reloc_types as a struct, not a class.
1082 * object.h: Declare Symbols_data as a struct.
1083 * reloc.h: Declare Read_relocs_data as a struct.
1084 * target.h: Declare Relocate_info as a struct.
1085
1086 2012-04-24 David S. Miller <davem@davemloft.net>
1087
1088 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1089 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1090 and R_SPARC_WPLT30.
1091
1092 2012-04-24 Cary Coutant <ccoutant@google.com>
1093
1094 * incremental-dump.cc (find_input_containing_global): Replace
1095 magic number with symbolic constant.
1096 (dump_incremental_inputs): Update version number.
1097 * incremental.cc (Output_section_incremental_inputs): Update version
1098 number; import symbolic constants from Incremental_inputs_reader.
1099 (Incremental_inputs::create_data_sections): Align relocations
1100 section correctly for 64-bit targets.
1101 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1102 constants; add padding.
1103 (Output_section_incremental_inputs::write_header): Add assert for
1104 header_size.
1105 (Output_section_incremental_inputs::write_input_files): Add assert
1106 for input_entry_size.
1107 (Output_section_incremental_inputs::write_info_blocks): Add padding;
1108 add assert for object_info_size, input_section_entry_size,
1109 global_sym_entry_size.
1110 * incremental.h (Incremental_inputs_reader): Add symbolic constants
1111 for data structure sizes; use them.
1112 (Incremental_input_entry_reader): Import symbolic constants from
1113 Incremental_inputs_reader; use them.
1114
1115 2012-04-23 David S. Miller <davem@davemloft.net>
1116
1117 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1118 and elf_flags_set_.
1119 (Target_sparc::Target_sparc): Initialize new fields.
1120 (Target_sparc::do_make_elf_object): New function.
1121 (Target_sparc::do_adjust_elf_header): New function.
1122
1123 2012-04-23 Cary Coutant <ccoutant@google.com>
1124
1125 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1126 CU range table of gdb index.
1127
1128 2012-04-20 David S. Miller <davem@davemloft.net>
1129
1130 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1131 instead of false.
1132
1133 2012-04-16 David S. Miller <davem@davemloft.net>
1134
1135 * sparc.cc (Target_sparc::got_address): New function.
1136 (Sparc_relocate_functions::gdop_hix22): New function.
1137 (Sparc_relocate_functions::gdop_lox10): New function.
1138 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1139 relocs.
1140 (Target_sparc::Scan::local): Likewise if the global symbol is not
1141 preemptible and is not IFUNC.
1142 (Target_sparc::Relocate::relocate): Perform GOTDATA code
1143 transformations for local and non-preemptible non-IFUNC global
1144 symbols.
1145
1146 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1147 writing out 64-bit part of ranges.
1148
1149 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1150 -fpic and -fpie respectively.
1151 * Makefile.in: Regenerate.
1152
1153 * sparc.cc (class Target_sparc): Add rela_ifunc_.
1154 (Target_sparc::Target_sparc): Initialize new field.
1155 (Target_sparc::do_plt_section_for_global): New function.
1156 (Target_sparc::do_plt_section_for_local): New function.
1157 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1158 (Target_sparc::make_plt_section): New function, broken out of
1159 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
1160 (Target_sparc::make_plt_entry): Call make_plt_section.
1161 (Target_sparc::make_local_ifunc_plt_entry): New function.
1162 (Target_sparc::rela_ifunc_section): New function.
1163 (Target_sparc::plt_section): Remove const.
1164 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
1165 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1166 and ifunc_count_ fields.
1167 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1168 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1169 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1170 (Output_data_plt_sparc::rela_ifunc): New function.
1171 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1172 (Output_data_plt_sparc::has_ifunc_section): New function.
1173 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1174 (Output_data_plt_sparc::address_for_global): New function.
1175 (Output_data_plt_sparc::address_for_local): New function.
1176 (Output_data_plt_sparc::plt_index_to_offset): New function.
1177 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1178 and entry_count.
1179 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1180 entry_count.
1181 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1182 R_SPARC_JMP_IREL to switch.
1183 (Target_sparc::Scan::check_non_pic): Likewise.
1184 (Target_sparc::Scan::local): Handle IFUNC symbols.
1185 (Target_sparc::Scan::local): Likewise.
1186 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1187 and plt_address_for_local.
1188 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1189 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1190
1191 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1192 (class Output_data_reloc): Adjust calls to Output_reloc_type.
1193 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1194 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1195 global relocs too.
1196 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1197 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1198 calls.
1199 * sparc.cc (Target_sparc::Scan::global): Likewise.
1200 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1201
1202 2012-04-16 Cary Coutant <ccoutant@google.com>
1203
1204 * archive.cc (Library_base::should_include_member): Check for
1205 --export-dynamic-symbol.
1206 * options.h (class General_options): Add --export-dynamic-symbol.
1207 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1208 --export-dynamic-symbol.
1209 (Symbol_table::gc_mark_undef_symbols): Likewise.
1210 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1211
1212 2012-04-12 David S. Miller <davem@davemloft.net>
1213
1214 * sparc.cc (Reloc::wdisp10): New relocation method.
1215 (Reloc::h34): Likewise.
1216 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1217 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1218 R_SPARC_WDISP10.
1219 (Target_sparc::Scan::local): Likewise.
1220 (Target_sparc::Scan::global): Likewise.
1221 (Target_sparc::Relocate::relocate): Likewise.
1222
1223 2012-04-09 Cary Coutant <ccoutant@google.com>
1224
1225 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1226 low_pc == 0.
1227
1228 2012-04-06 Ian Lance Taylor <iant@google.com>
1229
1230 * timer.cc: #include <unistd.h>.
1231
1232 2012-04-06 Roland McGrath <mcgrathr@google.com>
1233
1234 * configure.in (AC_CHECK_HEADERS): Add locale.h.
1235 * config.in: Regenerate.
1236 * configure: Regenerate.
1237
1238 2012-04-05 Nick Clifton <nickc@redhat.com>
1239
1240 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1241 (AM_LC_MESSAGES): Add.
1242 * aclocal.m4: Regenerate.
1243 * config.in: Regenerate.
1244 * configure: Regenerate.
1245
1246 2012-03-21 Cary Coutant <ccoutant@google.com>
1247
1248 * Makefile.am: Add gdb-index.cc, gdb-index.h.
1249 * Makefile.in: Regenerate.
1250 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1251 (Sized_elf_reloc_mapper::symbol_section): New function.
1252 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1253 (make_elf_reloc_mapper): New function.
1254 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1255 (Dwarf_abbrev_table::do_read_abbrevs): New function.
1256 (Dwarf_abbrev_table::do_get_abbrev): New function.
1257 (Dwarf_ranges_table::read_ranges_table): New function.
1258 (Dwarf_ranges_table::read_range_list): New function.
1259 (Dwarf_pubnames_table::read_section): New function.
1260 (Dwarf_pubnames_table::read_header): New function.
1261 (Dwarf_pubnames_table::next_name): New function.
1262 (Dwarf_die::Dwarf_die): New function.
1263 (Dwarf_die::read_attributes): New function.
1264 (Dwarf_die::skip_attributes): New function.
1265 (Dwarf_die::set_name): New function.
1266 (Dwarf_die::set_linkage_name): New function.
1267 (Dwarf_die::attribute): New function.
1268 (Dwarf_die::string_attribute): New function.
1269 (Dwarf_die::int_attribute): New function.
1270 (Dwarf_die::uint_attribute): New function.
1271 (Dwarf_die::ref_attribute): New function.
1272 (Dwarf_die::child_offset): New function.
1273 (Dwarf_die::sibling_offset): New function.
1274 (Dwarf_info_reader::check_buffer): New function.
1275 (Dwarf_info_reader::parse): New function.
1276 (Dwarf_info_reader::do_parse): New function.
1277 (Dwarf_info_reader::do_read_string_table): New function.
1278 (Dwarf_info_reader::lookup_reloc): New function.
1279 (Dwarf_info_reader::get_string): New function.
1280 (Dwarf_info_reader::visit_compilation_unit): New function.
1281 (Dwarf_info_reader::visit_type_unit): New function.
1282 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1283 Sized_elf_reloc_mapper.
1284 (Sized_dwarf_line_info::symbol_section): Remove function.
1285 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1286 (Sized_dwarf_line_info::read_line_mappings): Remove object
1287 parameter, adjust callers.
1288 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1289 * dwarf_reader.h: Include <sys/types.h>.
1290 (class Track_relocs): Remove forward declaration.
1291 (class Elf_reloc_mapper): New class.
1292 (class Sized_elf_reloc_mapper): New class.
1293 (class Dwarf_abbrev_table): New class.
1294 (class Dwarf_range_list): New class.
1295 (class Dwarf_ranges_table): New class.
1296 (class Dwarf_pubnames_table): New class.
1297 (class Dwarf_die): New class.
1298 (class Dwarf_info_reader): New class.
1299 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1300 (Sized_dwarf_line_info::symbol_section): Remove member function.
1301 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1302 base class.
1303 * gdb-index.cc: New source file.
1304 * gdb-index.h: New source file.
1305 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1306 and .debug_types sections, call Layout::add_to_gdb_index.
1307 (Sized_relobj_incr::do_section_name): Implement.
1308 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1309 return type; Implement.
1310 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1311 return type.
1312 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1313 parameter list and return type.
1314 (Sized_incr_dynobj::do_section_contents): Likewise.
1315 * layout.cc: Include gdb-index.h.
1316 (Layout::Layout): Initialize gdb_index_data_.
1317 (Layout::init_fixed_output_section): Check for .gdb_index section.
1318 (Layout::add_to_gdb_index): New function. Instantiate.
1319 * layout.h: Add forward declaration for class Gdb_index.
1320 (Layout::add_to_gdb_index): New member function.
1321 (Layout::gdb_index_data_): New data member.
1322 * main.cc: Include gdb-index.h.
1323 (main): Print statistics for gdb index.
1324 * object.cc (Object::section_contents): Move code into
1325 do_section_contents.
1326 (need_decompressed_section): Check for sections needed when building
1327 gdb index.
1328 (build_compressed_section_map): Likewise.
1329 (Sized_relobj_file::do_read_symbols): Need local symbols when building
1330 gdb index.
1331 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1332 sections; call Layout::add_to_gdb_index.
1333 (Sized_relobj_file::do_decompressed_section_contents): Call
1334 do_section_contents directly.
1335 * object.h (Object::do_section_contents): Adjust parameter list and
1336 return type.
1337 (Object::do_decompressed_section_contents): Call do_section_contents
1338 directly.
1339 (Sized_relobj_file::do_section_contents): Adjust parameter list and
1340 return type.
1341 * options.h (class General_options): Add --gdb-index option.
1342 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1343 list and return type.
1344 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1345 * reloc.h (Track_relocs::checkpoint): New function.
1346 (Track_relocs::reset): New function.
1347
1348 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1349 New test cases.
1350 * testsuite/Makefile.in: Regenerate.
1351 * testsuite/gdb_index_test.cc: New test source file.
1352 * testsuite/gdb_index_test_1.sh: New test source file.
1353 * testsuite/gdb_index_test_2.sh: New test source file.
1354
1355 2012-03-19 Doug Kwan <dougkwan@google.com>
1356
1357 * arm.cc (Target_arm::do_define_standard_symbols): New method.
1358 (Target_arm::do_finalize_sections): Remove code which defines
1359 __exidx_start and __exidx_end. Make symbol table parameter
1360 anonymous as it is not used.
1361 * gold.cc (queue_middle_tasks): Call target hook to define any
1362 target-specific symbols.
1363 * target.h (Target::define_standard_symbols): New method.
1364 (Target::do_define_standard_symbols): Same.
1365 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1366 * testsuite/Makefile.in: Regenerate.
1367 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1368 and __exidx_end.
1369 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1370 relocations are generated for __exidx_start and __exidx_end.
1371
1372 2012-03-16 Doug Kwan <dougkwan@google.com>
1373
1374 * testsuite/Makefile.am: Disable test initpri3b.
1375 * testsuite/Makefile.in: Regenerate.
1376
1377 2012-03-15 Doug Kwan <dougkwan@google.com>
1378
1379 * arm.cc (Target_arm::got_section): Make .got section read-only
1380 if -z now is given.
1381
1382 2012-03-15 Ian Lance Taylor <iant@google.com>
1383
1384 PR gold/13850
1385 * layout.cc (Layout::make_output_section): Correctly mark
1386 SHT_INIT_ARRAY, et. al., as relro.
1387
1388 2012-03-14 Doug Kwan <dougkwan@google.com>
1389
1390 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1391 dynamic relocations for protected symbols in shared objects.
1392
1393 2012-03-13 Ian Lance Taylor <iant@google.com>
1394
1395 * resolve.cc (Symbol_table::resolve): When merging common symbols,
1396 keep the larger alignment.
1397
1398 2012-03-12 Cary Coutant <ccoutant@google.com>
1399
1400 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1401 handling of DW_LNE_define_file.
1402
1403 2012-03-12 Cary Coutant <ccoutant@google.com>
1404
1405 * reduced_debug_output.cc
1406 (Output_reduced_debug_info_section::get_die_end): Add new FORM
1407 codes to switch.
1408
1409 2012-02-29 Cary Coutant <ccoutant@google.com>
1410
1411 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1412
1413 2012-02-29 Cary Coutant <ccoutant@google.com>
1414
1415 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1416 Call Object::decompressed_section_contents.
1417 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1418 New dtor.
1419 (Sized_dwarf_line_info::buffer_start_): New data member.
1420 * merge.cc (Output_merge_data::do_add_input_section): Call
1421 Object::decompressed_section_contents.
1422 (Output_merge_string::do_add_input_section): Likewise.
1423 * object.cc (need_decompressed_section): New function.
1424 (build_compressed_section_map): Decompress sections needed later.
1425 (Sized_relobj_file::do_decompressed_section_contents): New function.
1426 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1427 * object.h (Object::decompressed_section_contents): New function.
1428 (Object::discard_decompressed_sections): New function.
1429 (Object::do_decompressed_section_contents): New function.
1430 (Object::do_discard_decompressed_sections): New function.
1431 (Compressed_section_info): New type.
1432 (Compressed_section_map): Include decompressed section contents.
1433 (Sized_relobj_file::do_decompressed_section_contents): New function.
1434 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1435
1436 2012-02-16 Cary Coutant <ccoutant@google.com>
1437
1438 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1439 * testsuite/Makefile.in: Regenerate.
1440
1441 2012-02-14 Cary Coutant <ccoutant@google.com>
1442
1443 * options.cc (General_options::finalize): Disallow -pie and -static.
1444
1445 2012-02-03 Doug Kwan <dougkwan@google.com>
1446
1447 * arm.cc (Arm_relocate_functions::abs8,
1448 Arm_relocate_functions::abs16): Use
1449 Bits::has_signed_unsigned_overflow32.
1450 (Arm_relocate_functions::thm_abs8): Correct range of
1451 overflow check.
1452 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1453 in assertions.
1454
1455 2012-02-02 Doug Kwan <dougkwan@google.com>
1456
1457 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1458 position independent outputs, not just shared objects.
1459
1460 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
1461
1462 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1463 * configure: Regenerated.
1464
1465 2012-01-27 Ian Lance Taylor <iant@google.com>
1466
1467 * reloc.h (Bits): New class with static functions, copied from
1468 namespace utils in arm.cc.
1469 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
1470 instead.
1471
1472 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1473
1474 * incremental.cc (write_info_blocks): Correct relocation offset.
1475
1476 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1477
1478 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1479 (Relocate::tls_gd_to_le): Likewise.
1480
1481 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1482
1483 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1484
1485 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1486
1487 * configure.ac: Check if -mcmodel=medium works.
1488 * configure: Regenerated.
1489
1490 2012-01-24 Cary Coutant <ccoutant@google.com>
1491
1492 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1493 definition and ...
1494 (read_unsigned_LEB_128_x): ... this new function.
1495 (read_signed_LEB_128): Replaced with inline definition and ...
1496 (read_signed_LEB_128_x): ... this new function.
1497 * int_encoding.h (read_unsigned_LEB_128_x): New function.
1498 (read_unsigned_LEB_128): Add inline definition.
1499 (read_signed_LEB_128_x): New function.
1500 (read_signed_LEB_128): Add inline definition.
1501 * testsuite/Makefile.am (leb128_unittest): New unit test.
1502 * testsuite/Makefile.in: Regenerate.
1503 * testsuite/leb128_unittest.cc: New unit test.
1504
1505 2012-01-23 Ian Lance Taylor <iant@google.com>
1506
1507 PR gold/13617
1508 * i386.cc (Target_i386::do_code_fill): When using a jmp
1509 instruction, pad with nop instructions.
1510 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1511
1512 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1513
1514 * x86_64.cc (gc_process_relocs): Add typename on types used in
1515 template.
1516 (scan_relocs): Likewise.
1517 (relocate_section): Likewise.
1518 (apply_relocation): Likewise.
1519
1520 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1521
1522 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1523 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1524 under x32.
1525
1526 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1527
1528 * x86_64.cc: Initial support for x32.
1529
1530 2012-01-03 Cary Coutant <ccoutant@google.com>
1531
1532 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1533 Use abstract base class for GOT.
1534 * gold/output.h (class Output_data_got_base): New abstract base class.
1535 (class Output_data_got): Derive from new base class, adjust ctors.
1536 (Output_data_got::reserve_slot): Make virtual; rename to
1537 do_reserve_slot; Adjust callers.
1538 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1539 pointer to abstract base class.
1540 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1541
1542 2011-12-18 Ian Lance Taylor <iant@google.com>
1543
1544 * object.h (Relobj::local_symbol_value): New function.
1545 (Relobj::local_plt_offset): New function.
1546 (Relobj::local_has_got_offset): New function.
1547 (Relobj::local_got_offset): New function.
1548 (Relobj::set_local_got_offset): New function.
1549 (Relobj::do_local_symbol_value): New pure virtual function.
1550 (Relobj::do_local_plt_offset): Likewise.
1551 (Relobj::do_local_has_got_offset): Likewise.
1552 (Relobj::do_local_got_offset): Likewise.
1553 (Relobj::do_set_local_got_offset): Likewise.
1554 (Sized_relobj::do_local_has_got_offset): Rename from
1555 local_has_got_offset.
1556 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1557 (Sized_relobj::do_set_local_got_offset): Rename from
1558 set_local_got_offset.
1559 (Sized_relobj_file::do_local_plt_offset): Rename from
1560 local_plt_offset.
1561 (Sized_relobj_file::do_local_symbol_value): New function.
1562 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1563 local_plt_offset.
1564 * output.cc (Output_data_got::Got_entry::write): Change object to
1565 Relobj. Use local_symbol_value.
1566 (Output_data_got::add_global_with_rel): Change rel_dyn to
1567 Output_data_reloc_generic*. Use add_global_generic.
1568 (Output_data_got::add_global_with_rela): Remove. Change all
1569 callers to use add_global_with_rel.
1570 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1571 Output_data_reloc_generic*. Use add_global_generic.
1572 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1573 callers to use add_global_pair_with_rel.
1574 (Output_data_got::add_local): Change object to Relobj*.
1575 (Output_data_got::add_local_plt): Likewise.
1576 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1577 change rel_dyn to Output_data_reloc_generic*. Use
1578 add_local_generic.
1579 (Output_data_got::add_local_with_rela): Remove. Change all
1580 callers to use all_local_with_rel.
1581 (Output_data_got::add_local_pair_with_rel): Change object to
1582 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1583 add_output_section_generic.
1584 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1585 callers to use add_local_pair_with_rel.
1586 (Output_data_got::reserve_local): Change object to Relobj*.
1587 * output.h: (class Output_data_reloc_generic): Add pure virtual
1588 declarations for add_global_generic, add_local_generic,
1589 add_output_section_generic.
1590 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1591 functions for Output_data_reloc_generic. Update declarations for
1592 changes listed in output.cc.
1593 (class Output_data_got): Change template parameter to got_size.
1594 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1595 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1596 function.
1597 (Sized_relobj_incr::do_local_plt_offset): New function.
1598 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1599 add_global_generic.
1600
1601 2011-12-17 Cary Coutant <ccoutant@google.com>
1602
1603 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1604 * resolve.cc (Symbol_table::resolve): Likewise.
1605 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1606 arrays.
1607 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1608
1609 2011-12-16 Ian Lance Taylor <iant@google.com>
1610
1611 * output.h (Output_data_reloc_generic::add): Only call
1612 add_dynamic_reloc if this is a dynamic reloc section.
1613
1614 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1615
1616 PR gold/13505
1617 * target-reloc.h (apply_relocation): Replace <64, false> with
1618 <size, big_endian>.
1619
1620 2011-11-25 Nick Clifton <nickc@redhat.com>
1621
1622 * po/it.po: New Italian translation.
1623
1624 2011-11-17 Sterling Augustine <saugustine@google.com>
1625
1626 * script.cc (script_include_directive): Implement.
1627 (read_script_file): New local variables name and search_path. Update
1628 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1629 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1630 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1631
1632 2011-11-11 Sterling Augustine <saugustine@google.com>
1633
1634 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1635 (file_or_sections_cmd): Likewise.
1636
1637 2011-11-11 Doug Kwan <dougkwan@google.com>
1638
1639 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1640 if --just-symbols is given.
1641
1642 2011-11-10 Doug Kwan <dougkwan@google.com>
1643
1644 PR gold/13362
1645 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1646 when processing data relocs.
1647 * reloc.h (Relocate_functions::rel_unaligned): New method.
1648 (Relocate_functions::pcrel_unaligned): Ditto.
1649 (Relocate_functions::rel32_unaligned): Ditto.
1650 (Relocate_functions::pcrel32_unaligned): Ditto.
1651
1652 2011-11-09 Doug Kwan <dougkwan@google.com>
1653
1654 PR gold/13362
1655 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1656 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1657 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1658 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1659 (Relocate_functions::rel_unaligned): New.
1660 (Relocate_functions::rel32_unaligned): New.
1661 * target-reloc.h (relocate_for_relocatable): Add code to handle
1662 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1663 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1664 arm_unaligned_reloc_r): New targets.
1665 * testsuite/Makefile.in: Regenerate.
1666 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1667 linking.
1668
1669 2011-11-02 Ian Lance Taylor <iant@google.com>
1670
1671 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1672 NATIVE_LINKER.
1673 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1674 * options.cc (General_options::finalize): Use library search path
1675 from configure script if specified. If not native and no sysroot,
1676 only search TOOLLIBDIR.
1677 * options.h (Search_directory::Search_directory): Change name to
1678 const std::string&.
1679 (General_options::add_to_library_path_with_sysroot): Change arg to
1680 const std::string&.
1681 * configure, Makefile.in, config.in: Rebuild.
1682
1683 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1684
1685 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1686 we are working around the ARM1176 Erratum.
1687 * options.h (General_options::fix_arm1176): Add option.
1688 * testsuite/Makefile.am: Add testcases, and keep current ones
1689 working.
1690 * testsuite/Makefile.in: Regenerate.
1691 * testsuite/arm_fix_1176.s: New file.
1692 * testsuite/arm_fix_1176.sh: Likewise.
1693
1694 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1695
1696 * arm.cc (Target_arm::Target_arm): Remove initialisation of
1697 may_use_blx_.
1698 (Target_arm::may_use_blx): Remove method.
1699 (Target_arm::set_may_use_blx): Likewise.
1700 (Target_arm::may_use_v4t_interworking): New method.
1701 (Target_arm::may_use_v5t_interworking): Likewise.
1702 (Target_arm::may_use_blx_): Remove member variable.
1703 (Arm_relocate_functions::arm_branch_common): Check for v5T
1704 interworking.
1705 (Arm_relocate_functions::thumb_branch_common): Likewise.
1706 (Reloc_stub::stub_type_for_reloc): Likewise.
1707 (Target_arm::do_finalize_sections): Correct interworking checks.
1708 * testsuite/Makefile.am: Add new tests.
1709 * testsuite/Makefile.in: Regenerate.
1710 * testsuite/arm_farcall_arm_arm.s: New test.
1711 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1712 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1713 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1714 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1715 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1716 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1717 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1718
1719 2011-10-31 Cary Coutant <ccoutant@google.com>
1720
1721 PR gold/13023
1722 * expression.cc (Expression::eval_with_dot): Add
1723 is_section_dot_assignment parameter.
1724 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1725 absolute and assigning to dot within a section.
1726 * script-sections.cc
1727 (Output_section_element_assignment::set_section_addresses): Pass
1728 dot_section to set_if_absolute.
1729 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1730 as is_section_dot_assignment flag to eval_with_dot.
1731 (Output_section_element_dot_assignment::set_section_addresses):
1732 Likewise.
1733 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1734 parameter. Also set value if relative to dot_section; set the
1735 symbol's output_section.
1736 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1737 parameter. Adjust all callers.
1738 (Expression::eval_maybe_dot): Likewise.
1739 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1740 Adjust all callers.
1741 * testsuite/script_test_2.t: Test assignment of an absolute value
1742 to dot within an output section element.
1743
1744 2011-10-31 Cary Coutant <ccoutant@google.com>
1745
1746 * options.h (class General_options): Add --[no-]gnu-unique options.
1747 * symtab.cc (Symbol_table::sized_write_globals): Convert
1748 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1749
1750 2011-10-31 Cary Coutant <ccoutant@google.com>
1751
1752 PR gold/13359
1753 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1754 unnecessary assertion.
1755 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1756
1757 2011-10-31 Sriraman Tallam <tmsriram@google.com>
1758
1759 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1760 gc_mark_symbol.
1761 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1762 gc_mark_symbol.
1763 Change to just keep the section associated with symbol.
1764 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1765 they are externally visible and --export-dynamic is turned on.
1766 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1767
1768 2011-10-19 Ian Lance Taylor <iant@google.com>
1769
1770 PR gold/13163
1771 * script-sections.cc
1772 (Output_section_element_dot_assignment::needs_output_section): New
1773 function.
1774
1775 2011-10-19 Ian Lance Taylor <iant@google.com>
1776
1777 PR gold/13204
1778 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1779 --section-start option was seen.
1780 * options.h (General_options::any_section_start): New function.
1781
1782 2011-10-18 David S. Miller <davem@davemloft.net>
1783
1784 PR binutils/13301
1785 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1786 member to track relocation locations that have moved during TLS
1787 reloc optimizations.
1788 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1789 (Target_sparc::Relocate::relocate): Adjust view down by 4
1790 bytes if it matches reloc_adjust_addr_.
1791 (Target_sparc::Relocate::relocate_tls): Always move the
1792 __tls_get_addr call delay slot instruction forward 4 bytes when
1793 performing relaxation.
1794
1795 2011-10-18 Cary Coutant <ccoutant@google.com>
1796
1797 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1798 (Output_file::map_no_anonymous): Check for non-zero
1799 return code from posix_fallocate.
1800
1801 2011-10-17 Cary Coutant <ccoutant@google.com>
1802
1803 PR gold/13245
1804 * plugin.cc (is_visible_from_outside): Check for symbols
1805 referenced from dynamic objects.
1806 * resolve.cc (Symbol_table::resolve): Don't count references
1807 from dynamic objects as references from real ELF files.
1808 * testsuite/plugin_test_2.sh: Adjust expected result.
1809
1810 2011-10-17 Cary Coutant <ccoutant@google.com>
1811
1812 * gold.cc: Include timer.h.
1813 (queue_middle_tasks): Stamp time.
1814 (queue_final_tasks): Likewise.
1815 * main.cc (main): Store timer in parameters. Print timers
1816 for each pass.
1817 * parameters.cc (Parameters::Parameters): Initialize timer_.
1818 (Parameters::set_timer): New function.
1819 (set_parameters_timer): New function.
1820 * parameters.h (Parameters::set_timer): New function.
1821 (Parameters::timer): New function.
1822 (Parameters::timer_): New data member.
1823 (set_parameters_timer): New function.
1824 * timer.cc (Timer::stamp): New function.
1825 (Timer::get_pass_time): New function.
1826 * timer.h (Timer::stamp): New function.
1827 (Timer::get_pass_time): New function.
1828 (Timer::pass_times_): New data member.
1829
1830 2011-10-17 Cary Coutant <ccoutant@google.com>
1831
1832 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1833 task for members of lib groups.
1834
1835 2011-10-17 Cary Coutant <ccoutant@google.com>
1836
1837 PR gold/13288
1838 * fileread.cc (File_read::find_view): Add assert.
1839 (File_read::make_view): Move bounds check (replace with assert)...
1840 (File_read::find_or_make_view): ... to here.
1841
1842 2011-10-12 Cary Coutant <ccoutant@google.com>
1843
1844 * output.cc (Output_file::open_base_file): Handle case where
1845 ::read returns less than requested size.
1846
1847 2011-10-10 Cary Coutant <ccoutant@google.com>
1848
1849 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1850 Initialize defined_count_.
1851 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1852 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1853 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1854 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1855 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1856 * incremental.h (Sized_relobj_incr::defined_count_): New data
1857 member.
1858 (Sized_incr_dynobj::defined_count_): New data member.
1859 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1860 Return zeroes instead of internal error.
1861
1862 2011-10-10 Cary Coutant <ccoutant@google.com>
1863
1864 PR gold/13249
1865 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1866 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1867 * output.h (class Output_reloc): Add use_plt_offset flag.
1868 (Output_reloc::type_): Adjust size of bit field.
1869 (Output_reloc::use_plt_offset_): New bit field.
1870 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1871 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1872 flag. Adjust all callers.
1873 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1874 creating RELATIVE relocations.
1875
1876 2011-10-10 Nick Clifton <nickc@redhat.com>
1877
1878 * po/es.po: Updated Spanish translation.
1879 * po/fi.po: Updated Finnish translation.
1880
1881 2011-10-03 Diego Novillo <dnovillo@google.com>
1882
1883 * options.cc (parse_uint): Fix dereference of RETVAL.
1884
1885 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1886
1887 * layout.h (section_order_map_): New member.
1888 (get_section_order_map): New member function.
1889 * output.cc (Output_section::add_input_section): Check for patterns
1890 only when --section-ordering-file is specified.
1891 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1892 output_sections have been formed.
1893 * layout.cc (Layout_Layout): Initialize section_order_map_.
1894 * plugin.cc (update_section_order): Store order in order_map. Do not
1895 update the order.
1896 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1897 * testsuite/Makefile.in: Regenerate.
1898 * testsuite/plugin_section_order.c: New file.
1899 * testsuite/plugin_final_layout.cc: New file.
1900 * testsuite/plugin_final_layout.sh: New file.
1901
1902 2011-09-29 Cary Coutant <ccoutant@google.com>
1903
1904 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1905 Check for NULL.
1906 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1907 symbols during incremental update.
1908 (Symbol_table::add_from_dynobj): Likewise.
1909
1910 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1911 Ian Lance Taylor <iant@google.com>
1912
1913 * symtab.cc (Symbol_table::define_special_symbol): Always
1914 canonicalize version string.
1915
1916 2011-09-26 Cary Coutant <ccoutant@google.com>
1917
1918 * gold.cc (queue_initial_tasks): Move option checks ...
1919 * options.cc (General_options::finalize): ... to here. Disable
1920 some options; make others fatal.
1921
1922 2011-09-26 Cary Coutant <ccoutant@google.com>
1923
1924 gcc PR lto/47247
1925 * plugin.cc (get_symbols_v2): New function.
1926 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1927 (is_referenced_from_outside): New function.
1928 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1929 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1930 (get_symbols): Pass version parameter.
1931 (get_symbols_v2): New function.
1932 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1933 parameter.
1934 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1935 (onload): Add LDPT_GET_SYMBOLS_V2.
1936 (all_symbols_read_hook): Use get_symbols_v2; check for
1937 LDPR_PREVAILING_DEF_IRONLY_EXP.
1938 * testsuite/plugin_test_3.sh: Update expected results.
1939
1940 2011-09-23 Simon Baldwin <simonb@google.com>
1941
1942 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1943 configuration options.
1944 * configure: Regenerate.
1945 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1946 * Makefile.in: Regenerate.
1947 * testsuite/Makefile.in: Regenerate.
1948
1949 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1950
1951 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1952
1953 2011-09-19 Cary Coutant <ccoutant@google.com>
1954
1955 * incremental.cc (can_incremental_update): Fix typo in comment.
1956 * incremental.h (can_incremental_update): Likewise.
1957
1958 2011-09-18 Cary Coutant <ccoutant@google.com>
1959
1960 * incremental.cc (can_incremental_update): New function.
1961 * incremental.h (can_incremental_update): New function.
1962 * layout.cc (Layout::init_fixed_output_section): Call it.
1963 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1964 * object.cc (Sized_relobj_file::do_layout): Call
1965 can_incremental_update.
1966
1967 2011-09-13 Cary Coutant <ccoutant@google.com>
1968
1969 * configure.ac: Check for glibc support for gnu_indirect_function
1970 support with static linking, setting automake conditional
1971 IFUNC_STATIC.
1972 * Makefile.in: Regenerate.
1973 * configure: Regenerate.
1974
1975 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1976 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1977 for IFUNC_STATIC.
1978 * testsuite/Makefile.in: Regenerate.
1979
1980 2011-09-13 Cary Coutant <ccoutant@google.com>
1981
1982 * incremental.cc (Sized_relobj_incr::do_layout): Call
1983 report_comdat_group for kept comdat sections.
1984 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1985 * testsuite/Makefile.in: Regenerate.
1986 * testsuite/incr_comdat_test_1.cc: New source file.
1987 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1988 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1989 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1990
1991 2011-09-13 Ian Lance Taylor <iant@google.com>
1992
1993 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1994 variable external_symbols_offset.
1995
1996 2011-09-12 Ian Lance Taylor <iant@google.com>
1997
1998 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1999 triggered if object has no symbols.
2000
2001 2011-09-09 David S. Miller <davem@davemloft.net>
2002
2003 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2004 (Output_fill_debug_line::do_write): Likewise.
2005
2006 2011-08-29 Cary Coutant <ccoutant@google.com>
2007
2008 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2009 casts to match formatting specs.
2010 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2011
2012 2011-08-26 Cary Coutant <ccoutant@google.com>
2013
2014 * layout.cc (Free_list::allocate): Provide guarantee of minimum
2015 remaining hole size when allocating.
2016 (Layout::make_output_section): Set fill methods for debug sections.
2017 * layout.h (Free_list::Free_list_node): Move from private to
2018 public.
2019 (Free_list::set_min_hole_size): New function.
2020 (Free_list::begin, Free_list::end): New functions.
2021 (Free_list::min_hole_): New data member.
2022 * output.cc: Include dwarf.h.
2023 (Output_fill_debug_info::do_minimum_hole_size): New function.
2024 (Output_fill_debug_info::do_write): New function.
2025 (Output_fill_debug_line::do_minimum_hole_size): New function.
2026 (Output_fill_debug_line::do_write): New function.
2027 (Output_section::Output_section): Initialize new data member.
2028 (Output_section::set_final_data_size): Ensure patch space is larger
2029 than minimum hole size.
2030 (Output_section::do_write): Fill holes in debug sections.
2031 * output.h (Output_fill): New class.
2032 (Output_fill_debug_info): New class.
2033 (Output_fill_debug_line): New class.
2034 (Output_section::set_free_space_fill): New function.
2035 (Output_section::free_space_fill_): New data member.
2036 * testsuite/Makefile.am (incremental_test_3): Add
2037 --incremental-patch option.
2038 (incremental_test_4): Likewise.
2039 (incremental_test_5): Likewise.
2040 (incremental_test_6): Likewise.
2041 (incremental_copy_test): Likewise.
2042 (incremental_common_test_1): Likewise.
2043 * testsuite/Makefile.in: Regenerate.
2044
2045 2011-08-26 Nick Clifton <nickc@redhat.com>
2046
2047 * po/es.po: Updated Spanish translation.
2048
2049 2011-08-01 Cary Coutant <ccoutant@google.com>
2050
2051 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2052 * gold/testsuite/Makefile.in: Regenerate.
2053 * gold/testsuite/justsyms_exec.c: New source file.
2054 * gold/testsuite/justsyms_lib.c: New source file.
2055
2056 2011-08-01 Cary Coutant <ccoutant@google.com>
2057
2058 * layout.cc (Layout::set_segment_offsets): Don't realign text
2059 segment if -Ttext was specified.
2060 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2061 file type.
2062 * object.h (Sized_relobj_file::e_type): New function.
2063 (Sized_relobj_file::e_type_): New data member.
2064 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2065 base address for ET_EXEC files.
2066 * target.cc (Target::do_make_elf_object_implementation): Allow
2067 ET_EXEC files with --just-symbols option.
2068
2069 2011-07-28 Cary Coutant <ccoutant@google.com>
2070
2071 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2072 Add thread_number parameter.
2073 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2074 * workqueue-threads.cc
2075 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2076 current thread if its thread number is greater than desired thread
2077 count.
2078 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2079 Add thread_number parameter.
2080 (Workqueue::should_cancel_thread): Likewise.
2081 (Workqueue::find_runnable_or_wait): Pass thread_number to
2082 should_cancel_thread.
2083 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2084 parameter.
2085
2086 2011-07-22 Sriraman Tallam <tmsriram@google.com>
2087
2088 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2089 only after checking if it cannot be forced local.
2090 * symtab.h (is_externally_visible): Check if the symbol is not forced
2091 local.
2092
2093 2011-07-15 Ian Lance Taylor <iant@google.com>
2094
2095 * options.h (class General_options): Add --print-output-format.
2096 Move -EL next to -EB, for better --help output.
2097 * target-select.cc: Include <cstdio>, "options.h", and
2098 "parameters.h".
2099 (Target_selector::do_target_bfd_name): New function.
2100 (print_output_format): New function.
2101 * target-select.h (class Target_selector): Update declarations.
2102 (Target_selector::target_bfd_name): New function.
2103 (print_output_format): Declare.
2104 * main.cc: Include "target-select.h".
2105 (main): Handle --print-output-format.
2106 * gold.cc: Include "target-select.h".
2107 (queue_initial_tasks): Handle --print-output-format when there are
2108 no input files.
2109 * parameters.cc (parameters_force_valid_target): Give a better
2110 error message if -EB/-EL does not match target.
2111 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2112 function.
2113
2114 2011-07-15 Ian Lance Taylor <iant@google.com>
2115
2116 * i386.cc (class Output_data_plt_i386): Add layout_ field.
2117 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2118 (Output_data_plt_i386::do_write): Write address of .dynamic
2119 section to first entry in .got.plt section.
2120 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2121 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2122 Initialize layout_.
2123 (Output_data_plt_x86_64::do_write): Write address of .dynamic
2124 section to first entry in .got.plt section.
2125 * layout.h (Layout::dynamic_section): New function.
2126
2127 2011-07-13 Sriraman Tallam <tmsriram@google.com>
2128
2129 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2130 to claim_file call.
2131 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2132 input_section_position_, and input_section_glob_.
2133 (read_layout_from_file): Call function section_ordering_specified.
2134 * layout.h (is_section_ordering_specified): New function.
2135 (section_ordering_specified): New function.
2136 (section_ordering_specified_): New boolean member.
2137 * main.cc(main): Call load_plugins after layout object is defined.
2138 * output.cc (Output_section::add_input_section): Use
2139 function section_ordering_specified to check if section ordering is
2140 needed.
2141 * output.cc (Output_section::add_relaxed_input_section): Use
2142 function section_ordering_specified to check if section ordering is
2143 needed.
2144 (Output_section::update_section_layout): New function.
2145 (Output_section::sort_attached_input_sections): Check if input section
2146 must be reordered.
2147 * output.h (Output_section::update_section_layout): New function.
2148 * plugin.cc (get_section_count): New function.
2149 (get_section_type): New function.
2150 (get_section_name): New function.
2151 (get_section_contents): New function.
2152 (update_section_order): New function.
2153 (allow_section_ordering): New function.
2154 (Plugin::load): Add the new interfaces to the transfer vector.
2155 (Plugin_manager::load_plugins): New parameter.
2156 (Plugin_manager::all_symbols_read): New parameter.
2157 (Plugin_manager::claim_file): New parameter. Save the elf object for
2158 unclaimed objects.
2159 (Plugin_manager::get_elf_object): New function.
2160 (Plugin_manager::get_view): Change to directly use the bool to check
2161 if get_view is called from claim_file_hook.
2162 * plugin.h (input_objects): New function
2163 (Plugin__manager::load_plugins): New parameter.
2164 (Plugin_manager::claim_file): New parameter.
2165 (Plugin_manager::get_elf_object): New function.
2166 (Plugin_manager::in_claim_file_handler): New function.
2167 (Plugin_manager::in_claim_file_handler_): New member.
2168 (layout): New function.
2169 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2170 handler with an extra parameter. Make the elf object before calling
2171 claim_file handler.
2172 * testsuite/plugin_test.c (get_section_count): New function pointer.
2173 (get_section_type): New function pointer.
2174 (get_section_name): New function pointer.
2175 (get_section_contents): New function pointer.
2176 (update_section_order): New function pointer.
2177 (allow_section_ordering): New function pointer.
2178 (onload): Check if the new interfaces exist.
2179
2180 2011-07-13 Ian Lance Taylor <iant@google.com>
2181
2182 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2183 relro section.
2184 * x86_64.cc (Target_x86_64::got_section): Likewise.
2185 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2186 (relro_now_test_SOURCES): New variable.
2187 (relro_now_test_DEPENDENCIES): New variable.
2188 (relro_now_test_LDFLAGS): New variable.
2189 (relro_now_test_LDADD): New variable.
2190 (relro_now_test.so): New target.
2191 * testsuite/Makefile.in: Rebuild.
2192
2193 2011-07-12 Ian Lance Taylor <iant@google.com>
2194
2195 PR gold/12980
2196 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2197 GLOB_DAT relocation rather than a RELATIVE relocation for a
2198 protected symbol when creating a shared library.
2199 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2200 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2201 * testsuite/protected_main_1.cc (main): Test that protected
2202 function has same address.
2203
2204 2011-07-11 Ian Lance Taylor <iant@google.com>
2205
2206 PR gold/12979
2207 * options.h (class General_options): Add -Bgroup.
2208 * options.cc (General_options::finalize): If -Bgroup is set,
2209 default to --unresolved-symbols=report-all.
2210 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2211 * target-reloc.h (issue_undefined_symbol_error): Handle
2212 --unresolved-symbols=report-all.
2213
2214 2011-07-08 Ian Lance Taylor <iant@google.com>
2215
2216 PR gold/11985
2217 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2218 if linker script discards key sections.
2219 (Layout::create_dynamic_symtab): Likewise.
2220 (Layout::assign_local_dynsym_offsets): Likewise.
2221 (Layout::sized_create_version_sections): Likewise.
2222 (Layout::create_interp): Likewise.
2223 (Layout::finish_dynamic_section): Likewise.
2224 (Layout::set_dynamic_symbol_size): Likewise.
2225
2226 2011-07-08 Ian Lance Taylor <iant@google.com>
2227
2228 PR gold/12386
2229 * options.h (class General_options): Add --unresolved-symbols.
2230 * target-reloc.h (issue_undefined_symbol_error): Check
2231 --unresolved-symbols. Add comments.
2232
2233 2011-07-08 Ian Lance Taylor <iant@google.com>
2234
2235 * testsuite/odr_violation2.cc (Ordering::operator()): Make
2236 expression more complex.
2237
2238 2011-07-08 Ian Lance Taylor <iant@google.com>
2239
2240 PR gold/11317
2241 * target-reloc.h (issue_undefined_symbol_error): New inline
2242 function, broken out of relocate_section.
2243 (relocate_section): Call issue_undefined_symbol_error.
2244 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2245 there is no TLS segment if we are about to issue an undefined
2246 symbol error.
2247 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2248
2249 2011-07-08 Ian Lance Taylor <iant@google.com>
2250
2251 PR gold/12279
2252 * resolve.cc (Symbol_table::should_override): Add fromtype
2253 parameter. Change all callers. Give error when linking together
2254 TLS and non-TLS symbol.
2255 (Symbol_table::should_override_with_special): Add fromtype
2256 parameter. Change all callers.
2257 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2258 there is no TLS segment if we have reported some errors.
2259 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2260
2261 2011-07-08 Ian Lance Taylor <iant@google.com>
2262
2263 PR gold/12372
2264 * target.h (Target::plt_address_for_global): New function.
2265 (Target::plt_address_for_local): New function.
2266 (Target::plt_section_for_global): Remove.
2267 (Target::plt_section_for_local): Remove.
2268 (Target::do_plt_address_for_global): New virtual function.
2269 (Target::do_plt_address_for_local): New virtual function.
2270 (Target::do_plt_section_for_global): Remove.
2271 (Target::do_plt_section_for_local): Remove.
2272 (Target::register_global_plt_entry): Add Symbol_table and Layout
2273 parameters.
2274 * output.cc (Output_data_got::Got_entry::write): Use
2275 plt_address_for_global and plt_address_for_local.
2276 * layout.cc (Layout::add_target_dynamic_tags): Use size and
2277 address of output section.
2278 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2279 got_irelative_, and irelative_count_ fields. Update
2280 declarations.
2281 (Output_data_plt_i386::has_irelative_section): New function.
2282 (Output_data_plt_i386::entry_count): Add irelative_count_.
2283 (Output_data_plt_i386::set_final_data_size): Likewise.
2284 (class Target_i386): Add got_irelative_ and rel_irelative_
2285 fields. Update declarations.
2286 (Target_i386::Target_i386): Initialize new fields.
2287 (Target_i386::do_plt_address_for_global): New function replacing
2288 do_plt_section_for_global.
2289 (Target_i386::do_plt_address_for_local): New function replacing
2290 do_plt_section_for_local.
2291 (Target_i386::got_section): Create got_irelative_.
2292 (Target_i386::rel_irelative_section): New function.
2293 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2294 fields. Don't define __rel_iplt_{start,end}.
2295 (Output_data_plt_i386::add_entry): Add symtab and layout
2296 parameters. Change all callers. Use different PLT and GOT for
2297 IFUNC symbols.
2298 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2299 layout parameters. Change all callers. Use different PLT and
2300 GOT.
2301 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2302 (Output_data_plt_i386::rel_irelative): New function.
2303 (Output_data_plt_i386::address_for_global): New function.
2304 (Output_data_plt_i386::address_for_local): New function.
2305 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
2306 IRELATIVE GOT when changing IFUNC GOT entries.
2307 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2308 reloc.
2309 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2310 if we didn't create an IRELATIVE GOT.
2311 (Target_i386::Relocate::relocate): Use plt_address_for_global and
2312 plt_address_for_local.
2313 (Target_i386::do_dynsym_value): Use plt_address_for_global.
2314 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2315 got_irelative_, and irelative_count_ fields. Update
2316 declarations.
2317 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2318 Initialize new fields. Remove symtab parameter. Change all
2319 callers.
2320 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2321 irelative_count_.
2322 (Output_data_plt_x86_64::has_irelative_section): New function.
2323 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2324 (class Target_x86_64): Add got_irelative_ and rel_irelative_
2325 fields. Update declarations.
2326 (Target_x86_64::Target_x86_64): Initialize new fields.
2327 (Target_x86_64::do_plt_address_for_global): New function replacing
2328 do_plt_section_for_global.
2329 (Target_x86_64::do_plt_address_for_local): New function replacing
2330 do_plt_section_for_local.
2331 (Target_x86_64::got_section): Create got_irelative_.
2332 (Target_x86_64::rela_irelative_section): New function.
2333 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
2334 all callers. Don't create __rel_iplt_{start,end}.
2335 (Output_data_plt_x86_64::add_entry): Add symtab and layout
2336 parameters. Change all callers. Use different PLT and GOT for
2337 IFUNC symbols.
2338 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2339 layout parameters. Change all callers. Use different PLT and
2340 GOT.
2341 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2342 parameters. Change all callers. Use different PLT and GOT for
2343 IFUNC symbols.
2344 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2345 (Output_data_plt_x86_64::rela_irelative): New function.
2346 (Output_data_plt_x86_64::address_for_global): New function.
2347 (Output_data_plt_x86_64::address_for_local): New function.
2348 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2349 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2350 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2351 (Target_x86_64::register_global_plt_entry): Add symtab and layout
2352 parameters.
2353 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2354 reloc.
2355 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2356 symbols if we didn't create an IRELATIVE GOT.
2357 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2358 plt_address_for_local.
2359 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2360 * testsuite/ifuncvar1.c: New test file.
2361 * testsuite/ifuncvar2.c: New test file.
2362 * testsuite/ifuncvar3.c: New test file.
2363 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2364 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2365 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2366 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2367 * testsuite/Makefile.in: Rebuild.
2368
2369 2011-07-07 Cary Coutant <ccoutant@google.com>
2370
2371 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2372 (two_file_test_1_ndebug.o): Likewise.
2373 (two_file_test_1b_ndebug.o): Likewise.
2374 (two_file_test_2_ndebug.o): Likewise.
2375 (two_file_test_main_ndebug.o): Likewise.
2376 (incremental_test_2): Link with no-debug versions.
2377
2378 2011-07-06 Cary Coutant <ccoutant@google.com>
2379
2380 * gold/incremental.cc
2381 (Output_section_incremental_inputs::write_info_blocks): Check for
2382 hidden and internal symbols.
2383
2384 2011-07-06 Cary Coutant <ccoutant@google.com>
2385
2386 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2387 Check disposition for startup file.
2388 (Incremental_inputs::report_command_line): Ignore
2389 --incremental-startup-unchanged option.
2390 * options.cc (General_options::parse_incremental_startup_unchanged):
2391 New function.
2392 (General_options::General_options): Initialize new data member.
2393 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2394 (General_options): Add --incremental-startup-unchanged option.
2395 (General_options::incremental_startup_disposition): New function.
2396 (General_options::incremental_startup_disposition_): New data member.
2397
2398 2011-07-06 Cary Coutant <ccoutant@google.com>
2399
2400 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2401 input file index to Script_info ctor.
2402 (Sized_incremental_binary::do_file_has_changed): Find the
2403 command-line argument for files named in scripts.
2404 * incremental.h (Script_info::Script_info): New ctor
2405 with input file index.
2406 (Script_info::input_file_index): New function.
2407 (Script_info::input_file_index_): New data member.
2408 (Incremental_binary::get_library): Add const.
2409 (Incremental_binary::get_script_info): Add const.
2410 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2411 * testsuite/Makefile.am (incremental_test_5): New test case.
2412 (incremental_test_6): New test case.
2413 * testsuite/Makefile.in: Regenerate.
2414
2415 2011-07-06 Cary Coutant <ccoutant@google.com>
2416
2417 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2418 debug output when command lines differ.
2419
2420 2011-07-06 Cary Coutant <ccoutant@google.com>
2421
2422 * incremental.cc (Incremental_inputs::report_command_line): Ignore
2423 --incremental-patch option.
2424 * layout.cc (Free_list::allocate): Extend allocation beyond original
2425 end if enabled.
2426 (Layout::make_output_section): Mark sections that should get
2427 patch space.
2428 * options.cc (parse_percent): New function.
2429 * options.h (parse_percent): New function.
2430 (DEFINE_percent): New macro.
2431 (General_options): Add --incremental-patch option.
2432 * output.cc (Output_section::Output_section): Initialize new data
2433 members.
2434 (Output_section::add_input_section): Print section name when out
2435 of patch space.
2436 (Output_section::add_output_section_data): Likewise.
2437 (Output_section::set_final_data_size): Add patch space when
2438 doing --incremental-full.
2439 (Output_section::do_reset_address_and_file_offset): Remove patch
2440 space.
2441 (Output_segment::set_section_list_addresses): Print debug output
2442 only if --incremental-update.
2443 * output.h (Output_section::set_is_patch_space_allowed): New function.
2444 (Output_section::is_patch_space_allowed_): New data member.
2445 (Output_section::patch_space_): New data member.
2446 * parameters.cc (Parameters::incremental_full): New function.
2447 * parameters.h (Parameters::incremental_full): New function
2448 * testsuite/Makefile.am (incremental_test_2): Add test for
2449 --incremental-patch option.
2450 * testsuite/Makefile.in: Regenerate.
2451 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2452 (t18): Remove function body.
2453
2454 2011-07-05 Doug Kwan <dougkwan@google.com>
2455
2456 PR gold/12771
2457 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2458 Arm_Address type for relocation result.
2459 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
2460 overflow check.
2461 (Arm_relocate_functions::abs32): Use unaligned access.
2462 (Arm_relocate_functions::rel32): Ditto.
2463 (Arm_relocate_functions::prel31): Ditto.
2464 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2465 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2466 static data relocations.
2467 * testsuite/Makefile.in: Regnerate.
2468 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2469
2470 2011-07-05 Ian Lance Taylor <iant@google.com>
2471
2472 PR gold/12392
2473 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2474 symbols if necessary.
2475 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2476
2477 2011-07-05 Ian Lance Taylor <iant@google.com>
2478
2479 PR gold/12952
2480 * resolve.cc (Symbol::override_base_with_special): Simply override
2481 version with special symbol version, ignoring previous version.
2482
2483 2011-07-05 Ian Lance Taylor <iant@google.com>
2484
2485 * object.cc (Sized_relobj_file::include_section_group): Add
2486 information to comment about signature location.
2487
2488 2011-07-02 Ian Lance Taylor <iant@google.com>
2489
2490 PR gold/12957
2491 * options.h (class General_options): Add -f and -F.
2492 * options.cc (General_options::finalize): Fatal error if -f/-F
2493 are used without -shared.
2494 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2495
2496 2011-07-02 Ian Lance Taylor <iant@google.com>
2497
2498 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2499
2500 2011-07-01 Ian Lance Taylor <iant@google.com>
2501
2502 PR gold/12525
2503 PR gold/12952
2504 * resolve.cc (Symbol::override_base_with_special): Don't override
2505 the version if the overriding symbol has a different name.
2506 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2507 all callers. If we give an error about an undefined version,
2508 define the base version if necessary.
2509 * dynobj.h (class Versions): Update declaration.
2510 * testsuite/weak_alias_test_5.cc: New file.
2511 * testsuite/weak_alias_test.script: New file.
2512 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2513 and versioned_alias have the right value, and call t2.
2514 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2515 weak_alias_test_5.so.
2516 (weak_alias_test_LDADD): Likewise.
2517 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2518 * testsuite/Makefile.in: Rebuild.
2519
2520 2011-07-01 Ian Lance Taylor <iant@google.com>
2521
2522 PR gold/12525
2523 * options.h (class General_options): Support -z notext.
2524 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2525 -Wl,-z,notext.
2526 (two_file_shared_nonpic.so): Likewise.
2527 (two_file_shared_mixed.so): Likewise.
2528 (two_file_shared_mixed_1.so): Likewise.
2529 (weak_undef_lib_nonpic.so): Likewise.
2530 (alt/weak_undef_lib_nonpic.so): Likewise.
2531 (tls_test_shared_nonpic.so): Likewise.
2532 * testsuite/Makefile.in: Rebuild.
2533
2534 2011-07-01 Ian Lance Taylor <iant@google.com>
2535
2536 PR gold/12525
2537 * configure.ac: Test whether static linking works, setting
2538 the automake conditional HAVE_STATIC.
2539 * testsuite/Makefile.am: Disable tests using -static if
2540 HAVE_STATIC is not true.
2541 * configure, testsuite/Makefile.in: Rebuild.
2542
2543 2011-07-01 Ian Lance Taylor <iant@google.com>
2544
2545 PR gold/12525
2546 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2547 Assert if we see DW_EH_PE_indirect.
2548 * target.h (Target::ehframe_datarel_base): New function.
2549 (Target::do_ehframe_datarel_base): New target function.
2550 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2551 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2552 function.
2553
2554 2011-07-01 Ian Lance Taylor <iant@google.com>
2555
2556 PR gold/12571
2557 * options.h (class General_options): Add
2558 --ld-generated-unwind-info.
2559 * ehframe.cc (Fde::write): Add address parameter. Change all
2560 callers. If associated with PLT, fill in address and size.
2561 (Cie::set_output_offset): Only add merge mapping if there is an
2562 object.
2563 (Cie::write): Add address parameter. Change all callers.
2564 (Eh_frame::add_ehframe_for_plt): New function.
2565 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2566 input_offset_ fields into union u_, with new plt field.
2567 (Fde::Fde): Adjust for new union field.
2568 (Fde::Fde) [Output_data version]: New constructor.
2569 (Fde::add_mapping): Only add merge mapping if there is an object.
2570 (class Cie): Update declarations.
2571 (class Eh_frame): Declare add_ehframe_for_plt.
2572 * layout.cc (Layout::layout_eh_frame): Break out code into
2573 make_eh_frame_section, and call it.
2574 (Layout::make_eh_frame_section): New function.
2575 (Layout::add_eh_frame_for_plt): New function.
2576 * layout.h (class Layout): Update declarations.
2577 * merge.cc (Merge_map::add_mapping): Add assertion.
2578 * i386.cc: Include "dwarf.h".
2579 (class Output_data_plt_i386): Make first_plt_entry,
2580 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2581 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2582 and plt_eh_frame_fde.
2583 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2584 boundary. Call add_eh_frame_for_plt if appropriate.
2585 * x86_64.cc: Include "dwarf.h".
2586 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2587 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2588 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2589 and plt_eh_frame_fde.
2590 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2591 appropriate.
2592
2593 2011-06-29 Ian Lance Taylor <iant@google.com>
2594
2595 PR gold/12629
2596 * object.cc (Sized_relobj_file::layout_section): Change shdr
2597 parameter to be const.
2598 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2599 out of do_layout.
2600 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2601 appropriate. Call layout_eh_frame_section.
2602 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2603 sections.
2604 * object.h (class Sized_relobj_file): Update declarations.
2605
2606 2011-06-29 Ian Lance Taylor <iant@google.com>
2607
2608 PR gold/12652
2609 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2610 modifier.
2611 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2612
2613 2011-06-29 Ian Lance Taylor <iant@google.com>
2614
2615 PR gold/12675
2616 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2617 SHT_X86_64_UNWIND.
2618 * layout.cc (Layout::layout_eh_frame): Likewise.
2619
2620 2011-06-29 Ian Lance Taylor <iant@google.com>
2621
2622 PR gold/12695
2623 * layout.cc (Layout::symtab_section_shndx): New function.
2624 * layout.h (class Layout): Declare symtab_section_shndx.
2625 * output.cc (Output_section::write_header): Call it.
2626
2627 2011-06-29 Ian Lance Taylor <iant@google.com>
2628
2629 PR gold/12818
2630 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2631 symbols which are not used in a relocation.
2632
2633 2011-06-28 Ian Lance Taylor <iant@google.com>
2634
2635 PR gold/12898
2636 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2637 script create indistinguishable segments.
2638 (Layout::set_segment_offsets): Use stable_sort when sorting
2639 segments. Pass this to Compare_segments constructor.
2640 * layout.h (class Layout): Make segment_precedes non-static.
2641 (class Compare_segments): Change from struct to class. Add
2642 layout_ field. Add constructor.
2643 * script-sections.cc
2644 (Script_sections::attach_sections_using_phdrs_clause): Rename
2645 local orphan to is_orphan. Don't report failure to put empty
2646 section in segment. On attachment failure, report name of
2647 section, and attach to first PT_LOAD segment.
2648
2649 2011-06-28 Ian Lance Taylor <iant@google.com>
2650
2651 PR gold/12934
2652 * target-select.cc (Target_selector::Target_selector): Add
2653 emulation parameter. Change all callers.
2654 (select_target_by_bfd_name): Rename from select_target_by_name.
2655 Change all callers.
2656 (select_target_by_emulation): New function.
2657 (supported_emulation_names): New function.
2658 * target-select.h (class Target_selector): Add emulation_ field.
2659 Update declarations.
2660 (Target_selector::recognize_by_bfd_name): Rename from
2661 recognize_by_name. Change all callers.
2662 (Target_selector::supported_bfd_names): Rename from
2663 supported_names. Change all callers.
2664 (Target_selector::recognize_by_emulation): New function.
2665 (Target_selector::supported_emulations): New function.
2666 (Target_selector::emulation): New function.
2667 (Target_selector::do_recognize_by_bfd_name): Rename from
2668 do_recognize_by_name. Change all callers.
2669 (Target_selector::do_supported_bfd_names): Rename from
2670 do_supported_names. Change all callers.
2671 (Target_selector::do_recognize_by_emulation): New function.
2672 (Target_selector::do_supported_emulations): New function.
2673 (select_target_by_bfd_name): Change name in declaration.
2674 (select_target_by_emulation): Declare.
2675 (supported_emulation_names): Declare.
2676 * parameters.cc (parameters_force_valid_target): Try to find
2677 target based on emulation from -m option.
2678 * options.h (class General_options): Change doc string for -m.
2679 * options.cc (help): Print emulations.
2680 (General_options::parse_V): Likewise.
2681 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2682 Add emulation parameter. Change all callers.
2683
2684 2011-06-28 Ian Lance Taylor <iant@google.com>
2685
2686 * target.h (class Target): Add osabi_ field.
2687 (Target::osabi): New function.
2688 (Target::set_osabi): New function.
2689 (Target::Target): Initialize osabi_.
2690 (Target::do_adjust_elf_header): Make pure virtual.
2691 (Sized_target::do_adjust_elf_header): Declare.
2692 * target.cc (Sized_target::do_adjust_elf_header): New function.
2693 (class Sized_target): Instantiate all versions.
2694 * freebsd.h (class Target_freebsd): Remove.
2695 (Target_selector_freebsd::do_recognize): Call set_osabi on
2696 Target.
2697 (Target_selector_freebsd::do_recognize_by_name): Likewise.
2698 (Target_selector_freebsd::set_osabi): Remove.
2699 * i386.cc (class Target_i386): Inherit from Sized_target rather
2700 than Target_freebsd.
2701 * x86_64.cc (class Target_x86_64): Likewise.
2702
2703 2011-06-28 Ian Lance Taylor <iant@google.com>
2704
2705 * target.h (Target::can_check_for_function_pointers): Rewrite.
2706 Make non-virtual.
2707 (Target::can_icf_inline_merge_sections): Likewise.
2708 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2709 (Target::Target_info): Add can_icf_inline_merge_sections field.
2710 (Target::do_can_check_for_function_pointers): New virtual
2711 function.
2712 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2713 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2714 from can_check_for_function_pointers, move in file.
2715 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2716 section_may_have_icf_unsafe_poineters, move in file.
2717 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2718 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2719 Rename from can_check_for_function_pointers, move in file.
2720 (Target_i386::can_icf_inline_merge_sections): Remove.
2721 (Target_i386::i386_info): Initialize
2722 can_icf_inline_merge_sections.
2723 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2724 Initialize can_icf_inline_merge_sections.
2725 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2726 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2727 Rename from can_check_for_function_pointers, move in file.
2728 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2729 (Target_x86_64::x86_64_info): Initialize
2730 can_icf_inline_merge_sections.
2731 * testsuite/testfile.cc (Target_test::test_target_info):
2732 Likewise.
2733 * icf.cc (get_section_contents): Correct formatting.
2734
2735 2011-06-27 Ian Lance Taylor <iant@google.com>
2736
2737 * symtab.cc (Symbol::versioned_name): New function.
2738 (Symbol_table::add_to_final_symtab): Use versioned_name when
2739 appropriate.
2740 (Symbol_table::sized_write_symbol): Likewise.
2741 * symtab.h (class Symbol): Declare versioned_name.
2742 * stringpool.h (class Stringpool_template): Add variant of add
2743 which takes a std::basic_string.
2744 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2745 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2746 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2747 (ver_test_12.o): New target.
2748 * testsuite/Makefile.in: Rebuild.
2749
2750 2011-06-27 Doug Kwan <dougkwan@google.com>
2751
2752 * arm.cc (Arm_relocate_functions::thm_jump8,
2753 Arm_relocate_functions::thm_jump11): Use a wider signed
2754 type to compute offset.
2755 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2756 arm_thm_jump8.
2757 * testsuite/Makefile.in: Regenerate.
2758 * testsuite/arm_branch_in_range.sh: Check test results of
2759 arm_thm_jump11 and arm_thm_jump8.
2760 * testsuite/arm_thm_jump11.s: New test source file.
2761 * testsuite/arm_thm_jump11.t: New linker script.
2762 * testsuite/arm_thm_jump8.s: New test source file.
2763 * testsuite/arm_thm_jump8.t: New linker script.
2764
2765 2011-06-24 Ian Lance Taylor <iant@google.com>
2766
2767 * layout.cc: Include "object.h".
2768 (ctors_sections_in_init_array): New static variable.
2769 (Layout::is_ctors_in_init_array): New function.
2770 (Layout::layout): Add entry to ctors_sections_in_init_array if
2771 appropriate.
2772 * layout.h (class Layout): Declare is_ctors_in_init_array.
2773 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2774 is_ctors_reverse_view is set.
2775 (Sized_relobj_file::write_sections): Add layout parameter. Change
2776 all callers. Set is_ctors_reverse_view field of View_size.
2777 (Sized_relobj_file::reverse_words): New function.
2778 * object.h (Sized_relobj_file::View_size): Add
2779 is_ctors_reverse_view field.
2780 (class Sized_relobj_file): Update declarations.
2781 * testsuite/initpri3.c: New test.
2782 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2783 initpri3b.
2784 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2785 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2786 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2787 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2788 * testsuite/Makefile.in: Rebuild.
2789
2790 2011-06-24 Cary Coutant <ccoutant@google.com>
2791
2792 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2793 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2794 (debug_msg_cdebug.err): New targets.
2795 * testsuite/Makefile.in: Regenerate.
2796 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2797 Fix checks for link with shared library.
2798
2799 2011-06-24 Doug Kwan <dougkwan@google.com>
2800
2801 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2802 skip empty text sections.
2803 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2804
2805 2011-06-22 Ian Lance Taylor <iant@google.com>
2806
2807 PR gold/12910
2808 * options.h (class General_options): Add --ctors-in-init-array.
2809 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2810 friends as SHT_PROGBITS for merging sections.
2811 (Layout::layout): Remove special handling of .init_array and
2812 friends. Don't sort if doing relocatable link. Sort for .ctors
2813 and .dtors if ctors_in_init_array.
2814 (Layout::make_output_section): Force correct section types for
2815 .init_array and friends. Don't sort if doing relocatable link,
2816 Don't sort .ctors and .dtors if ctors_in_init_array.
2817 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2818 (Layout::output_section_name): Add relobj parameter. Change all
2819 callers. Handle .ctors. and .dtors. in code rather than table.
2820 Handle .ctors and .dtors if ctors_in_init_array.
2821 (Layout::match_file_name): New function, moved from output.cc.
2822 * layout.h (class Layout): Update declarations.
2823 * output.cc: Include "layout.h".
2824 (Input_section_sort_entry::get_priority): New function.
2825 (Input_section_sort_entry::match_file_name): Just call
2826 Layout::match_file_name.
2827 (Output_section::Input_section_sort_init_fini_compare::operator()):
2828 Handle .ctors and .dtors. Sort by explicit priority rather than
2829 by name.
2830 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2831 * testsuite/initpri2.c: New test.
2832 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2833 (check_PROGRAMS): Add initpri2.
2834 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2835 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2836 * configure, testsuite/Makefile.in: Rebuild.
2837
2838 2011-06-19 Ian Lance Taylor <iant@google.com>
2839
2840 PR gold/12880
2841 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2842 .interp section to a PT_INTERP segment even if we have seen a
2843 --dynamic-linker option. Don't do it if we have seen a PHDRS
2844 clause in a linker script.
2845 (Layout::finalize): Don't create a .interp section if we've
2846 already create a PT_INTERP segment.
2847 (Layout::create_interp): Always call choose_output_section (revert
2848 patch of 2011-06-17). Don't create PT_INTERP segment.
2849 * script-sections.cc
2850 (Script_sections::create_note_and_tls_segments): Add a .interp
2851 section to a PT_INTERP segment even if we have seen a
2852 --dynamic-linker option.
2853
2854 2011-06-18 Ian Lance Taylor <iant@google.com>
2855
2856 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2857 merely because a non-PT_LOAD segment has a dynamic reloc.
2858
2859 2011-06-18 Ian Lance Taylor <iant@google.com>
2860
2861 * layout.cc (Layout::finish_dynamic_section): Don't create
2862 DT_FLAGS entry if not needed.
2863
2864 2011-06-18 Ian Lance Taylor <iant@google.com>
2865
2866 PR gold/12745
2867 * layout.cc (Layout::layout_eh_frame): Correct handling of
2868 writable .eh_frame section.
2869
2870 2011-06-17 Ian Lance Taylor <iant@google.com>
2871
2872 PR gold/12893
2873 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2874 symbol is redefined with the exact same object and value.
2875
2876 2011-06-17 Ian Lance Taylor <iant@google.com>
2877
2878 PR gold/12880
2879 * layout.h (class Layout): Add interp_segment_ field.
2880 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2881 (Layout::attach_allocated_section_to_segment): If making shared
2882 library, put .interp section in PT_INTERP segment.
2883 (Layout::finalize): Also call create_interp if -dynamic-linker
2884 option was used.
2885 (Layout::create_interp): Assert that there is no PT_INTERP
2886 segment. If not using a SECTIONS clause, use make_output_section.
2887 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2888 * script-sections.cc
2889 (Script_sections::create_note_and_tls_segments): If making shared
2890 library, put .interp section in PT_INTERP segment.
2891
2892 2011-06-17 Ian Lance Taylor <iant@google.com>
2893
2894 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2895 when making a shared library.
2896
2897 2011-06-17 Ian Lance Taylor <iant@google.com>
2898
2899 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2900 parameter. Change all callers. Don't issue warning about PC32
2901 against locally defined symbol.
2902
2903 2011-06-16 Ian Lance Taylor <iant@google.com>
2904
2905 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2906 occurs in same object.
2907
2908 2011-06-14 Alan Modra <amodra@gmail.com>
2909
2910 * po/POTFILES.in: Regenerate.
2911
2912 2011-06-09 Ian Lance Taylor <iant@google.com>
2913
2914 * script-sections.cc
2915 (Orphan_output_section::set_section_addresses): For a relocatable
2916 link set address to 0.
2917
2918 2011-06-09 Cary Coutant <ccoutant@google.com>
2919
2920 PR gold/12804
2921 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2922 used with --compress-debug-sections.
2923 * gold/object.cc (Sized_relobj_file::do_layout): Report
2924 uncompressed size of compressed input sections.
2925
2926 2011-06-08 Cary Coutant <ccoutant@google.com>
2927
2928 PR gold/12804
2929 * testsuite/two_file_test_2_v1.cc: Change initialization of
2930 v2 to keep it in .data.
2931
2932 2011-06-07 Cary Coutant <ccoutant@google.com>
2933
2934 * common.cc (Symbol_table::do_allocate_commons_list): Call
2935 gold_fallback.
2936 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2937 (Errors::fallback): New function.
2938 (gold_fallback): New function.
2939 * errors.h (Errors::fallback): New function.
2940 * gold.cc (gold_exit): Change status parameter to enum; adjust
2941 all callers.
2942 (queue_initial_tasks): Call gold_fallback.
2943 * gold.h: Include cstdlib.
2944 (Exit_status): New enum type.
2945 (gold_exit): Change status parameter to enum.
2946 (gold_fallback): New function.
2947 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2948 (Layout::create_symtab_sections): Likewise.
2949 (Layout::create_shdrs): Likewise.
2950 * main.cc (main): Adjust call to gold_exit.
2951 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2952 (Output_data_got::add_got_entry_pair): Likewise.
2953 (Output_section::add_input_section): Likewise.
2954 (Output_section::add_output_section_data): Likewise.
2955 (Output_segment::set_section_list_addresses): Likewise.
2956 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2957
2958 2011-06-07 Cary Coutant <ccoutant@google.com>
2959
2960 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2961 for incremental links.
2962 * output.cc (Output_segment::set_section_list_addresses): Remove
2963 FIXME and test for TLS or BSS.
2964
2965 2011-06-07 Cary Coutant <ccoutant@google.com>
2966
2967 * testsuite/Makefile.am: Add incremental_copy_test,
2968 incremental_common_test_1.
2969 * testsuite/Makefile.in: Regenerate.
2970 * testsuite/common_test_1_v1.c: New source file.
2971 * testsuite/common_test_1_v2.c: New source file.
2972 * testsuite/copy_test_v1.cc: New source file.
2973
2974 2011-06-07 Cary Coutant <ccoutant@google.com>
2975
2976 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2977 update, allocate common from bss section's free list.
2978 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2979 linker-defined symbols.
2980 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2981 Skip GOT and PLT entries that are no longer referenced.
2982 (Output_section_incremental_inputs::write_info_blocks): Mark
2983 linker-defined symbols.
2984 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2985 * output.cc (Output_section::allocate): New function.
2986 * output.h (Output_section::allocate): New function.
2987 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2988 linker-defined symbols.
2989 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2990 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2991 (Symbol::init_base_output_data): Likewise.
2992 (Symbol::init_base_output_segment): Likewise.
2993 (Symbol::init_base_constant): Likewise.
2994 (Sized_symbol::init_output_data): Likewise.
2995 (Sized_symbol::init_output_segment): Likewise.
2996 (Sized_symbol::init_constant): Likewise.
2997 (Symbol_table::do_define_in_output_data): Likewise.
2998 (Symbol_table::do_define_in_output_segment): Likewise.
2999 (Symbol_table::do_define_as_constant): Likewise.
3000 * symtab.h (Symbol::is_predefined): New function.
3001 (Symbol::init_base_output_data): Add is_predefined parameter.
3002 (Symbol::init_base_output_segment): Likewise.
3003 (Symbol::init_base_constant): Likewise.
3004 (Symbol::is_predefined_): New data member.
3005 (Sized_symbol::init_output_data): Add is_predefined parameter.
3006 (Sized_symbol::init_output_segment): Likewise.
3007 (Sized_symbol::init_constant): Likewise.
3008 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3009
3010 2011-06-07 Cary Coutant <ccoutant@google.com>
3011
3012 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3013 instead of emit_copy_reloc.
3014 (Copy_relocs::emit_copy_reloc): Refactor.
3015 (Copy_relocs::make_copy_reloc): New function.
3016 (Copy_relocs::add_copy_reloc): Remove.
3017 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3018 section.
3019 (Copy_relocs::make_copy_reloc): New function.
3020 (Copy_relocs::add_copy_reloc): Remove.
3021 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3022 unchanged input files.
3023 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3024 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3025 Reserve BSS space for COPY relocations.
3026 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3027 (Output_section_incremental_inputs::write_info_blocks): Record
3028 whether a symbol is copied from a shared object.
3029 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3030 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3031 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3032 (Incremental_input_entry_reader::get_output_symbol_index): Add
3033 is_copy parameter.
3034 (Incremental_binary::emit_copy_relocs): New function.
3035 (Incremental_binary::do_emit_copy_relocs): New function.
3036 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3037 new data member.
3038 (Sized_incremental_binary::add_copy_reloc): New function.
3039 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3040 (Sized_incremental_binary::Copy_reloc): New struct.
3041 (Sized_incremental_binary::Copy_relocs): New typedef.
3042 (Sized_incremental_binary::copy_relocs_): New data member.
3043 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3044 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3045 * target.h (Sized_target::emit_copy_reloc): New function.
3046 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3047
3048 2011-06-02 Cary Coutant <ccoutant@google.com>
3049
3050 PR gold/12163
3051 * gold/archive.cc (Archive::Archive): Initialize new data member.
3052 (Archive::include_all_members): Return if archive has already been
3053 included.
3054 * gold/archive.h (Archive::include_all_members_): New data member.
3055
3056 2011-06-02 Nick Clifton <nickc@redhat.com>
3057
3058 * dynobj.h: Fix spelling mistake in comment.
3059 * output.cc: Likewise.
3060
3061 2011-05-31 Doug Kwan <dougkwan@google.com>
3062 Asier Llano
3063
3064 PR gold/12826
3065 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3066 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3067 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
3068 redundant arm_exidx_test.so.
3069 * testsuite/Makefile.in: Regenerate.
3070 (check_SCRIPTS): Add pr12826.sh
3071 (check_DATA): Add pr12826.stdout
3072 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3073 * testsuite/pr12826.sh: New file.
3074 * testsuite/pr12826_1.s: Ditto.
3075 * testsuite/pr12826_1.s: Ditto.
3076
3077 2011-05-30 Ian Lance Taylor <iant@google.com>
3078
3079 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3080 sections.
3081
3082 2011-05-29 Ian Lance Taylor <iant@google.com>
3083
3084 PR gold/12804
3085 * testsuite/Makefile.am: Use different file name for two_file_test
3086 temporary file for each incremental test.
3087 * testsuite/Makefile.in: Rebuild.
3088
3089 2011-05-29 Ian Lance Taylor <iant@google.com>
3090
3091 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3092 binary input file is empty.
3093
3094 2011-05-27 Ian Lance Taylor <iant@google.com>
3095
3096 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3097 (ver_test_9.so): Likewise.
3098 * testsuite/Makefile.in: Rebuild.
3099
3100 2011-05-26 Cary Coutant <ccoutant@google.com>
3101
3102 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3103 * incremental.cc (Incremental_inputs::report_input_section): Fix
3104 comment, indentation.
3105 (Incremental_inputs::report_comdat_group): New function.
3106 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3107 of data for incremental input file entry.
3108 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3109 group count, COMDAT group signatures.
3110 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3111 an unchanged input file.
3112 * incremental.h (Incremental_object_entry::Incremental_object_entry):
3113 Initialize new data member.
3114 (Incremental_object_entry::add_comdat_group): New function.
3115 (Incremental_object_entry::get_comdat_group_count): New function.
3116 (Incremental_object_entry::get_comdat_signature_key): New function.
3117 (Incremental_object_entry::groups_): New data member.
3118 (Incremental_inputs::report_comdat_group): New function.
3119 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3120 data for incremental input file entry.
3121 (Incremental_input_entry_reader::get_comdat_group_count): New function.
3122 (Incremental_input_entry_reader::get_input_section): Adjust size of
3123 data for incremental input file entry.
3124 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3125 (Incremental_input_entry_reader::get_comdat_group_signature): New
3126 function.
3127 * object.cc (Sized_relobj::include_section_group): Report kept
3128 COMDAT groups for incremental links.
3129
3130 2011-05-24 David Meyer <pdox@google.com>
3131
3132 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3133 with name parameter. Add found_name parameter.
3134 * fileread.cc (Input_file::find_file): Adjust code accordingly.
3135 * dirsearch.h (class Dirsearch): Update declaration.
3136
3137 2011-05-24 Ian Lance Taylor <iant@google.com>
3138
3139 * archive.cc (Library_base::should_include_member): Pull in object
3140 from archive if it defines the entry symbol.
3141 * parameters.cc (Parameters::entry): New function.
3142 * parameters.h (class Parameters): Declare entry.
3143 * output.h (class Output_file_header): Remove entry_ field.
3144 * output.cc (Output_file_header::Output_file_header): Remove entry
3145 parameter. Change all callers.
3146 (Output_file_header::entry): Use parameters->entry.
3147 * gold.cc (queue_middle_tasks): Likewise.
3148 * plugin.cc (Plugin_hook::run): Likewise.
3149
3150 2011-05-24 Cary Coutant <ccoutant@google.com>
3151
3152 * gold.cc (queue_initial_tasks): Pass incremental base filename
3153 to Output_file::open_base_file; don't print error message.
3154 * incremental-dump.cc (main): Adjust call to
3155 Output_file::open_for_modification.
3156 * incremental-dump.cc (main): Likewise.
3157 * incremental.cc (Incremental_inputs::report_command_line):
3158 Ignore --incremental-base option when comparing command lines.
3159 Ignore parameter when given as separate argument.
3160 * options.h (class General_options): Add --incremental-base.
3161 * output.cc (Output_file::Output_file):
3162 (Output_file::open_base_file): Add base_name and writable parameters;
3163 read base file into new file; print error message here.
3164 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3165 callers.
3166 * output.h (Output_file::open_for_modification): Rename to...
3167 (Output_file::open_base_file): ...this; add base_name and
3168 writable parameters; adjust all callers.
3169 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3170 callers.
3171 * testsuite/Makefile.am (incremental_test_4): Test
3172 --incremental-base.
3173 * testsuite/Makefile.in: Regenerate.
3174
3175 2011-05-24 Cary Coutant <ccoutant@google.com>
3176
3177 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3178 incremental_test_4.
3179 * testsuite/Makefile.in: Regenerate.
3180 * testsuite/two_file_test_1_v1.cc: New test source file.
3181 * testsuite/two_file_test_1b_v1.cc: New test source file.
3182 * testsuite/two_file_test_2_v1.cc: New test source file.
3183
3184 2011-05-24 Cary Coutant <ccoutant@google.com>
3185
3186 * dynobj.h (Dynobj::do_dynobj): New function.
3187 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3188 flag and soname for shared objects.
3189 * incremental.cc (Incremental_inputs::report_object): Make
3190 either Incremental_object_entry or Incremental_dynobj_entry; add
3191 soname to string table.
3192 (Incremental_inputs::report_input_section): Add assertion.
3193 (Output_section_incremental_inputs::set_final_data_size): Adjust
3194 type of input file entry for shared libraries; adjust size of
3195 shared library info entry.
3196 (Output_section_incremental_inputs::write_input_files): Write
3197 as_needed flag for shared libraries.
3198 (Output_section_incremental_inputs::write_info_blocks): Adjust type
3199 of input file entry for shared libraries; write soname.
3200 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3201 soname from incremental info.
3202 * incremental.h (enum Incremental_input_flags): Add
3203 INCREMENTAL_INPUT_AS_NEEDED.
3204 (Incremental_input_entry::Incremental_input_entry): Initialize new
3205 data member.
3206 (Incremental_input_entry::set_as_needed): New function.
3207 (Incremental_input_entry::as_needed): New function.
3208 (Incremental_input_entry::do_dynobj_entry): New function.
3209 (Incremental_input_entry::as_needed_): New data member.
3210 (Incremental_object_entry::Incremental_object_entry): Don't check
3211 for shared library.
3212 (Incremental_object_entry::do_type): Likewise.
3213 (class Incremental_dynobj_entry): New class.
3214 (Incremental_input_entry_reader::as_needed): New function.
3215 (Incremental_input_entry_reader::get_soname): New function.
3216 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3217 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3218 size of shared library info entry.
3219 * layout.cc (Layout::finish_dynamic_section): Don't test for
3220 incremental link when adding DT_NEEDED entries.
3221 * object.h (Object::Object): Initialize new data member.
3222 (Object::dynobj): New function.
3223 (Object::set_as_needed): New function.
3224 (Object::as_needed): New function.
3225 (Object::do_dynobj): New function.
3226 (Object::as_needed_): New data member.
3227
3228 2011-05-24 Cary Coutant <ccoutant@google.com>
3229
3230 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3231 info; adjust display of GOT entries.
3232 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3233 vector of input objects; remove file_status_.
3234 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3235 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3236 got_plt reader; call target hooks to reserve GOT entries.
3237 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3238 of input file info header and GOT info entry.
3239 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3240 relocation info.
3241 (Got_plt_view_info::got_descriptor): Remove.
3242 (Got_plt_view_info::sym_index): New data member.
3243 (Got_plt_view_info::input_index): New data member.
3244 (Local_got_offset_visitor::visit): Write input file index.
3245 (Global_got_offset_visitor::visit): Write 0 for input file index.
3246 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3247 with sym_index and input_index.
3248 (Output_section_incremental_inputs::write_got_plt): Adjust size of
3249 incremental info GOT entry; replace got_descriptor with input_index.
3250 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3251 map from input file index to object.
3252 (Sized_relobj_incr::do_layout): Replace direct data member reference
3253 with accessor function.
3254 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3255 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3256 Adjust size of input file info header.
3257 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3258 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3259 (Incremental_input_entry_reader::get_input_section): Adjust size of
3260 input file info header.
3261 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3262 of incremental info GOT entry.
3263 (Incremental_got_plt_reader::get_got_desc): Remove.
3264 (Incremental_got_plt_reader::get_got_symndx): New function.
3265 (Incremental_got_plt_reader::get_got_input_index): New function.
3266 (Sized_incremental_binary::Sized_incremental_binary): Remove
3267 file_status_; add input_objects_.
3268 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3269 (Sized_incremental_binary::set_file_is_unchanged): Remove.
3270 (Sized_incremental_binary::file_is_unchanged): Remove.
3271 (Sized_incremental_binary::set_input_object): New function.
3272 (Sized_incremental_binary::input_object): New function.
3273 (Sized_incremental_binary::file_status_): Remove.
3274 (Sized_incremental_binary::input_objects_): New data member.
3275 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3276 references.
3277 (Sized_relobj_incr::invalid_address): Move to base class.
3278 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3279 class.
3280 (Sized_relobj_incr::do_output_section_offset): Likewise.
3281 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3282 (Sized_relobj_incr::section_offsets_): Likewise.
3283 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3284 function.
3285 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3286 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3287 with accessor function.
3288 (Sized_relobj_file::do_layout): Likewise.
3289 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3290 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3291 (Sized_relobj_file::compute_final_local_value): Replace refs to
3292 section_offsets_ with accessor function.
3293 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3294 * object.h (Relobj::Relobj): Initialize new data members.
3295 (Relobj::add_dyn_reloc): New function.
3296 (Relobj::first_dyn_reloc): New function.
3297 (Relobj::dyn_reloc_count): New function.
3298 (Relobj::first_dyn_reloc_): New data member.
3299 (Relobj::dyn_reloc_count_): New data member.
3300 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3301 references.
3302 (Sized_relobj::Address): New typedef.
3303 (Sized_relobj::invalid_address): Move here from child class.
3304 (Sized_relobj::Sized_relobj): Initialize new data members.
3305 (Sized_relobj::sized_relobj): New function.
3306 (Sized_relobj::is_output_section_offset_invalid): Move here from
3307 child class.
3308 (Sized_relobj::get_output_section_offset): Likewise.
3309 (Sized_relobj::local_has_got_offset): Likewise.
3310 (Sized_relobj::local_got_offset): Likewise.
3311 (Sized_relobj::set_local_got_offset): Likewise.
3312 (Sized_relobj::do_for_all_local_got_entries): Likewise.
3313 (Sized_relobj::clear_got_offsets): New function.
3314 (Sized_relobj::section_offsets): Move here from child class.
3315 (Sized_relobj::do_output_section_offset): Likewise.
3316 (Sized_relobj::do_set_section_offset): Likewise.
3317 (Sized_relobj::Local_got_offsets): Likewise.
3318 (Sized_relobj::local_got_offsets_): Likewise.
3319 (Sized_relobj::section_offsets_): Likewise.
3320 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3321 references.
3322 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3323 class.
3324 (Sized_relobj_file::sized_relobj): New function
3325 (Sized_relobj_file::local_has_got_offset): Move to base class.
3326 (Sized_relobj_file::local_got_offset): Likewise.
3327 (Sized_relobj_file::set_local_got_offset): Likewise.
3328 (Sized_relobj_file::get_output_section_offset): Likewise.
3329 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3330 (Sized_relobj_file::do_output_section_offset): Likewise.
3331 (Sized_relobj_file::do_set_section_offset): Likewise.
3332 (Sized_relobj_file::Local_got_offsets): Likewise.
3333 (Sized_relobj_file::local_got_offsets_): Likewise.
3334 (Sized_relobj_file::section_offsets_): Likewise.
3335 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3336 (all constructors).
3337 (set_needs_dynsym_index): Convert relobj to derived class pointer.
3338 (Output_reloc::get_symbol_index): Likewise.
3339 (Output_reloc::local_section_offset): Likewise.
3340 (Output_reloc::get_address): Likewise.
3341 (Output_reloc::symbol_value): Likewise.
3342 (Output_data_got::reserve_slot): Move to class definition.
3343 (Output_data_got::reserve_local): New function.
3344 (Output_data_got::reserve_slot_for_global): Remove.
3345 (Output_data_got::reserve_global): New function.
3346 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3347 (all constructors, two instantiations).
3348 (Output_reloc::get_relobj): New function (two instantiations).
3349 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3350 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3351 (Output_data_reloc::add_global): Adjust type of relobj.
3352 (Output_data_reloc::add_global_relative): Likewise.
3353 (Output_data_reloc::add_symbolless_global_addend): Likewise.
3354 (Output_data_reloc::add_local): Likewise.
3355 (Output_data_reloc::add_local_relative): Likewise.
3356 (Output_data_reloc::add_symbolless_local_addend): Likewise.
3357 (Output_data_reloc::add_local_section): Likewise.
3358 (Output_data_reloc::add_output_section): Likewise.
3359 (Output_data_reloc::add_absolute): Likewise.
3360 (Output_data_reloc::add_target_specific): Likewise.
3361 (Output_data_got::reserve_slot): Move definition here.
3362 (Output_data_got::reserve_local): New function.
3363 (Output_data_got::reserve_global): New function.
3364 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3365 section_offsets_ with accessor function.
3366 (Sized_relobj_file::write_sections): Likewise.
3367 (Sized_relobj_file::do_relocate_sections): Likewise.
3368 * target.h (Sized_target::reserve_local_got_entry): New function.
3369 (Sized_target::reserve_global_got_entry): New function.
3370 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3371 (Target_x86_64::reserve_global_got_entry): New function.
3372 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3373
3374 2011-05-23 Cary Coutant <ccoutant@google.com>
3375
3376 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3377 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3378 bit when checking got_type.
3379 * incremental.cc (Sized_incremental_binary::setup_readers):
3380 Store symbol table and string table locations; initialize bit vector
3381 of file status flags.
3382 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3383 unchanged files.
3384 (Sized_incremental_binary::do_process_got_plt): New function.
3385 (Sized_incremental_binary::get_symtab_view): Use stored locations.
3386 (Output_section_incremental_inputs::set_final_data_size): Record
3387 file index for each input file.
3388 (Output_section_incremental_inputs::write_got_plt): Store file index
3389 instead of input entry offset for each GOT entry.
3390 * incremental.h
3391 (Incremental_input_entry::Incremental_input_entry): Initialize new
3392 data member.
3393 (Incremental_input_entry::set_offset): Store file index.
3394 (Incremental_input_entry::get_file_index): New function.
3395 (Incremental_input_entry::file_index_): New data member.
3396 (Incremental_binary::process_got_plt): New function.
3397 (Incremental_binary::do_process_got_plt): New function.
3398 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3399 data members.
3400 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3401 (Sized_incremental_binary::set_file_is_unchanged): New function.
3402 (Sized_incremental_binary::file_is_unchanged): New function.
3403 (Sized_incremental_binary::do_process_got_plt): New function.
3404 (Sized_incremental_binary::file_status_): New data member.
3405 (Sized_incremental_binary::main_symtab_loc_): New data member.
3406 (Sized_incremental_binary::main_strtab_loc_): New data member.
3407 * output.cc (Output_data_got::Got_entry::write): Add case
3408 RESERVED_CODE.
3409 (Output_data_got::add_global): Call add_got_entry.
3410 (Output_data_got::add_global_plt): Likewise.
3411 (Output_data_got::add_global_with_rel): Likewise.
3412 (Output_data_got::add_global_with_rela): Likewise.
3413 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3414 (Output_data_got::add_global_pair_with_rela): Likewise.
3415 (Output_data_got::add_local): Call add_got_entry.
3416 (Output_data_got::add_local_plt): Likewise.
3417 (Output_data_got::add_local_with_rel): Likewise.
3418 (Output_data_got::add_local_with_rela): Likewise.
3419 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3420 (Output_data_got::add_local_pair_with_rela): Likewise.
3421 (Output_data_got::reserve_slot): New function.
3422 (Output_data_got::reserve_slot_for_global): New function.
3423 (Output_data_got::add_got_entry): New function.
3424 (Output_data_got::add_got_entry_pair): New function.
3425 (Output_section::add_output_section_data): Edit FIXME.
3426 * output.h
3427 (Output_section_data_build::Output_section_data_build): New
3428 constructor with size parameter.
3429 (Output_data_space::Output_data_space): Likewise.
3430 (Output_data_got::Output_data_got): Initialize new data member; new
3431 constructor with size parameter.
3432 (Output_data_got::add_constant): Call add_got_entry.
3433 (Output_data_got::reserve_slot): New function.
3434 (Output_data_got::reserve_slot_for_global): New function.
3435 (class Output_data_got::Got_entry): Add RESERVED_CODE.
3436 (Output_data_got::add_got_entry): New function.
3437 (Output_data_got::add_got_entry_pair): New function.
3438 (Output_data_got::free_list_): New data member.
3439 * target.h (Sized_target::init_got_plt_for_update): New function.
3440 (Sized_target::register_global_plt_entry): New function.
3441 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3442 Initialize new data member; call init; add constructor with PLT count.
3443 (Output_data_plt_x86_64::init): New function.
3444 (Output_data_plt_x86_64::add_relocation): New function.
3445 (Output_data_plt_x86_64::reserve_slot): New function.
3446 (Output_data_plt_x86_64::free_list_): New data member.
3447 (Target_x86_64::init_got_plt_for_update): New function.
3448 (Target_x86_64::register_global_plt_entry): New function.
3449 (Output_data_plt_x86_64::add_entry): Allocate from free list for
3450 incremental updates.
3451 (Output_data_plt_x86_64::add_relocation): New function.
3452 * testsuite/object_unittest.cc (Object_test): Set default options.
3453
3454 2011-05-16 Ian Lance Taylor <iant@google.com>
3455
3456 * options.h (class General_options): Make -i a synonym for -r.
3457
3458 2011-05-16 Ian Lance Taylor <iant@google.com>
3459
3460 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3461
3462 2011-05-10 Cary Coutant <ccoutant@google.com>
3463
3464 * object.cc (Sized_relobj::do_count_local_symbols): Check for
3465 strip_all (-s).
3466
3467 2011-05-06 Ian Lance Taylor <iant@google.com>
3468
3469 * layout.cc (Layout::layout): If the output section flags change,
3470 update the ordering.
3471
3472 2011-04-25 Cary Coutant <ccoutant@google.com>
3473
3474 * incremental-dump.cc (dump_incremental_inputs): Print local
3475 symbol info for each input file.
3476 * incremental.cc
3477 (Output_section_incremental_inputs::set_final_data_size): Add local
3478 symbol info to input file entries in incremental info.
3479 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3480 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3481 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3482 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3483 implementation.
3484 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3485 (Sized_incr_relobj::do_relocate): Write the local symbols.
3486 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3487 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3488 Adjust size of input file header.
3489 (Incremental_inputs_reader::get_local_symbol_offset): New function.
3490 (Incremental_inputs_reader::get_local_symbol_count): New function.
3491 (Incremental_inputs_reader::get_input_section): Adjust size of input
3492 file header.
3493 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3494 (Sized_incr_relobj::This): New typedef.
3495 (Sized_incr_relobj::sym_size): New const data member.
3496 (Sized_incr_relobj::Local_symbol): New struct.
3497 (Sized_incr_relobj::do_output_local_symbol_count): New function.
3498 (Sized_incr_relobj::do_local_symbol_offset): New function.
3499 (Sized_incr_relobj::local_symbol_count_): New data member.
3500 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3501 (Sized_incr_relobj::local_symbol_index_): New data member.
3502 (Sized_incr_relobj::local_symbol_offset_): New data member.
3503 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3504 (Sized_incr_relobj::local_symbols_): New data member.
3505 * object.h (Relobj::output_local_symbol_count): New function.
3506 (Relobj::local_symbol_offset): New function.
3507 (Relobj::do_output_local_symbol_count): New function.
3508 (Relobj::do_local_symbol_offset): New function.
3509 (Sized_relobj::do_output_local_symbol_count): New function.
3510 (Sized_relobj::do_local_symbol_offset): New function.
3511
3512 2011-04-22 Vladimir Simonov <sv@sw.ru>
3513
3514 * descriptors.cc (set_close_on_exec): New function.
3515 (Descriptors::open): Use set_close_on_exec.
3516 * output.cc (S_ISLNK): Define if not defined.
3517
3518 2011-04-22 Cary Coutant <ccoutant@google.com>
3519
3520 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3521 global symbol map.
3522 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3523 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3524 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3525 relocations.
3526 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3527 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3528 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3529 * incremental.h
3530 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3531 function.
3532 (Incremental_binary::apply_incremental_relocs): New function.
3533 (Incremental_binary::do_apply_incremental_relocs): New function.
3534 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3535 data member.
3536 (Sized_incremental_binary::add_global_symbol): New function.
3537 (Sized_incremental_binary::global_symbol): New function.
3538 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3539 (Sized_incremental_binary::symbol_map_): New data member.
3540 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3541 * target.h (Sized_target::apply_relocation): New function.
3542 * target-reloc.h (apply_relocation): New function.
3543 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3544
3545 2011-04-22 Doug Kwan <dougkwan@google.com>
3546
3547 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3548 flag of a SHT_ARM_EXIDX section.
3549 * testsuite/Makefile.am (arm_exidx_test): New test rules.
3550 * testsuite/Makefile.in: Regenerate.
3551 * testsuite/arm_exidx_test.s: New file.
3552 * testsuite/arm_exidx_test.sh: Same.
3553
3554 2011-04-20 Cary Coutant <ccoutant@google.com>
3555
3556 PR gold/12689
3557 * archive.h (Incremental_archive_entry::Archive_member):
3558 Initialize arg_serial_ (second constructor).
3559
3560 2011-04-17 Ian Lance Taylor <iant@google.com>
3561
3562 * object.cc (Relocate_info::location): Simplify location string.
3563 * errors.cc (Errors::error_at_location): Don't print program
3564 name.
3565 (Errors::warning_at_location): Likewise.
3566 (Errors::undefined_symbol): Likewise.
3567 * testsuite/debug_msg.sh: Update accordingly.
3568
3569 2011-04-14 Cary Coutant <ccoutant@google.com>
3570
3571 * gold/layout.cc (Layout::symtab_section_offset): New function.
3572 * gold/layout.h (Layout::symtab_section_offset): New function.
3573 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3574
3575 2011-04-12 Ian Lance Taylor <iant@google.com>
3576
3577 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3578 with MREMAP_MAYMOVE.
3579 * output.h (class Output_file): Add map_is_allocated_ field.
3580 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3581 not available, provide stubs. If mremap is not available, #define
3582 it to gold_mremap.
3583 (MREMAP_MAYMOVE): Define if not defined.
3584 (Output_file::Output_file): Initialize map_is_allocated_.
3585 (Output_file::resize): Check map_is_allocated_.
3586 (Output_file::map_anonymous): If mmap fails, use malloc.
3587 (Output_file::unmap): Don't do anything for an anonymous map.
3588 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3589 is not available, provide stubs.
3590 (File_read::View::~View): Use free rather than delete[].
3591 (File_read::make_view): Use malloc rather than new[]. If mmap
3592 fails, use malloc.
3593 (File_read::find_or_make_view): Use malloc rather than new[].
3594 * gold.h: Remove HAVE_REMAP code.
3595 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3596 exists. Rename mremap to gold_mremap. If mmap is not available
3597 don't do anything.
3598 * configure, config.in: Rebuild.
3599
3600 2011-04-11 Ian Lance Taylor <iant@google.com>
3601
3602 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3603 initialize local variable v.
3604
3605 2011-04-11 Cary Coutant <ccoutant@google.com>
3606
3607 * archive.cc (Archive::include_member): Adjust call to
3608 report_object.
3609 (Add_archive_symbols::run): Track argument serial numbers.
3610 (Lib_group::include_member): Likewise.
3611 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3612 * archive.h (Incremental_archive_entry::Archive_member):
3613 Initialize arg_serial_.
3614 (Archive_member::arg_serial_): New data member.
3615 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3616 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3617 incremental link.
3618 (Sized_dynobj::do_for_all_local_got_entries): New function.
3619 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3620 function.
3621 * fileread.cc (get_mtime): New function.
3622 * fileread.h (get_mtime): New function.
3623 * gold.cc (queue_initial_tasks): Check for incremental update.
3624 (process_incremental_input): New function.
3625 (queue_middle_tasks): Don't force valid target for incremental
3626 update.
3627 * incremental-dump.cc (find_input_containing_global): Adjust
3628 size of symbol info entry.
3629 (dump_incremental_inputs): Dump argument serial number and
3630 in_system_directory flag; bias shndx by 1; print symbol names
3631 when dumping per-file symbol lists; use new symbol info readers.
3632 * incremental.cc
3633 (Output_section_incremental_inputs:update_data_size): New function.
3634 (Sized_incremental_binary::setup_readers): Setup input readers
3635 for each input file; build maps for files added from libraries
3636 and scripts.
3637 (Sized_incremental_binary::check_input_args): New function.
3638 (Sized_incremental_binary::do_check_inputs): Build map of argument
3639 serial numbers to input arguments.
3640 (Sized_incremental_binary::do_file_has_changed): Rename
3641 do_file_is_unchanged to this; compare file modification times.
3642 (Sized_incremental_binary::do_init_layout): New function.
3643 (Sized_incremental_binary::do_reserve_layout): New function.
3644 (Sized_incremental_binary::do_get_input_reader): Remove.
3645 (Sized_incremental_binary::get_symtab_view): New function.
3646 (Incremental_checker::can_incrementally_link_output_file): Remove.
3647 (Incremental_inputs::report_command_line): Exclude --debug options.
3648 (Incremental_inputs::report_archive_begin): Add parameter; track
3649 argument serial numbers; don't put input file entry for archive
3650 before archive members.
3651 (Incremental_inputs::report_archive_end): Put input file entry
3652 for archive after archive members.
3653 (Incremental_inputs::report_object): Add parameter; track argument
3654 serial numbers and in_system_directory flag.
3655 (Incremental_inputs::report_script): Add parameter; track argument
3656 serial numbers.
3657 (Output_section_incremental_inputs::set_final_data_size): Adjust
3658 size of symbol info entry; check for forwarding symbols.
3659 (Output_section_incremental_inputs::write_input_files): Write
3660 in_system_directory flag and argument serial number.
3661 (Output_section_incremental_inputs::write_info_blocks): Map section
3662 indices between incremental info and original input file; store
3663 input section index for each symbol.
3664 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3665 change operator() to visit().
3666 (class Global_got_offset_visitor): Likewise.
3667 (class Global_symbol_visitor_got_plt):
3668 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3669 classes.
3670 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3671 (Sized_incr_relobj::do_read_symbols): New function.
3672 (Sized_incr_relobj::do_layout): New function.
3673 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3674 (Sized_incr_relobj::do_add_symbols): New function.
3675 (Sized_incr_relobj::do_should_include_member): New function.
3676 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3677 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3678 (Sized_incr_relobj::do_section_size): New function.
3679 (Sized_incr_relobj::do_section_name): New function.
3680 (Sized_incr_relobj::do_section_contents): New function.
3681 (Sized_incr_relobj::do_section_flags): New function.
3682 (Sized_incr_relobj::do_section_entsize): New function.
3683 (Sized_incr_relobj::do_section_address): New function.
3684 (Sized_incr_relobj::do_section_type): New function.
3685 (Sized_incr_relobj::do_section_link): New function.
3686 (Sized_incr_relobj::do_section_info): New function.
3687 (Sized_incr_relobj::do_section_addralign): New function.
3688 (Sized_incr_relobj::do_initialize_xindex): New function.
3689 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3690 (Sized_incr_relobj::do_read_relocs): New function.
3691 (Sized_incr_relobj::do_gc_process_relocs): New function.
3692 (Sized_incr_relobj::do_scan_relocs): New function.
3693 (Sized_incr_relobj::do_count_local_symbols): New function.
3694 (Sized_incr_relobj::do_finalize_local_symbols): New function.
3695 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3696 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3697 (Sized_incr_relobj::do_relocate): New function.
3698 (Sized_incr_relobj::do_set_section_offset): New function.
3699 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3700 (Sized_incr_dynobj::do_read_symbols): New function.
3701 (Sized_incr_dynobj::do_layout): New function.
3702 (Sized_incr_dynobj::do_add_symbols): New function.
3703 (Sized_incr_dynobj::do_should_include_member): New function.
3704 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3705 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3706 (Sized_incr_dynobj::do_section_size): New function.
3707 (Sized_incr_dynobj::do_section_name): New function.
3708 (Sized_incr_dynobj::do_section_contents): New function.
3709 (Sized_incr_dynobj::do_section_flags): New function.
3710 (Sized_incr_dynobj::do_section_entsize): New function.
3711 (Sized_incr_dynobj::do_section_address): New function.
3712 (Sized_incr_dynobj::do_section_type): New function.
3713 (Sized_incr_dynobj::do_section_link): New function.
3714 (Sized_incr_dynobj::do_section_info): New function.
3715 (Sized_incr_dynobj::do_section_addralign): New function.
3716 (Sized_incr_dynobj::do_initialize_xindex): New function.
3717 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3718 (make_sized_incremental_object): New function.
3719 (Incremental_library::copy_unused_symbols): New function.
3720 (Incremental_library::do_for_all_unused_symbols): New function.
3721 * incremental.h (enum Incremental_input_flags): New type.
3722 (class Incremental_checker): Remove.
3723 (Incremental_input_entry::Incremental_input_entry): Add argument
3724 serial number.
3725 (Incremental_input_entry::arg_serial): New function.
3726 (Incremental_input_entry::set_is_in_system_directory): New function.
3727 (Incremental_input_entry::is_in_system_directory): New function.
3728 (Incremental_input_entry::arg_serial_): New data member.
3729 (Incremental_input_entry::is_in_system_directory_): New data member.
3730 (class Script_info): Move here from script.h.
3731 (Script_info::Script_info): Add filename parameter.
3732 (Script_info::filename): New function.
3733 (Script_info::filename_): New data member.
3734 (Incremental_script_entry::Incremental_script_entry): Add argument
3735 serial number.
3736 (Incremental_object_entry::Incremental_object_entry): Likewise.
3737 (Incremental_object_entry::add_input_section): Build list of input
3738 sections with map to original shndx.
3739 (Incremental_object_entry::get_input_section_index): New function.
3740 (Incremental_object_entry::shndx_): New data member.
3741 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3742 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3743 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3744 serial number.
3745 (Incremental_inputs::report_archive_begin): Likewise.
3746 (Incremental_inputs::report_object): Likewise.
3747 (Incremental_inputs::report_script): Likewise.
3748 (class Incremental_global_symbol_reader): New class.
3749 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3750 and store flags and input file type.
3751 (Incremental_input_entry_reader::arg_serial): New function.
3752 (Incremental_input_entry_reader::type): Extract type from flags.
3753 (Incremental_input_entry_reader::is_in_system_directory): New function.
3754 (Incremental_input_entry_reader::get_input_section_count): Call
3755 accessor function for type.
3756 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3757 function for type; adjust size of global symbol entry.
3758 (Incremental_input_entry_reader::get_global_symbol_count): Call
3759 accessor function for type.
3760 (Incremental_input_entry_reader::get_object_count): Likewise.
3761 (Incremental_input_entry_reader::get_object_offset): Likewise.
3762 (Incremental_input_entry_reader::get_member_count): Likewise.
3763 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3764 (Incremental_input_entry_reader::get_member_offset): Likewise.
3765 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3766 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3767 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3768 (Incremental_input_entry_reader::get_global_symbol_reader): New
3769 function.
3770 (Incremental_input_entry_reader::get_output_symbol_index): New
3771 function.
3772 (Incremental_input_entry_reader::type_): Remove.
3773 (Incremental_input_entry_reader::flags_): New data member.
3774 (Incremental_inputs_reader::input_file_offset): New function.
3775 (Incremental_inputs_reader::input_file_index): New function.
3776 (Incremental_inputs_reader::input_file): Call input_file_offset.
3777 (Incremental_inputs_reader::input_file_at_offset): New function.
3778 (Incremental_relocs_reader::get_r_type): Reformat.
3779 (Incremental_relocs_reader::get_r_shndx): Reformat.
3780 (Incremental_relocs_reader::get_r_offset): Reformat.
3781 (Incremental_relocs_reader::data): New function.
3782 (Incremental_binary::Incremental_binary): Initialize new data members.
3783 (Incremental_binary::check_inputs): Add cmdline parameter.
3784 (Incremental_binary::file_is_unchanged): Remove.
3785 (Input_reader::arg_serial): New function.
3786 (Input_reader::get_unused_symbol_count): New function.
3787 (Input_reader::get_unused_symbol): New function.
3788 (Input_reader::do_arg_serial): New function.
3789 (Input_reader::do_get_unused_symbol_count): New function.
3790 (Input_reader::do_get_unused_symbol): New function.
3791 (Incremental_binary::input_file_count): New function.
3792 (Incremental_binary::get_input_reader): Change signature to use
3793 index instead of filename.
3794 (Incremental_binary::file_has_changed): New function.
3795 (Incremental_binary::get_input_argument): New function.
3796 (Incremental_binary::get_library): New function.
3797 (Incremental_binary::get_script_info): New function.
3798 (Incremental_binary::init_layout): New function.
3799 (Incremental_binary::reserve_layout): New function.
3800 (Incremental_binary::output_file): New function.
3801 (Incremental_binary::do_check_inputs): New function.
3802 (Incremental_binary::do_file_is_unchanged): Remove.
3803 (Incremental_binary::do_file_has_changed): New function.
3804 (Incremental_binary::do_init_layout): New function.
3805 (Incremental_binary::do_reserve_layout): New function.
3806 (Incremental_binary::do_input_file_count): New function.
3807 (Incremental_binary::do_get_input_reader): Change signature.
3808 (Incremental_binary::input_args_map_): New data member.
3809 (Incremental_binary::library_map_): New data member.
3810 (Incremental_binary::script_map_): New data member.
3811 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3812 new data members.
3813 (Sized_incremental_binary::output_section): New function.
3814 (Sized_incremental_binary::inputs_reader): Add const.
3815 (Sized_incremental_binary::symtab_reader): Add const.
3816 (Sized_incremental_binary::relocs_reader): Add const.
3817 (Sized_incremental_binary::got_plt_reader): Add const.
3818 (Sized_incremental_binary::get_symtab_view): New function.
3819 (Sized_incremental_binary::Inputs_reader): New typedef.
3820 (Sized_incremental_binary::Input_entry_reader): New typedef.
3821 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3822 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3823 (Sized_incremental_binary::do_file_has_changed): New function.
3824 (Sized_incremental_binary::do_init_layout): New function.
3825 (Sized_incremental_binary::do_reserve_layout): New function.
3826 (Sized_input_reader::Inputs_reader): Remove.
3827 (Sized_input_reader::Input_entry_reader): Remove.
3828 (Sized_input_reader::do_arg_serial): New function.
3829 (Sized_input_reader::do_get_unused_symbol_count): New function.
3830 (Sized_input_reader::do_get_unused_symbol): New function.
3831 (Sized_incremental_binary::do_input_file_count): New function.
3832 (Sized_incremental_binary::do_get_input_reader): Change signature;
3833 use index instead of filename.
3834 (Sized_incremental_binary::section_map_): New data member.
3835 (Sized_incremental_binary::input_entry_readers_): New data member.
3836 (class Sized_incr_relobj): New class.
3837 (class Sized_incr_dynobj): New class.
3838 (make_sized_incremental_object): New function.
3839 (class Incremental_library): New class.
3840 * layout.cc (Free_list::num_lists): New static data member.
3841 (Free_list::num_nodes): New static data member.
3842 (Free_list::num_removes): New static data member.
3843 (Free_list::num_remove_visits): New static data member.
3844 (Free_list::num_allocates): New static data member.
3845 (Free_list::num_allocate_visits): New static data member.
3846 (Free_list::init): New function.
3847 (Free_list::remove): New function.
3848 (Free_list::allocate): New function.
3849 (Free_list::dump): New function.
3850 (Free_list::print_stats): New function.
3851 (Layout_task_runner::run): Resize output file for incremental updates.
3852 (Layout::Layout): Initialize new data members.
3853 (Layout::set_incremental_base): New function.
3854 (Layout::init_fixed_output_section): New function.
3855 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3856 incremental updates.
3857 (Layout::create_gold_note): Do not create gold note section for
3858 incremental updates.
3859 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3860 for incremental updates.
3861 (Layout::set_section_offsets): For incremental updates, allocate space
3862 from free list.
3863 (Layout::create_symtab_sections): Layout with offsets relative to
3864 start of section; for incremental updates, allocate space from free
3865 list.
3866 (Layout::create_shdrs): For incremental updates, allocate space from
3867 free list.
3868 (Layout::finish_dynamic_section): For incremental updates, do not
3869 check --as-needed (fixed in subsequent patch).
3870 * layout.h (class Free_list): New class.
3871 (Layout::set_incremental_base): New function.
3872 (Layout::incremental_base): New function.
3873 (Layout::init_fixed_output_section): New function.
3874 (Layout::allocate): New function.
3875 (Layout::incremental_base_): New data member.
3876 (Layout::free_list_): New data member.
3877 * main.cc (main): Print Free_list statistics.
3878 * object.cc (Relobj::finalize_incremental_relocs): Add
3879 clear_counts parameter; clear counts only when clear_counts is set.
3880 (Sized_relobj::Sized_relobj): Initialize new base class.
3881 (Sized_relobj::do_layout): Don't report special sections.
3882 (Sized_relobj::do_for_all_local_got_entries): New function.
3883 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3884 symtab_off to all symbol table offsets.
3885 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3886 * object.h (class Got_offset_list): Move to top of file.
3887 (Object::Object): Allow case where input_file == NULL.
3888 (Object::~Object): Likewise.
3889 (Object::input_file): Assert that input_file != NULL.
3890 (Object::lock): Allow case where input_file == NULL.
3891 (Object::unlock): Likewise.
3892 (Object::is_locked): Likewise.
3893 (Object::token): Likewise.
3894 (Object::release): Likewise.
3895 (Object::is_incremental): New function.
3896 (Object::get_mtime): New function.
3897 (Object::for_all_local_got_entries): New function.
3898 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3899 (Object::set_is_in_system_directory): New function.
3900 (Object::is_in_system_directory): New function.
3901 (Object::do_is_incremental): New function.
3902 (Object::do_get_mtime): New function.
3903 (Object::do_for_all_local_got_entries): New function.
3904 (Object::is_in_system_directory_): New data member.
3905 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3906 (class Sized_relobj_base): New class.
3907 (class Sized_relobj): Derive from Sized_relobj_base.
3908 (class Sized_relobj::Symbols): Redeclare from base class.
3909 (class Sized_relobj::local_got_offset_list): Remove.
3910 (class Sized_relobj::Output_sections): Redeclare from base class.
3911 (class Sized_relobj::do_for_all_local_got_entries): New function.
3912 (class Sized_relobj::write_local_symbols): Add offset parameter.
3913 (class Sized_relobj::local_symbol_offset_): Update comment.
3914 (class Sized_relobj::local_dynsym_offset_): Update comment.
3915 * options.cc (Input_arguments::add_file): Remove const.
3916 * options.h (Input_file_argument::Input_file_argument):
3917 Initialize arg_serial_ (all constructors).
3918 (Input_file_argument::set_arg_serial): New function.
3919 (Input_file_argument::arg_serial): New function.
3920 (Input_file_argument::arg_serial_): New data member.
3921 (Input_arguments::Input_arguments): Initialize file_count_.
3922 (Input_arguments::add_file): Remove const.
3923 (Input_arguments::number_of_input_files): New function.
3924 (Input_arguments::file_count_): New data member.
3925 (Command_line::number_of_input_files): Call
3926 Input_arguments::number_of_input_files.
3927 * output.cc (Output_segment_headers::Output_segment_headers):
3928 Set current size.
3929 (Output_section::Input_section::current_data_size): New function.
3930 (Output_section::Output_section): Initialize new data members.
3931 (Output_section::add_input_section): Don't do merge sections for
3932 an incremental link; allocate space from free list for an
3933 incremental update.
3934 (Output_section::add_output_section_data): Allocate space from
3935 free list for an incremental update.
3936 (Output_section::update_data_size): New function.
3937 (Output_section::set_fixed_layout): New function.
3938 (Output_section::reserve): New function.
3939 (Output_segment::set_section_addresses): Remove const.
3940 (Output_segment::set_section_list_addresses): Remove const; allocate
3941 space from free list for an incremental update.
3942 (Output_segment::set_offset): Adjust size of RELRO segment for an
3943 incremental update.
3944 * output.h (Output_data::current_data_size): Move here from
3945 child classes.
3946 (Output_data::pre_finalize_data_size): New function.
3947 (Output_data::update_data_size): New function.
3948 (Output_section_headers::update_data_size): new function.
3949 (Output_section_data_build::current_data_size): Move to Output_data.
3950 (Output_data_strtab::update_data_size): New function.
3951 (Output_section::current_data_size): Move to Output_data.
3952 (Output_section::set_fixed_layout): New function.
3953 (Output_section::has_fixed_layout): New function.
3954 (Output_section::reserve): New function.
3955 (Output_section::update_data_size): New function.
3956 (Output_section::has_fixed_layout_): New data member.
3957 (Output_section::free_list_): New data member.
3958 (Output_segment::set_section_addresses): Remove const.
3959 (Output_segment::set_section_list_addresses): Remove const.
3960 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3961 New function.
3962 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3963 New function.
3964 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3965 parameter when calling Add_symbols constructor; store argument
3966 serial number for members of a lib group.
3967 (Add_symbols::locks): Allow case where token == NULL.
3968 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3969 (Read_member::~Read_member): New function.
3970 (Read_member::is_runnable): New function.
3971 (Read_member::locks): New function.
3972 (Read_member::run): New function.
3973 (Check_script::~Check_script): New function.
3974 (Check_script::is_runnable): New function.
3975 (Check_script::locks): New function.
3976 (Check_script::run): New function.
3977 (Check_library::~Check_library): New function.
3978 (Check_library::is_runnable): New function.
3979 (Check_library::locks): New function.
3980 (Check_library::run): New function.
3981 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3982 (Add_symbols::library_): New data member.
3983 (class Read_member): New class.
3984 (class Check_script): New class.
3985 (class Check_library): New class.
3986 * reloc.cc (Read_relocs::is_runnable): Allow case where
3987 token == NULL.
3988 (Read_relocs::locks): Likewise.
3989 (Scan_relocs::locks): Likewise.
3990 (Relocate_task::locks): Likewise.
3991 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3992 to clear counters.
3993 (Sized_relobj::incremental_relocs_scan): Fix comment.
3994 (Sized_relobj::do_relocate): Pass output file offset to
3995 write_local_symbols.
3996 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3997 from class declaration.
3998 * script.cc (read_input_script): Allocate Script_info; pass
3999 argument serial number to report_script.
4000 * script.h (class Script_info): Move to incremental.h.
4001 * symtab.cc (Symbol_table::add_from_incrobj): New function.
4002 * symtab.h (Symbol_table::add_from_incrobj): New function.
4003 (Symbol_table::set_file_offset): New function.
4004
4005 2011-04-05 Cary Coutant <ccoutant@google.com>
4006
4007 * incremental-dump.cc (dump_incremental_inputs): Change signature
4008 to take a Sized_incremental_binary; change caller. Use readers
4009 in Sized_incremental_binary.
4010 * incremental.cc
4011 (Sized_incremental_binary::find_incremental_inputs_sections):
4012 Rename do_find_incremental_inputs_sections to this.
4013 (Sized_incremental_binary::setup_readers): New function.
4014 (Sized_incremental_binary::do_check_inputs): Check
4015 has_incremental_info_ flag; move setup code to setup_readers;
4016 use input readers.
4017 (Sized_incremental_binary::do_file_is_unchanged): New function.
4018 (Sized_incremental_binary::do_get_input_reader): New function.
4019 * incremental.h (class Incremental_binary): Move to end of file.
4020 (Incremental_binary::file_is_unchanged): New function.
4021 (Incremental_binary::do_file_is_unchanged): New function.
4022 (Incremental_binary::Input_reader): New class.
4023 (Incremental_binary::get_input_reader): New function.
4024 (class Sized_incremental_binary): Move to end of file.
4025 (Sized_incremental_binary::Sized_incremental_binary): Setup the
4026 input section reader classes.
4027 (Sized_incremental_binary::has_incremental_info): New function.
4028 (Sized_incremental_binary::inputs_reader): New function.
4029 (Sized_incremental_binary::symtab_reader): New function.
4030 (Sized_incremental_binary::relocs_reader): New function.
4031 (Sized_incremental_binary::got_plt_reader): New function.
4032 (Sized_incremental_binary::do_file_is_unchanged): New function.
4033 (Sized_incremental_binary::Sized_input_reader): New class.
4034 (Sized_incremental_binary::get_input_reader): New function.
4035 (Sized_incremental_binary::find_incremental_inputs_sections):
4036 Rename do_find_incremental_inputs_sections to this.
4037 (Sized_incremental_binary::setup_readers): New function.
4038 (Sized_incremental_binary::has_incremental_info_): New data member.
4039 (Sized_incremental_binary::inputs_reader_): New data member.
4040 (Sized_incremental_binary::symtab_reader_): New data member.
4041 (Sized_incremental_binary::relocs_reader_): New data member.
4042 (Sized_incremental_binary::got_plt_reader_): New data member.
4043 (Sized_incremental_binary::current_input_file_): New data member.
4044
4045 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
4046
4047 PR gold/12640
4048 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4049 violation.
4050
4051 2011-03-30 Cary Coutant <ccoutant@google.com>
4052
4053 * archive.cc (Archive::include_member): Adjust call to report_object.
4054 (Add_archive_symbols::run): Add script_info to call to
4055 report_archive_begin.
4056 (Lib_group::include_member): Adjust call to report_object.
4057 (Add_lib_group_symbols::run): Adjust call to report_object.
4058 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4059 blocks. Add object count for script input files.
4060 * incremental.cc (Incremental_inputs::report_archive_begin): Add
4061 script_info parameter; change all callers.
4062 (Incremental_inputs::report_object): Add script_info parameter;
4063 change all callers.
4064 (Incremental_inputs::report_script): Store backpointer to
4065 incremental info entry.
4066 (Output_section_incremental_inputs::set_final_data_size): Record
4067 additional information for scripts.
4068 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4069 * incremental.h (Incremental_script_entry::add_object): New function.
4070 (Incremental_script_entry::get_object_count): New function.
4071 (Incremental_script_entry::get_object): New function.
4072 (Incremental_script_entry::objects_): New data member; adjust
4073 constructor.
4074 (Incremental_inputs::report_archive_begin): Add script_info parameter.
4075 (Incremental_inputs::report_object): Add script_info parameter.
4076 (Incremental_inputs_reader::get_object_count): New function.
4077 (Incremental_inputs_reader::get_object_offset): New function.
4078 * options.cc (Input_arguments::add_file): Return reference to
4079 new input argument.
4080 * options.h (Input_argument::set_script_info): New function.
4081 (Input_argument::script_info): New function.
4082 (Input_argument::script_info_): New data member; adjust all
4083 constructors.
4084 (Input_file_group::add_file): Return reference to new input argument.
4085 (Input_file_lib::add_file): Likewise.
4086 (Input_arguments::add_file): Likewise.
4087 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4088 * script.cc (Parser_closure::Parser_closure): Add script_info
4089 parameter; adjust all callers.
4090 (Parser_closure::script_info): New function.
4091 (Parser_closure::script_info_): New data member.
4092 (read_input_script): Report scripts earlier to incremental info.
4093 (script_add_file): Set script_info in Input_argument.
4094 (script_add_library): Likewise.
4095 * script.h (Script_options::Script_info): Rewrite class.
4096
4097 2011-03-29 Cary Coutant <ccoutant@google.com>
4098
4099 * archive.cc (Library_base::should_include_member): Move
4100 method here from class Archive.
4101 (Archive::Archive): Initialize base class.
4102 (Archive::should_include_member): Move to base class.
4103 (Archive::do_for_all_unused_symbols): New function.
4104 (Add_archive_symbols::run): Remove redundant access to
4105 incremental_inputs.
4106 (Lib_group::Lib_group): Initialize base class.
4107 (Lib_group::do_filename): New function.
4108 (Lib_group::include_member): Pass pointer to Lib_group to
4109 report_object.
4110 (Lib_group::do_for_all_unused_symbols): New function.
4111 (Add_lib_group_symbols::run): Report archive information for
4112 incremental links.
4113 * archive.h (class Library_base): New base class.
4114 (class Archive): Derive from Library_base.
4115 (Archive::filename): Move to base class.
4116 (Archive::set_incremental_info): Likewise.
4117 (Archive::incremental_info): Likewise.
4118 (Archive::Should_include): Likewise.
4119 (Archive::should_include_member): Likewise.
4120 (Archive::Armap_entry): Remove.
4121 (Archive::Unused_symbol_iterator): Remove.
4122 (Archive::unused_symbols_begin): Remove.
4123 (Archive::unused_symbols_end): Remove.
4124 (Archive::do_filename): New function.
4125 (Archive::do_get_mtime): New function.
4126 (Archive::do_for_all_unused_symbols): New function.
4127 (Archive::task_): Move to base class.
4128 (Archive::incremental_info_): Likewise.
4129 (class Lib_group): Derive from Library_base.
4130 (Lib_group::do_filename): New function.
4131 (Lib_group::do_get_mtime): New function.
4132 (Lib_group::do_for_all_unused_symbols): New function.
4133 (Lib_group::task_): Move to base class.
4134 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4135 function.
4136 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4137 function.
4138 * incremental.cc (Incremental_inputs::report_archive_begin):
4139 Use Library_base; call library's get_mtime; add incremental inputs
4140 entry before members.
4141 (class Unused_symbol_visitor): New class.
4142 (Incremental_inputs::report_archive_end): Use Library_base; use
4143 visitor class to record unused symbols; don't add incremental inputs
4144 entry after members.
4145 (Incremental_inputs::report_object): Use Library_base.
4146 * incremental.h
4147 (Incremental_archive_entry::Incremental_archive_entry): Remove
4148 unused Archive parameter.
4149 (Incremental_inputs::report_archive_begin): Use Library_base.
4150 (Incremental_inputs::report_archive_end): Likewise.
4151 (Incremental_inputs::report_object): Likewise.
4152 * object.cc (Sized_relobj::do_for_all_global_symbols): New
4153 function.
4154 * object.h (Object::for_all_global_symbols): New function.
4155 (Object::do_for_all_global_symbols): New function.
4156 (Sized_relobj::do_for_all_global_symbols): New function.
4157 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
4158 function.
4159 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
4160 function.
4161
4162 2011-03-27 Ian Lance Taylor <iant@google.com>
4163
4164 * archive.cc (Archive::interpret_header): Return -1 if something
4165 goes wrong. Change callers accordingly.
4166
4167 2011-03-25 Cary Coutant <ccoutant@google.com>
4168
4169 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4170 * testsuite/Makefile.in: Regenerate.
4171
4172 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
4173
4174 * plugin.cc (get_view): New.
4175 (Plugin::load): Pass get_view to the plugin.
4176 (Plugin_manager::get_view): New.
4177
4178 2011-03-21 Ian Lance Taylor <iant@google.com>
4179
4180 * testsuite/final_layout.sh: Rewrite to not use dc.
4181 * testsuite/relro_test.sh: Fail if dc is not present.
4182
4183 2011-03-21 Sriraman Tallam <tmsriram@google.com>
4184
4185 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4186 Change == to -eq.
4187 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4188 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4189 Change == to -eq.
4190 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4191 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4192
4193 2011-03-14 Ian Lance Taylor <iant@google.com>
4194
4195 * script-sections.cc (Sort_output_sections::script_compare):
4196 Rename from is_before, change return type.
4197 (Sort_output_sections::operator()): Adjust accordingly.
4198
4199 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
4200
4201 PR gold/12572
4202 * testsuite/odr_violation2.cc: Add comment to make all error line
4203 numbers double digits.
4204 * testsuite/debug_msg.sh: Adjust expected errors.
4205
4206 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
4207
4208 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4209 but mark earlier ones as non-canonical
4210 (offset_to_iterator): Update search target and example
4211 (do_addr2line): Return extra lines in a vector*
4212 (format_file_lineno): Extract from do_addr2line
4213 (one_addr2line): Add vector* out-param
4214 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4215 when a lineno entry appeared last for its instruction
4216 (Dwarf_line_info): Add vector* out-param
4217 * object.cc (Relocate_info): Pass NULL for the vector* out-param
4218 * symtab.cc (Odr_violation_compare): Include the lineno in the
4219 comparison again.
4220 (linenos_from_loc): New. Combine the canonical line for an
4221 address with its other lines.
4222 (True_if_intersect): New. Helper functor to make
4223 std::set_intersection a query.
4224 (detect_odr_violations): Compare sets of lines instead of just
4225 one line for each function. This became less deterministic, but
4226 has fewer false positives.
4227 * symtab.h: Declarations.
4228 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4229 mix an optimized and non-optimized object in the same binary
4230 (odr_violation2.so): Same.
4231 * testsuite/Makefile.in: Regenerate from Makefile.am.
4232 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4233 * testsuite/debug_msg.sh: Update line numbers and add
4234 assertions.
4235 * testsuite/odr_violation1.cc: Use OdrDerived, in a
4236 non-optimized context.
4237 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4238 isn't inlined, and use OdrDerived in an optimized context.
4239 * testsuite/odr_header1.h: Defines OdrDerived, where
4240 optimization will change the
4241 first-instruction-in-the-destructor's file and line number.
4242 * testsuite/odr_header2.h: Defines OdrBase.
4243
4244 2011-03-09 Ian Lance Taylor <iant@google.com>
4245
4246 * fileread.cc (File_read::clear_views): Don't delete the whole
4247 file view.
4248
4249 2011-03-08 Ian Lance Taylor <iant@google.com>
4250
4251 PR gold/12525
4252 * fileread.cc: #include <climits>.
4253 (GOLD_IOV_MAX): Define.
4254 (File_read::read_multiple): Limit number of entries by iov_max.
4255 * fileread.h (class File_read): Always set max_readv_entries to
4256 128.
4257
4258 2011-03-07 Ian Lance Taylor <iant@google.com>
4259
4260 PR gold/12525
4261 * options.h (class General_options): Add -dy and -dn.
4262
4263 2011-03-02 Cary Coutant <ccoutant@google.com>
4264
4265 * testsuite/script_test_9.t: Add TLS segment.
4266
4267 2011-03-02 Simon Baldwin <simonb@google.com>
4268
4269 * configure.ac: Add check for gnu_indirect_function support in
4270 the toolchain building binutils.
4271 * configure: Rebuild.
4272
4273 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
4274
4275 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4276 plugin only symbols.
4277 (Symbol_table::sized_finalize_symbol) Mark symbol only present
4278 in plugin files as not needed in the symbol table.
4279
4280 2011-02-11 Sriraman Tallam <tmsriram@google.com>
4281
4282 * output.cc (Output_section::add_input_section): Delay fill
4283 generation for section ordering.
4284
4285 2011-02-09 Ian Lance Taylor <iant@google.com>
4286
4287 PR gold/12316
4288 * object.h (class Sized_relobj): Remove clear_local_symbols.
4289 * reloc.cc (Sized_relobj::do_relocate): Don't call
4290 clear_local_symbols.
4291
4292 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
4293
4294 * plugin.cc (is_visible_from_outside): Return true for symbols
4295 in the -u option.
4296
4297 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
4298
4299 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4300 filename.
4301
4302 2011-02-02 Sriraman Tallam <tmsriram@google.com>
4303
4304 * icf.h (is_section_foldable_candidate): Change type of parameter
4305 to std::string.
4306 * icf.cc (Icf::find_identical_sections): Change type of local variable
4307 section_name to be std::string.
4308 (is_function_ctor_or_dtor): Change type of parameter to std::string.
4309
4310 2011-01-25 Ian Lance Taylor <iant@google.com>
4311
4312 * script.cc (script_add_extern): Rewrite to use
4313 add_symbol_reference.
4314
4315 2011-01-25 Doug Kwan <dougkwan@google.com>
4316
4317 * icf.cc (get_section_contents): Always lock section's object.
4318
4319 2011-01-24 Ian Lance Taylor <iant@google.com>
4320
4321 * options.h (class General_options): Accept
4322 --no-detect-odr-violations.
4323
4324 2011-01-24 Ian Lance Taylor <iant@google.com>
4325
4326 * version.cc (version_string): Bump to 1.11.
4327
4328 2011-01-24 Ian Lance Taylor <iant@google.com>
4329
4330 * plugin.cc (class Plugin_rescan): Define new class.
4331 (Plugin_manager::claim_file): Set any_claimed_.
4332 (Plugin_manager::save_archive): New function.
4333 (Plugin_manager::save_input_group): New function.
4334 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4335 necessary.
4336 (Plugin_manager::new_undefined_symbol): New function.
4337 (Plugin_manager::rescan): New function.
4338 (Plugin_manager::rescannable_defines): New function.
4339 (Plugin_manager::add_input_file): Set any_added_.
4340 * plugin.h (class Plugin_manager): define new fields rescannable_,
4341 undefined_symbols_, any_claimed_, and any_added_. Declare
4342 Plugin_rescan as friend. Declare new functions.
4343 (Plugin_manager::Rescannable): Define type.
4344 (Plugin_manager::Rescannable_list): Define type.
4345 (Plugin_manager::Undefined_symbol_list): Define type.
4346 (Plugin_manager::Plugin_manager): Initialize new fields.
4347 * archive.cc (Archive::defines_symbol): New function.
4348 (Add_archive_symbols::run): Pass archive to plugins if any.
4349 * archive.h (class Archive): Declare defines_symbol.
4350 * readsyms.cc (Input_group::~Input_group): New function.
4351 (Finish_group::run): Pass input_group to plugins if any.
4352 * readsyms.h (class Input_group): Declare destructor.
4353 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4354 any.
4355
4356 2011-01-10 Ian Lance Taylor <iant@google.com>
4357
4358 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4359 section as relro.
4360 (Layout::set_segment_offsets): Reset increase_relro before calling
4361 set_section_addresses a second time.
4362
4363 2011-01-04 Cary Coutant <ccoutant@google.com>
4364
4365 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4366 sections before NOBITS sections.
4367
4368 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
4369
4370 * version.cc (print_version): Update copyright to 2011.
4371
4372 2010-12-23 Cary Coutant <ccoutant@google.com>
4373
4374 * output.h (Output_data_reloc::add_output_section): Pass OD instead
4375 of OS to this->add. Add OD parameter to second form of the function.
4376
4377 2010-12-20 Ian Lance Taylor <iant@google.com>
4378
4379 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4380 second of two consecutive entries with same offset.
4381
4382 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4383
4384 * testsuite/Makefile.am (ifuncmain2static_LDADD)
4385 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4386 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4387 to avoid unneeded links against $(LDADD).
4388 * testsuite/Makefile.in: Regenerate.
4389
4390 2010-12-15 Ian Lance Taylor <iant@google.com>
4391
4392 PR gold/12324
4393 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4394 for R_X86_64_32 and R_X86_64_PC32.
4395 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4396 ver_matching_def_pic.o.
4397 (ver_matching_def_pic.o): New target.
4398
4399 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4400
4401 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4402 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4403 Move definition before File_read::View member definitions.
4404 (File_read::View::~View): Initialize and hold lock before
4405 updating current_mapped_bytes.
4406
4407 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4408
4409 * dwarf_reader.cc: Remove outdated comment.
4410 * gold-threads.cc: Fix typo in error message.
4411 * archive.cc: Fix typos in comments.
4412 * archive.h: Likewise.
4413 * arm-reloc-property.cc: Likewise.
4414 * arm-reloc-property.h: Likewise.
4415 * arm-reloc.def: Likewise.
4416 * arm.cc: Likewise.
4417 * attributes.h: Likewise.
4418 * cref.cc: Likewise.
4419 * ehframe.cc: Likewise.
4420 * fileread.h: Likewise.
4421 * gold.h: Likewise.
4422 * i386.cc: Likewise.
4423 * icf.cc: Likewise.
4424 * incremental.h: Likewise.
4425 * int_encoding.cc: Likewise.
4426 * layout.h: Likewise.
4427 * main.cc: Likewise.
4428 * merge.h: Likewise.
4429 * object.cc: Likewise.
4430 * object.h: Likewise.
4431 * options.cc: Likewise.
4432 * readsyms.cc: Likewise.
4433 * reduced_debug_output.cc: Likewise.
4434 * reloc.cc: Likewise.
4435 * script-sections.cc: Likewise.
4436 * sparc.cc: Likewise.
4437 * symtab.h: Likewise.
4438 * target-reloc.h: Likewise.
4439 * target.cc: Likewise.
4440 * target.h: Likewise.
4441 * timer.cc: Likewise.
4442 * timer.h: Likewise.
4443 * x86_64.cc: Likewise.
4444
4445 2010-12-09 Cary Coutant <ccoutant@google.com>
4446
4447 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4448 stack.
4449 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4450 parameter; change all callers.
4451 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4452 * options.h (warn_execstack): New option.
4453
4454 2010-12-07 Doug Kwan <dougkwan@google.com>
4455
4456 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4457 like function call relocations.
4458
4459 2010-12-07 Ian Lance Taylor <iant@google.com>
4460
4461 * archive.cc (Archive::get_elf_object_for_member): Permit
4462 punconfigured to be NULL.
4463 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4464 (Archive::include_member): Pass NULL to get_elf_object_for_member
4465 if we searched for the archive and this is the first included
4466 object.
4467
4468 2010-12-01 Ian Lance Taylor <iant@google.com>
4469
4470 * dwarf_reader.h (class Sized_dwarf_line_info): Add
4471 track_relocs_type_ field.
4472 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4473 Set track_relocs_type_.
4474 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4475 contents when using RELA relocs.
4476 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4477 reloc_map_.
4478 * reloc.cc (Track_relocs::next_addend): New function.
4479 * reloc.h (class Track_relocs): Declare next_addend.
4480
4481 2010-12-01 Ian Lance Taylor <iant@google.com>
4482
4483 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4484 virtual destructor.
4485
4486 2010-12-01 Ian Lance Taylor <iant@google.com>
4487
4488 * README: Update compilers known to work and fail.
4489
4490 2010-11-23 Matthias Klose <doko@ubuntu.com>
4491
4492 * configure.in: For --enable-gold, handle value `default' instead of
4493 `both*'. Always install ld as ld.bfd, install as ld if gold is
4494 not the default.
4495 * configure: Regenerate.
4496
4497 2010-11-18 Doug Kwan <dougkwan@google.com>
4498
4499 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4500 and right_alignment to be zero. Store result alignment only if it is
4501 greater than existing alignment.
4502
4503 2010-11-16 Cary Coutant <ccoutant@google.com>
4504
4505 PR gold/12220
4506 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4507 Check for ".zdebug_line".
4508
4509 2010-11-16 Doug Kwan <dougkwan@google.com>
4510 Cary Coutant <ccoutant@google.com>
4511
4512 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4513 by reference; adjust all callers.
4514 * output.cc (Output_segment::set_section_addresses): Adjust references
4515 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4516 list is empty.
4517 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4518 end at page boundary.
4519
4520 2010-11-16 Cary Coutant <ccoutant@google.com>
4521
4522 PR gold/12220
4523 * layout.cc (Layout::choose_output_section): Transform names of
4524 compressed sections even when using a script with a SECTIONS clause.
4525 (Layout::output_section_name): Remove code to transform
4526 compressed debug section names.
4527 * output.cc (Output_section::add_input_section): Use uncompressed
4528 section size when tracking input sections.
4529
4530 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4531
4532 * symtab.h (Symbol::NON_PIC_REF): Remove.
4533 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4534 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4535 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4536 (Symbol::use_plt_offset): Take a flags argument and pass it
4537 directly to needs_dynamic_reloc. Restrict check for undefined
4538 weak symbols to function calls.
4539 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4540 (Target_arm::Scan::global): Use it.
4541 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4542 (Target_arm::Relocate::relocate): Likewise.
4543 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4544 parameter with an r_type parameter. Use get_reference_flags
4545 to get the flags.
4546 (Target_arm::Relocate::relocate): Update accordingly.
4547 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4548 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4549 (Target_i386::Scan::global): Likewise.
4550 (Target_i386::Relocate::relocate): Likewise.
4551 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4552 parameter with an r_type parameter. Use get_reference_flags
4553 to get the flags.
4554 (Target_i386::Relocate::relocate): Update accordingly.
4555 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4556 (Target_powerpc::Scan::global): Use it.
4557 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4558 (Target_powerpc::Relocate::relocate): Likewise.
4559 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4560 (Target_sparc::Scan::global): Use it.
4561 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4562 (Target_sparc::Relocate::relocate): Likewise.
4563 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4564 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4565 (Target_x86_64::Scan::global): Likewise.
4566 (Target_x86_64::Relocate::relocate): Likewise.
4567
4568 2010-11-08 Doug Kwan <dougkwan@google.com>
4569 Cary Coutant <ccoutant@google.com>
4570
4571 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4572 (Arm_exidx_merge_section::section_contents_): New data member.
4573 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4574 (Arm_input_section::~Arm_input_section): De-allocate memory.
4575 (Arm_input_section::original_contents_): New data member.
4576 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4577 in parameters instead of calling Object::section_contents without
4578 locking.
4579 (Arm_output_section::group_section): New parameter TASK. Pass it
4580 to callees that need locking objects.
4581 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4582 to lock EXIDX input sections. Fix a formatting issue. Call
4583 Arm_exidx_merged_section::build_contents to create merged section
4584 contents.
4585 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4586 to lock object of stub table owner.
4587 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4588 TEXT_SIZE to initialize data member TEXT_SIZE_.
4589 (Arm_exidx_input_section::addralign): Fix typo in comment.
4590 (Arm_exidx_input_section::text_size): New method.
4591 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4592 that require locking objects. Lock objects before scanning for stubs
4593 and updating local symbols.
4594 (Arm_input_section<big_endian>::init): Copy contents of original
4595 input section.
4596 (Arm_input_section<big_endian>::do_write): Use saved contents of
4597 original input section instead of calling Object::section_contents
4598 without locking.
4599 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4600 size without calling Object::section_size().
4601 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4602 for size. Allocate a buffer for merged EXIDX entries.
4603 (Arm_exidx_merged_section::build_contents): New method.
4604 (Arm_exidx_merged_section::do_write): Move merge section contents
4605 building code to Arm_exidx_merged_section::build_contetns. Write
4606 out contetns in buffer instead of building it on the fly.
4607 (Arm_relobj::make_exidx_input_section): Also pass text section size
4608 to Arm_exidx_input_section constructor.
4609 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4610 (Arm_dynobj::do_read_symbols): Fix memory leak.
4611 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4612 * target.h: (class Task): Add forward declaration.
4613 (Target::relax): Add new parameter TASK and pass it to
4614 Target::do_relax().
4615 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4616
4617 2010-11-05 Cary Coutant <ccoutant@google.com>
4618
4619 PR gold/10708
4620 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4621 object when reading from the file.
4622 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4623 second layout pass.
4624 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4625 when reading section contents.
4626 (get_section_contents): Likewise.
4627 (icf::find_identical_sections): Likewise.
4628 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4629 object when reading from the file.
4630 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4631 the object when doing deferred section layout.
4632
4633 2010-11-03 Nick Clifton <nickc@redhat.com>
4634
4635 PR gold/12001
4636 * script.h (class Symbol_assignment: name): New member. Returns
4637 the name of the symbol.
4638 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4639 Returns true if the given symbol name is on the list of
4640 assignments wating to be processed.
4641 * archive.cc (should_incldue_member): If the symbol is undefined,
4642 check to see if it is on the list of symbols pending assignment.
4643
4644 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4645
4646 * script-sections.cc (Script_sections::find_memory_region): Check
4647 for a NULL output section pointer.
4648
4649 2010-10-29 Doug Kwan <dougkwan@google.com>
4650
4651 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4652 Output_section::add_relaxed_input_section.
4653 * output.cc (Output_section::add_relaxed_input_section): Add new
4654 arguments LAYOUT and NAME. Set section order index.
4655 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4656 Copy section order index.
4657 * output.h (Output_section::add_relaxed_input_section): Add new
4658 arguments LAYOUT and NAME.
4659
4660 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4661
4662 * testsuite/Makefile.am: Move gcctestdir/ld rule to
4663 NATIVE_OR_CROSS_LINKER.
4664 * testsuite/Makefile.in: Regenerate.
4665
4666 2010-10-20 Doug Kwan <dougkwan@google.com>
4667
4668 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4669 without SHF_LINK_ORDER flags.
4670 * layout.cc (Layout::choose_output_section): Do not filter
4671 SHF_LINK_ORDER flag in a relocatable link.
4672
4673 2010-10-17 Cary Coutant <ccoutant@google.com>
4674
4675 * output.h (Output_segment::set_section_addresses): Change function
4676 signature. Update all callers.
4677 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4678 sections.
4679 (Output_segment::set_section_addresses): Align after last TLS
4680 section. Add padding before last relro section instead of after.
4681
4682 2010-10-17 Doug Kwan <dougkwan@google.com>
4683
4684 * gold/arm.cc (Target_arm::got_section): Use correct order and set
4685 GOT output section to be writable.
4686
4687 2010-10-14 Cary Coutant <ccoutant@google.com>
4688
4689 * debug.h (DEBUG_INCREMENTAL): New flag.
4690 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4691 * gold.cc (queue_initial_tasks): Check parameters for incremental link
4692 mode.
4693 * incremental.cc (report_command_line): Ignore all forms of
4694 --incremental.
4695 * layout.cc (Layout::Layout): Check parameters for incremental link
4696 mode.
4697 * options.cc (General_options::parse_incremental): New function.
4698 (General_options::parse_no_incremental): New function.
4699 (General_options::parse_incremental_full): New function.
4700 (General_options::parse_incremental_update): New function.
4701 (General_options::incremental_mode_): New data member.
4702 (General_options::finalize): Check incremental_mode_.
4703 * options.h (General_options): Update help text for --incremental.
4704 Add --no-incremental, --incremental-full, --incremental-update.
4705 (General_options::Incremental_mode): New enum type.
4706 (General_options::incremental_mode): New function.
4707 (General_options::incremental_mode_): New data member.
4708 * parameters.cc (Parameters::incremental_mode_): New data member.
4709 (Parameters::set_options): Set incremental_mode_.
4710 (Parameters::set_incremental_full): New function.
4711 (Parameters::incremental): New function.
4712 (Parameters::incremental_update): New function.
4713 (set_parameters_incremental_full): New function.
4714 * parameters.h (Parameters::set_incremental_full): New function.
4715 (Parameters::incremental): New function.
4716 (Parameters::incremental_update): New function.
4717 (Parameters::incremental_mode_): New data member.
4718 (set_parameters_incremental_full): New function.
4719 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4720 incremental link mode.
4721 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4722 (Sized_relobj::do_relocate_sections): Likewise.
4723 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4724 option.
4725 * testsuite/Makefile.in: Regenerate.
4726 * testsuite/incremental_test.sh: Filter all forms of --incremental.
4727
4728 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4729
4730 * script-sections.h (class Script_sections): Make
4731 Sections_elements typedef public.
4732 * script-sections.cc (class Sort_output_sections): Add elements_
4733 field. Add constructor which sets it; change all callers.
4734 (Sort_output_sections::is_before): New function.
4735 (Sort_output_sections::operator()): Call is_before.
4736 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4737 conditional.
4738 * testsuite/script_test_10.sh: New test. Test script section
4739 order.
4740 * testsuite/script_test_10.t: Likewise.
4741 * testsuite/script_test_10.s: Likewise.
4742 * testsuite/Makefile.am: Wrap the cross linker tests and the
4743 common tests into NATIVE_OR_CROSS_LINKER.
4744 (check_SCRIPTS): Add script_test_10.sh.
4745 (check_DATA): Add script_test_10.stdout.
4746 (script_test_10.o, script_test_10): New targets.
4747 (script_test_10.stdout): New target.
4748 * configure, testsuite/Makefile.in: Regenerate.
4749
4750 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4751
4752 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4753 error for the deprecated relocations.
4754 (Target_arm::Scan::global): Likewise.
4755 (Target_arm::Relocate::relocate): Likewise.
4756
4757 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4758
4759 * fileread.cc (Input_file::find_file): Initialize *found_name
4760 and *namep when using the fallback search for case 4.
4761
4762 2010-10-11 Cary Coutant <ccoutant@google.com>
4763
4764 * options.h (class General_options): Redefine -z lazy as an alias for
4765 the negation of -z now.
4766
4767 2010-10-11 Ian Lance Taylor <iant@google.com>
4768
4769 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4770 binding.
4771
4772 2010-10-06 Nick Clifton <nickc@redhat.com>
4773
4774 * script-sections.cc(class Memory_region): Remove
4775 current_lma_offset_ field. Rename current_vma_offset_ to
4776 current_offset_. Add last_section_ field.
4777 (Memory_region::get_current_vma_address): Rename to
4778 get_current_address.
4779 (Memory_region::get_current_lma_address): Delete.
4780 (Memory_region::increment_vma_offset): Rename to
4781 increment_offset.
4782 (Memory_region::increment_lma_offset): Delete.
4783 (Memory_region::attributes_compatible): New method. Returns
4784 true if the provided section is compatible with the region.
4785 (Memory_region::get_last_section): New method. Returns the last
4786 section to use the region.
4787 (Memory_region::set_last_section): New method. Stores the last
4788 section to use the region.
4789 (Script_sections::block_in_region): New method. Returns true if
4790 a block of memory is contained within a region.
4791 (Script_sections::find_memory_region): New method. Locates a
4792 memory region to be used to set a VMA or LMA address.
4793 (Output_section_definition::set_section_addresses): Add code to
4794 check for addresses set by memory regions.
4795 (Output_segment::set_section_addresses): Remove memory region
4796 walking code.
4797 (Script_sections::create_segment): Add a warning if a header
4798 segment is created outside of any region.
4799 * script-sections.h (class Script_sections): Add prototypes for
4800 find_memory_region and block_in_region methods.
4801 * testsuite/memory_test.s: Use .long instead of .word.
4802 * testsuite/memory_test.t: Add some more output sections.
4803 * testsuite/memory_test.sh: Update expected output.
4804
4805 2010-10-02 Doug Kwan <dougkwan@google.com>
4806
4807 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4808 defintion to symtab.h
4809 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4810 declaration to defintion.
4811
4812 2010-10-01 Nick Clifton <nickc@redhat.com>
4813
4814 * expression.cc (eval): Replace dummy argument with NULL.
4815 (eval_maybe_dot): Check for a NULL result section pointer.
4816 (Symbol_expression::value): Likewise.
4817 (Dot_expression::value): Likewise.
4818 (BINARY_EXPRESSION): Likewise.
4819 (Max_expression::value): Likewise.
4820 (Min_expression::value): Likewise.
4821 (Absolute_expression::value): Likewise.
4822 (Addr_expression::value_from_output_section): Likewise.
4823 (Loaddddr_expression::value_from_output_section): Likewise.
4824 (Segment_start_expression::value): Likewise.
4825 * script-sections.cc
4826 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4827 argument with NULL.
4828 (Sections_elememt_dot_assignment::set_section_addresses):
4829 Likewise.
4830 (Output_data_expression::do_write_to_buffer): Likewise.
4831 (Output_section_definition::finalize_symbols): Likewise.
4832 (Output_section_definition::set_section_addresses): Likewise.
4833
4834 2010-09-30 Doug Kwan <dougkwan@google.com>
4835
4836 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4837
4838 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4839
4840 * target.h (Target::can_icf_inline_merge_sections): New virtual
4841 function.
4842 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4843 virtual function.
4844 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4845 virtual function.
4846 * icf.cc (get_section_contents): Inline merge sections only when
4847 target allows it.
4848
4849 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4850
4851 * configure: Regenerate.
4852
4853 2010-09-17 Ian Lance Taylor <iant@google.com>
4854
4855 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4856 * testsuite/Makefile.am (memory_test.o): New target.
4857 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4858 memory_test.t.
4859 * testsuite/Makefile.in: Rebuild.
4860
4861 2010-09-17 Doug Kwan <dougkwan@google.com>
4862
4863 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4864 defintion if relocation uses GOT entries of the symbol.
4865 * testsuite/icf_safe_test.sh: Fix test.
4866 * testsuite/icf_safe_so_test.sh: Fix test.
4867
4868 2010-09-16 Cary Coutant <ccoutant@google.com>
4869
4870 * script_sections.cc (class Memory_region): Remove "NULL" from
4871 vector initializations.
4872
4873 2010-09-15 Cary Coutant <ccoutant@google.com>
4874
4875 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4876 Resolve forwarding symbols.
4877
4878 2010-09-15 Doug Kwan <dougkwan@google.com>
4879
4880 * gold/testsuite/script_test_3.t: Add ARM special sections.
4881 * gold/testsuite/script_test_4.t: Same.
4882 * gold/testsuite/script_test_5.t: Same.
4883 * gold/testsuite/script_test_6.t: Same.
4884 * gold/testsuite/script_test_7.t: Same.
4885 * gold/testsuite/script_test_7.t: Same.
4886 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4887
4888 2010-09-14 Cary Coutant <ccoutant@google.com>
4889
4890 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4891 (Target_x86_64::Relocate::relocate_tls): Replace check for
4892 saw_tls_block_reloc_ with test for executable section.
4893
4894 2010-09-12 Cary Coutant <ccoutant@google.com>
4895
4896 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4897 position-independent executables to shared libraries need dynamic
4898 relocations.
4899 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4900 position-independent executables.
4901 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4902 * testsuite/Makefile.in: Regenerate.
4903
4904 2010-09-10 Nick Clifton <nickc@redhat.com>
4905
4906 PR gold/11997
4907 * testsuite/memory_test.t: Discard any sections that are not
4908 needed.
4909
4910 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4911
4912 PR gold/11996
4913 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4914 "This::" to work around a bug in gcc 4.2.
4915
4916 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4917
4918 2010-09-09 Rafael Espindola <espindola@google.com>
4919
4920 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4921 sections with different PF_X flags in the same segment.
4922 (Layout::find_first_load_seg): Search all segments to find the first
4923 one.
4924 * options.h (rosegment): New.
4925
4926 2010-09-08 Rafael Espindola <espindola@google.com>
4927
4928 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4929
4930 2010-09-08 Doug Kwan <dougkwan@google.com>
4931
4932 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4933 (Arm_relobj::do_relocate_sections): Add new parameter for output
4934 file to match the parent.
4935 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4936 of local symbols instead of input values. Update code to track
4937 changes in gold::relocate_section.
4938 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4939 (Sized_relobj::compute_final_local_value_internal): New methods.
4940 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4941 body into private version of Sized_relobj::compute_final_local_value.
4942 Call the inline method.
4943 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4944 merged symbol value if there is one.
4945 (Symbol_value::has_output_value): New method defintiion.
4946 (Sized_relobj::Compute_final_local_value_status): New enum type.
4947 (Sized_relobj::compute_final_local_value): New methods.
4948 (Sized_relobj::compute_final_local_value_internal): New methods.
4949 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4950 and arm_cortex_a8.sh.
4951 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4952 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4953 New tests.
4954 * Makefile.in: Regenerate.
4955 * testsuite/arm_bl_out_of_range.s: Update test.
4956 * testsuite/thumb_bl_out_of_range.s: Ditto.
4957 * testsuite/thumb_blx_out_of_range.s: Ditto.
4958 * testsuite/arm_branch_out_of_range.sh: New file.
4959 * testsuite/arm_cortex_a8.sh: Ditto.
4960 * testsuite/arm_cortex_a8_b.s: Ditto.
4961 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4962 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4963 * testsuite/arm_cortex_a8_bl.s: Ditto.
4964 * testsuite/arm_cortex_a8_blx.s: Ditto.
4965 * testsuite/arm_cortex_a8_local.s: Ditto.
4966 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4967 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4968
4969 2010-09-08 Rafael Espindola <espindola@google.com>
4970
4971 * Makefile.am (memory_test.stdout): Run readelf with -W.
4972 * Makefile.in: Regenerate.
4973 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4974 64 bit output.
4975
4976 2010-09-08 Rafael Espindola <espindola@google.com>
4977
4978 * script-sections.cc (Script_sections::add_memory_region): Convert
4979 field precision to int.
4980 * script.cc (script_set_section_region, script_set_section_region):
4981 Convert field precision to int.
4982
4983 2010-09-08 Rafael Espindola <espindola@google.com>
4984
4985 * arm.cc (do_finalize_sections): Create the __exidx_start and
4986 __exdix_end symbols even when the section is missing.
4987
4988 2010-09-08 Nick Clifton <nickc@redhat.com>
4989
4990 * README: Remove claim that MEMORY is not supported.
4991 * expression.cc (script_exp_function_origin)
4992 (script_exp_function_length): Move from here to ...
4993 * script.cc: ... here.
4994 (script_set_section_region, script_add_memory)
4995 (script_parse_memory_attr, script_include_directive): New
4996 functions.
4997 * script-sections.cc
4998 (class Memory_region): New class.
4999 (class Output_section_definition): Add set_memory_region,
5000 set_section_vma, set_section_lma and get_section_name methods.
5001 (class Script_Sections): Add add_memory_region,
5002 find_memory_region, find_memory_region_origin,
5003 find_memory_region_length and set_memory_region methods.
5004 Have set_section_addresses method walk the list of set memory
5005 regions.
5006 Extend the print methos to display memory regions.
5007 * script-sections.h: Add prototypes for new methods.
5008 Add enum for MEMORY region attributes.
5009 * yyscript.y: Add support for parsing MEMORY regions.
5010 * script-c.h: Add prototypes for new functions.
5011 * testsuite/Makefile.am: Add test of MEMORY region functionality.
5012 * testsuite/Makefile.in: Regenerate.
5013 * testsuite/memory_test.sh: New script.
5014 * testsuite/memory_test.s: New assembler source file.
5015 * testsuite/memory_test.t: New linker script.
5016
5017 2010-08-27 Doug Kwan <dougkwan@google.com>
5018
5019 * gold/resolve.cc (Symbol_table::should_override): Let a weak
5020 reference override an existing dynamic weak reference.
5021 * testsuite/Makefile.am: Add new test dyn_weak_ref.
5022 * testsuite/Makefile.in: Regenerate.
5023 * testsuite/dyn_weak_ref.sh: New file.
5024 * testsuite/dyn_weak_ref_1.c: Ditto.
5025 * testsuite/dyn_weak_ref_2.c: Ditto.
5026
5027 2010-08-27 Ian Lance Taylor <iant@google.com>
5028
5029 * incremental.h (class Incremental_input_entry): Add virtual
5030 destructor.
5031
5032 2010-08-27 Ian Lance Taylor <iant@google.com>
5033
5034 * testsuite/start_lib_test_3.c: Mark t3 as used.
5035
5036 2010-08-27 Nick Clifton <nickc@redhat.com>
5037
5038 * options.cc (version_script): Fix small typo in previous
5039 whitespace tidyup.
5040
5041 2010-08-25 Nick Clifton <nickc@redhat.com>
5042
5043 * archive.cc: Formatting fixes: Remove whitespace between
5044 typename and following asterisk. Remove whitespace between
5045 function name and opening parenthesis.
5046 * archive.h: Likewise.
5047 * arm.cc: Likewise.
5048 * attributes.cc: Likewise.
5049 * attributes.h: Likewise.
5050 * common.cc: Likewise.
5051 * copy-relocs.cc: Likewise.
5052 * dirsearch.h: Likewise.
5053 * dynobj.cc: Likewise.
5054 * ehframe.cc: Likewise.
5055 * ehframe.h: Likewise.
5056 * expression.cc: Likewise.
5057 * fileread.cc: Likewise.
5058 * fileread.h: Likewise.
5059 * gc.h: Likewise.
5060 * gold-threads.cc: Likewise.
5061 * gold.cc: Likewise.
5062 * i386.cc: Likewise.
5063 * icf.h: Likewise.
5064 * incremental-dump.cc: Likewise.
5065 * incremental.cc: Likewise.
5066 * layout.cc: Likewise.
5067 * layout.h: Likewise.
5068 * main.cc: Likewise.
5069 * merge.cc: Likewise.
5070 * merge.h: Likewise.
5071 * object.cc: Likewise.
5072 * object.h: Likewise.
5073 * options.cc: Likewise.
5074 * options.h: Likewise.
5075 * output.cc: Likewise.
5076 * output.h: Likewise.
5077 * plugin.cc: Likewise.
5078 * plugin.h: Likewise.
5079 * powerpc.cc: Likewise.
5080 * reloc.cc: Likewise.
5081 * script-c.h: Likewise.
5082 * script-sections.cc: Likewise.
5083 * script.cc: Likewise.
5084 * stringpool.cc: Likewise.
5085 * symtab.cc: Likewise.
5086 * symtab.h: Likewise.
5087 * target.cc: Likewise.
5088 * timer.cc: Likewise.
5089 * timer.h: Likewise.
5090 * version.cc: Likewise.
5091 * x86_64.cc: Likewise.
5092
5093 2010-08-24 Nick Clifton <nickc@redhat.com>
5094
5095 PR 11899
5096 * layout.cc (segment_precedes): Sort segments by their physical
5097 addresses, if they have been set.
5098
5099 2010-08-23 Cary Coutant <ccoutant@google.com>
5100
5101 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5102 symbols data.
5103 (Lib_group::include_member): Unlock object after deleting its
5104 symbols data.
5105 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5106 the bug fixed here.
5107
5108 2010-08-19 Neil Vachharajani <nvachhar@google.com>
5109 Cary Coutant <ccoutant@google.com>
5110
5111 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5112 constructor, and set_blocker.
5113 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5114 readsyms_blocker_.
5115 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5116 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5117 * testsuite/Makefile.am (start_lib_test): New test case.
5118 * testsuite/Makefile.in: Regenerate.
5119 * testsuite/start_lib_test_main.c: New file.
5120 * testsuite/start_lib_test_1.c: New file.
5121 * testsuite/start_lib_test_2.c: New file.
5122 * testsuite/start_lib_test_3.c: New file.
5123
5124 2010-08-19 Ian Lance Taylor <iant@google.com>
5125
5126 * Makefile.in: Rebuild with automake 1.11.1.
5127 * aclocal.m4: Likewise.
5128 * testsuite/Makefile.in: Likewise.
5129
5130 2010-08-19 Ian Lance Taylor <iant@google.com>
5131
5132 PR 10893
5133 * i386.cc (class Output_data_plt_i386): Update declarations.
5134 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
5135 local_ifuncs_ fields.
5136 (Target_i386::do_plt_section_for_global): New function.
5137 (Target_i386::do_plt_section_for_local): New function.
5138 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5139 parameter; change all callers. Initialize global_ifuncs_ and
5140 local_ifuncs_. If doing a static link define __rel_iplt_start and
5141 __rel_iplt_end.
5142 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5143 (Output_data_plt_i386::add_local_ifunc_entry): New function.
5144 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5145 symbols.
5146 (Target_i386::make_plt_section): New function, broken out of
5147 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
5148 (Target_i386::make_plt_entry): Call make_plt_section.
5149 (Target_i386::make_local_ifunc_plt_entry): New function.
5150 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5151 (Target_i386::Scan::local): Handle IFUNC symbols. Add
5152 R_386_IRELATIVE to switch.
5153 (Target_i386::Scan::global): Likewise.
5154 (Target_i386::Relocate::relocate): Likewise.
5155 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5156 switch.
5157 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5158 (Target_x86_64::do_plt_section_for_global): New function.
5159 (Target_x86_64::do_plt_section_for_local): New function.
5160 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5161 parameter; change all callers. If doing a static link define
5162 __rela_iplt_start and __rela_iplt_end.
5163 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5164 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5165 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5166 to point to .plt.
5167 (Target_x86_64::make_local_ifunc_plt_entry): New function.
5168 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5169 switch.
5170 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5171 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
5172 R_X86_64_IRELATIVE to switch.
5173 (Target_x86_64::Scan::global): Likewise.
5174 (Target_x86_64::Relocate::relocate): Likewise.
5175 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5176 switch.
5177 * target.h (class Target): Add plt_section_for_global and
5178 plt_section_for_local functions. Add do_plt_section_for_global
5179 and do_plt_section_for_local virtual functions.
5180 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
5181 clarifying comments.
5182 (Symbol::use_plt_offset): Handle IFUNC symbol.
5183 * object.cc (Sized_relobj::Sized_relobj): Initialize
5184 local_plt_offsets_.
5185 (Sized_relobj::local_has_plt_offset): New function.
5186 (Sized_relobj::local_plt_offset): New function.
5187 (Sized_relobj::set_local_plt_offset): New function.
5188 (Sized_relobj::do_count): Handle IFUNC symbol.
5189 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
5190 a bit away from input_shndx_ field. Add set_is_func_symbol and
5191 is_ifunc_symbol functions.
5192 (class Sized_relobj): Update declarations. Remove Tls_got_entry
5193 and Local_tls_got_offsets. Define Local_plt_offsets. Add
5194 local_plt_offsets_ field.
5195 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5196 * output.h (class Output_section_data): Add non-const
5197 output_section function.
5198 (class Output_data_got): Update declarations.
5199 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5200 Add use_plt_offset parameter to global and local constructors.
5201 Change all callers. Change local_sym_index_ field to 31 bits.
5202 Change GSYM_CODE and CONSTANT_CODE accordingly.
5203 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5204 doing a static link don't set sh_link field.
5205 (Output_data_got::Got_entry::write): Use PLT offset if
5206 appropriate.
5207 (Output_data_got::add_global_plt): New function.
5208 (Output_data_got::add_local_plt): New function.
5209 * target-reloc.h (relocate_section): Handle IFUNC symbol.
5210 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5211 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5212 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5213 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5214 IFUNC conditional.
5215 * testsuite/ifunc-sel.h: New file.
5216 * testsuite/ifuncmain1.c: New file.
5217 * testsuite/ifuncmain1vis.c: New file.
5218 * testsuite/ifuncmod1.c: New file.
5219 * testsuite/ifuncdep2.c: New file.
5220 * testsuite/ifuncmain2.c: New file.
5221 * testsuite/ifuncmain3.c: New file.
5222 * testsuite/ifuncmod3.c: New file.
5223 * testsuite/ifuncmain4.c: New file.
5224 * testsuite/ifuncmain5.c: New file.
5225 * testsuite/ifuncmod5.c: New file.
5226 * testsuite/ifuncmain6pie.c: New file.
5227 * testsuite/ifuncmod6.c: New file.
5228 * testsuite/ifuncmain7.c: New file.
5229 * configure, testsuite/Makefile.in: Rebuild.
5230
5231 2010-08-18 Ian Lance Taylor <iant@google.com>
5232
5233 * incremental.cc
5234 (Output_section_incremental_inputs::write_input_files): Add cast
5235 to avoid signed/unsigned comparison warning.
5236 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5237
5238 2010-08-12 Cary Coutant <ccoutant@google.com>
5239
5240 * common.cc (Sort_commons::operator()): Remove unnecessary code.
5241
5242 2010-08-13 Ian Lance Taylor <iant@google.com>
5243
5244 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5245
5246 2010-08-12 Cary Coutant <ccoutant@google.com>
5247 Doug Kwan <dougkwan@google.com>
5248
5249 * resolve.cc (Symbol_table::should_override): When a weak dynamic
5250 defintion overrides non-weak undef, remember that the original undef
5251 is not weak.
5252 * symtab.cc (Symbol_table::sized_write_global): For undef without
5253 an original weak binding, set binding to global in output.
5254 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5255 * testsuite/Makefile.in: Regenerate.
5256 * testsuite/strong_ref_weak_def.sh: New file.
5257 * testsuite/strong_ref_weak_def_1.c: Ditto.
5258 * testsuite/strong_ref_weak_def_2.c: Ditto.
5259
5260 2010-08-12 Cary Coutant <ccoutant@google.com>
5261
5262 * testsuite/incremental_test.sh: Rewrite.
5263 * testsuite/incremental_test_1.c: Rewrite.
5264 * testsuite/incremental_test_2.c: Rewrite.
5265
5266 2010-08-12 Cary Coutant <ccoutant@google.com>
5267
5268 * arm.cc (Target_arm::got_size): Add const.
5269 (Target_arm::got_entry_count): New function.
5270 (Target_arm::plt_entry_count): New function.
5271 (Target_arm::first_plt_entry_offset): New function.
5272 (Target_arm::plt_entry_size): New function.
5273 (Output_data_plt_arm::entry_count): New function.
5274 (Output_data_plt_arm::first_plt_entry_offset): New function.
5275 (Output_data_plt_arm::get_plt_entry_size): New function.
5276 * i386.cc (Target_i386::got_size): Add const.
5277 (Target_i386::got_entry_count): New function.
5278 (Target_i386::plt_entry_count): New function.
5279 (Target_i386::first_plt_entry_offset): New function.
5280 (Target_i386::plt_entry_size): New function.
5281 (Output_data_plt_i386::entry_count): New function.
5282 (Output_data_plt_i386::first_plt_entry_offset): New function.
5283 (Output_data_plt_i386::get_plt_entry_size): New function.
5284 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5285 find_incremental_inputs_sections. Dump incremental_got_plt section.
5286 * incremental.cc: Include target.h.
5287 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5288 parameter. Adjust all callers. Find incremental_got_plt section.
5289 (Incremental_inputs::create_data_sections): Create incremental_got_plt
5290 section.
5291 (Output_section_incremental_inputs::set_final_data_size): Calculate
5292 size of incremental_got_plt section.
5293 (Output_section_incremental_inputs::do_write): Write the
5294 incremental_got_plt section.
5295 (Got_plt_view_info): New struct.
5296 (Local_got_offset_visitor): New class.
5297 (Global_got_offset_visitor): New class.
5298 (Global_symbol_visitor_got_plt): New class.
5299 (Output_section_incremental_inputs::write_got_plt): New function.
5300 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5301 Add parameter. Adjust all callers.
5302 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5303 (Incremental_inputs::got_plt_section): New function.
5304 (Incremental_inputs::got_plt_section_): New data member.
5305 (Incremental_got_plt_reader): New class.
5306 * layout.cc (Layout::create_incremental_info_sections): Add the
5307 incremental_got_plt section.
5308 * object.h (Got_offset_list::get_list): New function.
5309 (Got offset_list::for_all_got_offsets): New function.
5310 (Sized_relobj::local_got_offset_list): New function.
5311 * powerpc.cc (Target_powerpc::got_size): Add const.
5312 (Target_powerpc::got_entry_count): New function.
5313 (Target_powerpc::plt_entry_count): New function.
5314 (Target_powerpc::first_plt_entry_offset): New function.
5315 (Target_powerpc::plt_entry_size): New function.
5316 (Output_data_plt_powerpc::entry_count): New function.
5317 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5318 (Output_data_plt_powerpc::get_plt_entry_size): New function.
5319 * sparc.cc (Target_sparc::got_size): Add const.
5320 (Target_sparc::got_entry_count): New function.
5321 (Target_sparc::plt_entry_count): New function.
5322 (Target_sparc::first_plt_entry_offset): New function.
5323 (Target_sparc::plt_entry_size): New function.
5324 (Output_data_plt_sparc::entry_count): New function.
5325 (Output_data_plt_sparc::first_plt_entry_offset): New function.
5326 (Output_data_plt_sparc::get_plt_entry_size): New function.
5327 * symtab.h (Symbol::got_offset_list): New function.
5328 (Symbol_table::for_all_symbols): New function.
5329 * target.h (Sized_target::got_entry_count): New function.
5330 (Sized_target::plt_entry_count): New function.
5331 (Sized_target::plt_entry_size): New function.
5332 * x86_64.cc (Target_x86_64::got_size): Add const.
5333 (Target_x86_64::got_entry_count): New function.
5334 (Target_x86_64::plt_entry_count): New function.
5335 (Target_x86_64::first_plt_entry_offset): New function.
5336 (Target_x86_64::plt_entry_size): New function.
5337 (Output_data_plt_x86_64::entry_count): New function.
5338 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5339 (Output_data_plt_x86_64::get_plt_entry_size): New function.
5340
5341 2010-08-12 Cary Coutant <ccoutant@google.com>
5342
5343 * archive.cc: Include incremental.h.
5344 (Archive::Archive): Initialize incremental_info_.
5345 (Archive::include_member): Record archive members in incremental info.
5346 (Add_archive_symbols::run): Record begin and end of an archive in
5347 incremental info.
5348 (Lib_group::include_member): Record objects in incremental info.
5349 * archive.h (Incremental_archive_entry): Forward declaration.
5350 (Archive::set_incremental_info): New member function.
5351 (Archive::incremental_info): New member function.
5352 (Archive::Unused_symbol_iterator): New class.
5353 (Archive::unused_symbols_begin): New member function.
5354 (Archive::unused_symbols_end): New member function.
5355 (Archive::incremental_info_): New data member.
5356 * incremental-dump.cc (find_input_containing_global): New function.
5357 (dump_incremental_inputs): Dump new incremental info sections.
5358 * incremental.cc: Include symtab.h.
5359 (Output_section_incremental_inputs): New class.
5360 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5361 new incremental info sections.
5362 (Sized_incremental_binary::do_check_inputs): Likewise.
5363 (Incremental_inputs::report_archive): Remove.
5364 (Incremental_inputs::report_archive_begin): New function.
5365 (Incremental_inputs::report_archive_end): New function.
5366 (Incremental_inputs::report_object): New function.
5367 (Incremental_inputs::finalize_inputs): Remove.
5368 (Incremental_inputs::report_input_section): New function.
5369 (Incremental_inputs::report_script): Rewrite.
5370 (Incremental_inputs::finalize): Do nothing but finalize string table.
5371 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5372 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5373 (Incremental_inputs::create_data_sections): New function.
5374 (Incremental_inputs::relocs_entsize): New function.
5375 (Output_section_incremental_inputs::set_final_data_size): New function.
5376 (Output_section_incremental_inputs::do_write): New function.
5377 (Output_section_incremental_inputs::write_header): New function.
5378 (Output_section_incremental_inputs::write_input_files): New function.
5379 (Output_section_incremental_inputs::write_info_blocks): New function.
5380 (Output_section_incremental_inputs::write_symtab): New function.
5381 * incremental.h (Incremental_script_entry): Forward declaration.
5382 (Incremental_object_entry): Forward declaration.
5383 (Incremental_archive_entry): Forward declaration.
5384 (Incremental_inputs): Forward declaration.
5385 (Incremental_inputs_header_data): Remove.
5386 (Incremental_inputs_header): Remove.
5387 (Incremental_inputs_header_write): Remove.
5388 (Incremental_inputs_entry_data): Remove.
5389 (Incremental_inputs_entry): Remove.
5390 (Incremental_inputs_entry_write): Remove.
5391 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5392 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5393 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5394 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5395 Likewise.
5396 (Incremental_input_entry): New class.
5397 (Incremental_script_entry): New class.
5398 (Incremental_object_entry): New class.
5399 (Incremental_archive_entry): New class.
5400 (Incremental_inputs::Incremental_inputs): Initialize new data members.
5401 (Incremental_inputs::report_inputs): Remove.
5402 (Incremental_inputs::report_archive): Remove.
5403 (Incremental_inputs::report_archive_begin): New function.
5404 (Incremental_inputs::report_archive_end): New function.
5405 (Incremental_inputs::report_object): Change prototype.
5406 (Incremental_inputs::report_input_section): New function.
5407 (Incremental_inputs::report_script): Change prototype.
5408 (Incremental_inputs::get_reloc_count): New function.
5409 (Incremental_inputs::set_reloc_count): New function.
5410 (Incremental_inputs::create_data_sections): New function.
5411 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5412 (Incremental_inputs::inputs_section): New function.
5413 (Incremental_inputs::symtab_section): New function.
5414 (Incremental_inputs::relocs_section): New function.
5415 (Incremental_inputs::get_stringpool): Add const.
5416 (Incremental_inputs::command_line): Add const.
5417 (Incremental_inputs::inputs): Remove.
5418 (Incremental_inputs::command_line_key): New function.
5419 (Incremental_inputs::input_file_count): New function.
5420 (Incremental_inputs::input_files): New function.
5421 (Incremental_inputs::relocs_entsize): New function.
5422 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5423 (Incremental_inputs::finalize_inputs): Remove.
5424 (Incremental_inputs::Input_info): Remove.
5425 (Incremental_inputs::lock_): Remove.
5426 (Incremental_inputs::inputs_): Change type.
5427 (Incremental_inputs::inputs_map_): Remove.
5428 (Incremental_inputs::current_object_entry_): New data member.
5429 (Incremental_inputs::inputs_section_): New data member.
5430 (Incremental_inputs::symtab_section_): New data member.
5431 (Incremental_inputs::relocs_section_): New data member.
5432 (Incremental_inputs::reloc_count_): New data member.
5433 (Incremental_inputs_reader): New class.
5434 (Incremental_symtab_reader): New class.
5435 (Incremental_relocs_reader): New class.
5436 * layout.cc (Layout::finalize): Move finalization of incremental info
5437 and creation of incremental info sections to follow finalization of
5438 symbol table. Set offsets for postprocessing sections.
5439 (Layout::create_incremental_info_sections): Call
5440 Incremental_inputs::create_data_sections. Add incremental symtab
5441 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
5442 sections to layout after input sections.
5443 * layout.h (struct Timespec): Forward declaration.
5444 (Layout::incremental_inputs): Add const.
5445 (Layout::create_incremental_info_sections): Add parameter.
5446 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5447 * object.cc: Include incremental.h.
5448 (Relobj::finalize_incremental_relocs): New function.
5449 (Sized_relobj::do_layout): Record input sections in incremental info.
5450 * object.h (Object::output_section): New function.
5451 (Object::output_section_offset): Moved from Relobj.
5452 (Object::get_incremental_reloc_base): New function.
5453 (Object::get_incremental_reloc_count): New function.
5454 (Object::do_output_section): New function.
5455 (Object::do_output_section_offset): Moved from Relobj.
5456 (Object::do_get_incremental_reloc_base): New function.
5457 (Object::do_get_incremental_reloc_count): New function.
5458 (Object::Object): Initialize new data members.
5459 (Relobj::output_section): Renamed do_output_section and moved to
5460 protected.
5461 (Relobj::output_section_offset): Moved to Object.
5462 (Relobj::do_get_incremental_reloc_base): New function.
5463 (Relobj::do_get_incremental_reloc_count): New function.
5464 (Relobj::allocate_incremental_reloc_counts): New function.
5465 (Relobj::count_incremental_reloc): New function.
5466 (Relobj::finalize_incremental_relocs): New function.
5467 (Relobj::next_incremental_reloc_index): New function.
5468 (Relobj::reloc_counts_): New data member.
5469 (Relobj::reloc_bases_): New data member.
5470 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
5471 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
5472 (Sized_relobj::incremental_relocs_scan): New function.
5473 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5474 (Sized_relobj::incremental_relocs_write): New function.
5475 (Sized_relobj::incremental_relocs_write_reltype): New function.
5476 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5477 incremental link.
5478 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5479 archives and object files elsewhere.
5480 (Add_symbols::run): Report object files here.
5481 (Finish_group::run): Report end of archive at end of group.
5482 * reloc.cc: Include layout.h, incremental.h.
5483 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5484 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5485 (Sized_relobj::incremental_relocs_scan): New function.
5486 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5487 (Sized_relobj::do_relocate_sections): Write incremental relocations.
5488 (Sized_relobj::incremental_relocs_write): New function.
5489 (Sized_relobj::incremental_relocs_write_reltype): New function.
5490 * script.cc (read_input_script): Rewrite test for incremental link.
5491 Change call to Incremental_inputs::report_script.
5492 * symtab.h (Symbol_table::first_global_index): New function.
5493 (Symbol_table::output_count): New function.
5494
5495 2010-08-12 Doug Kwan <dougkwan@google.com>
5496
5497 * arm.cc (Target_arm::merge_object_attributes): Check command line
5498 options --no-wchar-size-warning and --no-enum-size-warning.
5499 * options.h (General_options): Add ld-compatible options
5500 --no-enum-size-warning and --no-wchar-size-warning.
5501
5502 2010-08-04 Ian Lance Taylor <iant@google.com>
5503
5504 * x86_64.cc (Target_x86_64::Scan::local): Use
5505 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5506 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5507 (Target_x86_64::Scan::global): Likewise.
5508 (Target_x86_64::Relocate::relocate): Likewise.
5509 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5510 Likewise.
5511
5512 2010-08-03 Cary Coutant <ccoutant@google.com>
5513
5514 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5515 to reserve space in merged_strings vector. Keep total input size
5516 for stats.
5517 (Output_merge_string::do_print_merge_stats): Print total input size.
5518 * merge.h (Output_merge_string): Add input_size_ field.
5519 * stringpool.cc (Stringpool_template::string_length): Move
5520 implementations out of Stringpool_template class and place in
5521 stringpool.h.
5522 * stringpool.h (string_length): Move out of Stringpool_template.
5523
5524 2010-08-03 Ian Lance Taylor <iant@google.com>
5525
5526 PR 11712
5527 * layout.cc (relaxation_loop_body): If address of load segment is
5528 set, adjust address to include headers if possible.
5529
5530 2010-08-03 Ian Lance Taylor <iant@google.com>
5531
5532 * version.cc (version_string): Bump to 1.10.
5533
5534 2010-08-03 Ian Lance Taylor <iant@google.com>
5535
5536 PR 11805
5537 * layout.h (enum Output_section_order): Define.
5538 (class Layout): Update declarations.
5539 * layout.cc (Layout::get_output_section): Add order parameter.
5540 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5541 is_first_non_relro parameters. Change all callers.
5542 (Layout::choose_output_section): Likewise.
5543 (Layout::add_output_section_data): Likewise.
5544 (Layout::make_output_section): Likewise. Set order.
5545 (Layout::default_section_order): New function.
5546 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5547 * output.cc (Output_section::Output_section): Initialize order_.
5548 Don't initialize deleted fields.
5549 (Output_segment::Output_segment): Don't initialize deleted
5550 fields.
5551 (Output_segment::add_output_section_to_load): New function
5552 replacing add_output_section. Change all callers to call this or
5553 add_output_section_to_nonload.
5554 (Output_segment::add_output_section_to_nonload): New function.
5555 (Output_segment::remove_output_section): Rewrite.
5556 (Output_segment::add_initial_output_data): Likewise.
5557 (Output_segment::has_any_data_sections): Likewise.
5558 (Output_segment::is_first_section_relro): Likewise.
5559 (Output_segment::maximum_alignment): Likewise.
5560 (Output_segment::has_dynamic_reloc): New function replacing
5561 dynamic_reloc_count. Change all callers.
5562 (Output_segment::has_dynamic_reloc_list): New function replacing
5563 dynamic_reloc_count_list. Change all callers.
5564 (Output_segment::set_section_addresses): Rewrite.
5565 (Output_segment::set_offset): Rewrite.
5566 (Output_segment::find_first_and_last_list): Remove.
5567 (Output_segment::set_tls_offsets): Rewrite.
5568 (Output_segment::first_section_load_address): Likewise.
5569 (Output_segment::output_section_count): Likewise.
5570 (Output_segment::section_with_lowest_load_address): Likewise.
5571 (Output_segment::write_section_headers): Likewise.
5572 (Output_segment::print_sections_to_map): Likewise.
5573 * output.h (class Output_data): Remove dynamic_reloc_count_
5574 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5575 (Output_data::add_dynamic_reloc): Rewrite.
5576 (Output_data::has_dynamic_reloc): New function.
5577 (Output_data::dynamic_reloc_count): Remove.
5578 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5579 is_last_relro_, is_first_non_relro_, is_interp_,
5580 is_dynamic_linker_section_ fields. Add order and set_order
5581 functions. Remove is_relro_local, set_is_relro_local,
5582 is_last_relro, set_is_last_relro, is_first_non_relro,
5583 set_is_first_non_relro functions, is_interp, set_is_interp,
5584 is_dynamic_linker_section, and set_is_dynamic_linker_section
5585 functions.
5586 (class Output_segment): Change Output_data_list from std::list to
5587 std:;vector. Add output_lists_ field. Remove output_data_ and
5588 output_bss_ fields. Update declarations.
5589
5590 2010-08-02 Ian Lance Taylor <iant@google.com>
5591
5592 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5593 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5594 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5595
5596 2010-08-02 Ian Lance Taylor <iant@google.com>
5597
5598 PR 11855
5599 * script.cc (Script_options::Script_options): Initialize
5600 symbol_definitions_ and symbol_references_.
5601 (Script_options::add_symbol_assignment): Update
5602 symbol_definitions_ and symbol_references_.
5603 (Script_options::add_symbol_reference): New function.
5604 (script_symbol): New function.
5605 * script.h (class Script_options): Add symbol_definitions_ and
5606 symbol_references_ fields.
5607 (Script_options::referenced_const_iterator): New type.
5608 (Script_options::referenced_begin): New function.
5609 (Script_options::referenced_end): New function.
5610 (Script_options::is_referenced): New function.
5611 (Script_options::any_unreferenced): New function.
5612 * script-c.h (script_symbol): Declare.
5613 * yyscript.y (exp): Call script_symbol.
5614 * symtab.cc: Include "script.h".
5615 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5616 Change all callers. Check symbols referenced by scripts.
5617 (Symbol_table::add_undefined_symbols_from_command_line): Add
5618 layout parameter. Change all callers.
5619 (Symbol_table::do_add_undefined_symbols_from_command_line):
5620 Likewise. Break out loop body. Check symbols referenced by
5621 scripts.
5622 (Symbol_table::add_undefined_symbol_from_command_line): New
5623 function broken out of
5624 do_add_undefined_symbols_from_command_line.
5625 * symtab.h (class Symbol_table): Update declarations.
5626 * archive.cc: Include "layout.h".
5627 (Archive::should_include_member): Add layout parameter. Change
5628 all callers. Check for symbol mentioned in expression.
5629 * archive.h (class Archive): Update declaration.
5630 * object.cc (Sized_relobj::do_should_include_member): Add layout
5631 parameter.
5632 * object.h (Object::should_include_member): Add layout parameter.
5633 Change all callers.
5634 (Object::do_should_include_member): Add layout parameter.
5635 (class Sized_relobj): Update declaration.
5636 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5637 parameter.
5638 * dynobj.h (class Sized_dynobj): Update declaration.
5639 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5640 layout parameter.
5641 * plugin.h (class Sized_pluginobj): Update declaration.
5642
5643 2010-08-02 Ian Lance Taylor <iant@google.com>
5644
5645 PR 11866
5646 * output.cc (Output_segment::set_offset): Search for the first and
5647 last sections rather than assuming that the list is in order.
5648 (Output_segment::find_first_and_last_list): New function.
5649 * output.h (class Output_segment): Update declarations.
5650 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5651 (relro_strip_test_SOURCES): New variable.
5652 (relro_strip_test_DEPENDENCIES): New variable.
5653 (relro_strip_test_LDFLAGS): New variable.
5654 (relro_strip_test_LDADD): New variable.
5655 (relro_strip_test.so): New target.
5656
5657 2010-08-02 Ian Lance Taylor <iant@google.com>
5658
5659 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5660 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5661 (Target_i386::got_tlsdesc_section): New function.
5662 (Target_i386::got_section): Create space for GOT entries for
5663 TLSDESC relocations.
5664 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5665 R_386_TLS_GOTDESC.
5666 (Target_i386::Scan::global): Likewise.
5667 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5668 using TLSDESC GOT.
5669 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5670 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5671 (Target_x86_64::got_tlsdesc_section): New function.
5672 (Target_x86_64::got_section): Create space for GOT entries for
5673 TLSDESC relocations.
5674 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5675 R_386_TLS_GOTDESC.
5676 (Target_x86_64::Scan::global): Likewise.
5677 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5678 using TLSDESC GOT.
5679
5680 2010-08-02 Ian Lance Taylor <iant@google.com>
5681
5682 * testsuite/final_layout.sh: Use dc to convert from hex to
5683 decimal.
5684
5685 2010-07-29 Sriraman Tallam <tmsriram@google.com>
5686
5687 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5688 paramter to the call to gold::gc_process_relocs.
5689 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5690 paramter to the call to gold::gc_process_relocs.
5691 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5692 parameter to the call to gold::gc_process_relocs.
5693 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5694 template parameter to the call to gold::gc_process_relocs.
5695 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5696 paramter to the call to gold::gc_process_relocs.
5697 * gc.h (get_embedded_addend_size): New function.
5698 (gc_process_relocs): Save the size of the reloc for use by ICF.
5699 * icf.cc (get_section_contents): Get the addend from the text section
5700 for SHT_REL relocation sections.
5701 * icf.h (Icf::Reloc_addend_size_info): New typedef.
5702 (Icf::Reloc_info): Add new member reloc_addend_size_info.
5703 * int_encoding.h (read_from_pointer): New overloaded function.
5704 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5705 * testsuite/icf_sht_rel_addend_test.sh: New file.
5706 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5707 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5708
5709 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5710
5711 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5712 * Makefile.in: Regenerate.
5713 * testsuite/Makefile.in: Regenerate.
5714
5715 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5716
5717 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5718 * gold/testsuite/debug_msg.cc: Likewise.
5719 * gold/testsuite/odr_violation1.cc
5720 * gold/testsuite/odr_violation2.cc
5721
5722 2010-07-21 Cary Coutant <ccoutant@google.com>
5723
5724 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5725 string, and length fields.
5726 (Output_merge_string::Merged_strings_list): New type.
5727 (Output_merge_string::Merged_strings_lists): New typedef.
5728 (Output_merge_string): Replace merged_strings_ with
5729 merged_strings_lists_.
5730 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5731 Merged_strings_list per input object and section. Don't store pointer
5732 to the string. Don't store length with each merged string entry.
5733 (Output_merge_string::finalize_merged_data): Loop over list of merged
5734 strings lists. Recompute length of each merged string.
5735
5736 2010-07-15 Cary Coutant <ccoutant@google.com>
5737
5738 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5739 here.
5740
5741 2010-07-14 Ian Lance Taylor <iant@google.com>
5742
5743 * descriptors.cc (Descriptors::open): Report correct name in error
5744 message.
5745
5746 2010-07-13 Doug Kwan <dougkwan@google.com>
5747
5748 * arm.cc (Arm_input_section::Arm_input_section): For a
5749 SHT_ARM_EXIDX section, always keeps the input sections.
5750 (Arm_input_section::set_exidx_section_link): New method.
5751 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5752 has_errors_ to false.
5753 (Arm_exidx_input_section::has_errors,
5754 Arm_exidx_input_section::set_has_errors): New methods.
5755 (Arm_exidx_input_section::has_errors_): New data member.
5756 (Arm_relobj::get_exidx_shndx_list): New method.
5757 (Arm_output_section::append_text_sections_to_list): Do not skip
5758 section without SHF_EXECINSTR.
5759 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5760 errors.
5761 (Arm_relobj::make_exidx_input_section): Add new parameter for text
5762 section header. Make error messages more verbose. Check for
5763 a non-executable section linked to an EXIDX section.
5764 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5765 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5766 check that there is no deferred EXIDX section if we exit early.
5767 Instead of not making an EXIDX section in case of an error, make one
5768 and set the has_errors flag of it.
5769 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5770 in a relocatable link.
5771 (Target_arm::do_relax): Look for the EXIDX output section instead of
5772 assuming that it is called .ARM.exidx.
5773 (Target_arm::fix_exidx_coverage): Add a new parameter for input
5774 section list. Do not check for SHF_EXECINSTR section flags but
5775 skip any input section with errors.
5776 * output.cc (Output_section::Output_section): Initialize
5777 always_keeps_input_sections_ to false.
5778 (Output_section::add_input_section): Check for
5779 always_keeps_input_sections_.
5780 * output.h (Output_section::always_keeps_input_sections,
5781 Output_section::set_always_keeps_input_sections): New methods.
5782 (Output_section::always_keeps_input_sections): New data member.
5783
5784 2010-07-13 Rafael Espindola <espindola@google.com>
5785
5786 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5787 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5788
5789 2010-07-13 Philip Herron <herron.philip@googlemail.com>
5790 Ian Lance Taylor <iant@google.com>
5791
5792 * output.h (Output_section_lookup_maps::add_merge_section):
5793 Correct check of whether value was inserted.
5794 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5795 (Output_section_lookup_maps::add_relaxed_input_section):
5796 Likewise.
5797 * arm.cc (Target_arm::got_section): Remove used local os.
5798 * i386.cc (Target_i386::got_section): Likewise.
5799 * x86_64.cc (Target_x86_64::got_section): Likewise.
5800 * sparc.cc (Target_sparc::got_section): Likewise.
5801 (Target_sparc::relocate): Remove unused local have_got_offset.
5802 * powerpc.cc (Target_powerpc::relocate): Likewise.
5803
5804 2010-07-13 Ian Lance Taylor <iant@google.com>
5805
5806 * compressed_output.cc (zlib_decompress): Fix signature in
5807 !HAVE_ZLIB_H case.
5808
5809 * archive.cc (Archive::include_member): Unlock an external member
5810 of a thin archive. Don't bother to delete an object we know is
5811 NULL.
5812
5813 2010-07-12 Cary Coutant <ccoutant@google.com>
5814
5815 * compressed_output.cc (zlib_decompress): New function.
5816 (get_uncompressed_size): New function.
5817 (decompress_input_section): New function.
5818 * compressed_output.h (get_uncompressed_size): New function.
5819 (decompress_input_section): New function.
5820 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5821 Handle compressed debug sections.
5822 * layout.cc (is_compressed_debug_section): New function.
5823 (Layout::output_section_name): Map compressed section names to
5824 canonical names.
5825 * layout.h (is_compressed_debug_section): New function.
5826 (is_debug_info_section): Recognize compressed debug sections.
5827 * merge.cc: Include compressed_output.h.
5828 (Output_merge_data::do_add_input_section): Handle compressed
5829 debug sections.
5830 (Output_merge_string::do_add_input_section): Handle compressed
5831 debug sections.
5832 * object.cc: Include compressed_output.h.
5833 (Sized_relobj::Sized_relobj): Initialize new data members.
5834 (build_compressed_section_map): New function.
5835 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5836 * object.h (Object::section_is_compressed): New method.
5837 (Object::do_section_is_compressed): New method.
5838 (Sized_relobj::Compressed_section_map): New type.
5839 (Sized_relobj::do_section_is_compressed): New method.
5840 (Sized_relobj::compressed_sections_): New data member.
5841 * output.cc (Output_section::add_input_section): Handle compressed
5842 debug sections.
5843 * reloc.cc: Include compressed_output.h.
5844 (Sized_relobj::write_sections): Handle compressed debug sections.
5845
5846 2010-07-08 Cary Coutant <ccoutant@google.com>
5847
5848 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5849 weak when resolving to a dynamic def.
5850 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5851 for weak undef/dynamic def cases. Adjust callers.
5852 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5853 undef_binding_weak_.
5854 (Symbol_table::sized_write_globals): Adjust symbol binding.
5855 (Symbol_table::sized_write_symbol): Add binding parameter.
5856 * symtab.h (Symbol::set_undef_binding): New method.
5857 (Symbol::is_undef_binding_weak): New method.
5858 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5859 (Symbol_table::should_override): Add new parameter.
5860 (Symbol_table::sized_write_symbol): Add new parameter.
5861
5862 * testsuite/weak_undef_file1.cc: Add new test case.
5863 * testsuite/weak_undef_file2.cc: Fix header comment.
5864 * testsuite/weak_undef_test.cc: Add new test case.
5865
5866 2010-06-29 Doug Kwan <dougkwan@google.com>
5867
5868 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5869 Initialize USE_SYMBOL_.
5870 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5871 definition.
5872 (Arm_reloc_property::uses_symbol_): New data member declaration.
5873 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5874 uses symbol value and symbol is undefined but not weakly undefined.
5875
5876 2010-06-28 Rafael Espindola <espindola@google.com>
5877
5878 * plugin.cc (Plugin::load): Use dlerror.
5879
5880 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5881
5882 * symtab.cc (detect_odr_violations): When reporting an ODR
5883 violation, report an object where the symbol is defined.
5884
5885 2010-06-25 Doug Kwan <dougkwan@google.com>
5886
5887 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5888 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5889 definition.
5890 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5891 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5892 target hook to detect function points.
5893 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5894 * icf.h (Icf::check_section_for_function_pointers): Change type of
5895 parameter SECTION_NAME to const reference to std::string. Use
5896 target hook to determine if section may have unsafe pointers.
5897 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5898 method definition.
5899
5900 2010-06-21 Rafael Espindola <espindola@google.com>
5901
5902 * fileread.cc (Input_file::find_fie): New
5903 (Input_file::open): Use Input_file::find_fie.
5904 * fileread.h (Input_file::find_fie): New
5905 * plugin.cc (set_extra_library_path): New.
5906 (Plugin::load): Add set_extra_library_path to the transfer vector.
5907 (Plugin_manager::set_extra_library_path): New.
5908 (Plugin_manager::add_input_file): Use the extra search path if set.
5909 (set_extra_library_path(): New.
5910 * plugin.h (Plugin_manager): Add set_extra_library_path and
5911 extra_search_path_.
5912
5913 2010-06-19 Cary Coutant <ccoutant@google.com>
5914
5915 * layout.cc (gdb_sections): Add .debug_types.
5916 (lines_only_debug_sections): Likewise.
5917
5918 2010-06-18 Rafael Espindola <espindola@google.com>
5919
5920 * plugin.cc (add_input_file,add_input_library)
5921 (Plugin_manager::add_input_file): Make filename arguments const.
5922 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5923 const.
5924
5925 2010-06-16 Doug Kwan <dougkwan@google.com>
5926
5927 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5928 .ARM.attributes section if we have not merged any input
5929 attributes sections.
5930
5931 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5932
5933 * arm.cc: Allow combining objects with no EABI version
5934 information.
5935
5936 2010-06-15 Rafael Espindola <espindola@google.com>
5937
5938 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5939
5940 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5941
5942 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5943 (struct iovec): Correct !HAVE_READV definition.
5944
5945 2010-06-10 Cary Coutant <ccoutant@google.com>
5946
5947 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5948 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5949 reloc sections.
5950 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5951
5952 PR 11683
5953 * symtab.h (Symbol::is_placeholder): New member function.
5954 * target-reloc.h (relocate_section): Check for placeholder symbols.
5955
5956 * testsuite/Makefile.am (plugin_test_8): New test.
5957 (plugin_test_9): New test.
5958 * testsuite/Makefile.in: Regenerate.
5959
5960 2010-06-09 Nick Clifton <nickc@redhat.com>
5961
5962 * yyscript.y (input_list_element): Allow strings prefixed with
5963 the '-' character. Treat these as libraries.
5964 * script.cc (script_add_library): New function. Adds a library
5965 specified by "-l<name>" found in an input script.
5966 * script-c.h: Add prototype for script_add_library.
5967
5968 2010-06-07 Doug Kwan <dougkwan@google.com>
5969
5970 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5971 Restrict stub-group size to be within long conditional branch
5972 range when working around cortex-A8 erratum.
5973
5974 2010-06-07 Damien Diederen <dd@crosstwine.com>
5975
5976 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5977 #ifdef typo.
5978
5979 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5980
5981 PR gold/11658
5982 * output.cc
5983 (Output_section::Input_section_sort_entry::compare_section_ordering):
5984 Change to return non-zero correctly.
5985 (Output_section::Input_section_sort_section_order_index_compare
5986 ::operator()): Change to fix ambiguity in comparisons.
5987
5988 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5989
5990 * gold.h (is_wildcard_string): New function.
5991 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5992 (Layout::layout_eh_frame): Ditto.
5993 (Layout::find_section_order_index): New method.
5994 (Layout::read_layout_from_file): New method.
5995 * layout.h (Layout::find_section_order_index): New method.
5996 (Layout::read_layout_from_file): New method.
5997 (Layout::input_section_position_): New private member.
5998 (Layout::input_section_glob_): New private member.
5999 * main.cc (main): Call read_layout_from_file here.
6000 * options.h (--section-ordering-file): New option.
6001 * output.cc (Output_section::input_section_order_specified_): New
6002 member.
6003 (Output_section::Output_section): Initialize new member.
6004 (Output_section::add_input_section): Add new parameter.
6005 Keep input sections when --section-ordering-file is used.
6006 (Output_section::set_final_data_size): Sort input sections when
6007 section ordering file is specified.
6008 (Output_section::Input_section_sort_entry): Add new parameter.
6009 Check sorting type.
6010 (Output_section::Input_section_sort_entry::compare_section_ordering):
6011 New method.
6012 (Output_section::Input_section_sort_compare::operator()): Change to
6013 consider section_order_index.
6014 (Output_section::Input_section_sort_init_fini_compare::operator()):
6015 Change to consider section_order_index.
6016 (Output_section::Input_section_sort_section_order_index_compare
6017 ::operator()): New method.
6018 (Output_section::sort_attached_input_sections): Change to sort
6019 according to section order when specified.
6020 (Output_section::add_input_section<32, true>): Add new parameter.
6021 (Output_section::add_input_section<64, true>): Add new parameter.
6022 (Output_section::add_input_section<32, false>): Add new parameter.
6023 (Output_section::add_input_section<64, false>): Add new parameter.
6024 * output.h (Output_section::add_input_section): Add new parameter.
6025 (Output_section::input_section_order_specified): New
6026 method.
6027 (Output_section::set_input_section_order_specified): New method.
6028 (Input_section::Input_section): Initialize section_order_index_.
6029 (Input_section::section_order_index): New method.
6030 (Input_section::set_section_order_index): New method.
6031 (Input_section::section_order_index_): New member.
6032 (Input_section::Input_section_sort_section_order_index_compare): New
6033 struct.
6034 (Output_section::input_section_order_specified_): New member.
6035 * script-sections.cc (is_wildcard_string): Delete and move modified
6036 method to gold.h.
6037 (Output_section_element_input::Output_section_element_input): Modify
6038 call to is_wildcard_string.
6039 (Output_section_element_input::Input_section_pattern
6040 ::Input_section_pattern): Ditto.
6041 (Output_section_element_input::Output_section_element_input): Ditto.
6042 * testsuite/Makefile.am (final_layout): New test case.
6043 * testsuite/Makefile.in: Regenerate.
6044 * testsuite/final_layout.cc: New file.
6045 * testsuite/final_layout.sh: New file.
6046
6047 2010-06-01 Rafael Espindola <espindola@google.com>
6048
6049 * plugin.cc (Plugin::load): Pass the output name to the plugin.
6050
6051 2010-06-01 Rafael Espindola <espindola@google.com>
6052
6053 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6054 visibility of symbols.
6055
6056 2010-05-27 Doug Kwan <dougkwan@google.com>
6057
6058 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6059 from start of output section instead of address for a local symbol
6060 in a merged or relaxed section when doing a relocatable link.
6061
6062 2010-05-26 Rafael Espindola <espindola@google.com>
6063
6064 PR 11604
6065 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6066 adding sections the garbage collector removed.
6067 * gold/testsuite/Makefile.am: Add test.
6068 * gold/testsuite/Makefile.in: Regenerate.
6069 * gold/testsuite/plugin_test_7.sh: New.
6070 * gold/testsuite/plugin_test_7_1.c: New.
6071 * gold/testsuite/plugin_test_7_2.c: New.
6072
6073 2010-05-26 Rafael Espindola <espindola@google.com>
6074
6075 * script-sections.cc (Output_section_definition::set_section_addresses):
6076 Check for --section-start.
6077
6078 2010-05-26 Doug Kwan <dougkwan@google.com>
6079
6080 * arm.cc (Arm_scan_relocatable_relocs): New class.
6081 (Target_arm::relocate_special_relocatable): New method.
6082 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6083 (Arm_relocate_functions::thumb_branch_common): Same.
6084 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6085 instead of Default_scan_relocatable_relocs.
6086 * target-reloc.h (relocate_for_relocatable): Let target handle
6087 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6088 * target.h (Sized_target::relocate_special_relocatable): New method.
6089
6090 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6091
6092 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6093
6094 2010-05-23 Doug Kwan <dougkwan@google.com>
6095
6096 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6097 instead of a cast.
6098 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6099 with a direct branch, not a conditional branch, to a stub.
6100 * merge.cc (Output_merge_base::record_input_section): New method
6101 defintion.
6102 (Output_merge_data::do_add_input_section): Record input section if
6103 keeps-input-sections flag is set.
6104 (Output_merge_string::do_add_input_section): Ditto.
6105 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6106 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6107 INPUT_SECTIONS_.
6108 (Output_merge_base::keeps_input_sections,
6109 Output_merge_base::set_keeps_input_sections,
6110 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6111 method definitions.
6112 (Output_merge_base::Input_sections): New type declaration.
6113 (Output_merge_base::input_sections_begin,
6114 Output_merge_base::input_sections_end,
6115 Output_merge_base::do_set_keeps_input_sections): New method definitions.
6116 (Output_merge_base::bool keeps_input_sections_,
6117 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6118 Output_merge_base::input_sections_): New data members.
6119 (Output_merge_data::do_set_keeps_input_sections): New method
6120 defintion.
6121 (Output_merge_string::do_set_keeps_input_sections): Ditto.
6122 * output.cc (Output_section::Input_section::relobj): Move method
6123 defintion from class declaration to here and handle merge sections.
6124 (Output_section::Input_section::shndx): Ditto.
6125 (Output_section::Output_section): Remove initializations of removed
6126 data members and initialize new data member LOOKUP_MAPS_.
6127 (Output_section::add_input_section): Set keeps-input-sections flag
6128 for a newly created merge output section as appropriate. Adjust code
6129 to use Output_section_lookup_maps class.
6130 (Output_section::add_relaxed_input_section): Adjst code for lookup
6131 maps code refactoring.
6132 (Output_section::add_merge_input_section): Add a new parameter
6133 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
6134 class. If adding input section to a newly created merge output
6135 section fails, remove the new merge section.
6136 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6137 Adjust code for use of the Output_section_lookup_maps class.
6138 (Output_section::find_merge_section): Ditto.
6139 (Output_section::build_lookup_maps): New method defintion.
6140 (Output_section::find_relaxed_input_section): Adjust code to use
6141 Output_section_lookup_maps class.
6142 (Output_section::get_input_sections): Export merge sections. Adjust
6143 code to use Output_section_lookup_maps class.
6144 (Output_section:::add_script_input_section): Adjust code to use
6145 Output_section_lookup_maps class. Update lookup maps for merge
6146 sections also.
6147 (Output_section::discard_states): Use Output_section_lookup_maps.
6148 (Output_section::restore_states): Same.
6149 * output.h (Merge_section_properties): Move class defintion out of
6150 Output_section.
6151 (Output_section_lookup_maps): New class.
6152 (Output_section::Input_section::is_merge_section): New method
6153 defintion.
6154 (Output_section::Input_section::relobj): Move defintion out of class
6155 defintion. Declare method only.
6156 (Output_section::Input_section::shndx): Ditto.
6157 (Output_section::Input_section::output_merge_base): New method defintion.
6158 (Output_section::Input_section::u2_.pomb): New union field.
6159 (Output_section::Merge_section_by_properties_map,
6160 Output_section::Output_section_data_by_input_section_map,
6161 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6162 Remove types.
6163 (Output_section::add_merge_input_section): Add new parameter
6164 KEEPS_INPUT_SECTIONS.
6165 (Output_section::build_lookup_maps): New method declaration.
6166 (Output_section::merge_section_map_,
6167 Output_section::merge_section_by_properties_map_,
6168 Output_section::relaxed_input_section_map_,
6169 Output_section::is_relaxed_input_section_map_valid_): Remove data
6170 members.
6171 (Output_section::lookup_maps_): New data member.
6172
6173 2010-05-21 Doug Kwan <dougkwan@google.com>
6174
6175 PR gold/11619
6176 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6177 avoid a compilation error.
6178
6179 2010-05-19 Rafael Espindola <espindola@google.com>
6180
6181 * script-sections.cc (Output_section_definition::allocate_to_segment):
6182 Update the phdrs_list even when the output section is NULL.
6183 * testsuite/Makefile.am: Add test.
6184 * testsuite/Makefile.in: Regenerate.
6185 * testsuite/script_test_9.cc: New.
6186 * testsuite/script_test_9.sh: New.
6187 * testsuite/script_test_9.t: New.
6188
6189 2010-05-19 Doug Kwan <dougkwan@google.com>
6190
6191 * arm.cc (Arm_input_section::original_size): New method.
6192 (Arm_input_section::do_addralign): Add a cast.
6193 (Arm_input_section::do_output_offset): Remove static cast.
6194 (Arm_input_section::original_addralign,
6195 Arm_input_section::original_size_): Change type to uint32_t.
6196 (Arm_input_section::init): Add safe casts for section alignment
6197 and size.
6198 (Arm_input_section::set_final_data_size): Do not set address and
6199 offset of stub table.
6200 (Arm_output_section::fix_exidx_coverage): Change use of of
6201 Output_section::Simple_input_section to that of
6202 Output_section::Input_section.
6203 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6204 except for the first pass.
6205 * output.cc (Output_section::get_input_sections): Change type of
6206 input_sections to std::list<Input_section>.
6207 (Output_section::add_script_input_section): Rename from
6208 Output_section::add_simple_input_section. Change type of SIS
6209 parameter from Simple_input_section to Input_section.
6210 * output.h (Output_section::Simple_input_section): Remove class.
6211 (Output_section::Input_section): Change class visibility to public.
6212 (Output_section::Input_section::addralign): Use stored alignments
6213 for special input sections if set.
6214 (Output_section::Input_section::set_addralign): New method.
6215 (Output_section::get_input_sections): Change parameter type from
6216 list of Simple_input_section to list of Input_section.
6217 (Output_section::add_script_input_section): Rename from
6218 Output_section::add_simple_input_section. Change first parameter's
6219 type from Simple_input_section to Input_section and remove the
6220 second and third parameters.
6221 * script-sections.cc (Input_section::Input_section_list): Change
6222 type to list of Output_section::Input_section/
6223 (Input_section_info::Input_section_info): Change parameter type of
6224 INPUT_SECTION to Output_section::Input_section.
6225 (Input_section_info::input_section): Change return type.
6226 (Input_section_info::input_section_): Change type to
6227 Output_section::Input_section.
6228 (Output_section_element_input::set_section_addresses): Adjust code
6229 to use Output_section::Input_section instead of
6230 Output_section::Simple_input_section. Adjust code for renaming
6231 of Output_section::add_simple_input_section.
6232 (Orphan_output_section::set_section_addresses): Ditto.
6233
6234 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6235
6236 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6237 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6238
6239 2010-05-18 Rafael Espindola <espindola@google.com>
6240
6241 * options.cc (General_options::finalize): Handle -nostdlib.
6242 * options.h (nostdlib): New option.
6243 * script.cc (script_add_search_dir): Handle -nostdlib.
6244
6245 2010-05-12 Doug Kwan <dougkwan@google.com>
6246
6247 * arm.cc (Target_arm::do_finalize_sections): Create an empty
6248 attributes section only if there no attributes section after merging.
6249 (Target_arm::merge_object_attributes): Move value of
6250 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6251 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6252 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6253 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6254 and arm_attr_merge_7.stdout.
6255 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6256 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6257 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6258 arm_attr_merge_7b.o): New rules.
6259 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6260 arm_attr_merge_7
6261 * testsuite/Makefile.in: Regenerate.
6262 * testsuite/arm_attr_merge.sh: New file.
6263 * testsuite/arm_attr_merge_[67][ab].s: Same.
6264
6265 2010-05-05 Nick Clifton <nickc@redhat.com>
6266
6267 * po/es.po: Updated Spanish translation.
6268
6269 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6270
6271 * Makefile.am (install-exec-local): Properly install gold as
6272 default cross linker.
6273 * Makefile.in: Regenerated.
6274
6275 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6276 Nick Clifton <nickc@redhat.com>
6277
6278 * configure.ac (install_as_default): Define and set to false
6279 unless --enable-gold or --enable-gold=both/gold has been
6280 specified.
6281 * configure: Regenerate.
6282
6283 * Makefile.am (install-exec-local): Install the executable as
6284 'ld.gold'. If install_as_default is true then also install it as
6285 'ld'.
6286 * Makefile.in: Regenerated.
6287
6288 2010-04-24 Ian Lance Taylor <iant@google.com>
6289
6290 * layout.cc (Layout::layout_reloc): In relocatable link don't
6291 combine reloc sections for grouped sections.
6292
6293 2010-04-23 Sriraman Tallam <tmsriram@google.com>
6294
6295 * gc.h (gc_process_relocs): Pass information on relocs pointing to
6296 sections that are not ordinary to icf.
6297 * icf.cc (get_section_contents): Handle relocation pointing to section
6298 with no object or shndx information.
6299 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6300 * testsuite/Makefile.in: Regenerate.
6301 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6302 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6303
6304 2010-04-22 Ian Lance Taylor <iant@google.com>
6305
6306 * expression.cc (Expression::Expression_eval_info): Add
6307 result_alignment_pointer field.
6308 (Expression::eval_with_dot): Add result_alignment_pointer
6309 parameter. Change all callers.
6310 (Expression::eval_maybe_dot): Likewise.
6311 (class Binary_expression): Add alignment_pointer parameter to
6312 left_value and right_value. Change all callers.
6313 (BINARY_EXPRESSION): Set result alignment.
6314 (class Trinary_expression): Add alignment_pointer parameter to
6315 arg2_value and arg3_value. Change all callers.
6316 (Trinary_cond::value): Set result alignment.
6317 (Max_expression::value, Min_expression::value): Likewise.
6318 (Align_expression::value): Likewise.
6319 * script-sections.cc (class Sections_element): Add dot_alignment
6320 parameter to set_section_addresses virtual function. Update
6321 instantiations.
6322 (class Output_section_element): Likewise.
6323 (Script_sections::create_segments): Add dot_alignment parameter.
6324 Change all callers.
6325 (Script_sections::create_segments_from_phdrs_clause): Likewise.
6326 (Script_sections::set_phdrs_clause_addresses): Likewise.
6327 * script-sections.h: Update declarations.
6328 * script.h: Update declarations.
6329 * output.h (Output_segment::set_minimum_p_align): Don't decrease
6330 min_p_align.
6331 * testsuite/script_test_3.t: Set large alignment.
6332 * testsuite/script_test_3.sh: Make sure that at least one LOAD
6333 segment has expected alignment.
6334
6335 2010-04-22 Nick Clifton <nickc@redhat.com>
6336
6337 * po/gold.pot: Updated by the Translation project.
6338 * po/vi.po: Updated Vietnamese translation.
6339
6340 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
6341
6342 * testsuite/Makefile.am (check_PROGRAMS): Add
6343 icf_virtual_function_folding_test.
6344 * testsuite/Makefile.in: Regenerated.
6345
6346 2010-04-15 Andrew Haley <aph@redhat.com>
6347
6348 * options.h (merge_exidx_entries): New option.
6349 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6350 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6351 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6352 (Target_arm::merge_exidx_entries): New function.
6353 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6354 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6355 to Arm_exidx_fixup constructor.
6356 Add new arg, merge_exidx_entries.
6357 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6358 Arm_output_section::fix_exidx_coverage.
6359
6360 2010-04-18 Sriraman Tallam <tmsriram@google.com>
6361
6362 * icf.cc (get_section_contents): Check for preemptible functions.
6363 Ignore addend when appropriate.
6364 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
6365 section folded.
6366 (add_from_relobj): Check for section folded.
6367 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6368 * symtab.h (should_add_dynsym_entry): Add new parameter.
6369 * target-reloc.h (scan_relocs): Check for section folded.
6370 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6371 Check reloc types for function pointers in shared objects.
6372 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6373 case.
6374 (icf_preemptible_functions_test): New test case.
6375 (icf_string_merge_test): New test case.
6376 * testsuite.Makefile.in: Regenerate.
6377 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6378 bar_glob. Refactor code.
6379 * testsuite/icf_preemptible_functions_test.cc: New file.
6380 * testsuite/icf_preemptible_functions_test.sh: New file.
6381 * testsuite/icf_string_merge_test.cc: New file.
6382 * testsuite/icf_string_merge_test.sh: New file.
6383 * testsuite/icf_virtual_function_folding_test.cc: New file.
6384 * testsuite/icf_virtual_function_folding_test.sh: New file.
6385
6386 2010-04-14 Doug Kwan <dougkwan@google.com>
6387
6388 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6389 for local symbol recounting if we remove a section due to ICF.
6390 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6391 there are no regular objects in input.
6392
6393 2010-04-13 Doug Kwan <dougkwan@google.com>
6394
6395 * arm.cc (Arm_input_section::set_final_data_size): Compute
6396 accurate final data size instead of using current data size.
6397
6398 2010-04-09 Doug Kwan <dougkwan@google.com>
6399
6400 * layout.cc (Layout::choose_output_section): Handle script section
6401 types.
6402 (Layout::make_output_section_for_script): Add section type parameter.
6403 Handle script section types.
6404 * layout.h (Layout::make_output_section_for_script): Add section
6405 type parameter.
6406 * output.cc (Output_section::Output_section): Initialize data member
6407 is_noload_.
6408 (Output_section::do_reset_address_and_file_offset): Do not set address
6409 to 0 if section is a NOLOAD section.
6410 * output.h (Output_section::is_noload): New method.
6411 (Output_section::set_is_noload): Ditto.
6412 (Output_section::is_noload_): New data member.
6413 * script-c.h (Script_section_type): New enum type.
6414 (struct Parser_output_section_header): Add new file section_type.
6415 * script-sections.cc (Sections_element::output_section_name): Add
6416 parameter for returning script section type.
6417 (Output_section_definition::output_section_name): Ditto.
6418 (Output_section_definition::section_type)P; New method.
6419 (Output_section_definiton::script_section_type_name): Ditto.
6420 (Output_section_definition::script_section_type_): New data member.
6421 (Output_section_definition::Output_section_definition): Initialize
6422 data member Output_section_definition::script_section_type_.
6423 (Output_section_definition::create_sections): Pass script section type
6424 to Layout::make_output_section_for_script.
6425 (Output_section_definition::output_section_name): Return script
6426 section type to caller.
6427 (Output_section_definition::set_section_address): Do not advance
6428 dot value and load address if section type is NOLOAD. Set address
6429 of NOLOAD sections regardless of section flags.
6430 (Output_section_definition::print): Print section type if it is
6431 not SCRIPT_SECTION_TYPE_NONE.
6432 (Output_section_definition::section_type): New method.
6433 (Output_section_definition::script_section_type_name): Ditto.
6434 (Script_sections::output_section_name): Add new parameter
6435 PSECTION_TYPE for returning script section type. Pass it to
6436 section elements. Handle discard sections.
6437 (Sort_output_sections::operator()): Handle NOLOAD sections.
6438 * script-sections.h (Script_sections::Section_type): New enum type.
6439 (Script_sections::output_section_name): Add a new parameter for
6440 returning script section type.
6441 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6442 INFO and NOLOAD.
6443 * yyscript.y (union): Add new field SECTION_TYPE.
6444 (COPY, DSECT, INFO, NOLOAD): New tokens.
6445 (opt_address_and_section_type): Change type to output_section_header.
6446 (section_type): New non-terminal
6447 (section_header): Handle section type.
6448 (opt_address_and_section_type): Return section type value.
6449
6450 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
6451
6452 * testsuite/plugin_common_test_1.c (foo): Add prototype.
6453 * testsuite/plugin_common_test_2.c (foo): Likewise.
6454
6455 2010-04-08 Doug Kwan <dougkwan@google.com>
6456
6457 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6458 Output_merge_data.
6459 * output.cc (Output_section::add_merge_input_section): Simplify
6460 code and return status of Output_merge_base::add_input_section.
6461 Update merge section map only if Output_merge_base::add_input_section
6462 returns true.
6463
6464 2010-04-07 Doug Kwan <dougkwan@google.com>
6465
6466 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6467 if section is marked as containing instructions but has no mapping
6468 symbols.
6469 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6470 correct section index.
6471 (Arm_relobj::find_linked_text_section): Ditto.
6472
6473 2010-04-07 Cary Coutant <ccoutant@google.com>
6474
6475 * archive.cc (include_member): Destroy Read_symbols_data object before
6476 releasing file.
6477 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6478 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6479 (Read_symbols_data::~Read_symbols_data) New destructor.
6480 (Section_relocs::Section_relocs) New constructor.
6481 (Section_relocs::~Section_relocs) New destructor.
6482 (Read_relocs_data::Read_relocs_data) New constructor.
6483 (Read_relocs_data::~Read_relocs_data) New destructor.
6484 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6485 pointers to NULL after deleting.
6486
6487 2010-04-07 Doug Kwan <dougkwan@google.com>
6488
6489 * arm.cc: Replace "endianity" with "endianness" in comments.
6490 (Arm_exidx_cantunwind): Ditto.
6491 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6492 (Arm_relobj::merge_flags_and_attributes): New method.
6493 (Arm_relobj::merge_flags_and_attributes_): New data member.
6494 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6495 (Arm_relobj::scan_sections_for_stubs): Ditto.
6496 (Arm_relobj::do_read_symbols): Check to see if we really want to
6497 merge processor-specific flags and attributes. Exit early if
6498 an object is empty except for section names and the undefined symbol.
6499 (Target_arm::do_finalize_sections): Move check for ELF format to
6500 Arm_relobj::do_read_symbols. Merge processor specific flags and
6501 attributes from a regular object only when we have determined that
6502 it is aapropriate. Do not create an .ARM.attributes section in
6503 output if there is no regular input object.
6504 (Target_arm::merge_processor_specific_flags): Check
6505 --warn-mismatch before printing any error.
6506 (Target_arm::merge_object_attributes): Ditto.
6507 * gold.cc (queue_middle_tasks): Handle the case in which there is
6508 no regular object in input.
6509 * options.cc (General_options::parse_EB): New method.
6510 (General_options::parse_EL): Same.
6511 (General_options::General_options): Initialize endianness_.
6512 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6513 New options.
6514 (General_options::Endianness): New enum.
6515 (General_options::endianness): New method.
6516 (General_options::endianness_): New data member.
6517 * parameters.cc (Parameters::set_options): Check target endianness.
6518 (Parameters::set_target_once): Ditto.
6519 (Parameters::check_target_endianness): New method.
6520 (parameters_force_valid_target): If either -EL or -EB is specified,
6521 use it to define endianness of default target.
6522 * parameters.h (Parameters::check_target_endianness): New method
6523 declaration.
6524 * target.h (class Target): Change "endianity" to "endianness"
6525 in comments.
6526
6527 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6528
6529 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6530 * configure: Regenerate.
6531 * Makefile.in: Regenerate.
6532 * testsuite/Makefile.in: Regenerate.
6533
6534 2010-04-06 Cary Coutant <ccoutant@google.com>
6535
6536 gcc PR lto/42757
6537 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6538 prevailing definitions of common symbols.
6539 * testsuite/plugin_test_6.sh: New test case.
6540 * testsuite/plugin_common_test_1.c: New test case.
6541 * testsuite/plugin_common_test_2.c: New test case.
6542 * testsuite/Makefile.am (plugin_test_6): New test case.
6543 * testsuite/Makefile.in: Regenerate.
6544
6545 2010-04-06 Nick Clifton <nickc@redhat.com>
6546
6547 * po/vi.po: New Vietnamese translation.
6548
6549 2010-03-30 Doug Kwan <dougkwan@google.com>
6550
6551 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6552
6553 2010-03-25 Doug Kwan <dougkwan@google.com>
6554
6555 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6556 to avoid a conversion warning on a 32-bit host.
6557
6558 2010-03-24 Ian Lance Taylor <iant@google.com>
6559
6560 * testsuite/script_test_3.t: Add a TLS segment.
6561 * testsuite/Makefile.am (check_PROGRAMS): Add
6562 tls_phdrs_script_test.
6563 (tls_phdrs_script_test_SOURCES): Define.
6564 (tls_phdrs_script_test_DEPENDENCIES): Define.
6565 (tls_phdrs_script_test_LDFLAGS): Define.
6566 (tls_phdrs_script_test_LDADD): Define.
6567 * testsuite/Makefile.in: Rebuild.
6568
6569 2010-03-23 Cary Coutant <ccoutant@google.com>
6570
6571 * fileread.cc (find_or_make_view): Fix comment.
6572
6573 2010-03-23 Ian Lance Taylor <iant@google.com>
6574
6575 * script-sections.cc (class Orphan_section_placement): Define
6576 PLACE_TLS and PLACE_TLS_BSS.
6577 (Orphan_section_placement::Orphan_section_placement): Initialize
6578 new places.
6579 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6580 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6581 (tls_script_test_SOURCES): Define.
6582 (tls_script_test_DEPENDENCIES): Define.
6583 (tls_script_test_LDFLAGS): Define.
6584 (tls_script_test_LDADD): Define.
6585 * testsuite/Makefile.in: Rebuild.
6586
6587 2010-03-22 Doug Kwan <dougkwan@google.com>
6588
6589 * arm.cc (Arm_relocate_functions::abs8,
6590 Arm_relocate_functions::abs16): Use correct check for overflow
6591 specified in the ARM ELF specs.
6592 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6593 target of a BLX instruction specially.
6594 (Reloc_stub::stub_type_for_reloc): Ditto.
6595 (Relocate::relocate): Use symbolic names instead of numeric relocation
6596 codes to report error.
6597 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6598 workaround.
6599 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6600 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6601 thumb2_blx_out_of_range.stdout
6602 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6603 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6604 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6605 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6606 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6607 thumb2_blx_in_range, thumb2_blx_in_range.o,
6608 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6609 thumb2_blx_out_of_range.o): New rules.
6610 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6611 thumb2_blx_in_range and thumb2_blx_out_of_range.
6612 * testsuite/Makefile.in: Regenerate.
6613 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6614 * testsuite/thumb_blx_in_range.s: New file.
6615 * testsuite/thumb_blx_out_of_range.s: New file.
6616
6617 2010-03-22 Rafael Espindola <espindola@google.com>
6618
6619 * archive.cc (Should_include): Move to archive.h.
6620 (should_include_member): Make it a member of Archive.
6621 (Lib_group): New.
6622 (Add_lib_group_symbols): New.
6623 * archive.h: Include options.h.
6624 (Archive_member): Moved from Archive.
6625 (Should_include): Moved from archive.cc.
6626 (Lib_group): New.
6627 (Add_lib_group_symbols): New.
6628 * dynobj.cc (do_should_include_member): New.
6629 * dynobj.h (do_should_include_member): New.
6630 * gold.cc (queue_initial_tasks): Update call to queue.
6631 * main.cc (main): Print lib group stats.
6632 * object.cc (do_should_include_member): New.
6633 * object.h: Include archive.h.
6634 (Object::should_include_member): New.
6635 (Object::do_should_include_member): New.
6636 (Sized_relobj::do_should_include_member): New.
6637 * options.cc (General_options::parse_start_lib): New.
6638 (General_options::parse_end_lib): New.
6639 (Input_arguments::add_file): Handle lib groups.
6640 (Input_arguments::start_group): Check we are not in a lib.
6641 (Input_arguments::start_lib): New.
6642 (Input_arguments::end_lib): New.
6643 * options.h (General_options): Add start_lib and end_lib.
6644 (Input_argument::lib_): New.
6645 (Input_argument::lib): New.
6646 (Input_argument::is_lib): New.
6647 (Input_file_lib): New.
6648 (Input_arguments::in_lib_): New.
6649 (Input_arguments::in_lib): New.
6650 (Input_arguments::start_lib): New.
6651 (Input_arguments::end_lib_): New.
6652 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6653 in unused members as preempted.
6654 (Sized_pluginobj::do_should_include_member): New.
6655 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6656 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6657 return the blocker.
6658 (Read_symbols::do_whole_lib_group): New.
6659 (Read_symbols::do_lib_group): New.
6660 (Read_symbols::do_read_symbols): Handle lib groups.
6661 (Read_symbols::get_name): Handle lib groups.
6662 * readsyms.h (Read_symbols): Add an archive member pointer.
6663 (Read_symbols::do_whole_lib_group): New.
6664 (Read_symbols::do_lib_group): New.
6665 (Read_symbols::member_): New.
6666 * script.cc (read_input_script): Update call to queue_soon.
6667
6668 2010-03-19 Doug Kwan <dougkwan@google.com>
6669
6670 * arm.cc (Stub_table::Stub_table): Initialize new data members
6671 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6672 (Stub_table::add_reloc_stub): Assign stub offset and update
6673 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6674 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6675 New data members.
6676 (Stub_table::update_data_size_and_addralign): Use
6677 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6678 instead of going over all reloc stubs.
6679 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6680 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6681 Stringpool_template::offset_ to size of Stringpool_char.
6682 (Stringpool_template::new_key_offset): Remove code to initialize
6683 Stringpool_template::offset_.
6684 * stringpool.h (Stringpool_template::set_no_zero_null): Set
6685 Stringpool_template::offset_ to zero.
6686
6687 2010-03-15 Doug Kwan <dougkwan@google.com>
6688
6689 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6690 offset_.
6691 (Stringpool_template::new_key_offset): New method.
6692 (Stringpool_template::add_string): Assign offsets when adding new
6693 strings.
6694 (Stringpool_template::set_string_offsets): Do not set string offsets
6695 when not optimizing.
6696 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6697 member size_.
6698 (Chunked_vector::clear): Clear size_.
6699 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6700 (Chunked_vector::size): Return size_.
6701 (Chunked_vector::push_back): Use size_ to find insert position.
6702 (Chunked_vector::size_): New data member.
6703 (Stringpool_template::set_no_zero_null): Assert string set is empty.
6704 (Stringpool_template::new_key_offset): New method declaration.
6705 (Stringpool_template::offset_): New data member.
6706
6707 2010-03-15 Rafael Espindola <espindola@google.com>
6708
6709 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6710 Add_symbols' constructor.
6711 * readsyms.h (Add_symbols): Remove the input_group member.
6712
6713 2010-03-10 Ian Lance Taylor <iant@google.com>
6714
6715 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6716 target to ask whether a reference to a symbol requires a stack
6717 split.
6718 * target.h (Target::is_call_to_non_split): New function.
6719 (Target::do_is_call_to_non_split): Declare virtual function.
6720 * target.cc: Include "symtab.h".
6721 (Target::do_is_call_to_non_split): New function.
6722 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6723
6724 2010-03-10 Cary Coutant <ccoutant@google.com>
6725
6726 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6727 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6728 (File_read::open[2]): Add whole_file_view_ to list of views.
6729 (File_read::make_view): Remove test of whole_file_view_.
6730 (File_read::find_or_make_view): Create whole_file_view_ if
6731 necessary.
6732 (File_read::clear_views): Replace bool parameter with enum;
6733 adjust all callers. Don't delete views with permanent data;
6734 do delete cached views and views from archives if
6735 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6736 if clearing the corresponding view.
6737 * fileread.h (File_read::Clear_views_mode): New enum.
6738 (File_read::View::is_permanent_view): New method.
6739 (File_read::clear_views): Replace bool parameter
6740 with enum; adjust all callers.
6741 * options.h (General_options): Change keep_files_mapped option;
6742 add map_whole_files.
6743 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6744 releasing the file.
6745 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6746 the file.
6747
6748 2010-03-10 David S. Miller <davem@davemloft.net>
6749
6750 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6751
6752 2010-03-09 Sriraman Tallam <tmsriram@google.com>
6753
6754 * icf.cc (get_section_contents): Add '@' marker after processing the
6755 merge reloc.
6756
6757 2010-03-08 Doug Kwan <dougkwan@google.com>
6758
6759 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6760 due to a conversion warning.
6761 (Arm_relobj::update_output_local_symbol_count): Check for local
6762 symbol with unset output index.
6763
6764 2010-03-05 Ian Lance Taylor <iant@google.com>
6765
6766 * options.h (class General_options): Add --spare-dynamic-tags.
6767 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6768 --spare-dynamic-tags.
6769
6770 2010-03-05 Ian Lance Taylor <iant@google.com>
6771
6772 * incremental.cc: Include "libiberty.h".
6773
6774 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6775
6776 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6777 function, is_info_ member.
6778 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6779 (Versions::Versions): Update caller.
6780 (Versions::define_base_version): Likewise.
6781 (Versions::add_def): Likewise.
6782
6783 2010-03-03 Sriraman Tallam <tmsriram@google.com>
6784
6785 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6786 (Scan::possible_function_pointer_reloc): New function.
6787 (Scan::local_reloc_may_be_function_pointer): Change to call
6788 possible_function_pointer_reloc.
6789 (Scan::global_reloc_may_be_function_pointer): Ditto.
6790 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6791 relocations in ".data.rel.ro._ZTV" section.
6792 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6793 * testsuite/icf_safe_so_test.cc: Ditto.
6794 * testsuite/icf_safe_test.cc: Ditto.
6795 * testsuite/icf_safe_test.sh: Ditto.
6796
6797 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6798 Ian Lance Taylor <iant@google.com>
6799
6800 * target-reloc.h (relocate_section): Check the symbol table index
6801 for -1U before setting the local symbol index.
6802 (scan_relocatable_relocs): If copying the relocation, record that
6803 the local symbol is required.
6804 * object.h (Symbol_value::is_output_symtab_index_set): New
6805 function.
6806 (Symbol_value::may_be_discarded_from_output_symtab): New
6807 function.
6808 (Symbol_value::has_output_symtab_entry): New function.
6809 (Symbol_value::needs_output_symtab_entry): Remove.
6810 (Symbol_value::output_symtab_index): Make sure the symbol index is
6811 set.
6812 (Symbol_value::set_output_symtab_index): Make sure the symbol
6813 index is not set. Make sure the new index is valid.
6814 (Symbol_value::set_must_have_output_symtab_entry): New function.
6815 (Symbol_value::has_output_dynsym_entry): New function.
6816 (Symbol_value::set_output_dynsym_index): Make sure the new index
6817 is valid.
6818 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6819 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6820 local symbol if permitted.
6821 (Sized_relobj::do_finalize_local_symbols): Call
6822 is_output_symtab_index_set rather than needs_output_symtab_entry.
6823 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6824 rather than needs_output_symtab_entry. Call
6825 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6826 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6827 is_output_symtab_index_set rather than needs_output_symtab_entry.
6828 * testsuite/discard_locals_relocatable_test.c: New file.
6829 * testsuite/discard_locals_test.sh: Test -r.
6830 * testsuite/Makefile.am (check_DATA): Add
6831 discard_locals_relocatable_test1.syms,
6832 discard_local_relocatable_test2.syms.
6833 (MOSTLYCLEANFILES): Likewise. Also add
6834 discard_locals_relocatable_test1.lout and
6835 discard_locals_relocatable_test2.out.
6836 (discard_locals_relocatable_test1.syms): New target.
6837 (discard_locals_relocatable_test.o): New target.
6838 (discard_locals_relocatable_test1.out): New target.
6839 (discard_locals_relocatable_test2.syms): New target.
6840 (discard_locals_relocatable_test2.out): New target.
6841 (various): Add missing ../ld-new dependencies.
6842 * testsuite/Makefile.in: Rebuild.
6843
6844 2010-03-03 Nick Clifton <nickc@redhat.com>
6845
6846 * po/fi.po: New Finnish translation.
6847
6848 2010-03-01 Doug Kwan <dougkwan@google.com>
6849
6850 * layout.cc (Layout::Layout): Force section types of .init_array*,
6851 .preinit_array* and .fini_array* sections.
6852 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6853 Fix check of return value of std::string::find.().
6854 (Output_section::Input_section_sort_compare::operator()): Remove
6855 comment about .init_array.
6856 (Output_section::Input_section_sort_init_fini_compare::operator()):
6857 New method.
6858 (Output_section::sort_attached_input_sections): Handle .init_array
6859 and .fini_array specially.
6860 * output.h (Output_section::Inut_section_sort_compare): Update
6861 comment.
6862 (Output_section::Input_section_sort_init_fini_compare): New struct.
6863
6864 2010-02-26 Doug Kwan <dougkwan@google.com>
6865
6866 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6867 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6868 * testsuite/debug_msg.sh: Avoid matching source line number for
6869 use of global variable undef_int.
6870
6871 2010-02-26 Doug Kwan <dougkwan@google.com>
6872
6873 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6874 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6875 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6876 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6877 * options.cc (General_options::General_options): Initialize member
6878 fix_v4bx_.
6879 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6880 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6881 and rm_no_fix_v4bx.stdout
6882 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6883 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6884 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6885 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6886 and arm_no_fix_v4bx.
6887 * Makefile.in: Regenerate.
6888 * testsuite/arm_fix_v4bx.s: New file.
6889 * testsuite/arm_fix_v4bx.sh: Ditto.
6890
6891 2010-02-24 Doug Kwan <dougkwan@google.com>
6892
6893 * arm.cc (Target_arm::got_section): Make the .got section the first
6894 non RELRO section in the data segment.
6895 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6896 suffixes of section names.
6897
6898 2010-02-24 Doug Kwan <dougkwan@google.com>
6899
6900 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6901 flags and attributes merging if an input file is a binary file.
6902 * fileread.cc (Input_file::open): Record format of original file.
6903 * fileread.h (Input_file::Format): New enum type.
6904 (Input_file::Input_file): Initialize data member format_.
6905 (Input_file::format): New method definition.
6906 (Input_file::format_):: New data member.
6907
6908 2010-02-24 Doug Kwan <dougkwan@google.com>
6909
6910 * arm.cc (Arm_output_data_got): New class.
6911 (ARM_TCB_SIZE): New constant
6912 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6913 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6914 If user uses a script with a SECTIONS clause, issue only a warning
6915 for a misplaced EXIDX input section. Otherwise, issue an error.
6916 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6917 garbage collection.
6918 (Target_arm::got_mode_index_entry): Handle static linking.
6919 (Target_arm::Scan::local): Ditto.
6920 (Target_arm::Scan::global): Ditto.
6921 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6922 all incorrectly implemented relocations.
6923 (Target_arm::fix_exidx_coverage): Pass layout to
6924 Arm_output_section::fix_exidx_coverage.
6925 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6926 from ".ARM.exidx." and ".ARM.extab.".
6927
6928 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6929
6930 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6931 section if it does not already exist.
6932 * attributes.cc (Attributes_section_data::Attributes_section_data):
6933 Don't crash if size is zero.
6934
6935 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6936 Ian Lance Taylor <iant@google.com>
6937
6938 * gold.cc (queue_middle_tasks): If no input files were opened,
6939 exit.
6940 * workqueue.h (Task_function::Task_function): Assert that there is
6941 a blocker.
6942
6943 2010-02-22 Doug Kwan <dougkwan@google.com>
6944
6945 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6946 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6947 types to avoid warnings due to different uint64_t implementations
6948 on different hosts.
6949
6950 2010-02-21 Doug Kwan <dougkwan@google.com>
6951
6952 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6953 handling of the maximum backward branch offset.
6954 (Arm_relocate_functions::thumb_branch_common): Ditto.
6955 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6956 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6957 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6958 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6959 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6960 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6961 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6962 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6963 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6964 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6965 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6966 thumb2_bl_out_of_range.o): New rules.
6967 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6968 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6969 thumb2_bl_out_of_range
6970 * testsuite/Makefile.in: Regenerate.
6971 * testsuite/arm_bl_in_range.s: New file.
6972 * testsuite/arm_bl_out_of_range.s: Ditto.
6973 * testsuite/arm_branch_in_range.sh: Ditto.
6974 * testsuite/arm_branch_range.t: Ditto.
6975 * testsuite/thumb2_branch_range.t: Ditto.
6976 * testsuite/thumb_bl_in_range.s: Ditto.
6977 * testsuite/thumb_bl_out_of_range.s: Ditto.
6978 * testsuite/thumb_branch_range.t: Ditto.
6979
6980 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6981
6982 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6983 Add reloc offset information.
6984 * icf.cc (get_section_contents): Change iterators to point to the new
6985 vectors. Add reloc offset information to the contents.
6986 * icf.h (Icf::Sections_reachable_info): New typedef.
6987 (Icf::Sections_reachable_list): New typedef.
6988 (Icf::Offset_info): New typedef.
6989 (Icf::Reloc_info): New struct typedef.
6990 (Icf::Reloc_info_list): New typedef.
6991 (Icf::symbol_reloc_list): Delete method.
6992 (Icf::addend_reloc_list): Delete method.
6993 (Icf::section_reloc_list): Delete method.
6994 (Icf::reloc_info_list): New method.
6995 (Icf::reloc_info_list_): New member.
6996
6997 2010-02-19 Doug Kwan <dougkwan@google.com>
6998
6999 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7000 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7001 * arm.cc (Arm_relocation_functions): New forward declaration.
7002 (Target_arm::Target_arm): Initialize new data members
7003 got_mod_index_offset_ and tls_base_symbol_defined_.
7004 (Target_arm::Relocate::relocate_tls): New method.
7005 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7006 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7007 New methods.
7008 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7009 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7010 (Target_arm::got_mod_index_offset_,
7011 Target_arm::tls_base_symbol_defined_): New data members.
7012 (Target_arm::Scan::local, Target::Scan::global,
7013 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7014 relocations.
7015
7016 2010-02-18 Doug Kwan <dougkwan@google.com>
7017
7018 * arm.cc (Arm_relobj::find_linked_text_section): New method.
7019 (Arm_relobj::make_exidx_input_section): Pass section index of linked
7020 text section as a parameter becuase some broken tools may not set
7021 the link in section header.
7022 (Target_arm::has_got_section): New method.
7023 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7024 without any mapping symbol as data only. Remove warning.
7025 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7026 link in its section header, try to discover the link by inspecting the
7027 REL31 relocation at the beginning of the section.
7028 (Target_arm::Scan::check_non_pic): Report name of offending relocation
7029 in error message.
7030 (Target_arm::Scan::global): Treat any reference to the symbol
7031 _GLOBAL_OFFSET_TABLE_ as a GOT access.
7032
7033 2010-02-12 Sriraman Tallam <tmsriram@google.com>
7034
7035 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7036 (Scan::global_reloc_may_be_function_pointer): New function.
7037 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7038 (Scan::global_reloc_may_be_function_pointer): New function.
7039 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7040 (Scan::global_reloc_may_be_function_pointer): New function.
7041 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7042 (Scan::global_reloc_may_be_function_pointer): New function.
7043 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7044 (Scan::global_reloc_may_be_function_pointer): New function.
7045 (Scan::possible_function_pointer_reloc): New function.
7046 (Target_x86_64::can_check_for_function_pointers): New function.
7047 * gc.h (gc_process_relocs): Scan relocation types to determine if
7048 function pointers were taken for targets that support it.
7049 * icf.cc (Icf::find_identical_sections): Include functions for
7050 folding in safe ICF whose pointer is not taken.
7051 * icf.h (Secn_fptr_taken_set): New typedef.
7052 (fptr_section_id_): New member.
7053 (section_has_function_pointers): New function.
7054 (set_section_has_function_pointers): New function.
7055 (check_section_for_function_pointers): New function.
7056 * options.h: Fix comment for safe ICF option.
7057 * target.h (can_check_for_function_pointers): New function.
7058 * testsuite/Makefile.am: Add icf_safe_so_test test case.
7059 Modify icf_safe_test for X86-64.
7060 * testsuite/Makefile.in: Regenerate.
7061 * testsuite/icf_safe_so_test.cc: New file.
7062 * testsuite/icf_safe_so_test.sh: New file.
7063 * testsuite/icf_safe_test.cc (kept_func_3): New function.
7064 (main): Change to take pointer to function kept_func_3.
7065 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7066 folding is done correctly for X86-64.
7067
7068 2010-02-12 David S. Miller <davem@davemloft.net>
7069
7070 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7071 is_symbolless parameter.
7072 (Output_reloc<SHT_REL>::is_symbolless): New.
7073 (Output_reloc<SHT_REL>::is_symbolless_): New.
7074 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7075 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7076 (Output_reloc<SHT_RELA>::is_symbolless): New.
7077 (Output_data_reloc::add_global): Handle is_symbolless.
7078 (Output_data_reloc::add_global_relative): Likewise.
7079 (Output_data_reloc::add_local): Likewise.
7080 (Output_data_reloc::add_local_relative): Likewise.
7081 (Output_data_reloc::add_symbolless_global_addend): New.
7082 (Output_data_reloc::add_symbolless_local_addend): New.
7083 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7084 is_symbolless.
7085 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7086 instead of ->is_relative_
7087 (Output_reloc::write): Likewise.
7088 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7089 (Output_reloc::write_rel): Simplify.
7090
7091 * sparc.cc (Target_sparc::Scan::local): Use
7092 ->add_symbolless_local_addend as needed.
7093 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7094 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
7095 based upon relocation offset.
7096
7097 2010-02-11 Doug Kwan <dougkwan@google.com>
7098
7099 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7100 (Target_arm::Scan::global): Ditto. Also remove a comment before the
7101 beginning of function.
7102 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7103 and MOVT_ABS relocations. Those are non issued in scanning. Fix
7104 parameter is_32bit in calls to should_apply_static_reloc.
7105 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7106 (check_DATA): Add arm_abs_global.stdout.
7107 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7108 arm_abs_global.stdout): New rules.
7109 (MOSTLLYCLEANFILES): Add arm_abs_global
7110 * Makefile.in: Regenerate.
7111 * testsuite/arm_abs_global.s: New file.
7112 * testsuite/arm_abs_global.sh: Ditto.
7113 * testsuite/arm_abs_lib.s: Ditto.
7114
7115 2010-02-11 Ian Lance Taylor <iant@google.com>
7116
7117 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7118 Read_relocs task.
7119 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
7120 Allocate_commons_task first.
7121 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7122 task, rather than symtab_lock_.
7123 (Gc_process_relocs::~Gc_process_relocs): New function.
7124 (Gc_process_relocs::is_runnable): Check this_blocker_.
7125 (Gc_process_relocs::locks): Use next_blocker_ rather than
7126 blocker_.
7127 (Scan_relocs::~Scan_relocs): New function.
7128 (Scan_relocs::is_runnable): Check this_blocker_ rather than
7129 symtab_lock_.
7130 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
7131 next_blocker_.
7132 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7133 fields. Add this_blocker_ and next_blocker_ fields. Adjust
7134 constructor accordingly.
7135 (class Gc_process_relocs): Likewise.
7136 (class Scan_relocs): Likewise.
7137 * common.h (class Allocate_commons_task): Remove symtab_lock_
7138 field, and corresponding constructor parameter.
7139 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7140 symtab_lock_.
7141 (Allocate_commons_task::locks): Likewise.
7142
7143 2010-02-11 Ian Lance Taylor <iant@google.com>
7144
7145 * gold-threads.h (class Once): Define.
7146 (class Initialize_lock): Rewrite as child of Once.
7147 * gold-threads.cc (class Once_initialize): Define.
7148 (once_pointer_control): New static variable.
7149 (once_pointer, once_arg): New static variables.
7150 (c_run_once): New static function.
7151 (Once::Once, Once::run_once, Once::internal_run): New functions.
7152 (class Initialize_lock_once): Remove.
7153 (initialize_lock_control): Remove.
7154 (initialize_lock_pointer): Remove.
7155 (initialize_lock_once): Remove.
7156 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7157 (Initialize_lock::initialize): Rewrite.
7158 (Initialize_lock::do_run_once): New function.
7159 * archive.cc (Archive::interpret_header): Only clear name if it is
7160 not already empty.
7161 * fileread.cc: Include "gold-threads.h"
7162 (file_counts_lock): New static variable.
7163 (file_counts_initialize_lock): Likewise.
7164 (File_read::release): Only increment counts when using --stats.
7165 Use a lock around the increment.
7166 * parameters.cc (class Set_parameters_target_once): Define.
7167 (set_parameters_target_once): New static variable.
7168 (Parameters::Parameters): Move here from parameters.h.
7169 (Parameters::set_target): Rewrite.
7170 (Parameters::set_target_once): New function.
7171 (Parameters::clear_target): Move here and rewrite.
7172 * parameters.h (class Parameters): Update declarations. Add
7173 set_parameters_target_once_ field.
7174 (Parameters::Parameters): Move to parameters.cc.
7175 (Parameters::clear_target): Likewise.
7176 * readsyms.cc (Read_symbols::do_group): Create a Start_group
7177 task.
7178 (Start_group::~Start_group): New function.
7179 (Start_group::is_runnable): New function.
7180 (Start_group::locks, Start_group::run): New functions.
7181 (Finish_group::run): Change saw_undefined to size_t.
7182 * readsyms.h (class Start_group): Define.
7183 (class Finish_group): Change saw_undefined_ field to size_t.
7184 (Finish_group::Finish_group): Remove saw_undefined and
7185 this_blocker parameters. Change all callers.
7186 (Finish_group::set_saw_undefined): New function.
7187 (Finish_group::set_blocker): New function.
7188 * symtab.h (class Symbol_table): Change saw_undefined to return
7189 size_t. Change saw_undefined_ field to size_t.
7190 * target-select.cc (Set_target_once::do_run_once): New function.
7191 (Target_selector::Target_selector): Initialize set_target_once_
7192 field. Don't initialize lock_ and initialize_lock_ fields.
7193 (Target_selector::instantiate_target): Rewrite.
7194 (Target_selector::set_target): New function.
7195 * target-select.h (class Set_target_once): Define.
7196 (class Target_selector): Update declarations. Make
7197 Set_target_once a friend. Remove lock_ and initialize_lock_
7198 fields. Add set_target_once_ field.
7199
7200 2010-02-10 Ian Lance Taylor <iant@google.com>
7201
7202 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7203 queueing any tasks.
7204 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
7205 (queue_middle_tasks): Add all blockers before queueing any tasks.
7206 (queue_final_tasks): Likewise.
7207 * token.h (Task_token::add_blockers): New function.
7208 * object.h (Input_objects::number_of_relobjs): New function.
7209
7210 2010-02-10 Ian Lance Taylor <iant@google.com>
7211
7212 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7213 shared, not if not position independent.
7214 * x86_64.cc (Relocate::relocate_tls): Likewise.
7215 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7216 (tls_pie_pic_test): New target.
7217 * testsuite/Makefile.in: Rebuild.
7218
7219 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7220 (tls_test_main_pie.o, tls_test_pie.o): New targets.
7221 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7222 * testsuite/Makefile.in: Rebuild.
7223
7224 2010-02-09 David S. Miller <davem@davemloft.net>
7225
7226 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7227 R_SPARC_RELATIVE using ->add_local_relative().
7228 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7229
7230 * output.h (Output_data_dynamic::add_section_size): New method
7231 that takes two Output_data objects.
7232 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7233 entry param. Handle it in initializers.
7234 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7235 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7236 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7237 arg.
7238 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7239 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7240 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7241 for dynrel_includes_plt.
7242 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7243 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7244 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7245 before .rela.plt
7246 (Target_sparc::do_finalize_sections): Update to pass true for
7247 dynrel_includes_plt.
7248 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7249 output before .rela.plt
7250 (Target_powerpc::do_finalize_sections): Update to pass true for
7251 dynrel_includes_plt when 32-bit.
7252
7253 2010-02-08 Doug Kwan <dougkwan@google.com>
7254
7255 * arm.cc (Arm_relobj::simple_input_section_output_address): New
7256 method.
7257 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7258 Arm_relobj::scan_section_for_cortex_a8_stubs,
7259 Arm_relobj::do_relocation_section): Instead of calling
7260 Output_section::output_address, use faster
7261 Arm_relobj::simple_input_section_output_address.
7262
7263 2010-02-08 David S. Miller <davem@davemloft.net>
7264
7265 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7266 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7267 relocation helper function.
7268
7269 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7270 just like R_SPARC_GOT{10,13,22}.
7271 (Target_sparc::Scan::local): Likewise.
7272 (Target_sparc::Relocate:relocate): Likewise.
7273
7274 2010-02-06 Ian Lance Taylor <iant@google.com>
7275
7276 * configure.ac: Rewrite targetobjs duplicate removal code to use
7277 only shell constructs.
7278 * configure: Rebuild.
7279
7280 2010-02-05 Doug Kwan <dougkwan@google.com>
7281
7282 PR 11247
7283 * arm.cc (Arm_relobj::section_is_scannable): New method.
7284 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7285 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7286
7287 2010-02-04 Doug Kwan <dougkwan@google.com>
7288
7289 PR 11247
7290 * arm-reloc-property.cc (cstdio): Include.
7291 * configure.ac (targetobjs): Remove duplicates.
7292 * configure: Regenerate.
7293 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7294 big and little endian version for a given address size.
7295
7296 2010-02-03 Doug Kwan <dougkwan@google.com>
7297
7298 * arm-reloc-property.cc
7299 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7300 definition.
7301 * arm-reloc-property.h
7302 (Arm_reloc_property_table::get_implemented_static_reloc_property):
7303 New method definition.
7304 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7305 declaration.
7306 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7307 overflow to N.
7308 (GOT_PREL): Change implemented to Y.
7309 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7310 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7311 (Arm_relocate_functions::movw_abs_nc): Remove method.
7312 (Arm_relocate_functions::movt_abs): Ditto.
7313 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7314 (Arm_relocate_functions::thm_movt_abs): Ditto.
7315 (Arm_relocate_functions::movw_rel_nc): Ditto.
7316 (Arm_relocate_functions::movw_rel): Ditto.
7317 (Arm_relocate_functions::movt_rel): Ditto.
7318 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7319 (Arm_relocate_functions:thm_movw_rel): Ditto.
7320 (Arm_relocate_functions:thm_movt_rel): Ditto.
7321 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7322 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7323 New method definitions.
7324 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7325 (Arm_relocation_functions::arm_grp_ldr): Ditto.
7326 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7327 (Arm_relocation_functions::arm_grp_ldc): Ditto.
7328 (Target_arm::Relocate::relocate): Check for non-static or
7329 unimplemented relocation code and exit early. Change calls to
7330 Target_arm::reloc_uses_thumb_bit and
7331 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7332 instead. Refactor code to handle similar relocations to increase
7333 code sharing. Remove check for unsupported relocation code in switch
7334 statement.
7335 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7336 relocation property table to find out size. Change error message to
7337 print out the name of a relocation code instead of the numeric value.
7338 (Target_arm::scan_reloc_for_stub): Use relocation property table
7339 instead of calling Target_arm::reloc_uses_thumb_bit().
7340
7341 2010-02-02 Doug Kwan <dougkwan@google.com>
7342
7343 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7344 types of relaxed input section.
7345
7346 2010-02-02 Doug Kwan <dougkwan@google.com>
7347
7348 * Makefile.am (HFILES): Add arm-reloc-property.h.
7349 (DEFFILES): New.
7350 (TARGETSOURCES): Add arm-reloc-property.cc
7351 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7352 (libgold_a_SOURCES): $(DEFFILES)
7353 * Makefile.in: Regenerate.
7354 * arm-reloc-property.cc: New file.
7355 * arm-reloc-property.h: New file.
7356 * arm-reloc.def: New file.
7357 * arm.cc: Update comments.
7358 (arm-reloc-property.h): New included header.
7359 (arm_reloc_property_table): New global variable.
7360 (Target_arm::do_select_as_default_target): New method definition.
7361 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7362 arm-reloc-property to targ_extra_obj.
7363 * parameters.cc (set_parameters_target): Call
7364 Target::select_as_default_target().
7365 * target.h (Target::select_as_default_target): New method definition.
7366 (Target::do_select_as_default_target): Same.
7367
7368 2010-02-01 Doug Kwan <dougkwan@google.com>
7369
7370 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7371 first_output_text_section_.
7372 (Arm_exidx_fixup::first_output_text_section): New method definition.
7373 (Arm_exidx_fixup::first_output_text_section_): New data member.
7374 (Arm_exidx_fixup::process_exidx_section): Record the first text
7375 output section seen.
7376 (Arm_output_section::fix_exidx_coverage): Set correct linked section
7377 and entsize in output section header.
7378
7379 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7380
7381 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7382 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7383 (Arm_relocate_functions::thm_alu11): New Method.
7384 (Arm_relocate_functions::thm_pc8): New Method.
7385 (Arm_relocate_functions::thm_pc12): New Method.
7386 (Target_arm::Scan::local): Handle the relocations.
7387 (Target_arm::Scan::global): Likewise.
7388 (Target_arm::Relocate::relocate): Likewise.
7389 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7390
7391 2010-01-29 Doug Kwan <dougkwan@google.com>
7392
7393 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7394 of relocation types as ld.
7395
7396 2010-01-29 Doug Kwan <dougkwan@google.com>
7397
7398 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7399 to public.
7400 (Arm_relocate_functions::thumb_branch_common): Ditto.
7401 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7402 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7403 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7404 Arm_relocate_functions::jump24): Remove.
7405 (Target_arm::Relocate::relocate): Adjust code to call
7406 Arm_relocation_functions::arm_branch_common and
7407 Arm_relocation_functions::thumb_branch_common instead of their removed
7408 wrappers. Merge switch-cases together to reduce source code size.
7409
7410 2010-01-29 Doug Kwan <dougkwan@google.com>
7411
7412 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7413 output_local_symbol_count_needs_update_.
7414 (Arm_relobj::output_local_symbol_count_needs_update,
7415 Arm_relobj::set_output_local_symbol_count_needs_update,
7416 Arm_relobj::update_output_local_symbol_count): New methods.
7417 (Arm_relobj::output_local_symbol_count_needs_update_): New data
7418 member.
7419 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7420 of pointed function as in a R_ARM_PREL31 relocation.
7421 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7422 for output local symbol count updating.
7423 (Target_arm::do_relax): Update output local symbol counts in objects
7424 if necessary.
7425 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7426
7427 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7428
7429 * arm.cc: Added support for the ARM relocations:
7430 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7431 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7432 (Arm_relocate_functions::movw_rel_nc): Renamed (was
7433 movw_prel_nc).
7434 (Arm_relocate_functions::movw_rel): New method.
7435 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7436 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7437 thm_movw_prel_nc).
7438 (Arm_relocate_functions::thm_movw_rel): New method.
7439 (Arm_relocate_functions::thm_movt_rel): Renamed (was
7440 thm_movt_prel).
7441 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7442 relocations.
7443 (Target_arm::Scan::global): Likewise.
7444 (Target_arm::Relocate::relocate): Likewise.
7445 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7446 Likewise.
7447
7448 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7449
7450 * arm.cc: Added support for ARM group relocations.
7451 (Target_arm::reloc_needs_sym_origin): New method.
7452 (Arm_relocate_functions::calc_grp_kn): New method.
7453 (Arm_relocate_functions::calc_grp_residual): New method.
7454 (Arm_relocate_functions::calc_grp_gn): New method.
7455 (Arm_relocate_functions::arm_grp_alu): New Method.
7456 (Arm_relocate_functions::arm_grp_ldr): New Method.
7457 (Arm_relocate_functions::arm_grp_ldrs): New Method.
7458 (Arm_relocate_functions::arm_grp_ldc): New Method.
7459 (Target_arm::Scan::local): Handle the ARM group relocations.
7460 (Target_arm::Scan::global): Likewise.
7461 (Target_arm::Relocate::relocate): Likewise.
7462 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7463 Likewise.
7464
7465 2010-01-26 Doug Kwan <dougkwan@google.com>
7466
7467 * arm.cc (set): Include.
7468 (class Arm_exidx_fixup): Change type of last_input_section_ to const
7469 pointer type.
7470 (Arm_output_section::Text_section_list): New type.
7471 (Arm_output_section::append_text_sections_to_list): New method.
7472 (Arm_output_section::fix_exidx_coverage): Ditto.
7473 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7474 (Arm_relobj::convert_input_section_to_relaxed_section): Use
7475 Relobj::set_section_offset() instead of
7476 Sized_relobj::invalidate_section_offset().
7477 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7478 parameter for section headers. Ignore relocation sections for
7479 unallocated sections and EXIDX sections.
7480 (Target_arm::fix_exidx_coverage): New method.
7481 (Target_arm::output_section_address_less_than): New type.
7482 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7483 linked text section instead of the EXIDX section.
7484 (Arm_output_section::create_stub_group): Add an assertion to check
7485 that this is not an EXIDX output section.
7486 (Arm_output_section::append_text_sections_to_list): New method.
7487 (Arm_output_section::fix_exidx_coverage): Ditto.
7488 (Arm_relobj::scan_sections_for_stubs): Adjust call to
7489 Arm_relobj::section_needs_reloc_stub_scanning.
7490 (Target_arm::do_relax): Fix EXIDX output section coverage in the
7491 first pass.
7492 (Target_arm::fix_exidx_coverage): New method.
7493 * object.h (Relobj::set_output_section): New method.
7494 (Sized_relobj::invalidate_section_offset): Remove method.
7495 (Sized_relobj::do_invalidate_section_offset): Remove method.
7496 (Sized_relobj::do_set_section_offset): Handle offset value -1.
7497
7498 2010-01-25 Doug Kwan <dougkwan@google.com>
7499
7500 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7501 Fix warning due to signed and unsigned comparison on a 32-bit host.
7502
7503 2010-01-22 Doug Kwan <dougkwan@google.com>
7504
7505 * arm.cc (Target_arm::do_relax): Record an output section for section
7506 offset adjustment it contains any stub table that has changed.
7507 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7508 offsets in an output section if necessary.
7509 * output.cc (Output_section::Output_section): Initialize
7510 section_offsets_need_adjustments_.
7511 (Output_section::add_input_section_for_script): Renamed to
7512 Output_section::add_simple_input_section.
7513 (Output_section::save_states): Add a comment.
7514 (Output_section::discard_states): New method defintion.
7515 (Output_section::adjust_section_offsets): Same.
7516 * output.h (Output_section::add_input_section_for_script): Renamed to
7517 Output_section::add_simple_input_section.
7518 (Output_section::discard_states): New method declaration.
7519 (Output_section::adjust_section_offsets): Same.
7520 (Output_section::section_offsets_need_adjustment,
7521 Output_section::set_section_offsets_need_adjustment): New method
7522 definitions.
7523 (Output_section::section_offsets_need_adjustment_): New data member.
7524 * script-sections.cc
7525 (Output_section_element_input::set_section_address): Adjust code for
7526 renaming of Output_section::add_input_section_for_script.
7527 (Orphan_output_section::set_section_address): Same.
7528
7529 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7530
7531 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7532 Fix_v4bx enum values .
7533 * gold/options.h (General_options): New option definitions.
7534 (General_options::fix_v4bx): New method.
7535 (General_options::Fix_v4bx): New enum.
7536 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7537 (General_options::parse_fix_v4bx_interworking): New method.
7538
7539 2010-01-22 Doug Kwan <dougkwan@google.com>
7540
7541 * arm.cc (Arm_exidx_fixup): New class.
7542
7543 2010-01-21 Doug Kwan <dougkwan@google.com>
7544
7545 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7546 classes.
7547 (Arm_exidx_section_offset_map): New type.
7548
7549 2010-01-21 Doug Kwan <dougkwan@google.com>
7550
7551 * arm.cc (Arm_exidx_input_section): New class.
7552 (Arm_relobj::exidx_input_section_by_link,
7553 Arm_relobj::exidx_input_section_by_shndx,
7554 Arm_relobj::make_exidx_input_section): New methods.
7555 (read_arm_attributes_section): Remove.
7556 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7557 information about them.
7558 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7559 to here.
7560
7561 2010-01-20 Doug Kwan <dougkwan@google.com>
7562
7563 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7564 Input_section_specifier to Section_id.
7565 (Target_arm::new_arm_input_section: Adjust code for change of key
7566 type.
7567 (Target_arm::find_arm_input_section): Ditto.
7568 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7569 (Section_id): Remove.
7570 (Garbage_collection::Section_id_hash): Remove.
7571 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7572 (Section_id): Remove.
7573 (Icf::Section_id_hash): Remove.
7574 * object.h (Section_id, Const_section_id, Section_id_hash,
7575 Const_section_id_hash): New type definitions.
7576 * output.cc (Output_section::add_relaxed_input_section): Change to
7577 use Const_section_id instead of Input_section_specifier as key type.
7578 (Output_section::add_merge_input_section): Ditto.
7579 (Output_section::build_relaxation_map): Change to use Section_id
7580 instead of Input_section_specifier as key type.
7581 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7582 Ditto.
7583 (Output_section::convert_input_sections_to_relaxed_sections): Change
7584 to use Const_section_id instead of Input_section_specifier as key type.
7585 (Output_section::find_merge_section): Ditto.
7586 (Output_section::find_relaxed_input_section): Ditto.
7587 * output.h (Input_section_specifier): Remove class.
7588 (Output_section::Output_section_data_by_input_section_map): Change
7589 key type to Const_section_id.
7590 (Output_section::Output_relaxed_input_section_by_input_section_map):
7591 Ditto.
7592 (Output_section::Relaxation_map): Change key type to Section_id.
7593
7594 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7595
7596 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7597 (class Arm_v4bx_stub): New class.
7598 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7599 (Stub_factory::make_arm_v4bx_stub): New method.
7600 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7601 (Stub_table::empty): Handle v4bx stubs.
7602 (Stub_table::add_arm_v4bx_stub): New method.
7603 (Stub_table::find_arm_v4bx_stub): New method.
7604 (Arm_relocate_functions::v4bx): New method.
7605 (Target_arm::fix_v4bx): New method.
7606 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7607 (Stub_table::relocate_stubs): Likewise.
7608 (Stub_table::do_write): Likewise.
7609 (Stub_table::update_data_size_and_addralign): Likewise.
7610 (Stub_table::finalize_stubs): Likewise.
7611 (Target_arm::Scan::local): Likewise.
7612 (Target_arm::Scan::global): Likewise.
7613 (Target_arm::do_finalize_sections): Likewise.
7614 (Target_arm::Relocate::relocate): Likewise.
7615 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7616 Likewise.
7617 (Target_arm::scan_reloc_for_stub): Likewise.
7618 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7619
7620 2010-01-19 Ian Lance Taylor <iant@google.com>
7621
7622 * output.cc (Output_section_headers::do_sized_write): Write large
7623 segment count to sh_info field.
7624 (Output_file_header::do_sized_write): For large segment count,
7625 write PN_XNUM to e_phnum field.
7626
7627 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7628
7629 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7630 (Arm_relocate_functions::thm_jump8): New function.
7631 (Arm_relocate_functions::thm_jump11): New function.
7632 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7633 R_ARM_THM_JUMP11.
7634 (Target_arm::Scan::global): Likewise.
7635 (Target_arm::Relocate::relocate): Likewise.
7636 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7637 Likewise.
7638
7639 2010-01-14 Doug Kwan <dougkwan@google.com>
7640
7641 * arm.cc (map, utility): Include headers.
7642 (Target_arm::apply_cortex_a8_workaround): New method.
7643 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7644 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7645 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7646 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7647 the --[no-]fix-cortex-a8 command line options.
7648 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7649 (Target_arm::relocate_stub): Use addend in instruction template.
7650 * options.h (DEFINE_bool): Set the user-set flag.
7651 (General_options): Add --[no-]-fix-cortex options.
7652 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7653 : Update fast look-up map after conversion.
7654
7655 2010-01-14 Sriraman Tallam <tmsriram@google.com>
7656
7657 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7658 in the first pass of do_layout.
7659
7660 2010-01-13 Doug Kwan <dougkwan@google.com>
7661
7662 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7663 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7664 apparent compiler problem of not folding static constant integral
7665 data members of elfcpp::Elf_sizes<32>.
7666
7667 2010-01-13 Doug Kwan <dougkwan@google.com>
7668
7669 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7670 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7671 Arm_relobj::scan_section_for_cortex_a8_erratum,
7672 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7673 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7674 sections to scan for relocation stubs into a new method
7675 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7676 relocation and Cortex-A8 stub scanning.
7677 (Target_arm::do_relax): Force stubs to be after stubbed sections
7678 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
7679 the beginning of a new relaxation pass. Update a comment.
7680 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7681
7682 2010-01-12 Ian Lance Taylor <iant@google.com>
7683
7684 * target-reloc.h (visibility_error): New inline function.
7685 (relocate_section): Call visibility_error.
7686 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7687 (MOSTLYCLEANFILES): Likewise.
7688 (protected_4_pic.o, protected_3.err): New targets.
7689 * testsuite/protected_4.cc: New file.
7690
7691 2010-01-12 Doug Kwan <dougkwan@google.com>
7692
7693 * arm.cc (Cortex_a8_reloc): New class.
7694 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7695 and cortex_a8_relocs_info_.
7696 (Target_arm::fix_cortex_a8): New method definition.
7697 (Target_arm::Cortex_a8_relocs_info): New type.
7698 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7699 New data member declarations.
7700 (Target_arm::scan_reloc_for_stub): Record information about
7701 relocations for THUMB branches that might be exempted from the
7702 Cortex-A8 workaround.
7703 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7704 at the beginning of a relaxation pass.
7705
7706 2010-01-12 Doug Kwan <dougkwan@google.com>
7707
7708 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7709 (Arm_relobj::Mapping_symbol_position,
7710 Arm_reloj::Mapping_symbol_position_less,
7711 Arm_relobj::Mapping_symbols_info): New types.
7712 (Target_arm::is_mapping_symbol_name): New method definition.
7713 (Arm_relobj::do_count_local_symbols): Save information about mapping
7714 symbols.
7715
7716 2010-01-11 Doug Kwan <dougkwan@google.com>
7717
7718 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7719 Arm_relocate_functions::thumb32_branch_upper,
7720 Arm_relocate_functions::thumb32_branch_lower,
7721 Arm_relocate_functions::thumb32_cond_branch_offset,
7722 Arm_relocate_functions::thumb32_cond_branch_upper,
7723 Arm_relocate_functions::thumb32_cond_branch_lower,
7724 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7725 branch offset encoding.
7726 (Arm_relocate_functions::thumb_branch_common): Use new branch
7727 offset encoding methods to avoid code duplication.
7728 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7729 (Stub_addend_reader::operator()): Use new branch encoding method
7730 to avoid code duplication.
7731
7732 2010-01-11 Doug Kwan <dougkwan@google.com>
7733
7734 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7735 (Target_arm::do_finalize_sections): Define special EXIDX section
7736 symbols only if referenced.
7737 * gc.h (Garbage_collection::add_reference): New method.
7738 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7739 code duplication.
7740
7741 2010-01-11 Ian Lance Taylor <iant@google.com>
7742
7743 * script.cc (Version_script_info::build_expression_list_lookup):
7744 Change complaing about duplicate wildcard match from error to
7745 warning.
7746
7747 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7748 of 2009-12-30.
7749 (Version_script_info::Version_script_info): Initialize globs_,
7750 default_version_, default_is_global_, and exact_. Don't
7751 initialize globals_ or locals_.
7752 (Version_script_info::build_lookup_tables): Build local symbols
7753 first.
7754 (Version_script_info::unquote): New function.
7755 (Version_script_info::add_exact_match): New function.
7756 (Version_script_info::build_expression_list_lookup): Remove lookup
7757 parameter. Add is_global parameter. Change all callers. Handle
7758 wildcard pattern specially. Unquote pattern. Call
7759 add_exact_match.
7760 (Version_script_info::get_name_to_match): New function.
7761 (Version_script_info::get_symbol_version): New function.
7762 (Version_script_info::get_symbol_version_helper): Remove.
7763 (Version_script_info::check_unmatched_names): Call unquote.
7764 * script.h (class Version_script_info): Change get_symbol_version
7765 to be non-inline and add is_global parameter; change all callers.
7766 Rewrite symbol_is_local. Update declarations. Define struct
7767 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7768 Remove globals_ and locals_ members. Add exact_, globs_,
7769 default_version_, is_global_.
7770 (Version_script_info::Glob): Remove pattern, add expression and
7771 is_global. Update constructor. Change all callers.
7772 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7773 default version.
7774 (Versions::symbol_section_contents): If a symbol is undefined, or
7775 defined in a dynamic object, set the version index to
7776 VER_NDX_LOCAL.
7777 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7778 symbol_is_local.
7779 (Symbol_table::add_from_pluginobj): Likewise.
7780 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7781
7782 2010-01-11 Doug Kwan <dougkwan@google.com>
7783
7784 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7785 (incremental_dump_LDADD): Add linking option for libintl.
7786 * Makefile.in: Regenerate.
7787
7788 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7789
7790 PR gold/11144
7791 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7792 instead of -Ds.
7793 * testsuite/Makefile.in: Regenerated.
7794
7795 2010-01-10 Doug Kwan <dougkwan@google.com>
7796
7797 * options.h (DEFINE_var): Use parentheses around argument varname__
7798 in macro body to avoid any unintended subsequent substitutions.
7799
7800 2010-01-10 Ian Lance Taylor <iant@google.com>
7801
7802 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7803 candidates before doing symbol resolution.
7804
7805 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7806 ODR candidates if only one is weak.
7807
7808 2010-01-08 Ian Lance Taylor <iant@google.com>
7809
7810 * script.cc (Version_script_info::build_expression_list_lookup):
7811 Don't warn about ambiguous version, just record the ambiguity.
7812 (Version_script_info::get_symbol_version_helper): Give error if
7813 version is ambiguous.
7814
7815 2010-01-08 Doug Kwan <dougkwan@google.com>
7816
7817 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7818 prev_data_size_ and prev_addralign_. Remove initializer for
7819 deleted data member has_been_changed_.
7820 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7821 to determine if the table is empty.
7822 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7823 Remove.
7824 (Stub_table::add_reloc_stub): Define method in class definition
7825 instead of just declaring it there.
7826 (Stub_table::add_cortex_a8_stub): New method definition.
7827 (Stub_table::update_data_size_and_addralign): Ditto.
7828 (Stub_table::finalize_stubs): Ditto.
7829 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7830 (Stub_table::do_addralign_): Return address alignment in the
7831 (Stub_table::do_reset_address_and_file_offset): Define method in
7832 class definition instead of declaring it there. Set current data
7833 size to be the data size of the previous pass.
7834 (Stub_table::set_final_data_size): Use current data size as the
7835 final data size.
7836 (Stub_table::relocate_stub): Change parameter type of stub from
7837 Reloc_stub pointer to Stub pointer.
7838 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7839 (Stub_table::Cortex_a8_stub_list): New typedef.
7840 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7841 Stub_table::prev_addralign_): New data member.
7842 (Arm_relobj::Arm_relobj): Initialize data member
7843 section_has_cortex_a8_workaround_.
7844 (Arm_relobj::section_has_cortex_a8_workaround,
7845 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7846 definitions.
7847 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7848 declarations.
7849 (Target_arm::relocate_stub): Change parameter type of stub from
7850 Reloc_stub pointer to Stub pointer.
7851 (Insn_template::size, Insn_template::alignment): Handle
7852 THUMB16_SPECIAL_TYPE.
7853 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7854 Stub_table::update_data_size_and_addralign,
7855 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7856 definitions.
7857 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7858 (Stub_table::do_write): Ditto.
7859 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7860
7861 2010-01-08 Ian Lance Taylor <iant@google.com>
7862
7863 PR 11108
7864 * symtab.h (class Symbol): Remove fields is_target_special_ and
7865 has_plt_offset_. Add field is_defined_in_discarded_section_.
7866 (Symbol::is_defined_in_discarded_section): New function.
7867 (Symbol::set_is_defined_in_discarded_section): New function.
7868 (Symbol::has_plt_offset): Rewrite.
7869 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7870 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7871 Don't initialize is_target_special_ or has_plt_offset_.
7872 Initialize is_defined_in_discarded_section_.
7873 (Symbol_table::add_from_relobj): If appropriate, set
7874 is_defined_in_discarded_section.
7875 * resolve.cc (Symbol::override_base_with_special): Don't test
7876 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7877 * target-reloc.h (relocate_section): Do special handling for
7878 symbols defined in discarded sections for global symbols as well
7879 as local symbols.
7880
7881 2010-01-08 Ian Lance Taylor <iant@google.com>
7882
7883 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7884 the SHT_SYMTAB case.
7885
7886 2010-01-08 Ian Lance Taylor <iant@google.com>
7887
7888 * object.cc (Sized_relobj::do_layout): Don't get confused if
7889 layout_eh_frame returns NULL.
7890
7891 2010-01-08 Ian Lance Taylor <iant@google.com>
7892
7893 PR 11084
7894 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7895 dynamic symbol table, use the normal symbol table.
7896 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7897 symbol table.
7898
7899 2010-01-08 Ian Lance Taylor <iant@google.com>
7900
7901 PR 11072
7902 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7903 sections.
7904
7905 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7906
7907 * version.cc (print_version): Change to "Copyright 2010".
7908
7909 2010-01-08 Ian Lance Taylor <iant@google.com>
7910
7911 PR 10287
7912 PR 11063
7913 * i386.cc (class Target_i386): Change return type of plt_section
7914 to be non-const.
7915 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7916 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7917 tls_desc_rel_ field.
7918 (Output_data_plt_i386::rel_tls_desc): New function.
7919 (Target_i386::rel_tls_desc_section): New function.
7920 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7921 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7922 R_386_TLS_DESC reloc in rel_tls_desc_section.
7923 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7924 Define struct Tlsdesc_info.
7925 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7926 (Target_x86_64::do_reloc_symbol_index): New function.
7927 (Target_x86_64::add_tlsdesc_info): New function.
7928 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7929 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7930 tlsdesc_rel_ field.
7931 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7932 all callers.
7933 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7934 (Target_x86_64::rela_tlsdesc_section): New function.
7935 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7936 handling.
7937 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7938 (Target_x86_64::do_reloc_addend): New function.
7939 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7940 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7941 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7942 (Output_reloc::type): New function.
7943 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7944 (Output_reloc::is_target_specific): New function.
7945 (Output_reloc::target_arg): New function.
7946 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7947 absolute relocs and target specific relocs.
7948 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7949 add_target_specific.
7950 (class Output_data_reloc) [SHT_RELA]: Likewise.
7951 * output.cc (Output_reloc::Output_reloc): Add four new versions
7952 for absolute relocs and target specific relocs.
7953 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7954 (Output_reloc::get_symbol_index): Likewise.
7955 (Output_reloc::local_section_offset): Check that local_sym_index_
7956 is not TARGET_CODE or 0.
7957 (Output_reloc::symbol_value): Likewise.
7958 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7959 reloc.
7960 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7961 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7962 functions.
7963 * layout.cc (add_target_dynamic_tags): Use output section for
7964 DT_PLTRELSZ and DT_JMPREL.
7965
7966 2010-01-07 Ian Lance Taylor <iant@google.com>
7967
7968 PR 11061
7969 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7970 function.
7971 (class Output_data_reloc_generic): Define.
7972 (class Output_data_reloc_base): Change base class to
7973 Output_data_reloc_generic. Change add() method to call
7974 bump_relative_reloc_count for a relative reloc. Remove
7975 sort_relocs_ field.
7976 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7977 to sort_relocs().
7978 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7979 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7980 appropriate.
7981 * layout.h (class Layout): Update declaration.
7982
7983 2010-01-07 Ian Lance Taylor <iant@google.com>
7984
7985 * output.h (class Output_data): Add const version of
7986 output_section and do_output_section.
7987 (class Output_section_data): Add const version of
7988 do_output_section.
7989 (class Output_section): Likewise.
7990 * layout.cc (Layout::add_target_dynamic_tags): New function.
7991 * layout.h (class Layout): Update declarations.
7992 * arm.cc (Target_arm::do_finalize_sections): Use
7993 add_target_dynamic_tags.
7994 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7995 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7996 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7997 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7998
7999 2010-01-07 Ian Lance Taylor <iant@google.com>
8000
8001 PR 11042
8002 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8003 object as needed.
8004
8005 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
8006 Ian Lance Taylor <iant@google.com>
8007
8008 PR 11019
8009 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8010 Xindex::read_symtab_xindex.
8011
8012 2010-01-07 Doug Kwan <dougkwan@google.com>
8013
8014 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8015 (Insn_template::thumb16_bcond_insn): New method declaration.
8016 (Insn_template): Fix spelling.
8017 (Stub::thumb16_special): New method declaration.
8018 (Stub::do_write): Define virtual method which was previously pure
8019 virtual.
8020 (Stub::do_thumb16_special): New method declaration.
8021 (Stub::do_fixed_endian_write): New template member.
8022 (Reloc_stub::do_write): Remove.
8023 (Reloc_stub::do_fixed_endian_write): Remove.
8024 (Cortex_a8_stub): New class definition.
8025 (Stub_factory::make_cortex_a8_stub): New method definition.
8026 (Stub_factory::Stub_factory): Add missing static storage class
8027 qualifier for elf32_arm_stub_a8_veneer_blx.
8028
8029 2010-01-07 Ian Lance Taylor <iant@google.com>
8030
8031 PR 10980
8032 * options.h (class General_options): Add --warn-unresolved-symbols
8033 and --error-unresolved-symbols.
8034 * errors.cc (Errors::undefined_symbol): Implement
8035 --warn-unresolved-symbols.
8036
8037 * options.h (class General_options): Add -z text and -z textoff.
8038 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8039
8040 2010-01-06 Sriraman Tallam <tmsriram@google.com>
8041
8042 * gc.h (Garbage_collection::Cident_section_map): New typedef.
8043 (Garbage_collection::cident_sections): New function.
8044 (Garbage_collection::add_cident_section): New function.
8045 (Garbage_collection::cident_sections_): New member.
8046 (gc_process_relocs): Add references to sections whose names are C
8047 identifiers.
8048 * gold.h (cident_section_start_prefix): New constant.
8049 (cident_section_stop_prefix): New constant.
8050 (is_cident): New function.
8051 * layout.cc (Layout::define_section_symbols): Replace string constants
8052 with the newly defined constants.
8053 * object.cc (Sized_relobj::do_layout): Track sections whose names are
8054 C identifiers.
8055 * testsuite/Makefile.am: Add gc_orphan_section_test.
8056 * testsuite/Makefile.in: Regenerate.
8057 * testsuite/gc_orphan_section_test.cc: New file.
8058 * testsuite/gc_orphan_section_test.sh: New file.
8059
8060 2010-01-06 Ian Lance Taylor <iant@google.com>
8061
8062 PR 10980
8063 * options.h (class General_options): Add --warn-shared-textrel.
8064 * layout.cc (Layout::finish_dynamic_section): Implement
8065 --warn-shared-textrel.
8066
8067 PR 10980
8068 * options.h (class General_options): Add --warn-multiple-gp.
8069
8070 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8071
8072 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8073 $(THREADSLIB) and $(LIBDL).
8074 * Makefile.in: Rebuild.
8075
8076 2010-01-06 Ian Lance Taylor <iant@google.com>
8077
8078 PR 10980
8079 * options.cc (General_options::parse_section_start): New function.
8080 (General_options::section_start): New function.
8081 (General_options::General_options): Initialize all members.
8082 * options.h: Include <map>
8083 (class General_options): Add --section-start. Add section_starts_
8084 member.
8085 * layout.cc (Layout::attach_allocated_section_to_segment): If
8086 --section-start was used, set the address of the segment. Remove
8087 local sort_sections.
8088 (Layout::relaxation_loop_body): If the address of the load segment
8089 has been set by --section-start, don't use it.
8090 * output.h (Output_segment::update_flags_for_output_section): New
8091 function.
8092 * output.cc (Output_segment::add_output_section): Call
8093 update_flags_for_output_section.
8094
8095 2010-01-05 Ian Lance Taylor <iant@google.com>
8096
8097 PR 10980
8098 * options.h (class General_options): Add --undefined-version.
8099 * script.cc (struct Version_expression): Add was_matched_by_symbol
8100 field.
8101 (Version_script_info::matched_symbol): New function.
8102 (Version_script_info::get_symbol_version_helper): Call
8103 matched_symbol.
8104 (Version_script_info::check_unmatched_names): New function.
8105 * script.h (class Version_script_info): Update declarations.
8106 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8107
8108 * options.h (class General_options): Use DEFINE_bool_alias for
8109 allow_multiple_definition.
8110 * resolve.cc (Symbol_table::should_override): Don't test
8111 allow_multiple_definition.
8112
8113 PR 10980
8114 * options.h (class General_options): Add --cref.
8115 * main.cc (main): Print cref table if --cref. Don't close mapfile
8116 until after printing cref table.
8117 * cref.cc: Include "symtab.h".
8118 (class Cref_inputs): Define Cref_table_compare and Cref_table.
8119 (Cref_table_compare::operator()): New function.
8120 (Cref_inputs::gather_cref): New function.
8121 (filecol): New static const.
8122 (Cref_inputs::print_cref): New function.
8123 (Cref::print_cref): New function.
8124 * cref.h: Include <cstdio>.
8125 (class Cref): Update declarations.
8126 * mapfile.h (Mapfile::file): New function.
8127 * object.h (class Object): Define Symbols. Declare virtual
8128 do_get_global_symbols.
8129 (Object::get_global_symbols): New function.
8130 * object.cc (Input_objects::add_object): Pass object to cref_ if
8131 --cref.
8132 (Input_objects::archive_start): Likewise.
8133 (Input_objects::archive_stop): Likewise.
8134 (Input_objects::print_cref): New function.
8135 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8136 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8137 --cref.
8138 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8139 function.
8140 * plugin.h (class Sized_pluginobj): Update declarations.
8141
8142 2010-01-05 Ian Lance Taylor <iant@google.com>
8143
8144 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8145 to is_default_version. Rename insdef to insdefault.
8146 (Symbol_table::add_from_relobj): Rename def to is_default_version
8147 and local to is_forced_local.
8148 (Symbol_table::add_from_pluginobj): Likewise.
8149 (Symbol_table::add_from_dynobj): Likewise.
8150 (Symbol_table::define_special_symbol): Rename insdef to
8151 insdefault.
8152
8153 2010-01-04 Ian Lance Taylor <iant@google.com>
8154
8155 PR 10980
8156 * options.h (class General_options): Add
8157 --allow-multiple-definition and -z muldefs.
8158 * resolve.cc (Symbol_table::should_override): Don't warn about a
8159 multiple symbol definition if --allow-multiple-definition or -z
8160 muldefs.
8161
8162 PR 10980
8163 * options.h (class General_options): Add --add-needed and
8164 --copy-dt-needed-entries. Tweak --as-needed help entry.
8165 * object.cc (Input_objects::check_dynamic_dependencies): Give an
8166 error if --copy-dt-needed-entries aka --add-needed is used and
8167 would cause a change in behaviour.
8168
8169 PR 10980
8170 * options.h (class General_options): Add -G as a short version of
8171 --shared. Add no-op options -assert, -g, and -i.
8172
8173 2010-01-04 Sriraman Tallam <tmsriram@google.com>
8174
8175 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8176 check for .text or .gnu.linkonce.t sections.
8177 * icf.cc (Icf::find_identical_sections): Ditto.
8178 Change the detection for mangled function name within the section
8179 name.
8180 * icf.h (is_section_foldable_candidate): New function.
8181
8182 2009-12-30 Ian Lance Taylor <iant@google.com>
8183
8184 PR 10980
8185 * options.h (class General_options): Permit two dashes with
8186 --retain-symbols-file.
8187
8188 2009-12-30 Ian Lance Taylor <iant@google.com>
8189
8190 PR 10979
8191 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8192 don't put the file header and segment headers in the text
8193 segment.
8194
8195 PR 10979
8196 * common.cc (Sort_commons::operator()): Stabilize sort when both
8197 entries are NULL.
8198 (Symbol_table::do_allocate_commons_list): When allocating common
8199 symbols, skip a symbol which is no longer common.
8200 * symtab.h (Symbol::is_common): Test whether the symbol comes from
8201 an object before checking its type.
8202 * testsuite/common_test_2.c: New file.
8203 * testsuite/common_test_3.c: New file.
8204 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8205 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8206 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8207 (common_test_2_pic.o, common_test_2.so): New targets.
8208 (common_test_3_pic.o, common_test_3.so): New targets.
8209 * testsuite/Makefile.in: Rebuild.
8210
8211 PR 10979
8212 * script.cc (read_input_script): If we see a new SECTIONS clause,
8213 and we have added an input section, give an error.
8214 * layout.h (class Layout): Add have_added_input_section function.
8215 Add have_added_input_section_ field.
8216 * layout.cc (Layout::Layout): Initialize
8217 have_added_input_section_.
8218 (Layout::layout): Set have_added_input_section_.
8219 (Layout::layout_eh_frame): Likewise.
8220
8221 2009-12-30 Ian Lance Taylor <iant@google.com>
8222
8223 PR 10931
8224 * options.h (class General_options): Add --sort-common option.
8225 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8226 * common.cc (Sort_common): Add sort_order parameter to
8227 constructor. Add sort_order_ field.
8228 (Sort_commons::operator): Check sort_order_.
8229 (Symbol_table::allocate_commons): Determine the sort order.
8230 (Symbol_table::do_allocate_commons): Add sort_order parameter.
8231 Change all callers.
8232 (Symbol_table::do_allocate_commons_list): Likewise.
8233
8234 2009-12-30 Ian Lance Taylor <iant@google.com>
8235
8236 PR 10916
8237 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8238 symbols from this object, don't change the visibility of an
8239 undefined symbol.
8240 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8241
8242 2009-12-30 Ian Lance Taylor <iant@google.com>
8243
8244 PR 10861
8245 * script.h (class Version_script_info): Define Language enum.
8246 Update declarations. Define Glob, Exact, and Lookup types. Add
8247 new fields globals_, locals_, and is_finalized_.
8248 * script.cc: Various formatting fixes.
8249 (class Parser_closure): Change language_stack_ from a vector of
8250 std::string to one of Version_script_info::Language. Adjust all
8251 uses accordingly.
8252 (class Lazy_demangler): Remove.
8253 (struct Version_expression): Change language from std::string to
8254 Version_script_info::Language.
8255 (Version_script_info::Version_script_info): New function.
8256 (Version_script_info::~Version_script_info): Don't call clear.
8257 (Version_script_info::finalize): New function.
8258 (Version_script_info::build_lookup_tables): New function.
8259 (Version_script_info::build_expression_list_lookup): New
8260 function.
8261 (Version_script_info::get_symbol_version_helper): Rewrite to use
8262 lookup tables.
8263 (Version_script_info::print_expression_list): Adjust to use
8264 Version_script_info::Language.
8265 (script_push_lex_into_version_mode): Check that the version script
8266 has not been finalized.
8267 (version_script_push_lang): Change language string to
8268 Version_script_info::Language.
8269 * options.cc (Command_line::version_script): New function.
8270 * options.h (class General_options): Add finalize_dynamic_list
8271 function. Change version_script from declaration to definition.
8272 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8273 * testsuite/version_script.map: Remove duplicate def of foo.
8274 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8275 version_script.map.
8276 * testsuite/Makefile.in: Rebuild.
8277
8278 2009-12-30 Ian Lance Taylor <iant@google.com>
8279
8280 PR 10843
8281 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8282 if the input symbol index is 0, make the output symbol index 0.
8283
8284 2009-12-30 Ian Lance Taylor <iant@google.com>
8285
8286 PR 10670
8287 * options.h (class General_options): Add -x/--discard-all.
8288 * object.cc (Sized_relobj::do_count_local_symbols): Handle
8289 --discard-all. If the local symbol needs a dynamic entry, check
8290 that before handling --discard-locals.
8291
8292 2009-12-30 Ian Lance Taylor <iant@google.com>
8293
8294 PR 10450
8295 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8296 flags to PF_R.
8297 (Output_segment::add_output_section): Don't change the flags if
8298 the type is PT_TLS.
8299
8300 PR 10450
8301 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8302 GNU hash table if they need a dynamic value. Otherwise, don't add
8303 them if they are defined in a dynamic object or are forced local.
8304
8305 2009-12-29 Ian Lance Taylor <iant@google.com>
8306
8307 PR 10450
8308 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8309 .gnu.hash table for a 32-bit target.
8310
8311 PR 10450
8312 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8313 regular and a dynamic object only needs a dynamic symbol table
8314 entry if it is externally visible.
8315
8316 PR 10450
8317 * i386.cc (class Target_i386): Initialize global_offset_table_ in
8318 constructor. Add global_offset_table_ field.
8319 (Target_i386::got_section): Set global_offset_table_.
8320 (Target_i386::do_finalize_sections): Set global_offset_table_
8321 size.
8322 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8323 in constructor. Add global_offset_table_ field.
8324 (Target_x86_64::got_section): Set global_offset_table_.
8325 (Target_x86_64::do_finalize_sections): Set global_offset_table_
8326 size.
8327
8328 * layout.cc (Layout::Layout): Initialize increase_relro_.
8329 (Layout::get_output_section): Add is_relro, is_last_relro, and
8330 is_first_non_relro parameters. Change all callers.
8331 (Layout::choose_output_section): Likewise.
8332 (Layout::add_output_section_data): Likewise.
8333 (Layout::make_output_section): Likewise.
8334 (Layout::set_segment_offsets): Clear increase_relro when using a
8335 linker script.
8336 * layout.h (class Layout): Add increase_relro method. Add
8337 increase_relro_ field. Update declarations.
8338 * output.cc (Output_section::Output_section): Initialize
8339 is_last_relro_ and is_first_non_relro_.
8340 (Output_segment::add_output_section): Group relro sections is
8341 do_sort is true. Handle is_last_relro and is_first_non_relro.
8342 (Output_segment::maximum_alignment): Remove relro handling.
8343 (Output_segment::set_section_addresses): Add increase_relro
8344 parameter. Change all callers. Add initial alignment to align
8345 relro sections on separate page. Remove old relro handling.
8346 (Output_segment::set_section_list_addresses): Remove in_relro
8347 parameter. Change all callers.
8348 (Output_segment::set_offset): Add increase parameter. Change all
8349 callers. Remove old relro handling.
8350 * output.h (class Output_section): Add new methods: is_last_relro,
8351 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8352 Add is_last_relro_ and is_first_non_relro_ fields.
8353 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8354 Create separate .got.plt section. Call increase_relro.
8355 * x86_64.cc (Target_x86_64::got_section): Likewise.
8356 * testsuite/relro_script_test.t: Add .got.plt.
8357
8358 PR 10450
8359 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8360 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8361 (Layout::finalize): Call set_dynamic_symbol_size.
8362 (Layout::set_dynamic_symbol_size): New function.
8363 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
8364 set_dynamic_symbol_size.
8365
8366 PR 10450
8367 * output.h (class Output_section): Add is_entsize_zero_ field.
8368 * output.cc (Output_section::Output_section): Initialize
8369 is_entsize_zero_.
8370 (Output_section::set_entsize): If two different entsizes are
8371 requested, force it to zero.
8372 (Output_section::add_input_section): Set flags for .debug_str
8373 before updating section flags. Set entsize.
8374 (Output_section::update_flags_for_input_section): Set SHF_MERGE
8375 and SHF_STRING if all input sections have those flags.
8376
8377 2009-12-29 Rafael Espindola <espindola@google.com>
8378
8379 * main.cc (main): Fix the sys time reporting.
8380 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8381 reporting.
8382
8383 2009-12-29 Sriraman Tallam <tmsriram@google.com>
8384
8385 * options.cc (General_options::parse_version): Allow -v to exit
8386 without an error if there is nothing to link.
8387
8388 2009-12-29 Ian Lance Taylor <iant@google.com>
8389
8390 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8391 using a version of gcc before 4.1.
8392 * configure: Rebuild.
8393
8394 2009-12-28 Chris Demetriou <cgd@google.com>
8395
8396 * attributes.cc (Output_attributes_section_data::do_write): Use
8397 std::vector::front rather than std::vector::data.
8398
8399 2009-12-28 Ian Lance Taylor <iant@google.com>
8400
8401 * symtab.h (class Symbol_table): Add enum Defined.
8402 * resolve.cc (Symbol_table::should_override): Add defined
8403 parameter. Change all callers. Test whether object is NULL
8404 before calling a method on it.
8405 (Symbol_table::report_resolve_problem): Add defined parameter.
8406 Change all callers.
8407 (Symbol_table::should_override_with_special): Likewise.
8408 * symtab.cc (Symbol_table::define_in_output_data): Add defined
8409 parameter. Change all callers.
8410 (Symbol_table::do_define_in_output_data): Likewise.
8411 (Symbol_table::define_in_output_segment): Likewise.
8412 (Symbol_table::do_define_in_output_segment): Likewise.
8413 (Symbol_table::define_as_constant): Likewise.
8414 (Symbol_table::do_define_as_constant): Likewise.
8415 * script.h (class Symbol_assignment): Add is_defsym parameter to
8416 constructor; change all callers.
8417 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8418 parameter. Change all callers. Add is_defsym_ field.
8419 (class Parser_closure): Add parsing_defsym parameter to
8420 constructor; change all callers. Add parsing_defsym accessor
8421 function. Add parsing_defsym_ field.
8422
8423 2009-12-28 Ian Lance Taylor <iant@google.com>
8424
8425 * gold.cc (queue_middle_tasks): Fix formatting.
8426 * object.cc (Relobj::is_section_name_included): Likewise.
8427
8428 2009-12-23 Ian Lance Taylor <iant@google.com>
8429
8430 * i386.cc (Target_i386::do_calls_non_split): Recognize
8431 -fsplit-stack prologue for a function with a static chain.
8432 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8433 -fsplit-stack prologue when using %r11.
8434
8435 2009-12-21 Sriraman Tallam <tmsriram@google.com>
8436
8437 * options.cc (General_options::parse_version): Make -v continue and do
8438 the link like GNU ld does.
8439
8440 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
8441
8442 * Makefile.am (CCFILES): Add timer.cc.
8443 (HFILES): Add timer.h.
8444 * configure.ac: Check for sysconf and times.
8445 * main.cc: include timer.h.
8446 (main): Use Timer instead of get_run_time.
8447 * timer.cc: New.
8448 * timer.h: New.
8449 * workqueue.cc: include timer.h.
8450 (Workqueue::find_and_run_task):
8451 Report user, sys and wall time.
8452 * Makefile.in: Regenerate.
8453 * config.in: Regenerate.
8454 * configure: Regenerate.
8455
8456 2009-12-16 Doug Kwan <dougkwan@google.com>
8457
8458 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8459 sections.
8460 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8461 relaxed input sections.
8462 * output.cc (Output_section::find_relaxed_input_section): Change
8463 return type to Output_relaxed_input_section pointer. Adjust code
8464 for new type of relaxed_input_section_map_.
8465 * output.h (Output_section::find_relaxed_input_section): Change
8466 return type to Output_relaxed_input_section pointer.
8467 (Output_section::Output_relaxed_input_section_by_input_section_map):
8468 New type.
8469 (Output_section::relaxed_input_section_map_): Change type to
8470 Output_section::Output_relaxed_input_section_by_input_section_map.
8471 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8472 input section.
8473
8474 2009-12-15 Ian Lance Taylor <iant@google.com>
8475
8476 * layout.cc (Layout::create_shstrtab): Only write out after input
8477 sections if we are compressing debug sections.
8478
8479 2009-12-15 Ian Lance Taylor <iant@google.com>
8480
8481 * archive.cc (Archive::add_symbols): Only look up a symbol without
8482 a version if there is, in fact, a version.
8483
8484 2009-12-14 Ian Lance Taylor <iant@google.com>
8485
8486 Revert -Wshadow changes, all changes from:
8487 2009-12-11 Doug Kwan <dougkwan@google.com>
8488 2009-12-11 Nick Clifton <nickc@redhat.com>
8489 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8490
8491 2009-12-11 Doug Kwan <dougkwan@google.com>
8492
8493 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8494 due to -Wshadow.
8495 * attributes.cc (Object_attribute::size): Ditto.
8496 (Attributes_section_data::size): Ditto.
8497 (Attributes_section_data::Attributes_section_data): Ditto.
8498 (Output_attributes_section_data::do_write): Ditto.
8499 * attributes.h (Object_attribute::set_type): Ditto.
8500 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8501
8502 2009-12-11 Nick Clifton <nickc@redhat.com>
8503
8504 * archive.cc: Fix shadowed variable warnings.
8505 * arm.cc: Likewise.
8506 * compressed_output.cc: Likewise.
8507 * compressed_output.h: Likewise.
8508 * configure: Likewise.
8509 * dwarf_reader.cc: Likewise.
8510 * dynobj.cc: Likewise.
8511 * dynobj.h: Likewise.
8512 * ehframe.cc: Likewise.
8513 * ehframe.h: Likewise.
8514 * errors.cc: Likewise.
8515 * expression.cc: Likewise.
8516 * fileread.cc: Likewise.
8517 * fileread.h: Likewise.
8518 * freebsd.h: Likewise.
8519 * i386.cc: Likewise.
8520 * icf.cc: Likewise.
8521 * incremental.h: Likewise.
8522 * layout.cc: Likewise.
8523 * layout.h: Likewise.
8524 * mapfile.cc: Likewise.
8525 * merge.cc: Likewise.
8526 * merge.h: Likewise.
8527 * object.cc: Likewise.
8528 * object.h: Likewise.
8529 * options.h: Likewise.
8530 * output.cc: Likewise.
8531 * output.h: Likewise.
8532 * parameters.cc: Likewise.
8533 * plugin.cc: Likewise.
8534 * powerpc.cc: Likewise.
8535 * reduced_debug_output.cc: Likewise.
8536 * reduced_debug_output.h: Likewise.
8537 * reloc.cc: Likewise.
8538 * reloc.h: Likewise.
8539 * resolve.cc: Likewise.
8540 * script-sections.cc: Likewise.
8541 * script.cc: Likewise.
8542 * script.h: Likewise.
8543 * sparc.cc: Likewise.
8544 * symtab.cc: Likewise.
8545 * symtab.h: Likewise.
8546 * target-select.cc: Likewise.
8547 * target-select.h: Likewise.
8548 * token.h: Likewise.
8549 * workqueue.cc: Likewise.
8550 * workqueue.h: Likewise.
8551 * x86_64.cc: Likewise.
8552
8553 2009-12-10 Doug Kwan <dougkwan@google.com>
8554
8555 * arm.cc (attributes.h): New include.
8556 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8557 (Arm_relobj::~Arm_relobj): Delete object pointed by
8558 attributes_section_data_.
8559 (Arm_relobj::attributes_section_data): New method definition.
8560 (Arm_relobj::attributes_section_data_): New data member declaration.
8561 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8562 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8563 attributes_section_data_.
8564 (Arm_dynobj::attributes_section_data): New method definition.
8565 (Arm_dynobj::attributes_section_data_): New data member declaration.
8566 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8567 initialization value of may_use_blx_ to false.
8568 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8569 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8570 object attributes to compute results instead of hard-coding.
8571 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8572 Target_arm::get_secondary_compatible_arch,
8573 Target_arm::set_secondary_compatible_arch
8574 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8575 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8576 New method declarations.
8577 (Target_arm::get_aeabi_object_attribute): New method definition.
8578 (Target_arm::attributes_section_data_): New data member declaration.
8579 (read_arm_attributes_section): New template definition.
8580 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8581 (Arm_dynobj::do_read_symbols): Ditto.
8582 (Target_arm::do_finalize_sections): Merge attributes sections from
8583 input. Check for BLX use after attributes section merging.
8584 Fix __exidx_start and __exidx_end visibility. Create an
8585 .ARM.attributes section if necessary.
8586 (Target_arm::get_secondary_compatible_arch,
8587 Target_arm::set_secondary_compatible_arch,
8588 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8589 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8590 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8591 New method definitions.
8592
8593 2009-12-09 Ian Lance Taylor <iant@google.com>
8594
8595 * plugin.cc (Plugin::load): Don't cast from void* to a function
8596 pointer.
8597
8598 2009-12-09 Ian Lance Taylor <iant@google.com>
8599
8600 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8601 information fields.
8602
8603 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8604
8605 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8606 Replace two_file_shared_1.so with two_file_shared_2.so.
8607 * testsuite/Makefile.in: Regenerated.
8608
8609 2009-12-08 Doug Kwan <dougkwan@google.com>
8610
8611 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8612 (HFILES): Add attributes.h and int_encoding.h.
8613 * Makefile.in: Regenerate.
8614 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8615 function definitions to int_encoding.cc
8616 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8617 prototypes to int_encoding.h
8618 * reduced_debug_output.cc (int_encoding.h): New include.
8619 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8620 function definitions to int_encoding.cc
8621 (insert_into_vector, read_from_pointer): Move template definitions to
8622 int_encoding.h
8623 * attributes.cc: New file.
8624 * attributes.h: New file.
8625 * int_encoding.cc: New file.
8626 * int_encoding.h: New file.
8627
8628 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
8629
8630 PR gold/11055
8631 * incremental-dump.cc (dump_incremental_inputs): New.
8632 (main): Use dump_incremental_inputs.
8633
8634 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8635
8636 PR gold/10893
8637 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8638 checking elfcpp::STT_FUNC.
8639 (Target_i386::Relocate::relocate): Likewise.
8640 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8641
8642 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8643 symbols from shared libraries into normal FUNC symbols.
8644
8645 * symtab.h (Symbol): Add is_func and use it.
8646
8647 2009-12-05 Doug Kwan <dougkwan@google.com>
8648
8649 * arm.cc (Target_arm::arm_info): Initialize new fields
8650 attributes_section and attributes_vendor.
8651 * i386.cc (Target_i386::i386_info): Same.
8652 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8653 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8654 fields attributes_section and attributes_vendor.
8655 * sparc.cc (Target_sparc::sparc_info): Same.
8656 * target.h (Target::attributes_section, Target::attributes_vendor,
8657 Target::is_attributes_section, Target::attribute_arg_type,
8658 Target::attributes_order): New method definitions.
8659 (Target::Target_info::attributes_section,
8660 Target::Target_info::attributes_vendor): New fields.
8661 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8662 virtual method definitions.
8663 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8664 attributes_section and attributes_vendor.
8665 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8666
8667 2009-12-05 Doug Kwan <dougkwan@google.com>
8668
8669 * arm.cc: Update comments about interworking and stub generation.
8670 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8671 considered as non-PIC.
8672 (Arm_relocate_functions::base_abs): Fix formatting.
8673 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8674 of function to use GOT entry address instead of offset.
8675 (Target_arm::Scan::global): Issue an error if a symbol would need a
8676 PLT does not get one because it is untyped. Remove code to create
8677 dynamic symbols for relative branches.
8678 (Target_arm::Relocate::relocate: Use 0 instead of false since function
8679 takes unsigned integer instead of boolean.
8680
8681 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
8682
8683 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8684 (two_file_test_LDADD): Likewise.
8685 (common_test_1_LDADD): Likewise.
8686 (exception_test_LDADD) Likewise.
8687 (weak_test_LDADD): Likewise.
8688 (many_sections_test_LDADD): Likewise.
8689 (initpri1_LDADD): Likewise.
8690 (script_test_1_LDADD): Likewise.
8691 (script_test_2_LDADD): Likewise.
8692 (justsyms_LDADD): Likewise.
8693 (binary_test_LDADD): Likewise.
8694 (large_LDADD): Likewise.
8695 * testsuite/Makefile.in: Regenerated.
8696
8697 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
8698
8699 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8700 (Symbol_table::override_with_special): Likewise.
8701 (Symbol_table::add_from_object): Likewise.
8702
8703 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8704
8705 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8706 Don't set the data_offset twice.
8707
8708 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8709
8710 * testsuite/Makefile.in: Regenerate.
8711
8712 2009-12-03 Doug Kwan <dougkwan@google.com>
8713
8714 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8715 (Target_arm::do_finalize_sections): Add parameter for symbol table
8716 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8717 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8718 parameter for symbol table pointer.
8719 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8720 an additional parameter for a pointer to symbol table.
8721 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8722 parameter for a symbol table pointer.
8723 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8724 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8725 Ditto.
8726 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8727 parameter for a symbol table pointer.
8728
8729 2009-12-03 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): Move ...
8734 * incremental.h (Incremental_inputs_header)
8735 (Incremental_inputs_header_write, Incremental_inputs_entry)
8736 (Incremental_inputs_entry_write): here.
8737
8738 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8739
8740 * incremental.cc (make_sized_incremental_binary): Set the target.
8741 Error if it is incompatible.
8742 * output.h (Output_file): Add filename method.
8743
8744 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8745
8746 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8747 from the get_* methods.
8748
8749 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8750
8751 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8752 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8753 Write 0 for the data_offset of scripts.
8754
8755 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8756
8757 * testsuite/Makefile.am: Add the incremental_test.sh test.
8758 * testsuite/incremental_test.sh: New.
8759 * testsuite/incremental_test_1.c: New.
8760 * testsuite/incremental_test_2.c: New.
8761
8762 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
8763
8764 * incremental-dump.cc (main): Fix typos.
8765
8766 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
8767
8768 PR gold/11025
8769 * incremental-dump.cc (main): Use llu to print 64 bit values.
8770
8771 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8772 H.J. Lu <hongjiu.lu@intel.com>
8773
8774 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8775 $(LIBDL).
8776 (incremental_dump_LDADD): Likewise.
8777 * Makefile.in: Regenerated.
8778
8779 2009-11-25 Doug Kwan <dougkwan@google.com>
8780
8781 Revert:
8782
8783 2009-11-25 Doug Kwan <dougkwan@google.com>
8784
8785 * arm.cc (Target_arm::Target_arm): Move method definition
8786 outside of class definition. Add code to handle
8787 --target1-rel, --target1-abs and --target2= options.
8788 (Target_arm::get_reloc_reloc_type): Change method to be
8789 non-static and const.
8790 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8791 New data member declaration.
8792 (Target_arm::Scan::local, Target_arm::Scan::global,
8793 Target_arm::Relocate::relocate,
8794 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8795 Adjust call to Target_arm::get_real_reloc_type.
8796 (Target_arm::get_real_reloc_type): Use command line options
8797 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8798 * options.h (--target1-rel, --target1-abs, --target2): New
8799 ARM-only options.
8800
8801 2009-11-25 Doug Kwan <dougkwan@google.com>
8802
8803 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8804 class definition. Add code to handle --target1-rel, --target1-abs
8805 and --target2= options.
8806 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8807 and const.
8808 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8809 member declaration.
8810 (Target_arm::Scan::local, Target_arm::Scan::global,
8811 Target_arm::Relocate::relocate,
8812 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8813 call to Target_arm::get_real_reloc_type.
8814 (Target_arm::get_real_reloc_type): Use command line options to
8815 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8816 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8817 options.
8818
8819 2009-11-25 Doug Kwan <dougkwan@google.com>
8820
8821 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8822 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8823 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8824 formatting.
8825 (Arm_relocate_functions::thm_call): Replace body with a call to
8826 Arm_relocate_functions::thumb_branch_common.
8827 (Arm_relocate_functions::thm_jump24,
8828 Arm_relocate_functions::thm_xpc22): New method definitions.
8829 (Arm_relocate_functions::thumb_branch_common): New method definition.
8830 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8831 operator.
8832 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8833 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8834
8835 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8836
8837 * Makefile.am: Build incremental-dump
8838 * Makefile.in: Regenerate.
8839 * incremental-dump.cc: New.
8840 * incremental.cc (Incremental_inputs_header_data,
8841 Incremental_inputs_entry_data): Move to incremental.h
8842 * incremental.h: (Incremental_inputs_header_data,
8843 Incremental_inputs_entry_data): Move from incremental.cc
8844
8845 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8846
8847 * incremental.cc (Incremental_inputs_header,
8848 Incremental_inputs_header_write, Incremental_inputs_entry,
8849 Incremental_inputs_entry_write): Add a typedef with the data type.
8850
8851 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8852
8853 * incremental.cc (Incremental_inputs_header,
8854 Incremental_inputs_header_write, Incremental_inputs_entry,
8855 Incremental_inputs_entry_write): Update comment about which
8856 type has the filed descriptions.
8857
8858 2009-11-15 Doug Kwan <dougkwan@google.com>
8859
8860 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8861 (Arm_relocate_functions::arm_branch_common): Change method defintion
8862 in class definition to a method declaration and update list of formal
8863 parameters.
8864 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8865 Arm_relocation_functions::jump24): Adjust call to
8866 Arm_relocate_functions::arm_branch_common. Update list of formal
8867 parameters.
8868 (Arm_relocate_functions::xpc25): New method definition.
8869 (Arm_relocate_functions::arm_branch_common): Move method defintion
8870 out from class definition. Use stubs for mode-switching and extending
8871 branch ranges.
8872 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8873 specially. Change code to enable use of stubs in ARM branches.
8874
8875 2009-11-10 Doug Kwan <dougkwan@google.com>
8876
8877 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8878 in method declaration.
8879 (Target_arm::relocate_stub): New method declaration.
8880 (Target_arm::default_target): Change to return a pointer instead of
8881 a const reference.
8882 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8883 Target_arm::default_target.
8884 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8885 method definition.
8886 (Target_arm::relocate_section): Adjust view.
8887 (Target_arm::relocate_stub): New method definition.
8888
8889 2009-11-10 Doug Kwan <dougkwan@google.com>
8890
8891 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8892 a format warning.
8893 * incremental.cc (open_incremental_binary): Initialized local
8894 variables to avoid warnings.
8895 * object.cc (make_elf_object): Ditto.
8896 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8897 a format warning.
8898
8899 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8900
8901 PR gold/10930
8902 * testsuite/plugin_test.c: Include "config.h".
8903
8904 2009-11-09 Doug Kwan <dougkwan@google.com>
8905
8906 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8907 (arm_symbol_value): Remove.
8908 (Arm_relocate_functions::arm_branch_common,
8909 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8910 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8911 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8912 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8913 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8914 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8915 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8916 Arm_relocate_functions::thm_mobw_abs_nc,
8917 Arm_relocate_functions::thm_mov_abs,
8918 Arm_relocate_functions::movw_prel_nc,
8919 Arm_relocate_functions::thm_movt_abs,
8920 Arm_relocate_functions::movt_prel,
8921 Arm_relocate_functions::thm_movw_prel_nc,
8922 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8923 (Target_arm::Relocate::relocate): Only decompose address into two
8924 parts if relocation type uses the thumb-bit and pass the actual
8925 bit instead of a flag indicating that the thumb-bit is used. Adjust
8926 calls to methods in Arm_relocate_functions for this change.
8927
8928 2009-11-08 Ian Lance Taylor <iant@google.com>
8929
8930 PR 10925
8931 * reloc.cc: Instantiate
8932 Sized_relobj::initialize_input_to_output_maps and
8933 Sized_relobj:free_input_to_output_maps.
8934
8935 2009-11-06 Ian Lance Taylor <iant@google.com>
8936
8937 PR 10876
8938 * defstd.cc (in_segment): Set only_if_ref true for "end".
8939
8940 2009-11-06 Doug Kwan <dougkwan@google.com>
8941
8942 * arm.cc (class Reloc_stub): Correct a comment.
8943 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8944 (Target_arm::scan_section_for_stubs): New method declaration.
8945 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8946 Change methods from private to protected.
8947 (Target_arm::do_may_relax): New method definition.
8948 (Target_arm::do_relax, Target_arm::group_sections,
8949 Target_arm::scan_reloc_for_stub,
8950 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8951 (Target_arm::arm_input_section_map_): New data member declaration.
8952 (Target_arm::scan_reloc_for_stub,
8953 Target_arm::scan_reloc_section_for_stubs,
8954 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8955 Target_arm::do_relax): New method definitions.
8956
8957 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8958
8959 * configure.ac: Check for (struct stat)::st_mtim
8960 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8961 * config.in: Regenerate.
8962 * configure: Regenerate.
8963
8964 2009-11-05 Ian Lance Taylor <iant@google.com>
8965
8966 PR 10910
8967 * output.cc (Output_segment::add_output_section): Add missing
8968 return statement.
8969
8970 2009-11-04 Ian Lance Taylor <iant@google.com>
8971
8972 PR 10880
8973 * object.h (class Object): Add is_needed and set_is_needed
8974 methods. Add is_needed_ field. Make bool fields into bitfields.
8975 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8976 defined in a dynamic object and referenced by a regular object,
8977 set is_needed for the dynamic object.
8978 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8979 if the file is marked with as_needed and it is not needed.
8980
8981 2009-11-04 Ian Lance Taylor <iant@google.com>
8982
8983 PR 10887
8984 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8985 tags if data is discarded by linker script.
8986 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8987 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8988 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8989 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8990
8991 2009-11-04 Ian Lance Taylor <iant@google.com>
8992
8993 * layout.cc (Layout::get_output_section): Add is_interp and
8994 is_dynamic_linker_section parameters. Change all callers.
8995 (Layout::choose_output_section): Likewise.
8996 (Layout::make_output_section): Likewise.
8997 (Layout::add_output_section_data): Add is_dynamic_linker_section
8998 parameter. Change all callers.
8999 * layout.h (class Layout): Update declarations.
9000 * output.h (class Output_section): Add is_interp, set_is_interp,
9001 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9002 Add is_interp_, is_dynamic_linker_section_ fields. Change
9003 generate_code_fills_at_write_ to a bitfield.
9004 * output.cc (Output_section::Output_sections): Initialize new
9005 fields.
9006 (Output_segment::add_output_section): Add do_sort parameter.
9007 Change all callers.
9008
9009 2009-11-03 Ian Lance Taylor <iant@google.com>
9010
9011 PR 10860
9012 * options.h (class General_options): Add --warn-common.
9013 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9014 merging two common symbols.
9015 (Symbol_table::should_override): Handle --warn-common when merging
9016 a common symbol with a defined symbol. Use report_resolve_problem
9017 for multiple definitions.
9018 (Symbol_table::report_resolve_problem): New function.
9019 * symtab.h (class Symbol_table): Declare report_resolve_problem.
9020
9021 2009-11-03 Doug Kwan <dougkwan@google.com>
9022
9023 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9024 stub_factory_.
9025 (Target_arm::stub_factory): New method definition.
9026 (Target_arm::new_arm_input_section,
9027 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9028 Target_arm::reloc_uses_thumb_bit): New method declarations.
9029 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9030 New type definitions.
9031 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9032 member declarations.
9033 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9034 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9035 New method definitions.
9036
9037 2009-11-03 Ian Lance Taylor <iant@google.com>
9038
9039 * options.h (class General_options): Add --warn_constructors.
9040
9041 2009-11-03 Ian Lance Taylor <iant@google.com>
9042
9043 PR 10893
9044 * defstd.cc (in_section): Add entries for __rel_iplt_start,
9045 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9046
9047 2009-11-03 Ian Lance Taylor <iant@google.com>
9048
9049 PR 10895
9050 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9051 --msgid-bugs-address.
9052 (install-pdf): New target.
9053 (install-data_yes): Look up one directory to find mkinstalldirs.
9054
9055 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
9056
9057 * po/Make-in (.po.gmo): Don't generate .gmo files in source
9058 tree.
9059
9060 2009-10-30 Doug Kwan <dougkwan@google.com>
9061
9062 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9063
9064 2009-10-30 Doug Kwan <dougkwan@google.com>
9065
9066 * arm.cc (Stub_addend_reader): New struct template definition
9067 and partial specializations.
9068 (Stub_addend_reader::operator()): New method definition for a
9069 partially specialized template.
9070
9071 2009-10-30 Doug Kwan <dougkwan@google.com>
9072
9073 * arm.cc (Arm_relobj::processor_specific_flags): New method
9074 definition.
9075 (Arm_relobj::do_read_symbols): New method declaration.
9076 (Arm_relobj::processor_specific_flags_): New data member declaration.
9077 (Arm_dynobj): New class definition.
9078 (Target_arm::do_finalize_sections): Add input_objects parameter.
9079 (Target_arm::do_adjust_elf_header): New method declaration.
9080 (Target_arm::are_eabi_versions_compatible,
9081 (Target_arm::merge_processor_specific_flags): New method declaration.
9082 (Target_arm::do_make_elf_object): New overloaded method definitions
9083 and declaration.
9084 (Arm_relobj::do_read_symbols): New method definition.
9085 (Arm_dynobj::do_read_symbols): Ditto.
9086 (Target_arm::do_finalize_sections): Add input_objects parameters.
9087 Merge processor-specific flags from all input objects.
9088 (Target_arm::are_eabi_versions_compatible,
9089 Target_arm::merge_processor_specific_flags,
9090 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9091 New method definitions.
9092 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9093 Input_objects pointer type parameter.
9094 * layout.cc (Layout::finalize): Pass input objects to target's.
9095 finalize_sections function.
9096 * output.cc (Output_file_header::do_sized_write): Set ELF file
9097 header's processor-specific flags.
9098 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9099 Input_objects pointer type parameter.
9100 * sparc.cc (Target_sparc::do_finalize_sections): Same.
9101 * target.h (Input_objects): New forward class declaration.
9102 (Target::processor_specific_flags,
9103 Target::are_processor_specific_flags_sect): New method definitions.
9104 (Target::finalize_sections): Add input_objects parameter.
9105 (Target::Target): Initialize processor_specific_flags_ and
9106 are_processor_specific_flags_set_.
9107 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9108 parameter.
9109 (Target::set_processor_specific_flags): New method definition.
9110 (Target::processor_specific_flags_,
9111 Target::are_processor_specific_flags_set_): New data member
9112 declarations.
9113 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9114 Input_objects pointer type parameter.
9115
9116 2009-10-30 Doug Kwan <dougkwan@google.com>
9117
9118 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9119
9120 2009-10-28 Ian Lance Taylor <iant@google.com>
9121
9122 * object.h (class Relobj): Drop options parameter from
9123 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9124 do_scan_relocs, do_relocate. Change all callers.
9125 (class Sized_relobj): Drop options parameters from
9126 do_gc_process_relocs, do_scan_relocs, do_relocate,
9127 do_relocate_sections, relocate_sections, emit_relocs_scan,
9128 emit_relocs_scan_reltype. Change all callers.
9129 (struct Relocate_info): Remove options field and all references to
9130 it.
9131 * reloc.h (class Read_relocs): Remove options constructor
9132 parameter and options_ field. Change all callers.
9133 (class Gc_process_relocs, class Scan_relocs): Likewise.
9134 (class Relocate_task): Likewise.
9135 * target-reloc.h (scan_relocs): Remove options parameter. Change
9136 all callers.
9137 (scan_relocatable_relocs): Likewise.
9138 * target.h (class Sized_target): Remove options parameter from
9139 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
9140 all callers.
9141 * gc.h (gc_process_relocs): Remove options parameter. Change all
9142 callers.
9143 * arm.cc: Update functions to remove options parameters.
9144 * i386.cc: Likewise.
9145 * powerpc.cc: Likewise.
9146 * sparc.cc: Likewise.
9147 * x86_64.cc: Likewise.
9148 * testsuite/testfile.cc: Likewise.
9149
9150 2009-10-28 Doug Kwan <dougkwan@google.com>
9151
9152 * arm.cc (Arm_relobj): New class definition.
9153 (Arm_relobj::scan_sections_for_stubs,
9154 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9155 New method definitions.
9156
9157 2009-10-28 Cary Coutant <ccoutant@google.com>
9158
9159 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9160 (Plugin::cleanup_done_): New member.
9161 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9162 (Plugin_manager::cleanup_done_): Remove.
9163 (Plugin_manager::add_input_file): Edit error message.
9164 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9165 (Plugin_manager::cleanup): Remove use of cleanup_done_.
9166
9167 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
9168
9169 * fileread.cc: (File_read::View::~View): Use the new
9170 data_ownership_ filed.
9171 (File_read::~File_read): Dispose the new whole_file_view_.
9172 (File_read::open): Mmap the whole file if needed.
9173 (File_read::open): Use whole_file_view_ instead of contents_.
9174 (File_read::find_view): Use whole_file_view_ if applicable.
9175 (File_read::do_read): Use whole_file_view_ instead of contents_.
9176 (File_read::make_view): Use whole_file_view_ instead of contents_,
9177 update File_read::View::View call.
9178 (File_read::find_or_make_view): Update File_read::View::View
9179 call.
9180 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9181 remove contents_
9182 (File_read::View::Data_ownership): New enum.
9183 (File_read::View::View): Replace bool mapped_ with Data_ownership
9184 argument.
9185 (File_read::View::mapped_): Remove (replaced by data_ownership_).
9186 (File_read::View::data_ownership_): New field.
9187 (File_read::contents_): Remove (replaced by whole_file_view_).
9188 (File_read::whole_file_view_): New field.
9189 * options.h (class General_options): Add --keep-files-mapped.
9190
9191 2009-10-27 Cary Coutant <ccoutant@google.com>
9192
9193 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9194 * testsuite/Makefile.am (plugin_test_5): New test case.
9195 * testsuite/Makefile.in: Regenerate.
9196
9197 2009-10-25 Doug Kwan <dougkwan@google.com>
9198
9199 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9200 from private to protected to allow access by child class.
9201 (Sized_relobj::do_relocate_sections): New method declaration.
9202 (Sized_relobj::relocate_sections): Virtualize.
9203 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9204 Sized_relobj::relocate_sections. Instantiate template explicitly
9205 for different target sizes and endianity.
9206
9207 2009-10-24 Doug Kwan <dougkwan@google.com>
9208
9209 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9210 (Arm_input_section::as_arm_input_section): New method.
9211 (Arm_output_section): New class definition.
9212 (Arm_output_section::create_stub_group,
9213 Arm_output_section::group_sections): New method definitions.
9214
9215 2009-10-22 Doug Kwan <dougkwan@google.com>
9216
9217 * arm.cc (Arm_input_section): New class definition.
9218 (Arm_input_section::init, Arm_input_section:do_write,
9219 Arm_input_section::set_final_data_size,
9220 Arm_input_section::do_reset_address_and_file_offset): New method
9221 definitions.
9222
9223 2009-10-21 Doug Kwan <dougkwan@google.com>
9224
9225 * arm.cc (Stub_table, Arm_input_section): New forward class
9226 declarations.
9227 (Stub_table): New class defintion.
9228 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9229 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9230 New method definition.
9231
9232 2009-10-21 Doug Kwan <dougkwan@google.com>
9233
9234 * arm.cc: Update copyright comments.
9235 (Target_arm): New forward class template declaration.
9236 (Arm_address): New type.
9237 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9238 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9239 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9240 constants.
9241 (Insn_template): Same.
9242 (DEF_STUBS): New macro.
9243 (Stub_type): New enum type.
9244 (Stub_template): New class definition.
9245 (Stub): Same.
9246 (Reloc_stub): Same.
9247 (Stub_factory): Same.
9248 (Target_arm::Target_arm): Initialize may_use_blx_ and
9249 should_force_pic_veneer_.
9250 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9251 Target_arm::should_force_pic_veneer,
9252 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9253 Target_arm::using_thumb_only, Target_arm:;default_target): New
9254 method defintions.
9255 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9256 New data member declarations.
9257 (Insn_template::size, Insn_template::alignment): New method defintions.
9258 (Stub_template::Stub_template): New method definition.
9259 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9260 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9261 (Stub_factory::Stub_factory): New method definition.
9262 * gold.h (string_hash): New template.
9263 * output.h (Input_section_specifier::hash_value): Use
9264 gold::string_hash.
9265 (Input_section_specifier::string_hash): Remove.
9266 * stringpool.cc (Stringpool_template::string_hash): Use
9267 gold::string_hash.
9268
9269 2009-10-20 Doug Kwan <dougkwan@google.com>
9270
9271 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9272 symbols of relaxed input sections.
9273 * output.h (Output_section::find_relaxed_input_section): Make
9274 method public.
9275
9276 2009-10-16 Doug Kwan <dougkwan@google.com>
9277
9278 * dynobj.cc (Versions::Versions): Initialize version_script_.
9279 Only insert base version symbol definition for a shared object
9280 if version script defines any version versions.
9281 (Versions::define_base_version): New method definition.
9282 (Versions::add_def): Check that base version is not needed.
9283 (Versions::add_need): Define base version lazily.
9284 * dynobj.h (Versions::define_base_version): New method declaration.
9285 (Versions::needs_base_version_): New data member declaration.
9286 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9287 (check_DATA): Add no_version_test.stdout.
9288 (libno_version_test.so, no_version_test.o no_version_test.stdout):
9289 New make rules.
9290 * testsuite/Makefile.in: Regenerate.
9291 * testsuite/no_version_test.c: New file.
9292 * testsuite/no_version_test.sh: Ditto.
9293
9294 2009-10-16 Doug Kwan <dougkwan@google.com>
9295
9296 * expression.cc (class Segment_start_expression): New class definition.
9297 (Segment_start_expression::value): New method definition.
9298 (script_exp_function_segment_start): Return a new
9299 Segment_start_expression.
9300 * gold/script-c.h (script_saw_segment_start_expression): New function
9301 prototype.
9302 * script-sections.cc (Script_sections::Script_sections): Initialize
9303 SAW_SEGMENT_START_EXPRESSION_ to false.
9304 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9305 and -Tbbs options to specify section addresses if given in
9306 command line and no SEGMENT_START expression is seen in a script.
9307 * script-sections.h (Script_sections::saw_segment_start_expression,
9308 Script_sections::set_saw_segment_start_expression): New method
9309 definition.
9310 (Script_sections::saw_segment_start_expression_): New data member
9311 declaration.
9312 * script.cc (script_saw_segment_start_expression): New function.
9313 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9314 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9315 script_test_7.sh and script_test_8.sh.
9316 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9317 script_test_8.stdout.
9318 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9319 (script_test_6, script_test_6.stdout, script_test_7,
9320 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9321 * Makefile.in: Regenerate.
9322 * testsuite/script_test_6.sh: New file.
9323 * testsuite/script_test_6.t: Same.
9324 * testsuite/script_test_7.sh: Same.
9325 * testsuite/script_test_7.t: Same.
9326 * testsuite/script_test_8.sh: Same.
9327
9328 2009-10-16 Doug Kwan <dougkwan@google.com>
9329
9330 * output.cc (Output_segment::set_section_list_address): Cast
9331 expressions to unsigned long long type to avoid format warnings.
9332
9333 2009-10-15 Ian Lance Taylor <iant@google.com>
9334
9335 * script.cc (Script_options::add_symbol_assignment): Always add a
9336 dot assignment to script_sections_.
9337 * script-sections.cc (Script_sections::add_dot_assignment):
9338 Initialize if necessary.
9339
9340 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9341 program headers with no load segment if there is a linker script.
9342
9343 * layout.cc (Layout::set_segment_offsets): Align the file offset
9344 to the segment aligment for -N or -n with no load segment.
9345 * output.cc (Output_segment::add_output_section): Don't crash if
9346 the first section is a TLS section.
9347 (Output_segment::set_section_list_addresses): Print an error
9348 message if the address moves backward in a linker script.
9349 * script-sections.cc
9350 (Output_section_element_input::set_section_addresses): Don't
9351 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9352 (Orphan_output_section::set_section_addresses): Likewise.
9353
9354 2009-10-15 Doug Kwan <dougkwan@google.com>
9355
9356 * layout.cc (Layout::finish_dynamic_section): Generate tags
9357 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9358 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9359 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9360
9361 2009-10-14 Ian Lance Taylor <iant@google.com>
9362
9363 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9364 fields.
9365 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9366 data_shdr fields of relinfo.
9367 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9368 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
9369 R_386_TLS_LDO_32, adjust based on section flags.
9370 (Target_i386::Relocate::fix_up_ldo): Remove.
9371
9372 2009-10-13 Ian Lance Taylor <iant@google.com>
9373
9374 Add support for -pie.
9375 * options.h (class General_options): Add -pie and
9376 --pic-executable.
9377 (General_options::output_is_position_independent): Test -pie.
9378 (General_options::output_is_executable): Return true if not shared
9379 and not relocatable.
9380 (General_options::output_is_pie): Remove.
9381 * options.cc (General_options::finalize): Reject incompatible uses
9382 of -pie.
9383 * gold.cc (queue_middle_tasks): A -pie link is not static.
9384 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9385 * symtab.cc (Symbol::final_value_is_known): Return false if
9386 output_is_position_independent.
9387 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9388 output_is_position_independent.
9389 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9390 output_is_position_independent.
9391 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9392 output_is_position_independent.
9393 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9394 two_file_pie_test.
9395 (basic_pie_test.o, basic_pie_test): New targets.
9396 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9397 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9398 (two_file_pie_test): New target.
9399 * testsuite/Makefile.in: Rebuild.
9400 * README: Remove note saying that -pie is not supported.
9401
9402 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
9403
9404 * options.h (class General_options): Add -init and -fini.
9405 * layout.cc (Layout::finish_dynamic_section): Emit
9406 given init and fini functions.
9407
9408 2009-10-13 Sriraman Tallam <tmsriram@google.com>
9409
9410 * gc.h (gc_process_relocs): Check if icf is enabled using new
9411 function.
9412 * gold.cc (queue_initial_tasks): Likewise.
9413 (queue_middle_tasks): Likewise.
9414 * object.cc (do_layout): Likewise.
9415 * symtab.cc (is_section_folded): Likewise.
9416 * main.cc (main): Likewise.
9417 * reloc.cc (Read_relocs::run): Likewise.
9418 (Sized_relobj::do_scan_relocs): Likewise.
9419 * icf.cc (is_function_ctor_or_dtor): New function.
9420 (Icf::find_identical_sections): Check if function is ctor or dtor when
9421 safe icf is chosen.
9422 * options.h (General_options::icf): Change option to be an enum.
9423 (Icf_status): New enum.
9424 (icf_enabled): New method.
9425 (icf_safe_folding): New method.
9426 (set_icf_status): New method.
9427 (icf_status_): New variable.
9428 * (options.cc) (General_options::finalize): Set icf_status_.
9429 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9430 icf_test and icf_keep_unique_test to use the --icf enum flag.
9431 * testsuite/icf_safe_test.sh: New file.
9432 * testsuite/icf_safe_test.cc: New file.
9433
9434 2009-10-12 Sriraman Tallam <tmsriram@google.com>
9435
9436 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9437 includes to gc.h and icf.h.
9438 * arm.cc: Include gc.h.
9439 * gold.cc: Likewise.
9440 * i386.cc: Likewise.
9441 * powerpc.cc: Likewise.
9442 * sparc.cc: Likewise.
9443 * x86_64.cc: Likewise.
9444 * gc.h: Include icf.h.
9445
9446 2009-10-11 Ian Lance Taylor <iant@google.com>
9447
9448 * plugin.cc: Include "gold.h" before other header files.
9449
9450 2009-10-10 Chris Demetriou <cgd@google.com>
9451
9452 * options.h (Input_file_argument::Input_file_type): New enum.
9453 (Input_file_argument::is_lib_): Replace with...
9454 (Input_file_argument::type_): New member.
9455 (Input_file_argument::Input_file_argument): Take Input_file_type
9456 'type' rather than boolean 'is_lib' as second argument.
9457 (Input_file_argument::is_lib): Use type_.
9458 (Input_file_argument::is_searched_file): New function.
9459 (Input_file_argument::may_need_search): Handle is_searched_file.
9460 * options.cc (General_options::parse_library): Support -l:filename.
9461 (General_options::parse_just_symbols): Update for Input_file_argument
9462 changes.
9463 (Command_line::process): Likewise.
9464 * archive.cc (Archive::get_file_and_offset): Likewise.
9465 * plugin.cc (Plugin_manager::release_input_file): Likewise.
9466 * script.cc (read_script_file, script_add_file): Likewise.
9467 * fileread.cc (Input_file::Input_file): Likewise.
9468 (Input_file::will_search_for): Handle is_searched_file.
9469 (Input_file::open): Likewise.
9470 * readsyms.cc (Read_symbols::get_name): Likewise.
9471 * testsuite/Makefile.am (searched_file_test): New test.
9472 * testsuite/Makefile.in: Regenerate.
9473 * testsuite/searched_file_test.cc: New file.
9474 * testsuite/searched_file_test_lib.cc: New file.
9475
9476 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9477 Ian Lance Taylor <iant@google.com>
9478
9479 * descriptor.cc: Include <cstdio> and "binary-io.h".
9480 (Descriptors::open): Open the files in binary mode always.
9481 * script.cc (Lex::get_token): Treat \r as whitespace.
9482
9483 2009-10-09 Ian Lance Taylor <iant@google.com>
9484
9485 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9486
9487 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9488 Ian Lance Taylor <iant@google.com>
9489
9490 * configure.ac: Check for readv function also.
9491 * fileread.cc (readv): Define if not HAVE_READV.
9492 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9493 does not exist.
9494 * config.in: Regenerate.
9495 * configure: Regenerate.
9496
9497 2009-10-09 Doug Kwan <dougkwan@google.com>
9498
9499 * layout.cc (Layout::make_output_section): Call target hook to make
9500 ordinary output section.
9501 (Layout::finalize): Adjust parameter list of call the
9502 Target::may_relax().
9503 * layout.h (class Layout::section_list): New method.
9504 * merge.h (Output_merge_base::entsize): Change visibility to public.
9505 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9506 New methods.
9507 (Output_merge_string::do_is_string): New method.
9508 * object.cc (Sized_relobj::do_setup): renamed from
9509 Sized_relobj::set_up.
9510 * object.h (Sized_relobj::adjust_shndx,
9511 Sized_relobj::initializ_input_to_output_maps,
9512 Sized_relobj::free_input_to_output_maps): Change visibilities to
9513 protected.
9514 (Sized_relobj::setup): Virtualize.
9515 (Sized_relobj::do_setup): New method declaration.
9516 (Sized_relobj::invalidate_section_offset,
9517 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9518 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9519 * options.cc (parse_int): New function.
9520 * options.h (parse_int): New declaration.
9521 (DEFINE_int): New macro.
9522 (stub_group_size): New option.
9523 * output.cc (Output_section::Output_section): Initialize memebers
9524 merge_section_map_, merge_section_by_properties_map_,
9525 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9526 (Output_section::add_input_section): Handled deferred code-fill
9527 generation and remove an old comment.
9528 (Output_section::add_relaxed_input_section): New method definition.
9529 (Output_section::add_merge_input_section): Use merge section by
9530 properties map to speed to search. Update merge section maps
9531 as appropriate.
9532 (Output_section::build_relaxation_map): New method definition.
9533 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9534 Same.
9535 (Output_section::relax_input_section): Renamed to
9536 Output_section::convert_input_sections_to_relaxed_sections and change
9537 interface to take a vector of pointers to relaxed sections.
9538 (Output_section::find_merge_section,
9539 Output_section::find_relaxed_input_section): New method definitions.
9540 (Output_section::is_input_address_mapped,
9541 Output_section::output_offset, Output_section::output_address):
9542 Use output section data maps to speed up searching.
9543 (Output_section::find_starting_output_address): Add comments.
9544 (Output_section::do_write,
9545 Output_section::write_to_postprocessing_buffer): Do code-fill
9546 generation as appropriate.
9547 (Output_section::get_input_sections): Invalidate relaxed input section
9548 map.
9549 (Output_section::restore_states): Adjust type of checkpoint .
9550 Invalidate relaxed input section map.
9551 * output.h (Output_merge_base): New class declaration.
9552 (Input_section_specifier): New class defintion.
9553 (class Output_relaxed_input_section) Change base class to
9554 Output_section_data_build.
9555 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9556 base class initializer.
9557 (Output_section::add_relaxed_input_section): New method declaration.
9558 (Output_section::Input_section): Change visibility to protected.
9559 (Output_section::Input_section::relobj,
9560 Output_section::Input_section::shndx): Handle relaxed input sections.
9561 Output_section::input_sections) Change visibility to protected. Also
9562 define overload to return a non-const pointer.
9563 (Output_section::Merge_section_properties): New class defintion.
9564 (Output_section::Merge_section_by_properties_map,
9565 Output_section::Output_section_data_by_input_section_map,
9566 Output_section::Relaxation_map): New types.
9567 (Output_section::relax_input_section): Rename method to
9568 Output_section::convert_input_sections_to_relaxed_sections and change
9569 interface to take a vector of relaxed section pointers.
9570 (Output_section::find_merge_section,
9571 Output_section::find_relaxed_input_section,
9572 Output_section::build_relaxation_map,
9573 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9574 New method declarations.
9575 (Output_section::merge_section_map_
9576 Output_section::merge_section_by_properties_map_,
9577 Output_section::relaxed_input_section_map_,
9578 Output_section::is_relaxed_input_section_map_valid_,
9579 Output_section::generate_code_fills_at_write_): New data members.
9580 * script-sections.cc
9581 (Output_section_element_input::set_section_addresses): Call
9582 current_data_size and addralign methods of relaxed input sections.
9583 (Orphan_output_section::set_section_addresses): Call current_data_size
9584 and addralign methods of relaxed input sections.
9585 * symtab.cc (Symbol_table::compute_final_value): Extract template
9586 from the body of Symbol_table::sized_finalize_symbol.
9587 (Symbol_table::sized_finalized_symbol): Call
9588 Symbol_table::compute_final_value.
9589 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9590 (Symbol_table::compute_final_value): New templated method declaration.
9591 * target.cc (Target::do_make_output_section): New method defintion.
9592 * target.h (Target::make_output_section): New method declaration.
9593 (Target::relax): Add more parameters for input objects, symbol table
9594 and layout. Adjust call to do_relax.
9595 (Target::do_make_output_section): New method declaration.
9596 (Target::do_relax): Add parameters for input objects, symbol table
9597 and layout.
9598
9599 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9600
9601 * pread.c: Include stdio.h.
9602
9603 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9604
9605 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9606 defined.
9607
9608 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9609
9610 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9611 Change read_shndx type to unsigned int.
9612 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9613 int.
9614 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9615 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9616 Change read_shndx type to unsigned int.
9617 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9618 int.
9619 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9620 * layout.cc (Layout::create_symtab_sections): Cast the result of
9621 local_symcount * symsize to off_t in the gold_assert.
9622
9623 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9624
9625 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9626 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9627 R_ARM_BASE_ABS.
9628 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9629 (Arm_relocate_functions::thm_abs5): New function.
9630 (Arm_relocate_functions::abs12): New function.
9631 (Arm_relocate_functions::abs16): New function.
9632 (Arm_relocate_functions::base_abs): New function.
9633 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9634 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9635 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9636 R_ARM_BASE_ABS.
9637 (Scan::global): Likewise.
9638 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9639 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9640 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9641 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9642 R_ARM_BASE_ABS.
9643
9644 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9645
9646 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9647 (Arm_relocate_functions::movt_prel): New function.
9648 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9649 (Arm_relocate_functions::thm_movt_prel): New function.
9650 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9651 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9652 (Scan::global, Relocate::relocate): Likewise.
9653 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9654
9655 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9656
9657 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9658 Incremental_checker.
9659 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9660 unsigned int.
9661 (class Incremental_inputs_header): New class.
9662 (Incremental_inputs_header_writer): Edit comment.
9663 (Incremental_inputs_entry): New class.
9664 (Incremental_inputs_entry_writer): Edit comment.
9665 (Sized_incremental_binary::do_find_incremental_inputs_section):
9666 Add *strtab_shndx parameter, fill it.
9667 (Sized_incremental_binary::do_check_inputs): New method.
9668 (Incremental_checker::can_incrementally_link_output_file): Use
9669 Sized_incremental_binary::check_inputs.
9670 (Incremental_inputs::report_command_line): Save command line in
9671 command_line_.
9672 * incremental.h:
9673 (Incremental_binary::find_incremental_inputs_section): New
9674 method.
9675 (Incremental_binary::do_find_incremental_inputs_section): Add
9676 strtab_shndx parameter.
9677 (Incremental_binary::do_check_inputs): New pure virtual method.
9678 (Sized_incremental_binary::do_check_inputs): Declare.
9679 (Incremental_checker::Incremental_checker): Add incremental_inputs
9680 parameter, use it to initialize incremental_inputs_.
9681 (Incremental_checker::incremental_inputs_): New field.
9682 (Incremental_checker::command_line): New method.
9683 (Incremental_checker::inputs): New method.
9684 (Incremental_checker::command_line_): New field.
9685
9686 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9687
9688 * incremental.cc: Include <cstdarg> and "target-select.h".
9689 (vexplain_no_incremental): New function.
9690 (explain_no_incremental): New function.
9691 (Incremental_binary::error): New method.
9692 (Sized_incremental_binary::do_find_incremental_inputs_section): New
9693 method.
9694 (make_sized_incremental_binary): New function.
9695 (open_incremental_binary): New function.
9696 (can_incrementally_link_file): Add checks if output is ELF and has
9697 inputs section.
9698 * incremental.h: Include "elfcpp_file.h" and "output.h".
9699 (Incremental_binary): New class.
9700 (Sized_incremental_binary): New class.
9701 (open_incremental_binary): Declare.
9702 * object.cc (is_elf_object): Use
9703 elfcpp::Elf_recognizer::is_elf_file.
9704 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9705 * output.h (Output_file::filesize): New method.
9706
9707 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9708
9709 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9710 New function.
9711 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9712 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9713 function.
9714 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9715 function.
9716 (Arm_relocate_functions::movw_abs_nc): New function.
9717 (Arm_relocate_functions::movt_abs): New function.
9718 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9719 (Arm_relocate_functions::thm_movt_abs): New function.
9720 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9721 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9722 (Scan::global): Likewise.
9723 (Relocate::relocate): Likewise.
9724 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9725
9726 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9727
9728 * arm.cc (Arm_relocate_functions::got_prel) New function.
9729 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9730 (Relocate::relocate): Likewise.
9731 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9732
9733 2009-10-06 Ian Lance Taylor <iant@google.com>
9734
9735 * options.h (class General_options): Define
9736 split_stack_adjust_size parameter.
9737 * object.h (class Object): Add uses_split_stack_ and
9738 has_no_split_stack_ fields. Add uses_split_stack and
9739 has_no_split_stack accessor functions. Declare
9740 handle_split_stack_section.
9741 (class Reloc_symbol_changes): Define.
9742 (class Sized_relobj): Define Function_offsets. Declare
9743 split_stack_adjust, split_stack_adjust_reltype, and
9744 find_functions.
9745 * object.cc (Object::handle_split_stack_section): New function.
9746 (Sized_relobj::do_layout): Call handle_split_stack_section.
9747 * dynobj.cc (Sized_dynobj::do_layout): Call
9748 handle_split_stack_section.
9749 * reloc.cc (Sized_relobj::relocate_sections): Call
9750 split_stack_adjust for executable sections in split_stack
9751 objects. Pass reloc_map to relocate_section.
9752 (Sized_relobj::split_stack_adjust): New function.
9753 (Sized_relobj::split_stack_adjust_reltype): New function.
9754 (Sized_relobj::find_functions): New function.
9755 * target-reloc.h: Include "object.h".
9756 (relocate_section): Add reloc_symbol_changes parameter. Change
9757 all callers.
9758 * target.h (class Target): Add calls_non_split method. Declare
9759 do_calls_non_split virtual method. Declare match_view and
9760 set_view_to_nop.
9761 * target.cc: Include "elfcpp.h".
9762 (Target::do_calls_non_split): New function.
9763 (Target::match_view): New function.
9764 (Target::set_view_to_nop): New function.
9765 * gold.cc (queue_middle_tasks): Give an error if mixing
9766 split-stack and non-split-stack objects with -r.
9767 * i386.cc (Target_i386::relocate_section): Add
9768 reloc_symbol_changes parameter.
9769 (Target_i386::do_calls_non_split): New function.
9770 * x86_64.cc (Target_x86_64::relocate_section): Add
9771 reloc_symbol_changes parameter.
9772 (Target_x86_64::do_calls_non_split): New function.
9773 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9774 parameter.
9775 * powerpc.cc (Target_powerpc::relocate_section): Add
9776 reloc_symbol_changes parameter.
9777 * sparc.cc (Target_sparc::relocate_section): Add
9778 reloc_symbol_changes parameter.
9779 * configure.ac: Call AM_CONDITIONAL for the default target.
9780 * configure: Rebuild.
9781 * testsuite/Makefile.am (TEST_AS): New variable.
9782 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9783 (check_DATA): Add split_i386 and split_x86_64 files.
9784 (SPLIT_DEFSYMS): Define.
9785 (split_i386_[1234n].o): New targets.
9786 (split_i386_[124]): New targets.
9787 (split_i386_[1234r].stdout): New targets.
9788 (split_x86_64_[1234n].o): New targets.
9789 (split_x86_64_[124]): New targets.
9790 (split_x86_64_[1234r].stdout): New targets.
9791 (MOSTLYCLEANFILES): Add new executables.
9792 * testsuite/split_i386.sh: New file.
9793 * testsuite/split_x86_64.sh: New file.
9794 * testsuite/split_i386_1.s: New file.
9795 * testsuite/split_i386_2.s: New file.
9796 * testsuite/split_i386_3.s: New file.
9797 * testsuite/split_i386_4.s: New file.
9798 * testsuite/split_i386_n.s: New file.
9799 * testsuite/split_x86_64_1.s: New file.
9800 * testsuite/split_x86_64_2.s: New file.
9801 * testsuite/split_x86_64_3.s: New file.
9802 * testsuite/split_x86_64_4.s: New file.
9803 * testsuite/split_x86_64_n.s: New file.
9804 * testsuite/testfile.cc (Target_test): Update relocation_section
9805 function.
9806 * testsuite/Makefile.in: Rebuild.
9807
9808 2009-10-06 Ian Lance Taylor <iant@google.com>
9809
9810 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9811 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9812 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9813 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9814 the address on ldo_addrs_.
9815 (Target_i386::Relocate::fix_up_ldo): New function.
9816
9817 2009-10-06 Rafael Espindola <espindola@google.com>
9818
9819 * plugin.cc (add_input_library): New.
9820 (Plugin::load): Add add_input_library to tv.
9821 (Plugin_manager::add_input_file): Add the is_lib argument.
9822 (add_input_file): Update call to Plugin_manager::add_input_file.
9823 (add_input_library): New.
9824 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9825
9826 2009-09-30 Doug Kwan <dougkwan@google.com>
9827
9828 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9829 symbol and call Symbol::may_need_copy_reloc to determine if
9830 a copy reloc is needed.
9831 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9832 nocopyreloc is given in command line.
9833 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9834 given in command line.
9835 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9836 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9837 of the removed Target_i386::may_need_copy_reloc.
9838 * options.h (copyreloc): New option with default value false.
9839 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9840 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9841 instead of the removed Target_powerpc::may_need_copy_reloc.
9842 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9843 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9844 instead of the removed Target_sparc::may_need_copy_reloc.
9845 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9846 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9847 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9848 instead of the removed Target_x86_64::may_need_copy_reloc.
9849
9850 2009-09-30 Ian Lance Taylor <iant@google.com>
9851
9852 * object.h (class Object): Remove target_ field, and target,
9853 sized_target, and set_target methods.
9854 (Object::sized_target): Remove.
9855 (class Sized_relobj): Update declarations. Remove sized_target.
9856 * object.cc (Sized_relobj::setup): Remove target parameter.
9857 Change all callers.
9858 (Input_objects::add_object): Don't do anything with the target.
9859 (make_elf_sized_object): Add punconfigured parameter. Change all
9860 callers. Set or test parameter target.
9861 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9862 Change all callers.
9863 * parameters.cc (Parameters::set_target): Change parameter type to
9864 be non-const.
9865 (Parameters::default_target): Remove.
9866 (set_parameters_target): Change parameter type to be non-const.
9867 (parameters_force_valid_target): New function.
9868 (parameters_clear_target): New function.
9869 * parameters.h (class Parameters): Update declarations. Remove
9870 default_target method. Add sized_target and clear_target
9871 methods. Change target_ to be non-const.
9872 (set_parameters_target): Update declaration.
9873 (parameters_force_valid_target): Declare.
9874 (parameters_clear_target): Declare.
9875 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9876 as NULL if we aren't searching.
9877 (Add_symbols::run): Don't check for compatible target.
9878 * fileread.cc (Input_file::open_binary): Call
9879 parameters_force_valid_target.
9880 * gold.cc (queue_middle_tasks): Likewise.
9881 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9882 set_target on object.
9883 * dynobj.h (class Sized_dynobj): Update declarations.
9884 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9885 make_elf_object returns NULL.
9886 (Archive::include_member): Don't check whether object target is
9887 compatible.
9888 * output.cc (Output_section::add_input_section): Get target from
9889 parameters.
9890 (Output_section::relax_input_section): Likewise.
9891 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9892 parameters.
9893 (Sized_relobj::do_scan_relocs): Likewise.
9894 (Sized_relobj::relocate_sections): Likewise.
9895 * resolve.cc (Symbol_table::resolve): Likewise.
9896 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9897 parameter. Change all callers.
9898 (Symbol_table::add_from_object): Get target from parameters.
9899 (Symbol_table::add_from_relobj): Don't check object target.
9900 (Symbol_table::add_from_dynobj): Likewise.
9901 (Symbol_table::define_special_symbol): Get target from
9902 parameters.
9903 * symtab.h (class Symbol_table): Update declaration.
9904 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9905 parameter. Change all callers. Clear parameter target.
9906 (Binary_test): Test target here.
9907 * testsuite/object_unittest.cc (gold_testsuite): Remove
9908 target_test_pointer parameter. Change all callers.
9909 (Object_test): Test target here.
9910
9911 2009-09-26 Ian Lance Taylor <iant@google.com>
9912
9913 * testsuite/initpri1.c: Don't try to use constructor priorities if
9914 compiling with gcc before 4.3.
9915
9916 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9917
9918 * testsuite/retain_symbols_file_test.sh (check_present): Change
9919 output file name to retain_symbols_file_test.stdout.
9920 (check_absent): Likewise.
9921
9922 2009-09-18 Craig Silverstein <csilvers@google.com>
9923
9924 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9925 * options.cc: Include <cerrno> and <fstream>.
9926 (General_options::finalize): Parse -retain-symbols-file tag.
9927 * options.h: New flag.
9928 (General_options): New method should_retain_symbol, new
9929 variable symbols_to_retain.
9930 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9931 should_retain_symbol map.
9932 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9933 * testsuite/Makefile.in: Regenerate.
9934 * testsuite/retain_symbols_file_test.sh: New file.
9935
9936 2009-09-18 Nick Clifton <nickc@redhat.com>
9937
9938 * po/es.po: Updated Spanish translation.
9939
9940 2009-09-17 Doug Kwan <dougkwan@google.com>
9941
9942 * debug.h (DEBUG_RELAXATION): New constant.
9943 (DEBUG_ALL): Add DEBUG_RELAXATION.
9944 (debug_string_to_enum): Add relaxation debug option.
9945 * layout.cc
9946 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9947 Layout::Relaxation_debug_check::read_sections,
9948 Layout::Relaxation_debug_check::read_sections): New method definitions.
9949 (Layout::Layout): Initialize data members
9950 record_output_section_data_from_scrips_,
9951 script_output_section_data_list_ and relaxation_debug_check_.
9952 (Layout::save_segments, Layout::restore_segments,
9953 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9954 Layout::relaxation_loop_body): New method definitions.
9955 (Layout::finalize): Support relaxation. Move section layout code to
9956 Layout::relaxation_loop_body.
9957 (Layout::set_asection_address_from_script): Move code for orphan
9958 section placement out.
9959 (Layout::place_orphan_sections_in_script): New method definition.
9960 * layout.h (Output_segment_headers, Output_file_header):
9961 New forward class declarations.
9962 (Layout::~Layout): Define.
9963 (Layout::new_output_section_data_from_script): New method definition.
9964 (Layout::place_orphan_sections_in_script): New method declaration.
9965 (Layout::Segment_states): New type declaration.
9966 (Layout::save_segments, Layout::restore_segments,
9967 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9968 Layout::relaxation_loop_body): New method declarations.
9969 (Layout::Output_section_data_list): New type declaration.
9970 (Layout::Relaxation_debug_check): New class definition.
9971 (Layout::record_output_section_data_from_script_,
9972 Layout::script_output_section_data_list_, Layout::segment_states_,
9973 Layout::relaxation_debug_check_): New data members.
9974 * output.cc: (Output_section_headers::do_size): New method definition.
9975 (Output_section_headers::Output_section_headers): Move size
9976 computation to Output_section_headers::do_size.
9977 (Output_segment_headers::do_size): New method definition.
9978 (Output_file_header::Output_file_header): Move size computation to
9979 Output_file_header::do_size and call it.
9980 (Output_file_header::do_size): New method definition.
9981 (Output_data_group::Output_data_group): Adjust call to
9982 Output_section_data.
9983 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9984 (Output_symtab_xindex::do_write): Add array bound check.
9985 (Output_section::Input_section::print_to_mapfile): Handle
9986 RELAXED_INPUT_SECTION_CODE.
9987 (Output_section::Output_section): Initialize data member checkpoint_.
9988 (Output_section::~Output_section): Delete checkpoint object pointed
9989 by checkpoint_.
9990 (Output_section::add_input_section): Always add an Input_section if
9991 relaxing.
9992 (Output_section::add_merge_input_section): Add assert.
9993 (Output_section::relax_input_section): New method definition.
9994 (Output_section::set_final_data_size): Set load address to zero for
9995 an unallocated section.
9996 (Output_section::do_address_and_file_offset_have_reset_values):
9997 New method definition.
9998 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9999 Handle relaxed input section.
10000 (Output_section::sort_attached_input_sections): Checkpoint input
10001 section list lazily.
10002 (Output_section::get_input_sections): Change type of input_sections to
10003 list of Simple_input_section pointers. Checkpoint input section list
10004 lazily. Also handle relaxed input sections.
10005 (Output_section::add_input_section_for_script): Take a reference to
10006 a Simple_input_section object instead of Relobj pointer and section
10007 index as parameter. Handle relaxed input sections.
10008 (Output_section::save_states, Output_section::restore_states): New
10009 method definitions.
10010 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10011 (Output_data::is_data_size_fixed): New method definition.
10012 (Output_data::reset_addresss_and_file_offset): Do not reset data size
10013 if it is fixed.
10014 (Output_data::address_and_file_offset_have_reset_values): New method
10015 definition.
10016 (Output_data::do_address_and_file_offset_have_reset_values): New method
10017 definition.
10018 (Output_data::set_data_size): Check that data size is not fixed.
10019 (Output_data::fix_data_size): New method definition.
10020 (Output_data::is_data_size_fixed_): New data member.
10021 (Output_section_headers::set_final_data_size): New method definition.
10022 (Output_section_headers::do_size): New method declaration.
10023 (Output_segment_headers::set_final_data_size): New method definition.
10024 (Output_segment_headers::do_size): New method declaration.
10025 (Output_file_header::set_final_data_size)::New method definition.
10026 (Output_file_header::do_size)::New method declaration.
10027 (Output_section_data::Output_section_data): Add new parameter
10028 is_data_size_fixed and use it to fix data size.
10029 (Output_data_const::Output_data_const): Adjust call to base class
10030 constructor and fix data size.
10031 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10032 base class constructor and fix data size.
10033 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10034 base class constructor and fix data size.
10035 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10036 class constructor and fix data size.
10037 (Output_data_group::set_final_data_size): New method definition.
10038 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10039 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10040 class constructor and fix data size.
10041 (Output_relaxed_input_section): New class definition.
10042 (Output_section::Simple_input_section): New class definition.
10043 (Output_section::get_input_sections): Adjust parameter list.
10044 (Output_section::add_input_section_for_script): Same.
10045 (Output_section::save_states, Output_section::restore_states,
10046 Output_section::do_address_and_file_offset_have_reset_values,
10047 (Output_section::Input_section::Input_section): Handle
10048 RELAXED_INPUT_SECTION_CODE. Add new overload for
10049 Output_relaxed_input_section.
10050 (Output_section::Input_section::is_input_section,
10051 Output_section::Input_section::set_output_section): Handle relaxed
10052 input section.
10053 (Output_section::Input_section::is_relaxed_input_section,
10054 Output_section::Input_section::output_section_data,
10055 Output_section::Input_section::relaxed_input_section): New method
10056 definitions.
10057 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10058 value.
10059 (Output_section::Input_section::u1_): Update comments.
10060 (Output_section::Input_section::u2_): Add new union member poris.
10061 (Output_section::Checkpoint_output_section): New classs definition.
10062 (Output_section::relax_input_section): New method declaration.
10063 (Output_section::checkpoint_): New data member.
10064 (Output_segment): Update comments.
10065 (Output_segment::Output_segment): Un-privatize copy constructor.
10066 (Output_segment::operator=): Un-privatize.
10067 * script-sections.cc (Output_section_element::Input_section_list):
10068 Change element type to Output_section::Simple_input_section.
10069 (Output_section_element_dot_assignment::set_section_addresses):
10070 Register output section data for relaxation clean up.
10071 (Output_data_exression::Output_data_expression): Adjust call to base
10072 constructor to fix data size.
10073 (Output_section_element_data::set_section_addresses): Register
10074 Output_data_expression object for relaxation clean up.
10075 (struct Input_section_info): Replace Relobj pointer and section index
10076 pair with Output_section::Simple_input_section and Convert struct to a
10077 class.
10078 (Input_section_sorter::operator()): Adjust access to
10079 Input_section_info data member to use accessors.
10080 (Output_section_element_input::set_section_addresses): Use layout
10081 parameter. Adjust code to use Output_section::Simple_input_section
10082 and Input_secction_info classes. Register filler for relaxation
10083 clean up.
10084 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10085 and section index pair with Output_section::Simple_input_section
10086 class. Adjust code accordingly.
10087 (Phdrs_element::release_segment): New method definition.
10088 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10089 segment list.
10090 (Script_sections::release_segments): New method definition.
10091 * gold/script-sections.h (Script_sections::release_segments): New
10092 method declaration.
10093 * gold/target.h (Target::may_relax, Target::relax,
10094 Target::do_may_relax, Target::do_relax): New method definitions.
10095
10096 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10097
10098 * arm.cc (has_signed_unsigned_overflow): New function.
10099 (Arm_relocate_functions::abs8): New function.
10100 (Target_arm::Scan::local): Handle R_ARM_ABS8.
10101 (Target_arm::Scan::global): Likewise.
10102 (Target_arm::relocate::relocate): Likewise.
10103 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10104 Likewise.
10105
10106 2009-09-16 Cary Coutant <ccoutant@google.com>
10107
10108 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10109 * testsuite/Makefile.in: Regenerate.
10110
10111 2009-09-11 Nick Clifton <nickc@redhat.com>
10112
10113 * po/gold.pot: Updated by the Translation project.
10114
10115 2009-09-08 Cary Coutant <ccoutant@google.com>
10116
10117 * output.cc (Output_file::open): Add execute permission to empty file.
10118 * testsuite/Makefile.am (permission_test): New test.
10119 * testsuite/Makefile.in: Regenerate.
10120
10121 2009-09-02 Ian Lance Taylor <iant@google.com>
10122
10123 * output.cc (Output_file::resize): Call map_no_anonymous rather
10124 than map.
10125
10126 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
10127
10128 * gold.cc: Include "incremental.h".
10129 (queue_initial_tasks): Call Incremental_checker methods.
10130 * incremental.cc: Include "output.h".
10131 (Incremental_checker::can_incrementally_link_output_file): New
10132 method.
10133 * incremental.h (Incremental_checker): New class.
10134
10135 * output.cc (Output_file::open_for_modification): New method.
10136 (Output_file::map_anonymous): Changed return type to bool. Record
10137 map in base_ field.
10138 (Output_file::map_no_anonymous): New method, broken out of map.
10139 (Output_file::map): Use map_no_anonymous and map_anonymous.
10140 * output.h (class Output_file): Update declarations.
10141
10142 2009-08-24 Cary Coutant <ccoutant@google.com>
10143
10144 * options.h (Command_line::Pre_options): New class.
10145 (Command_line::pre_options): New member.
10146 * options.cc (gold::options::ready_to_register): New variable.
10147 (One_option::register_option): Do nothing if not registering options.
10148 Assert if same short option registered twice.
10149 (General_options::General_options): Turn off option registration when
10150 done constructing.
10151 (Command_line::Pre_options::Pre_options): New constructor.
10152
10153 2009-08-24 Cary Coutant <ccoutant@google.com>
10154
10155 * options.h (General_options::no_keep_memory): Remove incorrect
10156 short option.
10157
10158 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10159
10160 * Makefile.am (am__skiplex, am__skipyacc): New.
10161 * Makefile.in: Regenerate.
10162
10163 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10164
10165 * Makefile.am (AM_CPPFLAGS): Renamed from ...
10166 (INCLUDES): ... this.
10167 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10168 (AM_CPPFLAGS): Renamed from ...
10169 (INCLUDE): ... this.
10170 * Makefile.in, testsuite/Makefile.in: Regenerate.
10171
10172 * Makefile.in: Regenerate.
10173 * aclocal.m4: Likewise.
10174 * config.in: Likewise.
10175 * configure: Likewise.
10176 * testsuite/Makefile.in: Likewise.
10177
10178 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10179 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10180 * Makefile.in: Regenerate.
10181 * testsuite/Makefile.in: Regenerate.
10182
10183 2009-08-19 Cary Coutant <ccoutant@google.com>
10184
10185 * resolve.cc (Symbol_table::resolve): Don't complain about defined
10186 symbols in shared libraries overridden by hidden or internal symbols
10187 in the main program.
10188
10189 2009-08-19 Chris Demetriou <cgd@google.com>
10190
10191 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10192 checking source file names in error messages.
10193
10194 2009-08-18 Doug Kwan <dougkwan@google.com>
10195
10196 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10197 an elcpp::Ehdr as parameter. Adjust call to set_target.
10198 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10199 an elfcpp::Ehdr as parameter.
10200 * object.cc (Object::set_target): Remove the version that looks up
10201 a target and sets it.
10202 (Sized_relobj::setup): Take a Target object instead of
10203 an elfcpp::Ehdr as parameter. Adjust call to set_target.
10204 (make_elf_sized_object): Find target and ask target to
10205 make an ELF object.
10206 * object.h: (Object::set_target): Remove the version that looks up
10207 a target and sets it.
10208 (Sized_relobj::setup): Take a Target object instead of
10209 an elfcpp:Ehdr as parameter.
10210 * target.cc: Include dynobj.h.
10211 (Target::do_make_elf_object_implementation): New.
10212 (Target::do_make_elf_object): New.
10213 * target.h (Target::make_elf_object): New template declaration.
10214 (Target::do_make_elf_object): New method declarations.
10215 (Target::do_make_elf_object_implementation): New template declaration.
10216
10217 2009-08-14 Ian Lance Taylor <iant@google.com>
10218
10219 * gold.h (FUNCTION_NAME): Define.
10220 (gold_unreachable): Use FUNCTION_NAME.
10221
10222 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10223
10224 * icf.cc (Icf::find_identical_sections): Issue a warning when a
10225 symbol in the --keep-unique list is not found.
10226
10227 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10228
10229 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10230 been maked as --keep-unique.
10231 (Icf::unfold_section): New function.
10232 * icf.h (Icf::unfold_section): New function.
10233 * options.h (General_options::keep_unique): New option.
10234 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10235 * testsuite/Makefile.in: Regenerate.
10236 * testsuite/icf_keep_unique_test.sh: New file.
10237 * testsuite/icf_keep_unique_test.cc: New file.
10238
10239 2009-08-12 Cary Coutant <ccoutant@google.com>
10240
10241 PR 10471
10242 * resolve.cc (Symbol_table::resolve): Check for references from
10243 dynamic objects to hidden and internal symbols.
10244 * testsuite/Makefile.am (hidden_test.sh): New test.
10245 * testsuite/Makefile.in: Regenerate.
10246 * testsuite/hidden_test.sh: New script.
10247 * testsuite/hidden_test_1.c: New test source.
10248 * testsuite/hidden_test_main.c: New test source.
10249
10250 2009-08-11 Doug Kwan <dougkwan@google.com>
10251
10252 * arm.cc: Update comments.
10253 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10254 segment to locate the .ARM.exidx section if present.
10255
10256 2009-08-09 Doug Kwan <dougkwan@google.com>
10257
10258 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10259 patch.
10260
10261 2009-08-07 Sriraman Tallam <tmsriram@google.com>
10262 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10263 compiler warnings.
10264
10265 2009-08-06 Sriraman Tallam <tmsriram@google.com>
10266
10267 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10268 valid tls_segment only for non-debug-section relocations.
10269 * testsuite/Makefile.am: Add gc_tls_test.
10270 * testsuite/Makefile.in: Regenerate.
10271 * testsuite/gc_tls_test.cc: New file.
10272 * testsuite/gc_tls_test.sh: New file.
10273
10274 2009-08-05 Sriraman Tallam <tmsriram@google.com>
10275
10276 * icf.cc: New file.
10277 * icf.h: New file.
10278 * Makefile.am (CCFILES): Add icf.cc.
10279 (HFILES): Add icf.h
10280 * Makefile.in: Regenerate.
10281 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10282 * gc.h (gc_process_relocs): Populate lists used by icf to contain
10283 section, symbol and addend information for the relocs.
10284 * gold.cc (queue_middle_tasks): Call identical code folding.
10285 * gold.h: Add defines for multimap.
10286 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10287 to the call of finalize_local_symbols.
10288 * main.cc (main): Create object of class Icf.
10289 * object.cc (Sized_relobj::do_layout): Allow this function to be
10290 called twice during icf.
10291 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10292 to sections marked as identical by icf.
10293 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10294 when available.
10295 (Sized_relobj::do_section_entsize): New function.
10296 * object.h (Object::section_entsize): New function.
10297 (Object::do_section_entsize): New pure virtual function.
10298 (Relobj::finalize_local_symbols): Add new parameter.
10299 (Relobj::do_section_entsize): New function.
10300 * options.h (General_options::icf): New option.
10301 (General_options::icf_iterations): New option.
10302 (General_options::print_icf_sections): New option.
10303 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10304 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10305 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10306 icf.
10307 * symtab.cc (Symbol_table::is_section_folded): New function.
10308 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
10309 to sections marked as identical by icf.
10310 * symtab.h (Symbol_table::set_icf): New function.
10311 (Symbol_table::icf): New function.
10312 (Symbol_table::is_section_folded): New function.
10313 (Symbol_table::icf_): New data member.
10314 * target-reloc.h (relocate_section): Ignore sections folded by icf.
10315 * testsuite/Makefile.am: Add commands to build icf_test.
10316 * testsuite/Makefile.in: Regenerate.
10317 * testsuite/icf_test.sh: New file.
10318 * testsuite/icf_test.cc: New file.
10319
10320 2009-07-24 Chris Demetriou <cgd@google.com>
10321
10322 * layout.cc (is_compressible_debug_section): Fix incorrect
10323 comment about compressed section names.
10324
10325 2009-07-20 Ian Lance Taylor <ian@airs.com>
10326
10327 PR 10419
10328 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10329
10330 2009-07-16 Ian Lance Taylor <iant@google.com>
10331
10332 PR 10400
10333 * layout.h: #include <map>.
10334 (class Kept_section): Change from struct to class. Add accessors
10335 and setters. Add section size to Comdat_group mapping. Change
10336 Comdat_group to std::map. Add is_comdat_ field. Add
10337 linkonce_size field in union.
10338 (class Layout): Update declaration of find_or_add_kept_section.
10339 Don't declare find_kept_object.
10340 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10341 parameter. Add object, shndx, is_comdat, and is_group_name
10342 parameters. Change all callers. Adjust for new Kept_section.
10343 (Layout::find_kept_object): Remove.
10344 * object.cc (Sized_relobj::include_section_group): Update use of
10345 Kept_section. Rename secnum to shndx. Only record
10346 Kept_comdat_section if sections are the same size.
10347 (Sized_relobj::include_linkonce_section): Update use of
10348 Kept_section. Only record Kept_comdat_section if sections are the
10349 same size. Set size of linkonce section.
10350 (Sized_relobj::map_to_kept_section): Update call to
10351 get_kept_comdat_section.
10352 * object.h (class Sized_relobj): Rename fields in
10353 Kept_comdat_section to drop trailing underscores; change object
10354 field to Relobj*. Change Kept_comdat_section_table to store
10355 struct rather than pointer.
10356 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10357 Add kept_object and kept_shndx parameters. Change all callers.
10358 (Sized_relobj::get_kept_comdat_section): Change return type to
10359 bool. Add kept_object and kept_shndx parameters. Change all
10360 callers.
10361 * plugin.cc (Pluginobj::include_comdat_group): Update call to
10362 Layout::find_or_add_kept_section.
10363
10364 2009-07-09 Ian Lance Taylor <iant@google.com>
10365
10366 * merge.cc (Object_merge_map::initialize_input_to_output_map):
10367 Reserve space in the hash table.
10368
10369 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
10370
10371 * fileread.cc (File_read::get_mtime): New method.
10372 * fileread.h (Timespec): New structure.
10373 (File_read::get_mtime): New method.
10374 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10375 Renamed from timestamp_nsec.
10376 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10377 Elf_Xword.
10378 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10379 timestamp_nsec.
10380 (Incremental_inputs::report_archive): Save mtime; style fix.
10381 (Incremental_inputs::report_obejct): Save mtime; style fix.
10382 (Incremental_inputs::report_script): Save mtime; style fix.
10383 (Incremental_inputs::finalize_inputs): Style fix.
10384 (Incremental_inputs::finalize): Style fix.
10385 (Incremental_inputs::create_input_section_data): Store inputs
10386 mtime.
10387 * incremental.h (Incremental_inputs::report_script): Add mtime
10388 argument.
10389 (Incremental_inputs::Input_info::Input_info): Intialize only one
10390 union member.
10391 (Incremental_inputs::Input_info::archive): Move to nameless
10392 union.
10393 (Incremental_inputs::Input_info::obejct): Move to nameless union.
10394 (Incremental_inputs::Input_info::script): Move to nameless union.
10395 (Incremental_inputs::mtime): New field.
10396 * script.cc (read_input_script): Pass file mtime to
10397 Incremental_input.
10398 * script.h (Script_info::inputs): Style fix.
10399
10400 2009-07-01 Ian Lance Taylor <ian@airs.com>
10401
10402 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10403 instead of 32.
10404
10405 2009-06-24 Ian Lance Taylor <iant@google.com>
10406
10407 PR 10156
10408 * layout.cc (Layout::choose_output_section): If we find an
10409 existing section, update the flags.
10410 (Layout::create_notes): New function, broken out of
10411 Layout::finalize.
10412 (Layout::finalize): Don't create note sections.
10413 (Layout::create_note): Don't crash if linker script discards
10414 section.
10415 (Layout::create_gold_note): Likewise.
10416 (Layout::create_build_id): Likewise. Don't set
10417 after_input_sections on the section.
10418 (Layout::create_executable_stack_info): Remove target parameter.
10419 Change caller.
10420 * layout.h (class Layout): Declare create_notes. Update
10421 declaration of create_executable_stack_info.
10422 * gold.cc (queue_middle_tasks): Call create_notes.
10423 * output.cc (Output_section::update_flags_for_input_section): Move
10424 here from output.h. If SHF_ALLOC flag is newly set, mark address
10425 invalid.
10426 * output.h (Output_data::mark_address_invalid): New function.
10427 (class Output_section): Only declare, not define,
10428 update_flags_for_input_section. Remove set_flags.
10429
10430 2009-06-24 Ian Lance Taylor <iant@google.com>
10431
10432 * script-sections.cc (Output_section_definition::
10433 set_section_addresses): Rename shadowing local load_address to
10434 laddr.
10435
10436 2009-06-24 Ian Lance Taylor <iant@google.com>
10437
10438 PR 10244
10439 * reloc.cc (relocate_sections): Skip empty relocation sections.
10440
10441 2009-06-23 Ian Lance Taylor <iant@google.com>
10442
10443 PR 10156
10444 * layout.cc (Layout::create_note): Use choose_output_section
10445 rather than make_output_section.
10446
10447 2009-06-23 Ian Lance Taylor <iant@google.com>
10448
10449 PR 10237
10450 * options.cc (General_options::parse_V): Set printed_version_.
10451 (General_options::General_options): Initialize printed_version_.
10452 * options.h (class General_options): Add printed_version_ field.
10453 * gold.cc (queue_initial_tasks): If there are no input files,
10454 don't give a fatal error if we printed the version information.
10455 (queue_middle_tasks): If using -r with a shared object, give a
10456 fatal error rather than an ordinary error.
10457
10458 2009-06-23 Ian Lance Taylor <iant@google.com>
10459
10460 PR 10219
10461 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10462 (Layout::make_output_section): Set have_stabstr_section_ if we see
10463 a .stab*str section.
10464 (Layout::finalize): Call link_stabs_sections.
10465 (Layout::link_stabs_sections): New file.
10466 * layout.h (class Layout): Add have_stabstr_section_ field.
10467 Declare link_stabs_sections.
10468
10469 2009-06-23 Doug Kwan <dougkwan@google.com>
10470
10471 * Makefile.am (libgold_a_LIBADD): New.
10472 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10473 * Makefile.in: Regenerate.
10474 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10475 * configure: Regenerate.
10476 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10477 * fileread.cc: Include sys/state.h
10478 * gold.h: Declare memmem and strndup if found missing.
10479 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10480
10481 2009-06-23 Ian Lance Taylor <iant@google.com>
10482
10483 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10484 * configure: Rebuild.
10485
10486 2009-06-23 Ian Lance Taylor <iant@google.com>
10487
10488 PR 10147
10489 * object.cc (Object::section_contents): Don't try to get a view if
10490 the section has length zero.
10491 (Object::handle_gnu_warning_section): If the section is empty, use
10492 the name of the section as the warning.
10493
10494 2009-06-23 Ian Lance Taylor <iant@google.com>
10495
10496 PR 10133
10497 * stringpool.h (class Stringpool_template): Add optimize_ field.
10498 (Stringpool_template::set_optimize): New function.
10499 * stringpool.cc (Stringpool_template::Stringpool_template):
10500 Initialize optimize_ field.
10501 (Stringpool_template::set_string_offsets): Test local optimize
10502 fild rather than parameter.
10503 * layout.cc (Layout::Layout): Call set_optimize on the section
10504 name stringpool.
10505
10506 2009-06-22 Ian Lance Taylor <iant@google.com>
10507
10508 PR 10030
10509 * yyscript.y: Parse TARGET.
10510 * script.cc (script_set_target): New function.
10511 * script-c.h (script_set_target): Declare.
10512 * options.cc (General_options::string_to_object_format): Rename
10513 from string_to_object_format in anonymous namespace. Change
10514 callers.
10515 * options.h (class General_options): Declare
10516 string_to_object_format.
10517
10518 2009-06-22 Ian Lance Taylor <iant@google.com>
10519
10520 * script-sections.cc (Script_sections::create_segments): Don't put
10521 program headers in a PT_LOAD segment if -n or -N.
10522
10523 2009-06-22 Ian Lance Taylor <iant@google.com>
10524
10525 PR 10141
10526 * options.h (class General_options): Add -z lazy and -z now. Sort
10527 -z options into alphabetical order.
10528 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10529
10530 2009-06-21 Ian Lance Taylor <iant@google.com>
10531
10532 * layout.cc (Layout::make_output_section): Call
10533 Target::new_output_section.
10534 (Layout::attach_allocated_section_to_segment): Put large section
10535 sections in a separate load segment with the large segment flag
10536 set.
10537 (Layout::segment_precedes): Sort large data segments after other
10538 load segments.
10539 (align_file_offset): New static function.
10540 (Layout::set_segment_offsets): Use align_file_offset.
10541 * output.h (class Output_section): Add is_small_section_ and
10542 is_large_section_ fields.
10543 (Output_section::is_small_section): New function.
10544 (Output_section::set_is_small_section): New function.
10545 (Output_section::is_large_section): New function.
10546 (Output_section::set_is_large_section): New function.
10547 (Output_section::is_large_data_section): New function.
10548 (class Output_segment): Add is_large_data_segment_ field.
10549 (Output_segment::is_large_data_segment): New function.
10550 (Output_segment::set_is_large_data_segment): New function.
10551 * output.cc (Output_section::Output_section): Initialize new
10552 fields.
10553 (Output_segment::Output_segment): Likewise.
10554 (Output_segment::add_output_section): Add assertion that large
10555 data sections always go in large data segments. Force small data
10556 sections to the end of the list of data sections. Force small BSS
10557 sections to the start of the list of BSS sections. For large BSS
10558 sections to the end of the list of BSS sections.
10559 * symtab.h (class Symbol): Declare is_common_shndx.
10560 (Symbol::is_defined): Check Symbol::is_common_shndx.
10561 (Symbol::is_common): Likewise.
10562 (class Symbol_table): Define enum Commons_section_type. Update
10563 declarations. Add small_commons_ and large_commons_ fields.
10564 * symtab.cc (Symbol::is_common_shndx): New function.
10565 (Symbol_table::Symbol_table): Initialize new fields.
10566 (Symbol_table::add_from_object): Put small and large common
10567 symbols in the right list.
10568 (Symbol_table::sized_finalized_symbol): Check
10569 Symbol::is_common_shndx.
10570 (Symbol_table::sized_write_globals): Likewise.
10571 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10572 common symbol lists. Don't call do_allocate_commons_list if the
10573 list is empty.
10574 (Symbol_table::do_allocate_commons_list): Remove is_tls
10575 parameter. Add comons_section_type parameter. Change all
10576 callers. Handle small and large common symbols.
10577 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10578 Symbol::is_common_shndx.
10579 * resolve.cc (symbol_to_bits): Likewise.
10580 * target.h (Target::small_common_shndx): New function.
10581 (Target::small_common_section_flags): New function.
10582 (Target::large_common_shndx): New function.
10583 (Target::large_common_section_flags): New function.
10584 (Target::new_output_section): New function.
10585 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10586 small_common_section_flags, and large_common_section_flags
10587 fields.
10588 (Target::do_new_output_section): New virtual function.
10589 * arm.cc (Target_arm::arm_info): Initialize new fields.
10590 * i386.cc (Target_i386::i386_info): Likewise.
10591 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10592 Likewise.
10593 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10594 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10595 (Target_x86_64::do_new_output_section): New function.
10596 * configure.ac: Define conditional MCMODEL_MEDIUM.
10597 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10598 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10599 (large_LDFLAGS): Define.
10600 * testsuite/large.c: New file.
10601 * testsuite/testfile.cc (Target_test::test_target_info):
10602 Initialize new fields.
10603 * configure, testsuite/Makefile.in: Rebuild.
10604
10605 2009-06-05 Doug Kwan <dougkwan@google.com>
10606
10607 * Makefile.am (CCFILES): Add target.cc.
10608 * Makefile.in: Regenerate.
10609 * i386.cc (class Target_i386): Define new virtual method to
10610 override do_is_local_label_name in parent.
10611 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10612 local symbols if --discard-locals or -X is given.
10613 * options.h (class General_options): Declare new options
10614 '--discard-locals' and '-X' for discarding locals.
10615 * target.h (class Target): Define new methods is_local_label_name.
10616 Declare new virtual method do_is_local_label_name.
10617 * target.cc: New file.
10618 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10619 (check_SCRIPTS): Add discard_locals_test.sh.
10620 (check_DATA): Add discard_local_tests.syms.
10621 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10622 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10623 * testsuite/Makefile.in: Regenerate.
10624 * testsuite/discard_locals_test.c: New file.
10625 * testsuite/discard_locals_test.sh: Same.
10626
10627 2009-06-05 Doug Kwan <dougkwan@google.com>
10628
10629 * object.cc (Sized_relobj::Sized_relobj): Initialize
10630 discarded_eh_frame_shndx_ to -1U.
10631 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10632 section.
10633 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10634 a discarded .eh_frame section.
10635 (Sized_relobj::do_finalize_local_symbols): Ditto.
10636 * object.h (class Sized_relobj): Declare new member
10637 discarded_eh_frame_shndx_.
10638 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10639 (local_labels_test.o, local_labels_test): New rules.
10640 * testsuite/Makefile.in: Regenerate.
10641
10642 2009-06-04 Doug Kwan <dougkwan@google.com>
10643
10644 * layout.cc (Layout::section_name_mapping): Add mapping for
10645 special ARM sections.
10646
10647 2009-06-03 Doug Kwan <dougkwan@google.com>
10648
10649 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10650 (utils::has_overflow): Same.
10651
10652 2009-06-03 Ian Lance Taylor <iant@google.com>
10653
10654 * layout.cc (Layout::section_name_mapping): New array, replacing
10655 Layout::linkonce_mapping.
10656 (Layout::section_name_mapping_count): New variable, replacing
10657 Layout::linkonce_mapping_count.
10658 (Layout::linkonce_output_name): Remove.
10659 (Layout::output_section_name): Rewrite.
10660 * layout.h (class Layout): Rename Linkonce_mapping to
10661 Section_name_mapping, linkonce_mapping to section_name_mapping,
10662 linkonce_mapping_count to section_name_mapping_count. Don't
10663 declare linkonce_output_name.
10664
10665 2009-06-03 Doug Kwan <dougkwan@google.com>
10666
10667 * gold/arm.cc (namespace utils): New.
10668 (Target_arm::reloc_is_non_pic): Define new method.
10669 (class Arm_relocate_functions): New.
10670 (Target_arm::Relocate::relocate): Handle relocation types used by
10671 Android.
10672
10673 2009-06-03 Ian Lance Taylor <iant@google.com>
10674
10675 * arm.cc (Target_arm::scan::global): Use || instead of |.
10676
10677 2009-06-02 Doug Kwan <dougkwan@google.com>
10678
10679 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
10680 issued_non_pic_error_.
10681 (class Target_arm::Scan): Declare new method check_non_pic.
10682 Define new method symbol_needs_plt_entry.
10683 Declare new data member issued_non_pic_error_.
10684 (class Target_arm::Relocate): Declare new method
10685 should_apply_static_reloc.
10686 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10687 (Target_arm::Scan::check_non_pic): Define new method.
10688 (Target_arm::Scan::local): Handle a small subset of reloc types used
10689 by Android.
10690 (Target_arm::Scan::local): Same.
10691 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10692
10693 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
10694
10695 * incremental.cc (Incremental_inputs::report_command_line): Filter
10696 out --incremental-* options.
10697
10698 2009-05-29 Doug Kwan <dougkwan@google.com>
10699
10700 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10701 template class.
10702 (class Target_arm): Update comment.
10703 (Target_arm::Target_arm): Initialize new data members GOT_,
10704 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10705 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10706 and Target_arm::rel_dyn_section.
10707 Declare new_enum Target_arm::Got_type.
10708 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10709 and DYNBSS_.
10710 Update commments for member do_dynsym_value.
10711 (Target_arm::got_size, Target_arm::plt_section,
10712 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10713 new methods inside class defintion.
10714 (Target_arm::got_section): Define new method.
10715 (Target_arm::rel_dyn_section): Same.
10716 (Output_data_plt_arm): New template class.
10717 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10718 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10719 (Output_data_plt_arm::add_entry): Same.
10720 (Output_data_plt_arm::first_plt_entry): Define new
10721 static data member for PLT instruction template.
10722 (Output_data_plt_arm::plt_entry): Same.
10723 (Output_data_plt_arm::do_write): Define new method.
10724 (Target_arm::make_plt_entry): Same.
10725 (Target_arm::do_finalize_sections): Same.
10726 (Target_arm::do_dynsym_value): Same.
10727
10728 2009-05-28 Doug Kwan <dougkwan@google.com>
10729
10730 * Makefile.am (TARGETSOURCES): Add arm.cc.
10731 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10732 * Makefile.in: Regenerate.
10733 * arm.cc: New file.
10734 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10735
10736 2009-05-26 Doug Kwan <dougkwan@google.com>
10737
10738 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10739 (General_options::check_excluded_libs): Strip off directories in
10740 archive name before matching like GNU ld does.
10741 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10742 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10743 (exclude_libs_test_LDFLAGS): Add linker option
10744 -Wl,--exclude-libs,libexclude_libs_test_3
10745 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10746 an explicit archive without using -l.
10747 (alt/libexclude_libs_test_3.a): New make rule.
10748 * testsuite/Makefile.in: Regenerate.
10749 * testsuite/exclude_libs_test.c : Declare lib3_default().
10750 (main): Call it.
10751 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10752 * exclude_libs_test_3.c: New file.
10753
10754 2009-05-26 Nick Clifton <nickc@redhat.com>
10755
10756 * po/id.po: New Indonesian translation.
10757 * po/gold.pot: Updated template file.
10758
10759 2009-05-22 Sriraman Tallam <tmsriram@google.com>
10760
10761 * testsuite/Makefile.am: Add -ffunction-sections to compile
10762 gc_comdat_test files. Add -Wl,--gc-sections to build
10763 gc_comdat_test.
10764 * testsuite/Makefile.in: Regenerate.
10765 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10766
10767 2009-05-21 Sriraman Tallam <tmsriram@google.com>
10768
10769 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10770 kept comdat section was garbage collected.
10771 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10772 * testsuite/Makefile.in: Regenerate.
10773 * testsuite/gc_comdat_test.sh: New file.
10774 * testsuite/gc_comdat_test_1.cc: New file.
10775 * testsuite/gc_comdat_test_2.cc: New file.
10776
10777 2009-05-19 Doug Kwan <dougkwan@google.com>
10778
10779 * archive.cc (Archive::Archive): Move constructor from archive.h
10780 to here. Initialize no_export_.
10781 (Archive::get_elf_object_for_member): Set no_export flag of object.
10782 * archive.h (Archive::Archive): Move constructor body to
10783 archive.cc.
10784 (Archive::no_export): New method.
10785 (Archive::no_export_): New field.
10786 * object.h (Object::Object): Initialize no_export_ to false.
10787 (Object::no_export, Object::set_no_export): New methods.
10788 (Object::no_export_): New field.
10789 * options.cc (General_options::parse_exclude_libs): New method.
10790 (General_options::check_excluded_libs) Same.
10791 * options.h (exclude_libs): New option.
10792 (General_options::check_excluded_libs): New method declaration.
10793 (General_options::excluded_libs_): New field.
10794 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10795 default or protected visibility if an object has no-export flag set.
10796 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10797 (check_SCRIPTS): Add exclude_libs_test.sh.
10798 (check_DATA): Add exclude_libs_test.syms.
10799 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10800 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10801 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10802 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10803 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10804 libexclude_libs_test_2.a): New rules.
10805 * testsuite/Makefile.in: Regenerate.
10806 * testsuite/exclude_libs_test.c: New file.
10807 * testsuite/exclude_libs_test.sh: Ditto.
10808 * testsuite/exclude_libs_test_1.c: Ditto.
10809 * testsuite/exclude_libs_test_2.c: Ditto.
10810
10811 2009-05-15 Ian Lance Taylor <iant@google.com>
10812
10813 * configure.ac: Check for declarations for cases where libiberty.h
10814 checks HAVE_DECL_xxx.
10815 * configure, config.in: Rebuild.
10816
10817 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10818
10819 * gold.h (Incremental_argument_list): Remove (invalid) forward
10820 declaration.
10821 * incremental.cc (Incremental_inputs::report_achive): New method.
10822 (Incremental_inputs::report_object): New method.
10823 (Incremental_inputs::report_script): New method.
10824 (Incremental_inputs::finalize_inputs): New method.
10825 (Incremental_inputs::finalize): Call finalize_inputs().
10826 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10827 Create inputs entries.
10828 * incremental.h (Incremental_input_type): New enum.
10829 (Incremental_inputs::Incremental_input): Initialize new fields.
10830 (Incremental_inputs::report_inputs): New method.
10831 (Incremental_inputs::report_achive): New method.
10832 (Incremental_inputs::report_object): New method.
10833 (Incremental_inputs::report_script): New method.
10834 (Incremental_inputs::finalize_inputs): New method.
10835 (Incremental_inputs::Input_info): New struct.
10836 (Incremental_inputs::Input_info_map): New typedef.
10837 (Incremental_inputs::lock_): New field.
10838 (Incremental_inputs::Inputs_): New field.
10839 (Incremental_inputs::Inputs_map): New field.
10840 * main.cc (main): Call Incremental_input::report_inputs.
10841 * options.h (Input_argument_list): Typedef moved from
10842 Input_arguments.
10843 (Input_file_group::Files): Remove, use ::Input_argument_list.
10844 (Input_file_group::Input_argument_list): Remove, use
10845 ::Input_argument_list.
10846 * plugin.cc (Plugin_manager::add_input_file): Add error in
10847 incremental build.
10848 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10849 functions.
10850 * script.cc (read_input_script): Call
10851 Incremental_input::report_script.
10852 * script.h (Script_info): New class.
10853
10854 2009-04-27 Ian Lance Taylor <iant@google.com>
10855
10856 * x86_64.cc (do_adjust_output_section): Set entsize to
10857 plt_entry_size.
10858
10859 2009-04-23 Elliott Hughes <enh@google.com>
10860
10861 * output.cc (Output_file::close): After short writes, continue
10862 writing from the correct offset in the buffer being written.
10863
10864 2009-04-23 Chris Demetriou <cgd@google.com>
10865
10866 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10867 * configure: Regenerate.
10868 * config.in: Regenerate.
10869 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10870 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10871
10872 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10873
10874 * incremental.cc (Incremental_inputs_header_data): Renamed from
10875 Incremental_input_header_data.
10876 (Incremental_inputs_header_data::data_size): New field.
10877 (Incremental_inputs_header_data::put_input_file_count): Renamed
10878 from input_file_count.
10879 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10880 from command_line_offset.
10881 (Incremental_inputs_header_data::put_reserved): Renamed from
10882 put_reserved.
10883 (Incremental_inputs_entry_data): Renamed from
10884 Incremental_input_entry_data.
10885 (Incremental_inputs_entry_data::data_size): New field.
10886 (Incremental_inputs::report_command_line): New method.
10887 (Incremental_inputs::finalize): New method.
10888 (Incremental_inputs::create_incremental_inputs_data): New method.
10889 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10890 * incremental.h: New file.
10891 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10892 (Layout::finalize): Create incremental inputs section in
10893 incremental builds.
10894 (Layout::create_incremental_info_sections): New method.
10895 * layout.h (Layout::incremental_inputs): New method.
10896 (Layout::create_incremental_info_sections): New method.
10897 (Layout::incremental_inputs_): New field.
10898 * main.cc (main): Notify Incremental_input of the command line.
10899
10900 2009-04-01 Ian Lance Taylor <iant@google.com>
10901 Mikolaj Zalewski <mikolajz@google.com>
10902
10903 * gold.h (reserve_unordered_map): Define, three versions, one for
10904 each version of Unordered_map.
10905 * layout.cc (Layout::Layout): Remove options parameter. Add
10906 number_of_input_files parameter. Don't initialize options_.
10907 Initialize number_of_input_files_ and resized_signatures_. Move
10908 sections_are_attached_.
10909 (Layout::layout_group): Reserve space for group_signatures_.
10910 (Layout::find_or_add_kept_section): Change name parameter to be a
10911 reference. Resize signatures_ map when it gets large enough.
10912 (Layout::layout_eh_frame): Use parameters->options() instead of
10913 this->options_.
10914 (Layout::make_output_section): Likewise.
10915 (Layout::attach_allocated_section_to_segment): Likewise.
10916 (Layout::finalize, Layout::create_executable_stack): Likewise.
10917 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10918 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10919 * layout.h (class Layout): Update declarations. Remove options_
10920 field. Add number_of_input_files_ and resized_signatures_
10921 fields. Move sections_are_attached_ field.
10922 * main.cc (main): Pass number of input files to Layout
10923 constructor. Don't pass options.
10924
10925 2009-03-30 Ian Lance Taylor <iant@google.com>
10926
10927 * ffsll.c (ffsll): Correct implementation.
10928
10929 2009-03-27 Ian Lance Taylor <iant@google.com>
10930
10931 * ffsll.c: New file.
10932 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10933 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10934 * ftruncate.c (ftruncate): Declare before definition.
10935 * mremap.c (mremap): Likewise.
10936 * pread.c (pread): Likewise.
10937 * configure, Makefile.in, config.in: Rebuild.
10938
10939 * mremap.c: New file.
10940 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10941 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10942 (mremap): Declare if HAVE_MREMAP is not defined.
10943 * configure, Makefile.in, config.in: Rebuild.
10944
10945 2009-03-27 Cary Coutant <ccoutant@google.com>
10946
10947 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10948 position independent.
10949 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10950 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10951
10952 2009-03-24 Cary Coutant <ccoutant@google.com>
10953
10954 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10955 an executable.
10956 (needs_dynamic_reloc): Likewise.
10957
10958 2009-03-24 Ian Lance Taylor <iant@google.com>
10959
10960 * yyscript.y (file_cmd): Recognize EXTERN.
10961 (extern_name_list, extern_name_list_body): New nonterminals.
10962 * script.cc (script_add_extern): Define.
10963 * script-c.h (script_add_extern): Declare.
10964
10965 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10966
10967 * object.cc (is_elf_object): Define.
10968 * object.h (is_elf_object): Declare.
10969 * archive.cc (Archive::get_elf_object_for_member): Call
10970 is_elf_object.
10971 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10972
10973 2009-03-24 Elliott Hughes <enh@google.com>
10974
10975 * output.cc (Output_file::map_anonymous): Define.
10976 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10977 try an anonymous one. Report the size if the mmap fails.
10978 * output.h (class Output_file): Declare map_anonymous.
10979
10980 2009-03-24 Ian Lance Taylor <iant@google.com>
10981
10982 * target-select.cc (instantiate_target): Don't acquire the lock if
10983 the instantiated_target_ field has already been set.
10984
10985 2009-03-23 Ian Lance Taylor <iant@google.com>
10986
10987 * gold-threads.h (class Initialize_lock): Define.
10988 * gold-threads.cc (class Initialize_lock_once): Define.
10989 (initialize_lock_control): New static variable.
10990 (initialize_lock_pointer): New static variable.
10991 (initialize_lock_once): New static function.
10992 (Initialize_lock::Initialize_lock): Define.
10993 (Initialize_lock::initialize): Define.
10994 * target-select.h: Include "gold-threads.h".
10995 (class Target_selector): Add lock_ and initialize_lock_ fields.
10996 Don't define instantiate_target, just declare it.
10997 * target-select.cc (Target_selector::Target_selector): Initialize
10998 new fields.
10999 (Target_selector::instantiate_target): Define.
11000 * descriptors.h: Include "gold-threads.h".
11001 (class Descriptors): Add initialize_lock_ field.
11002 * descriptors.cc (Descriptors::Descriptors): Initialize new
11003 field.
11004 (Descriptors::open): Use initialize_lock_ field
11005 * errors.h (class Errors): Add initialize_lock_ field.
11006 * errors.cc (Errors::Errors): Initialize new field.
11007 (Errors::initialize_lock): Use initialize_lock_ field.
11008 * powerpc.cc (class Target_selector_powerpc): Remove
11009 instantiated_target_ field. In do_recognize call
11010 instantiate_target rather than do_instantiate_target. In
11011 do_instantiate_target just allocate a new target.
11012 * sparc.cc (class Target_selector_sparc): Likewise.
11013
11014 * freebsd.h: New file.
11015 * i386.cc: Include "freebsd.h".
11016 (Target_i386): Derive from Target_freebsd rather than
11017 Sized_target.
11018 (Target_selector_i386): Derive from Target_selector_freebsd rather
11019 than Target_selector.
11020 * x86_64.cc: Include "freebsd.h".
11021 (Target_x86_64): Derive from Target_freebsd rather than
11022 Sized_target.
11023 (Target_selector_x86_64): Derive from Target_selector_freebsd
11024 rather than Target_selector.
11025 * target.h (class Target): Add adjust_elf_header and
11026 do_adjust_elf_header.
11027 * output.cc (Output_file_header:: do_sized_write): Call target
11028 adjust_elf_header routine.
11029 * configure.tgt: Set targ_osabi.
11030 * configure.ac: Define GOLD_DEFAULT_OSABI.
11031 * parameters.cc (Parameters::default_target): Pass
11032 GOLD_DEFAULT_OSABI to select_target.
11033 * target-select.h (class Target_selector): Make instantiate_target
11034 protected rather than private.
11035 * Makefile.am (HFILES): Add freebsd.h.
11036 * configure, Makefile.in, config.in: Rebuild.
11037
11038 * merge.cc (do_add_input_section): Correct pend value. Change
11039 message about last entry not being null terminated from error to
11040 warning.
11041
11042 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
11043
11044 * incremental.cc: New file.
11045 * Makefile.am (CCFILES): Add incremental.cc.
11046 * Makefile.in: Rebuild.
11047
11048 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
11049
11050 * layout.cc (Layout::output_section_name): Preserve names
11051 of '.note.' sections.
11052
11053 2009-03-19 Ian Lance Taylor <iant@google.com>
11054
11055 * descriptors.cc (Descriptors::open): Check that the options are
11056 valid before using them.
11057
11058 2009-03-18 Ian Lance Taylor <iant@google.com>
11059
11060 * script-sections.h: Include <list>.
11061 (class Script_sections): Change Sections_elements from std::vector
11062 to std::list. Typedef public Elements_iterator. Add
11063 orphan_section_placement_, data_segment_align_start_, and
11064 saw_data_segment_align_ fields. Remove data_segment_align_index_
11065 field.
11066 * script-sections.cc (class Orphan_section_placement): New class.
11067 (class Sections_element): Add virtual functions is_relro and
11068 orphan_section_init. Remove virtual function place_orphan_here.
11069 (class Output_section_definition): Add is_relro and
11070 orphan_section_init. Remove place_orphan_here.
11071 (class Orphan_output_section): Likewise.
11072 (Script_sections::Script_sections): Update for field changes.
11073 (Script_sections::data_segment_align): Set saw_data_segment_align_
11074 and data_segment_align_start_, not data_segment_align_index.
11075 (Script_sections::data_segment_relro_end): Check
11076 saw_data_segment_align_. Use data_segment_align_start_ rather
11077 than data_segment_align_index_.
11078 (Script_sections::place_orphan): Rewrite to use
11079 Orphan_section_placement.
11080
11081 2009-03-17 Ian Lance Taylor <iant@google.com>
11082
11083 * archive.cc (Archive::add_symbols): Check for a version attached
11084 to the symbol name in the archive map.
11085 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11086 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11087 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11088 (ver_test_11.a): New target.
11089 * testsuite/Makefile.in: Rebuild.
11090
11091 * configure.ac: Check for chsize and posix_fallocate. Replace
11092 ftruncate.
11093 * ftruncate.c: New file, from gnulib.
11094 * output.cc (posix_fallocate): Define dummy version if not
11095 HAVE_POSIX_FALLOCATE.
11096 (Output_file::map): Call posix_fallocate rather than lseek and
11097 write.
11098 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11099 * configure, Makefile.in, config.in: Rebuild.
11100
11101 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
11102
11103 * layout.h (Layout::create_note): Add section_name parameter.
11104 * layout.cc (Layout::create_note): Likewise.
11105 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11106
11107 2009-03-17 Ian Lance Taylor <iant@google.com>
11108
11109 * descriptors.cc: Include "options.h".
11110 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11111 (Descriptors::open): Always use O_CLOEXEC when opening a new
11112 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
11113 then set FD_CLOEXEC.
11114
11115 * sparc.cc (class Target_sparc): Add has_got_section.
11116 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11117 make sure we have a GOT section.
11118
11119 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11120 (Target_sparc::Scan::local): Likewise.
11121 (Target_sparc::Scan::global): Likewise.
11122 (Target_sparc::Relocate::relocate): Likewise.
11123 (Target_sparc::Relocate::relocate_tls): Likewise.
11124
11125 * symtab.cc (Symbol_table::define_default_version): New function,
11126 broken out of add_from_object.
11127 (Symbol_table::add_from_object): Call define_default_version.
11128 (Symbol_table::define_special_symbol): Add resolve_oldsym
11129 parameter. Change all callers. If the version for a symbol comes
11130 from a version script, resolve it with the symbol with the same
11131 name with no version. Also add the symbol without a version if
11132 appropriate.
11133 (do_define_in_output_data): If resolving with oldsym, don't delete
11134 sym.
11135 (do_define_in_output_segment): Likewise.
11136 (do_define_as_constant): Likewise.
11137 * symtab.h (class Symbol_table): Update declarations.
11138
11139 2009-03-13 Ian Lance Taylor <iant@google.com>
11140
11141 * readsyms.cc (Read_symbols::incompatible_warning): New function.
11142 (Read_symbols::requeue): New function.
11143 (Read_symbols::do_read_symbols): If make_elf_object fails because
11144 the target type is not configured, and the file was searched for,
11145 issue a warning and retry with the next directory.
11146 (Add_symbols::run): If the file has an incompatible format, and
11147 it was searched for, requeue the Read_symbols task. On error,
11148 release the object.
11149 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
11150 dirindex parameter to constructor. Change all callers. Declare
11151 incompatible_warning and requeue.
11152 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11153 input_argument_ and input_group_ fields. Add them to
11154 constructor. Change all callers.
11155 (class Read_script): Add dirindex_ field. Add it to constructor.
11156 Change all callers.
11157 * archive.cc (Archive::setup): Remove input_objects parameter.
11158 Change all callers.
11159 (Archive::get_file_and_offset): Likewise.
11160 (Archive::read_all_symbols): Likewise.
11161 (Archive::read_symbols): Likewise.
11162 (Archive::get_elf_object_for_member): Remove input_objects
11163 parameter. Add punconfigured parameter. Change all callers.
11164 (Archive::add_symbols): Change return type to bool. Check return
11165 value of include_member.
11166 (Archive::include_all_members): Likewise.
11167 (Archive::include_member): Change return type to bool. Return
11168 false if first included object has incompatible target. Set
11169 included_member_ field.
11170 (Add_archive_symbols::run): If add_symbols returns false, requeue
11171 Read_symbols task.
11172 * archive.h (class Archive): Add included_member_ field.
11173 Initialize it in constructor. Add input_file and searched_for
11174 methods. Update declarations.
11175 (class Add_archive_symbols): Add dirpath_, dirindex_, and
11176 input_argument_ fields. Add them to constructor. Change all
11177 callers.
11178 * script.cc: Include "target-select.h".
11179 (class Parser_closure): Add skip_on_incompatible_target_ and
11180 found_incompatible_target_ fields. Add
11181 skip_on_incompatible_target parameter to constructor. Change all
11182 callers. Add methods skip_on_incompatible_target,
11183 clear_skip_on_incompatible_target, found_incompatible_target, and
11184 set_found_incompatible_target.
11185 (read_input_script): Add dirindex parameter. Change all callers.
11186 If parser finds an incompatible target, requeue Read_symbols
11187 task.
11188 (script_set_symbol): Clear skip_on_incompatible_target in
11189 closure.
11190 (script_add_assertion, script_parse_option): Likewise.
11191 (script_start_sections, script_add_phdr): Likewise.
11192 (script_check_output_format): New function.
11193 * script.h (read_input_script): Update declaration.
11194 * script-c.h (script_check_output_format): Declare.
11195 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11196 (ignore_cmd): Remove OUTPUT_FORMAT.
11197 * fileread.cc (Input_file::Input_file): Add explicit this.
11198 (Input_file::will_search_for): New function.
11199 (Input_file::open): Add pindex parameter. Change all callers.
11200 * fileread.h (class Input_file): Add input_file_argument method.
11201 Declare will_search_for. Update declarations.
11202 * object.cc (make_elf_object): Add punconfigured parameter.
11203 Change all callers.
11204 * object.h (class Object): Make input_file public. Add
11205 searched_for method.
11206 (make_elf_object): Update declaration.
11207 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
11208 restart search.
11209 * dirsearch.h (class Dirsearch): Update declaration.
11210 * options.h (class General_options): Add --warn-search-mismatch.
11211 * parameters.cc (Parameters::is_compatible_target): New function.
11212 * parameters.h (class Parameters): Declare is_compatible_target.
11213 * workqueue.cc (Workqueue::add_blocker): New function.
11214 * workqueue.h (class Workqueue): Declare add_blocker.
11215
11216 * fileread.cc (Input_file::open): Remove options parameter.
11217 Change all callers.
11218 (Input_file::open_binary): Likewise.
11219 * script.cc (read_input_script): Likewise.
11220 * readsyms.h (class Read_symbols): Remove options_ field. Remove
11221 options parameter from constructor. Change all callers.
11222 (class Read_script): Likewise.
11223 * fileread.h (class Input_file): Update declarations.
11224 * script.h (read_input_script): Update declaration.
11225
11226 2009-03-10 Nick Clifton <nickc@redhat.com>
11227
11228 * po/es.po: New Spanish translation.
11229
11230 2009-03-06 Cary Coutant <ccoutant@google.com>
11231
11232 * options.cc (parse_short_option): Keep dash_z from registering itself.
11233
11234 2009-03-03 Ian Lance Taylor <iant@google.com>
11235
11236 PR 9918
11237 * target-reloc.h (relocate_section): Pass output_section to
11238 relocate.
11239 * i386.cc (Target_i386::should_apply_static_reloc): Add
11240 output_section parameter. Change all callers.
11241 (Target_i386::Relocate::relocate): Add output_section parameter.
11242 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11243 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11244 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11245 * testsuite/two_file_shared.sh: New script.
11246 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11247 (check_DATA): Add two_file_shared.dbg.
11248 (two_file_shared.dbg): New target.
11249 * testsuite/Makefile.in: Rebuild.
11250
11251 2009-03-01 Ian Lance Taylor <iant@google.com>
11252
11253 * configure.ac: Check for byteswap.h.
11254 * configure: Rebuild.
11255 * config.in: Rebuild.
11256
11257 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
11258
11259 * layout.cc (Layout::find_or_add_kept_section): New function.
11260 (Layout::add_comdat): Removed.
11261 * layout.h (struct Kept_section): Move out of class Layout.
11262 Remove trailing underscores from field names. Add group_sections
11263 field. Rename group_ field to is_group. Change all uses.
11264 (class Layout): Declare find_or_add_kept_section, not add_comdat.
11265 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11266 comdat_groups_ field.
11267 (Sized_relobj::include_section_group): Use
11268 find_or_add_kept_section and Kept_section::group_sections.
11269 (Sized_relobj::include_linkonce_section): Likewise.
11270 * object.cc (class Sized_relobj): Don't define Comdat_group or
11271 Comdat_group_table. Remove find_comdat_group and
11272 add_comdat_group. Remove comdat_groups_ field.
11273 * plugin.cc (include_comdat_group): Use
11274 Layout::find_or_add_kept_section.
11275
11276 2009-02-28 Ian Lance Taylor <iant@google.com>
11277
11278 * README: --gc-sections and map files are now supported. Document
11279 some build requirements.
11280
11281 PR 6992
11282 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11283 relocatable link set the value of the section symbol to zero.
11284 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11285 relocatable link don't include the section address in the local
11286 symbol value.
11287
11288 2009-02-27 Ian Lance Taylor <iant@google.com>
11289
11290 PR 6811
11291 * options.h (class Search_directory): Add is_system_directory.
11292 (class General_options): Declare is_in_system_directory.
11293 * options.cc (get_relative_sysroot): Make static.
11294 (get_default_sysroot): Make static.
11295 (General_optoins::is_in_system_directory): New function.
11296 * fileread.cc (Input_file::is_in_system_directory): New function.
11297 * fileread.h (class Input_file): Declare is_in_system_directory.
11298 * object.h (class Object): Add is_in_system_directory.
11299 (class Input_objects): Remove system_library_directory_ field.
11300 * object.cc (Input_objects::add_object): Don't set
11301 system_library_directory_.
11302 (input_objects::found_in_system_library_directory): Remove.
11303 * symtab.cc (Symbol_table::write_globals): Remove input_objects
11304 parameter. Change all callers.
11305 (Symbol_table::sized_write_globals): Likewise.
11306 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11307 Call Object::is_in_system_directory.
11308 * symtab.h (class Symbol_table): Update declarations.
11309
11310 PR 5990
11311 * descriptors.h (Open_descriptor): Add is_on_stack field.
11312 * descriptors.cc (Descriptors::open): If the descriptor is on the
11313 top of the stack, remove it. Initialize is_on_stack field.
11314 (Descriptors::release): Only add pod to stack if it is not on the
11315 stack already.
11316 (Descriptors::close_some_descriptor): Clear stack_next and
11317 is_on_stack fields.
11318
11319 PR 7091
11320 * output.cc (Output_section::find_starting_output_address): Rename
11321 from starting_output_address; add PADDR parameter; change return
11322 type.
11323 * output.h (class Output_section): Declare
11324 find_starting_output_address instead of starting_output_address.
11325 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11326 section symbol for which we can't find a merge section.
11327
11328 PR 9836
11329 * symtab.cc (Symbol_table::add_from_object): If the visibility is
11330 hidden or internal, force the symbol to be local.
11331 * resolve.cc (Symbol::override_visibility): Define.
11332 (Symbol::override_base): Use override_visibility.
11333 (Symbol_table::resolve): Likewise.
11334 (Symbol::override_base_with_special): Likewise.
11335 (Symbol_table::override_with_special): If the visibility is hidden
11336 or internal, force the symbol to be local.
11337 * symtab.h (class Symbol): Add set_visibility and
11338 override_visibility.
11339 * testsuite/ver_test_1.sh: New file.
11340 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11341 (check_DATA): Add ver_test_1.syms.
11342 (ver_test_1.syms): New target.
11343 * testsuite/Makefile.in: Rebuild.
11344
11345 2009-02-25 Cary Coutant <ccoutant@google.com>
11346
11347 * layout.cc (Layout::choose_output_section): Don't rename sections
11348 when using a linker script that has a SECTIONS clause.
11349 * Makefile.in: Regenerate.
11350
11351 * testsuite/Makefile.am (script_test_5.sh): New test case.
11352 * testsuite/Makefile.in: Regenerate.
11353 * testsuite/script_test_5.cc: New file.
11354 * testsuite/script_test_5.sh: New file.
11355 * testsuite/script_test_5.t: New file.
11356
11357 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
11358
11359 * archive.cc (Archive::include_member): Update calls to add_symbols.
11360 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11361 the Layout argument.
11362 * dynobj.h (do_add_symbols): Add the Layout argument.
11363 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11364 Layout argument.
11365 * object.h (Object::add_symbols): Add the Layout argument.
11366 (Object::do_add_symbols): Add the Layout argument.
11367 (Sized_relobj::do_add_symbols): Add the Layout argument.
11368 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11369 Unify the two versions.
11370 (Add_plugin_symbols): Remove.
11371 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11372 (Sized_pluginobj::do_add_symbols): Unify the two versions.
11373 (Add_plugin_symbols): Remove.
11374 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11375 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11376 (Add_symbols::run): Make it work with Pulginobj.
11377
11378 2009-02-06 Ian Lance Taylor <iant@google.com>
11379
11380 * object.cc (Sized_relobj::do_layout): Make info message start
11381 with lower case letter.
11382
11383 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
11384
11385 * binary.cc: Fix file comment.
11386
11387 * options.h (enum Incremental_disposition): Define.
11388 (class General_options): Add new options: --incremental,
11389 --incremental_changed, --incremental_unchanged,
11390 --incremental_unknown. Add incremental_disposition_ and
11391 implicit_incremental_ fields.
11392 (General_options::incremental_disposition): New function.
11393 (class Position_dependent_options): Add incremental_disposition
11394 option.
11395 (Position_dependent_options::copy_from_options): Set incremental
11396 dispositions.
11397 * options.cc (General_options::parse_incremental_changed): New
11398 function.
11399 (General_options::parse_incremental_unchanged): New function.
11400 (General_options::parse_incremental_unknown): New function.
11401 (General_options::General_options): Initialize new fields
11402 incremental_disposition_ and implicit_incremental_.
11403 (General_options::finalize): Check for uasge of --incremental-*
11404 without --incremental.
11405
11406 2009-02-06 Chris Demetriou <cgd@google.com>
11407
11408 * gold.h (gold_undefined_symbol): Change to take only a Symbol
11409 pointer and to report location as the file name associated with
11410 the symbol.
11411 (gold_undefined_symbol_at_location): New function to replace the
11412 old gold_undefined_symbol functionality.
11413 * target-reloc.h (relocate_section): Update to use
11414 gold_undefined_symbol_at_location.
11415 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11416 Call gold_undefined_symbol function rather than gold_error.
11417 * errors.h (Errors::undefined_symbol): Take location as a
11418 string, rather than calculating it from a relocation.
11419 * errors.cc (Errors::fatal): Print "fatal error:" before the
11420 formatted message.
11421 (Errors::error, Errors::error_at_location): Print "error: "
11422 before the formatted message.
11423 (Errors::undefined_symbol): Take location as a string, rather
11424 than calculating it from a relocation.
11425 (gold_undefined_symbol_at_location): New function akin to
11426 old gold_undefined_symbol, calculates location from relocation.
11427 (gold_undefined_symbol): Change to take only a Symbol pointer
11428 and to report location as the file name associated with the symbol.
11429 * testsuite/debug_msg.sh: Update for changed error messages.
11430 * testsuite/undef_symbol.sh: Likewise.
11431
11432 2009-02-04 Duncan Sands <baldrick@free.fr>
11433
11434 PR 9812
11435 * reduced_debug_output.h
11436 (Output_reduced_debug_abbrev_section::failed): Use format for
11437 gold_warning.
11438 (Output_reduced_debug_info_section::faild): Likewise.
11439
11440 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
11441
11442 * script.cc (Lazy_demangler): New class.
11443 (Version_script_info::get_symbol_version_helper): Demangle a
11444 symbol only once.
11445
11446 2009-01-29 Cary Coutant <ccoutant@google.com>
11447
11448 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11449 to __tls_get_addr.
11450 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11451
11452 2009-01-28 Ian Lance Taylor <iant@google.com>
11453
11454 * version.cc (version_string): Bump to 1.9.
11455
11456 * gold.h: Include <cstring> and <stdint.h>.
11457 * version.cc: Include <cstdio>.
11458 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11459 warning.
11460 * reduced_debug_output.cc (insert_into_vector): Rename from
11461 Insert_into_vector; change all callers. Use Swap_unaligned to
11462 avoid aliasing issue; remove union since it is unnecessary.
11463
11464 2009-01-27 Sriraman Tallam <tmsriram@google.com>
11465
11466 * Makefile.am (CCFILES): Add gc.cc.
11467 (HFILES): Add gc.h.
11468 * Makefile.in: Regenerate.
11469 * gold.cc (Gc_runner): New class.
11470 (queue_initial_tasks): Call garbage collection related tasks
11471 when corresponding options are invoked.
11472 (queue_middle_gc_tasks): New function.
11473 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11474 processed early before laying out sections during garbage collection.
11475 * gold.h (queue_middle_gc_tasks): New function.
11476 (is_prefix_of): Move from "layout.cc".
11477 * i386.cc (Target_i386::gc_process_relocs): New function.
11478 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11479 * main.cc (main): Create object of class "Garbage_collection".
11480 * object.cc (Relobj::copy_symbols_data): New function.
11481 (Relobj::is_section_name_included): New function.
11482 (Sized_relobj::do_layout): Allow this function to be called twice
11483 during garbage collection and defer layout of section during the
11484 first call.
11485 * object.h (Relobj::get_symbols_data): New function.
11486 (Relobj::is_section_name_included): New function.
11487 (Relobj::copy_symbols_data): New function.
11488 (Relobj::set_symbols_data): New function.
11489 (Relobj::get_relocs_data): New function.
11490 (Relobj::set_relocs_data): New function.
11491 (Relobj::is_output_section_offset_invalid): New pure virtual function.
11492 (Relobj::gc_process_relocs): New function.
11493 (Relobj::do_gc_process_relocs): New pure virtual function.
11494 (Relobj::sd_): New data member.
11495 (Sized_relobj::is_output_section_offset_invalid): New function.
11496 (Sized_relobj::do_gc_process_relocs): New function.
11497 * options.h (General_options::gc_sections): Modify to not be a no-op.
11498 (General_options::print_gc_sections): New option.
11499 * plugin.cc (Plugin_finish::run): Remove function call to
11500 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11501 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11502 * reloc.cc (Read_relocs::run): Add task to process relocs and
11503 determine unreferenced sections when doing garbage collection.
11504 (Gc_process_relocs): New class.
11505 (Sized_relobj::do_gc_process_relocs): New function.
11506 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11507 sections that are garbage collected.
11508 * reloc.h (Gc_process_relocs): New class.
11509 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11510 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11511 symbols whose corresponding sections are garbage collected.
11512 (Symbol_table::Symbol_table): Add new parameter for the garbage
11513 collection object.
11514 (Symbol_table::gc_mark_undef_symbols): New function.
11515 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11516 (Symbol_table::gc_mark_dyn_syms): New function.
11517 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11518 as garbage.
11519 (Symbol_table::add_from_object): Likewise.
11520 (Symbol_table::add_from_relobj): When building shared objects, do not
11521 treat externally visible symbols as garbage.
11522 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11523 table information for static and relocatable links.
11524 * symtab.h (Symbol_table::set_gc): New function.
11525 (Symbol_table::gc): New function.
11526 (Symbol_table::gc_mark_undef_symbols): New function.
11527 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11528 (Symbol_table::gc_mark_dyn_syms): New function.
11529 (Symbol_table::gc_): New data member.
11530 * target.h (Sized_target::gc_process_relocs): New pure virtual
11531 function.
11532 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11533 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11534
11535 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11536
11537 * options.h (General_options::gc_sections): Define as a no-op for now.
11538 (General_options::no_keep_memory): Ditto.
11539 (General_options::Bshareable): Define.
11540 * options.cc (General_options::finalize): Honor -Bshareable.
11541
11542 2009-01-20 Andreas Schwab <schwab@suse.de>
11543
11544 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11545 read the value in the contents, since we don't use it. Use the
11546 template endianness when writing.
11547 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11548
11549 2009-01-19 Andreas Schwab <schwab@suse.de>
11550
11551 * configure.tgt (powerpc64-*): Fix targ_obj.
11552
11553 2009-01-15 Ian Lance Taylor <iant@google.com>
11554
11555 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11556 local symbols when stripping all symbols.
11557
11558 2009-01-14 Cary Coutant <ccoutant@google.com>
11559
11560 * output.cc (Output_reloc): Add explicit instantiations.
11561
11562 2009-01-14 Cary Coutant <ccoutant@google.com>
11563
11564 * archive.cc (Archive::get_elf_object_for_member): Remove call
11565 to File_read::claim_for_plugin.
11566 * descriptors.cc (Descriptors::open): Remove reference to
11567 is_claimed.
11568 (Descriptors::claim_for_plugin): Remove.
11569 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11570 (Descriptors::is_claimed): Remove.
11571 (claim_descriptor_for_plugin): Remove.
11572 * fileread.cc (File_read::claim_for_plugin): Remove.
11573 * fileread.h (File_read::claim_for_plugin): Remove.
11574 (File_read::descriptor): Reopen descriptor if necessary.
11575 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11576 (Plugin_manager::all_symbols_read): Add task parameter. Change
11577 all callers.
11578 (Plugin_manager::get_input_file): New function.
11579 (Plugin_manager::release_input_file): New function.
11580 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11581 corresponding data member.
11582 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11583 and pass to base constructor. Change all callers.
11584 (get_input_file, release_input_file): New functions.
11585 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11586 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11587 (Plugin_manager::all_symbols_read): Add task parameter.
11588 (Plugin_manager::get_input_file): New function.
11589 (Plugin_manager::release_input_file): New function.
11590 (Plugin_manager::task_): New data member.
11591 (Pluginobj::Pluginobj): Add filesize parameter.
11592 (Pluginobj::filename): New function.
11593 (Pluginobj::descriptor): New function.
11594 (Pluginobj::filesize): New function.
11595 (Pluginobj::filesize_): New data member.
11596 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11597 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11598 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11599
11600 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11601 with archive libraries.
11602 * testsuite/Makefile.in: Regenerate.
11603 * testsuite/plugin_test.c (struct sym_info): New type.
11604 (get_input_file, release_input_file): New static variables.
11605 (onload): Capture new transfer vector entries.
11606 (claim_file_hook): Stop reading at end of file according to filesize.
11607 Factor out parsing of readelf output into separate function.
11608 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11609 APIs and get the source file name from the symbol table. Convert
11610 source file name to corresponding object file name. Print info
11611 message when adding new input files.
11612 (parse_readelf_line): New function.
11613 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11614 * testsuite/plugin_test_2.sh: Likewise.
11615 * testsuite/plugin_test_3.sh: Likewise.
11616 * testsuite/plugin_test_4.sh: New test case.
11617
11618 2009-01-07 Ian Lance Taylor <iant@google.com>
11619
11620 * version.cc (version_string): Bump to 1.8.
11621
11622 2008-12-23 Cary Coutant <ccoutant@google.com>
11623
11624 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11625 * plugin.cc (Plugin_manager::finish): Rename as
11626 layout_deferred_objects. Move cleanup to separate function.
11627 (Plugin_manager::cleanup): New function.
11628 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11629 separately.
11630 * plugin.h (Plugin_manager::finish): Rename as
11631 layout_deferred_objects.
11632 (Plugin_manager::cleanup): New function.
11633 (Plugin_manager::cleanup_done): New field.
11634
11635 2008-12-23 Cary Coutant <ccoutant@google.com>
11636
11637 * plugin.cc (is_visible_from_outside): New function.
11638 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11639 so we don't return "IR only" status for exported symbols or -r links.
11640
11641 * testsuite/Makefile.am (plugin_test_3): New test case.
11642 * testsuite/Makefile.in: Regenerate.
11643 * testsuite/plugin_test_3.sh: New file.
11644
11645 2008-12-22 Cary Coutant <ccoutant@google.com>
11646
11647 * object.cc (Sized_relobj::layout_section): New function.
11648 (Sized_relobj::do_layout): Defer layout of input sections until after
11649 plugin has provided replacement files.
11650 (Sized_relobj::do_layout_deferred_sections): New function.
11651 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11652 (Relobj::layout_deferred_sections): New function.
11653 (Relobj::do_layout_deferred_sections): New function.
11654 (Sized_relobj::do_layout_deferred_sections): New function.
11655 (Sized_relobj::layout_section): New function.
11656 (Sized_relobj::Deferred_layout): New structure.
11657 (Sized_relobj::deferred_layout_): New field.
11658 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11659 Change all callers. Layout deferred sections.
11660 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11661 references.
11662 (Plugin_hook::run): Move code from do_plugin_hook inline.
11663 (Plugin_hook::do_plugin_hook): Remove.
11664 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11665 (Plugin_manager::finish): Renamed, was cleanup.
11666 (Plugin_manager::should_defer_layout): New function.
11667 (Plugin_manager::add_deferred_layout_object): New function.
11668 (Plugin_manager::Deferred_layout_list): New type.
11669 (Plugin_manager::deferred_layout_objects_): New field.
11670 (Plugin_hook::do_plugin_hook): Remove.
11671
11672 2008-12-17 Ian Lance Taylor <iant@google.com>
11673
11674 * options.h (class General_options): Add --no case for
11675 --export-dynamic.
11676
11677 2008-12-16 Cary Coutant <ccoutant@google.com>
11678
11679 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11680 vector.
11681 (Plugin_manager::claim_file): Create plugin object even if
11682 plugin did not call the add_symbols callback.
11683 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11684 asking for more symbols than were added.
11685 * testsuite/Makefile.am (plugin_test_1): Add test case with
11686 no global symbols.
11687 (empty.syms): New target.
11688 * testsuite/Makefile.in: Regenerate.
11689 * testsuite/plugin_test.c (claim_file_hook): Add new debug
11690 message. Don't call add_symbols if no globals.
11691 (all_symbols_read_hook): Don't provide replacement for empty
11692 claimed file.
11693
11694 2008-12-12 Ian Lance Taylor <iant@google.com>
11695
11696 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11697 r_type == 0 for a local symbol with r_sym == 0.
11698 (scan_relocatable_relocs): Pass r_sym to
11699 local_non_section_strategy.
11700 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11701 r_sym parameter.
11702
11703 * configure.ac: Update test for TLS descriptors: they are
11704 supported as of glibc 2.9.
11705 * configure: Rebuild.
11706
11707 2008-12-11 Ian Lance Taylor <iant@google.com>
11708
11709 PR 7091
11710 * target-reloc.h (Default_scan_relocatable_relocs): For each
11711 function, map r_type == 0 to RELOC_DISCARD.
11712
11713 2008-12-10 Cary Coutant <ccoutant@google.com>
11714
11715 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11716 object to override a kept COMDAT group from a plugin object.
11717
11718 2008-12-09 Ian Lance Taylor <iant@google.com>
11719
11720 PR 7088
11721 * yyscript.y (file_cmd): Handle INPUT.
11722
11723 * testsuite/initpri1.c: Change all declarations to be full
11724 prototypes by adding void, to avoid compiler warnings.
11725
11726 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
11727
11728 * options.cc (General_options::parse_plugin_opt): New.
11729 (General_options::add_plugin): The argument now is just the filename.
11730 (General_options::add_plugin_option): New.
11731 * options.h (plugin_opt): New.
11732 (add_plugin): Change argument name.
11733 (add_plugin_option): New.
11734 * plugin.cc (Plugin::load): Don't parse the plugin option.
11735 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11736 (Plugin::add_option): New.
11737 (Plugin::args_): Change type.
11738 (Plugin::filename_): New.
11739 (Plugin_manager::add_plugin_option): New.
11740 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11741 * testsuite/Makefile.in: Regenerate.
11742
11743 2008-12-05 Cary Coutant <ccoutant@google.com>
11744
11745 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11746 Handle --strip-lto-sections option.
11747 * options.h (strip_lto_sections): New option.
11748
11749 2008-12-01 Cary Coutant <ccoutant@google.com>
11750
11751 * plugin.cc (ld_plugin_message): Change format parameter to const.
11752 Fix mismatch between new[] and delete.
11753
11754 2008-11-14 Cary Coutant <ccoutant@google.com>
11755
11756 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11757 instead of -1U.
11758
11759 2008-11-05 Craig Silverstein <csilvers@google.com>
11760
11761 * options.cc (General_options::parse_dynamic_list): New function.
11762 * options.h (General_options): New flags dynamic_list,
11763 dynamic_list_data, dynamic_list_cpp_new, and
11764 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11765 (General_options::in_dynamic_list): New function.
11766 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11767 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11768 (Lex::can_continue_name): Likewise.
11769 (yylex): Likewise.
11770 (read_script_file): New parameter script_options.
11771 (read_dynamic_list): New function.
11772 (Script_options::define_dynamic_list): New function.
11773 (dynamic_list_keyword_parsecodes): New variable.
11774 (dynamic_list_keywords): New variable.
11775 * script.h (Script_options::define_dynamic_list): New function
11776 prototype.
11777 (read_dynamic_list): New function prototype.
11778 * symtab.cc (strprefix): New macro.
11779 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11780 dynamic_list_data, dynamic_list_cpp_new, and
11781 dynamic_list_cpp_typeinfo.
11782 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11783 (dynamic_list_expr): New rule.
11784 (dynamic_list_nodes): Likewise.
11785 (dynamic_list_node): Likewise.
11786 * testsuite/Makefile.am (dynamic_list): New test.
11787 * testsuite/Makefile.in: Regenerated.
11788 * testsuite/dynamic_list.t: New file.
11789 * testsuite/dynamic_list.sh: New file.
11790
11791 2008-11-05 Craig Silverstein <csilvers@google.com>
11792
11793 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11794 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11795 (t11_last): Likewise.
11796 * testsuite/ver_test_6.c (main): Likewise.
11797
11798 2008-10-07 Cary Coutant <ccoutant@google.com>
11799
11800 * options.c (General_options::finalize): Add check for -static and
11801 -shared.
11802 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11803 is not empty.
11804
11805 2008-10-02 Cary Coutant <ccoutant@google.com>
11806
11807 * plugin.cc (make_sized_plugin_object): Fix conditional
11808 compilation to work when not all targets are enabled.
11809
11810 2008-09-29 Cary Coutant <ccoutant@google.com>
11811
11812 * archive.cc (Archive::get_file_and_offset): Use filename instead
11813 of name to get library path.
11814 (Archive::include_member): Unlock external member of a thin archive.
11815
11816 * testsuite/Makefile.am (TEST_AR): New variable.
11817 (thin_archive_test_1): New test.
11818 (thin_archive_test_2): New test.
11819 * testsuite/Makefile.in: Regenerate.
11820 * testsuite/thin_archive_main.cc: New file.
11821 * testsuite/thin_archive_test_1.cc: New file.
11822 * testsuite/thin_archive_test_2.cc: New file.
11823 * testsuite/thin_archive_test_3.cc: New file.
11824 * testsuite/thin_archive_test_4.cc: New file.
11825
11826 2008-09-29 Cary Coutant <ccoutant@google.com>
11827
11828 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11829 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11830 instead of -1U.
11831 (Sized_relobj::do_finalize_local_symbols): Likewise.
11832 (Sized_relobj::map_to_kept_section): Likewise.
11833 * object.h (Sized_relobj::invalid_address): New constant.
11834 (Sized_relobj::do_output_section_offset): Check for invalid_address
11835 and return -1ULL.
11836 * output.cc (Output_reloc::local_section_offset): Use constant
11837 invalid_address instead of -1U.
11838 (Output_reloc::get_address): Likewise.
11839 (Output_section::output_address): Change -1U to -1ULL.
11840 * output.h (Output_reloc::invalid_address): New constant.
11841 * reloc.cc (Sized_relobj::write_sections): Use constant
11842 invalid_address instead of -1U.
11843 (Sized_relobj::relocate_sections): Likewise.
11844 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11845 values for merge sections.
11846 * target-reloc.h (relocate_for_relocatable): Use constant
11847 invalid_address instead of -1U.
11848
11849 2008-09-19 Cary Coutant <ccoutant@google.com>
11850
11851 Add plugin functionality for link-time optimization (LTO).
11852 * configure.ac (plugins): Add --enable-plugins option.
11853 * configure: Regenerate.
11854 * config.in: Regenerate.
11855 * Makefile.am (LIBDL): New variable.
11856 (CCFILES): Add plugin.cc.
11857 (HFILES): Add plugin.h.
11858 (ldadd_var): Add LIBDL.
11859 * Makefile.in: Regenerate.
11860
11861 * archive.cc: Include "plugin.h".
11862 (Archive::setup): Don't preread archive symbols when using a plugin.
11863 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11864 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11865 files.
11866 (Archive::include_member): Add symbols from plugin objects.
11867 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11868 * descriptors.cc (Descriptors::open): Check for file descriptors
11869 abandoned by plugins.
11870 (Descriptors::claim_for_plugin): New function.
11871 * descriptors.h (Descriptors::claim_for_plugin): New function.
11872 (Open_descriptor::is_claimed): New field.
11873 (claim_descriptor_for_plugin): New function.
11874 * fileread.cc (File_read::claim_for_plugin): New function.
11875 * fileread.h (File_read::claim_for_plugin): New function.
11876 (File_read::descriptor): New function.
11877 * gold.cc: Include "plugin.h".
11878 (queue_initial_tasks): Add task to call plugin hooks for generating
11879 new object files.
11880 * main.cc: Include "plugin.h".
11881 (main): Load plugin libraries.
11882 * object.h (Pluginobj): Declare.
11883 (Object::pluginobj): New function.
11884 (Object::do_pluginobj): New function.
11885 (Object::set_target): New function.
11886 * options.cc: Include "plugin.h".
11887 (General_options::parse_plugin): New function.
11888 (General_options::General_options): Initialize plugins_ field.
11889 (General_options::add_plugin): New function.
11890 * options.h (Plugin_manager): Declare.
11891 (General_options): Add --plugin option.
11892 (General_options::has_plugins): New function.
11893 (General_options::plugins): New function.
11894 (General_options::add_plugin): New function.
11895 (General_options::plugins_): New field.
11896 * plugin.cc: New file.
11897 * plugin.h: New file.
11898 * readsyms.cc: Include "plugin.h".
11899 (Read_symbols::do_read_symbols): Check for archive before checking
11900 for ELF file. Call plugin hooks to claim files.
11901 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11902 from a real object file; force override when processing replacement
11903 files.
11904 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11905 (Symbol::init_base_object): Likewise.
11906 (Symbol::init_base_output_data): Likewise.
11907 (Symbol::init_base_output_segment): Likewise.
11908 (Symbol::init_base_constant): Likewise.
11909 (Symbol::init_base_undefined): Likewise.
11910 (Symbol::output_section): Assert that object is not a plugin.
11911 (Symbol_table::add_from_pluginobj): New function.
11912 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11913 undefined.
11914 (Symbol_table::sized_write_globals): Likewise.
11915 (Symbol_table::add_from_pluginobj): Instantiate template.
11916 * symtab.h (Sized_pluginobj): Declare.
11917 (Symbol::in_real_elf): New function.
11918 (Symbol::set_in_real_elf): New function.
11919 (Symbol::in_real_elf_): New field.
11920 (Symbol_table::add_from_pluginobj): New function.
11921
11922 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11923 (LIBDL): New variable.
11924 (LDADD): Add LIBDL.
11925 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11926 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11927 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11928 (MOSTLYCLEANFILES): Likewise.
11929 * testsuite/Makefile.in: Regenerate.
11930 * testsuite/plugin_test.c: New file.
11931 * testsuite/plugin_test_1.sh: New file.
11932 * testsuite/plugin_test_2.sh: New file.
11933
11934 2008-09-16 Ian Lance Taylor <iant@google.com>
11935
11936 * target-reloc.h (relocate_section): Check whether a symbol is
11937 defined by the ABI before reporting an undefined symbol error.
11938 * target.h (Target::is_defined_by_abi): Make parameter const.
11939 (Target::do_is_defined_by_abi): Likewise.
11940 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11941 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11942 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11943 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11944 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11945 * testsuite/Makefile.in: Rebuild.
11946
11947 * fileread.cc (make_view): Add casts to avoid warning.
11948
11949 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11950
11951 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11952 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11953
11954 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11955
11956 * options.h (General_options::output_is_executable): New.
11957 (General_options::output_is_pie): New.
11958 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11959 for shared libraries.
11960 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11961
11962 2008-09-11 Chris Demetriou <cgd@google.com>
11963
11964 * options.h (origin): New -z option.
11965 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11966 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11967 in DT_FLAGS_1.
11968
11969 2008-09-05 Cary Coutant <ccoutant@google.com>
11970
11971 * fileread.cc (File_read::make_view): Add check for attempt to map
11972 beyond end of file.
11973
11974 2008-09-05 Cary Coutant <ccoutant@google.com>
11975
11976 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11977 explicit instantiations.
11978
11979 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11980
11981 PR gold/6858
11982 * options.cc (General_options::finalize): Allow undefined symbols
11983 in shlibs if linking -shared.
11984
11985 PR gold/6859
11986 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11987 symbols as not needing a dynsym entry.
11988
11989 2008-08-20 Craig Silverstein <csilvers@google.com>
11990
11991 * fileread.cc (File_read::open): Do not lock the file unless it
11992 was successfully opened.
11993
11994 2008-08-14 Cary Coutant <ccoutant@google.com>
11995
11996 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11997 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11998 * testsuite/tls_test.cc (struct int128): 128-bit struct
11999 for testing TLS relocs with non-zero addend.
12000 (v12): New TLS variable.
12001 (t12): New test.
12002 (t_last): Add check for v12.
12003 * testsuite/tls_test.h (t12): New function.
12004 * testsuite/tls_test_main.cc (thread_routine): Call new test.
12005
12006 2008-08-13 Ian Lance Taylor <iant@google.com>
12007
12008 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12009 set tls_segment_ or relro_segment_.
12010 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12011 when appropriate.
12012 * output.h (Output_section::clear_is_relro): New function.
12013 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12014 sections specially even when output_data_ is empty.
12015 (Output_segment::maximum_alignment): When first section is relro,
12016 only force alignment for PT_LOAD segments.
12017 * script.cc (script_data_segment_align): New function.
12018 (script_data_segment_relro_end): New function.
12019 * script-c.h (script_data_segment_align): Declare.
12020 (script_data_segment_relro_end): Declare.
12021 * script-sections.h (class Script_sections): Declare
12022 data_segment_align and data_segment_relro_end. Add fields
12023 segment_align_index_ and saw_relro_end_.
12024 * script-sections.cc (class Sections_element): Add set_is_relro
12025 virtual function. Add new bool* parameter to place_orphan_here.
12026 Add get_output_section virtual function.
12027 (class Output_section_definition): Add set_is_relro. Add new
12028 bool* parameter to place_orphan_here. Add get_output_section.
12029 Add is_relro_ field.
12030 (Output_section_definition::Output_section_definition): Initialize
12031 evaluated_address_, evaluated_load_address, evaluated_addralign_,
12032 and is_relro_ fields.
12033 (Output_section_definition::place_orphan_here): Add is_relro
12034 parameter.
12035 (Output_section_definition::set_section_addresses): Set relro for
12036 output section.
12037 (Output_section_definition::alternate_constraint): Likewise.
12038 (class Orphan_output_section): Add new bool* parameter to
12039 place_orphan_here. Add get_output_section.
12040 (Orphan_output_section::place_orphan_here): Add is_relro
12041 parameter.
12042 (Script_sections::Script_sections): Initialize
12043 data_segment_align_index_ and saw_relro_end_.
12044 (Script_sections::data_segment_align): New function.
12045 (Script_sections::data_segment_relro_end): New function.
12046 (Script_sections::place_orphan): Set or clear is_relro.
12047 (Script_sections::set_section_addresses): Force alignment of first
12048 TLS section.
12049 * yyscript.y (exp): Call script_data_segment_align and
12050 script_data_segment_relro_end.
12051 * testsuite/relro_script_test.t: New file.
12052 * testsuite/relro_test.cc (using_script): Declare.
12053 (t1, t2): Test using_script.
12054 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12055 (relro_script_test_SOURCES): Define.
12056 (relro_script_test_DEPENDENCIES): Define.
12057 (relro_script_test_LDFLAGS): Define.
12058 (relro_script_test_LDADD): Define.
12059 (relro_script_test.so): New target.
12060 * testsuite/Makefile.in: Rebuild.
12061
12062 2008-08-06 Cary Coutant <ccoutant@google.com>
12063
12064 * archive.cc (Archive::total_archives, Archive::total_members)
12065 (Archive::total_members_loaded): New variables.
12066 (Archive::setup): Add parameter. Add option to preread
12067 archive symbols.
12068 (Archive::read_armap): Add counter.
12069 (Archive::get_file_and_offset): New function.
12070 (Archive::get_elf_object_for_member): New function.
12071 (Archive::read_all_symbols): New function.
12072 (Archive::read_symbols): New function.
12073 (Archive::add_symbols): Add counters.
12074 (Archive::include_all_members): Use armap to find members if it's
12075 already built.
12076 (Archive::include_member): Skip reading symbols if already read.
12077 Factored code into Archive::get_file_and_offset and
12078 Archive::get_elf_object_for_member. Changed call to
12079 Mapfile::report_include_archive_member.
12080 (Archive::print_stats): New function.
12081 * archive.h: Declare Object and Read_symbols_data classes.
12082 (Archive::Archive): Add initializers for new members.
12083 (Archive::setup): Add parameter.
12084 (Archive::print_stats): New function.
12085 (Archive::total_archives, Archive::total_members)
12086 (Archive::total_members_loaded): New variables.
12087 (Archive::get_file_and_offset): New function.
12088 (Archive::get_elf_object_for_member): New function.
12089 (Archive::read_all_symbols): New function.
12090 (Archive::read_symbols): New function.
12091 (Archive::Archive_member): New class.
12092 (Archive::members_): New member.
12093 (Archive::num_members_): New member.
12094 * main.cc: Include archive.h.
12095 (main): Call Archive::print_stats.
12096 * mapfile.cc (Mapfile::report_include_archive_member): Delete
12097 archive parameter; member_name is now the fully-decorated name.
12098 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12099 * options.h: (General_options): Add --preread-archive-symbols option.
12100 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12101 Archive::setup.
12102
12103 2008-08-04 Ian Lance Taylor <iant@google.com>
12104
12105 * symtab.h (Symbol::use_plt_offset): New function.
12106 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12107 * powerpc.cc (Relocate::relocate): Likewise.
12108 * sparc.cc (Relocate::relocate): Likewise.
12109 * x86_64.cc (Relocate::relocate): Likewise.
12110 * testsuite/weak_plt.sh: New test.
12111 * testsuite/weak_plt_main.cc: New test.
12112 * testsuite/weak_plt_shared.cc: New test.
12113 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12114 (check_PROGRAMS): Add weak_plt.
12115 (check_DATA): Add weak_plt_shared.so.
12116 (weak_plt_main_pic.o, weak_plt): New targets.
12117 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12118 * testsuite/Makefile.in: Rebuild.
12119
12120 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12121 gcctestdir/ld.
12122 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12123 * testsuite/Makefile.in: Rebuild.
12124
12125 2008-08-04 Alan Modra <amodra@bigpond.net.au>
12126
12127 * Makefile.am (POTFILES.in): Set LC_ALL=C.
12128 * Makefile.in: Regenerate.
12129 * po/POTFILES.in: Regenerate.
12130
12131 2008-07-29 Ian Lance Taylor <iant@google.com>
12132
12133 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12134 symbols before other symbols.
12135 * testsuite/script_test_2.cc (test_addr): Declare.
12136 (test_addr_alias): Declare.
12137 (main): Check that test_addr and test_addr_alias have the right
12138 values.
12139 * testsuite/script_test_2.t: Define test_addr_alias and
12140 test_addr.
12141
12142 2008-07-24 Ian Lance Taylor <iant@google.com>
12143
12144 PR 5990
12145 * descriptors.cc: New file.
12146 * descriptors.h: New file.
12147 * gold-threads.h (class Hold_optional_lock): New class.
12148 * fileread.cc: Include "descriptors.h".
12149 (File_read::~File_read): Release descriptor rather than closing
12150 it.
12151 (File_read::open) [file]: Call open_descriptor rather than open.
12152 Set is_descriptor_opened_.
12153 (File_read::open) [memory]: Assert that descriptor is not open.
12154 (File_read::reopen_descriptor): New function.
12155 (File_read::release): Release descriptor.
12156 (File_read::do_read): Make non-const. Reopen descriptor.
12157 (File_read::read): Make non-const.
12158 (File_read::make_view): Reopen descriptor.
12159 (File_read::do_readv): Likewise.
12160 * fileread.h (class File_read): Add is_descriptor_opened_ field.
12161 Update declarations.
12162 * layout.cc: Include "descriptors.h".
12163 (Layout::create_build_id): Use open_descriptor rather than open.
12164 * output.cc: Include "descriptors.h".
12165 (Output_file::open): Use open_descriptor rather than open.
12166 * archive.cc (Archive::const_iterator): Change Archive to be
12167 non-const.
12168 (Archive::begin, Archive::end): Make non-const.
12169 (Archive::count_members): Likewise.
12170 * archive.h (class Archive): Update declarations.
12171 * object.h (Object::read): Make non-const.
12172 * Makefile.am (CCFILES): Add descriptors.cc.
12173 (HFILES): Add descriptors.h.
12174 * Makefile.in: Rebuild.
12175
12176 PR 6716
12177 * gold.h: Always include <clocale>. Add Solaris workarounds
12178 following code in binutils/sysdep.h.
12179
12180 PR 6048
12181 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12182 this->eh_frame_hdr_ is NULL before using it.
12183
12184 * dynobj.cc (Versions::Versions): Update comment.
12185
12186 * dynobj.cc (Versions::Versions): If there is an soname, use it as
12187 the base version name.
12188
12189 * stringpool.cc (Stringpool_template::add_with_length): Set key to
12190 array size plus one.
12191 (Stringpool_template::set_string_offsets): Subtract one from key
12192 before using it as an array index.
12193 (Stringpool_template::get_offset_with_length): Likewise.
12194 (Stringpool_template::write_to_buffer): Likewise.
12195 * stringpool.h (Stringpool_template::get_offset_from_key):
12196 Likewise.
12197
12198 2008-07-23 Ian Lance Taylor <iant@google.com>
12199
12200 PR 6658
12201 * object.h (Merged_symbol_value::value): Do our best to handle a
12202 negative addend.
12203
12204 PR 6647
12205 * script.cc (Version_script_info::get_versions): Don't add empty
12206 version tag to return value.
12207 (Version_script_info::get_symbol_version_helper): Change return
12208 type to bool. Add pversion parameter. Change all callers.
12209 (script_register_vers_node): Don't require a non-NULL tag.
12210 * script.h (class Version_script_info): Update declarations.
12211 (Version_script_info::get_symbol_version): Change return type to
12212 bool. Add version parameter. Change all callers.
12213 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12214 handling. Handle an empty version from a version script.
12215 (Symbol_table::define_special_symbol): Likewise.
12216 * testsuite/ver_test_10.script: New file.
12217 * testsuite/ver_test_10.sh: New file.
12218 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12219 (check_DATA): Add ver_test_10.syms.
12220 (ver_test_10.syms, ver_test_10.so): New target.
12221 * testsuite/Makefile.in: Rebuild.
12222
12223 2008-07-23 Simon Baldwin <simonb@google.com>
12224
12225 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12226 to zero for undefined symbols from dynamic libraries.
12227
12228 2008-07-23 Ian Lance Taylor <iant@google.com>
12229
12230 * symtab.cc (Symbol_table::resolve): Remove version parameter.
12231 Change all callers.
12232 * symtab.h (class Symbol_table): Update declaration.
12233 * testsuite/ver_test_9.cc: New file.
12234 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12235 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12236 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12237 (ver_test_9.so, ver_test_9.o): New targets.
12238 * testsuite/Makefile.in: Rebuild.
12239
12240 2008-07-22 Ian Lance Taylor <iant@google.com>
12241
12242 * options.h (class General_options): Define --check-sections.
12243 * layout.cc (Layout::set_segment_offsets): Handle
12244 --check-sections.
12245
12246 * options.h (class General_options): Define -n/--nmagic and
12247 -N/--omagic.
12248 * options.cc (General_options::finalize): For -n/--nmagic or
12249 -N/--omagic, set -static.
12250 * layout.cc (Layout::attach_allocated_section_to_segment): If
12251 -N/--omagic, don't put read-only and read-write sections in
12252 different segments.
12253 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12254 finding a read-only segment.
12255 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12256 don't set the minimum segment alignment to the common page size,
12257 and don't set the file offset to the address modulo the page size.
12258 * script-sections.cc (Script_sections::create_segments): If
12259 -n/--omagic, don't put read-only and read-write sections in
12260 different segments.
12261
12262 * cref.cc: New file.
12263 * cref.h: New file.
12264 * options.h (class General_options): Add --print-symbol-counts.
12265 * main.cc (main): Issue defined symbol report if requested.
12266 * archive.cc (Archive::interpret_header): Make into a const member
12267 function.
12268 (Archive::add_symbols): Call Input_objects::archive_start and
12269 archive_stop.
12270 (Archive::const_iterator): Define new class.
12271 (Archive::begin, Archive::end): New functions.
12272 (Archive::include_all_members): Rewrite to use iterator.
12273 (Archive::count_members): New function.
12274 * archive.h (class Archive): Update declarations.
12275 (Archive::filename): New function.
12276 * object.cc: Include "cref.h".
12277 (Sized_relobj::Sized_relobj): Initialize defined_count_.
12278 (Sized_relobj::do_get_global_symbol_counts): New function.
12279 (Input_objects::add_object): Add object to cross-referencer.
12280 (Input_objects::archive_start): New function.
12281 (Input_objects::archive_stop): New function.
12282 (Input_objects::print_symbol_counts): New function.
12283 * object.h: Declare Cref and Archive.
12284 (Object::get_global_symbol_counts): New function.
12285 (Object::do_get_global_symbol_counts): New pure virtual function.
12286 (class Sized_relobj): Add defined_count_ field. Update
12287 declarations.
12288 (class Input_objects): Add cref_ field. Update constructor.
12289 Update declarations.
12290 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12291 defined_count_.
12292 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12293 symbol counts.
12294 (Sized_dynobj::do_get_global_symbol_counts): New function.
12295 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12296 defined_count_. Update declarations. Define Symbols typedef.
12297 * symtab.cc (Symbol_table::add_from_relobj): Add defined
12298 parameter. Change all callers.
12299 (Symbol_table::add_from_dynobj): Add sympointers and defined
12300 parameters. Change all callers.
12301 * symtab.h (class Symbol_table): Update declarations.
12302 * Makefile.am (CCFILES): Add cref.cc.
12303 (HFILES): Add cref.h.
12304 * Makefile.in: Rebuild.
12305
12306 2008-07-22 Simon Baldwin <simonb@google.com>
12307
12308 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12309 to zero when writing undefined symbols.
12310
12311 2008-07-22 Ian Lance Taylor <iant@google.com>
12312
12313 * output.cc (Output_section::add_input_section): Don't try to
12314 merge empty merge sections.
12315
12316 2008-07-21 Craig Silverstein <csilvers@google.com>
12317
12318 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12319 Include symbol version in error message.
12320
12321 2008-07-20 Chris Demetriou <cgd@google.com>
12322
12323 * configure.ac (gold_cv_c_random_seed): New configured variable.
12324 (RANDOM_SEED_CFLAGS): New substituted variable.
12325 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12326 * configure: Rebuild.
12327 * Makefile.in: Likewise.
12328 * testsuite/Makefile.in: Likewise.
12329
12330 2008-07-18 Ian Lance Taylor <iant@google.com>
12331
12332 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12333 where we see NAME/NULL and NAME/VERSION as separate symbols.
12334 * testsuite/ver_test_main.cc (main): Call t4.
12335 (t4, t4_2a): Define.
12336 * testsuite/ver_test_2.cc (t4_2): Define.
12337 * testsuite/ver_test_2.script: Put t4_2a in VER2.
12338 * testsuite/ver_test_4.cc (t4_2a): Define.
12339 * testsuite/ver_test_4.script: Put t4_2a in VER2.
12340 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12341
12342 2008-07-17 Ian Lance Taylor <iant@google.com>
12343
12344 * dynobj.cc (Versions::add_def): If we give an error about a
12345 missing version, go ahead and create the version anyhow.
12346
12347 2008-07-10 Ian Lance Taylor <iant@google.com>
12348
12349 Handle output sections with more than 0x7fffffff bytes.
12350 * object.h (class Relobj): Change map_to_output_ to
12351 output_sections_, and just keep a section pointer. Change all
12352 uses. Move comdat group support to Sized_relobj.
12353 (Relobj::is_section_specially_mapped): Remove.
12354 (Relobj::output_section): Remove poff parameter. Change all
12355 callers.
12356 (Relobj::output_section_offset): New function.
12357 (Relobj::set_section_offset): Rewrite.
12358 (Relobj::map_to_output): Remove.
12359 (Relobj::output_sections): New function.
12360 (Relobj::do_output_section_offset): New pure virtual function.
12361 (Relobj::do_set_section_offset): Likewise.
12362 (class Sized_relobj): Add section_offsets_ field. Add comdat
12363 group support from Relobj. Update declarations.
12364 (Sized_relobj::get_output_section_offset): New function.
12365 (Sized_relobj::do_output_section_offset): New function.
12366 (Sized_relobj::do_set_section_offset): New function.
12367 * object.cc (Relobj::output_section_address): Remove.
12368 (Sized_relobj::Sized_relobj): Initialize new fields.
12369 (Sized_relobj::include_section_group): Cast find_kept_object to
12370 Sized_relobj.
12371 (Sized_relobj::include_linkonce_section): Likewise.
12372 (Sized_relobj::do_layout): Use separate arrays for output section
12373 and output offset.
12374 (Sized_relobj::do_count_local_symbols): Change map_to_output to
12375 output_sections.
12376 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12377 output_sections and section_offsets.
12378 (Sized_relobj::write_local_symbols): Likewise.
12379 (map_to_kept_section): Compute output address directly.
12380 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12381 output_sections and section_offsets.
12382 (Sized_relobj::write_sections): Likewise.
12383 (Sized_relobj::relocate_sections): Likewise.
12384 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12385 * output.h (class Output_reloc): Update declarations. Change
12386 u2_.relobj to Sized_relobj*.
12387 (class Output_data_reloc): Change add functions to use
12388 Sized_relobj*.
12389 * output.cc (Output_reloc::Output_reloc): Change relobj to
12390 Sized_relobj*.
12391 (Output_reloc::local_section_offset): Change return type to
12392 Elf_Addr. Use get_output_section_offset.
12393 (Output_reloc::get_address): Likewise.
12394 (Output_section::is_input_address_mapped): Don't call
12395 is_section_specially_mapped.
12396 (Output_section::output_offset): Likewise.
12397 (Output_section::output_address): Likewise.
12398 (Output_section::starting_output_address): Likewise.
12399 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12400 parameter to Sized_relobj*.
12401 (Copy_relocs::need_copy_reloc): Likewise.
12402 (Copy_relocs::save): Likewise.
12403 * copy-relocs.h (class Copy_relocs): Update declarations.
12404 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12405 Sized_relobj*. Change relobj_ field to Sized_relobj*.
12406 * target-reloc.h (relocate_for_relocatable): Change
12407 offset_in_output_section type to Elf_Addr. Change code that uses
12408 it as well.
12409 * layout.cc (Layout::layout): Always set *off.
12410 * mapfile.cc (Mapfile::print_input_section): Use
12411 output_section_offset.
12412 * i386.cc (Target_i386::copy_reloc): Change object parameter to
12413 Sized_relobj*.
12414 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12415 * sparc.cc (Target_sparc::copy_reloc): Likewise.
12416 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12417
12418 2008-07-03 Ian Lance Taylor <iant@google.com>
12419
12420 * layout.cc (Layout::include_section): Do not discard unrecognized
12421 SHT_STRTAB sections.
12422
12423 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
12424
12425 * script.cc (Lex::can_continue_name): Make '?' allowable in
12426 version-script names.
12427 * testsuite/version_script.map: Change glob pattern to use '?'
12428
12429 2008-06-30 Manish Singh <yosh@gimp.org>
12430
12431 PR 6585
12432 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12433 Correct typo.
12434
12435 2008-06-30 Ian Lance Taylor <iant@google.com>
12436
12437 PR 6660
12438 PR 6682
12439 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12440 versions]: Don't try to read the value in the contents, since we
12441 don't use it. Use the template endianness when writing.
12442
12443 2008-06-25 Cary Coutant <ccoutant@google.com>
12444
12445 * fileread.cc (File_read::make_view): Assert on zero-length view.
12446 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12447 symbol table when there are no symbols to read.
12448
12449 2008-06-23 Craig Silverstein <csilvers@google.com>
12450
12451 * version.cc (version_string): Bump to 1.7
12452
12453 2008-06-18 Craig Silverstein <csilvers@google.com>
12454
12455 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12456 constant 0xFFFF to type Valtype.
12457 (Powerpc_relocate_functions::rel16_ha): Likewise.
12458
12459 2008-06-17 Ian Lance Taylor <iant@google.com>
12460
12461 * output.h (Output_section::Input_section): Initialize p2align_ to
12462 zero for Output_section_data constructors.
12463 (Output_section::Input_section::addralign): If not an input
12464 section, return the alignment of the Output_section_data.
12465 * testsuite/copy_test.cc: New file.
12466 * testsuite/copy_test_1.cc: New file.
12467 * testsuite/copy_test_2.cc: New file.
12468 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12469 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12470 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12471 (copy_test_1_pic.o, copy_test_1.so): New targets.
12472 (copy_test_2_pic.o, copy_test_2.so): New targets.
12473 * testsuite/Makefile.in: Rebuild.
12474
12475 * script-sections.cc (Script_sections::place_orphan): Initialize
12476 local variable exact.
12477
12478 2008-06-13 David Edelsohn <edelsohn@gnu.org>
12479
12480 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12481
12482 2008-06-12 David Edelsohn <edelsohn@gnu.org>
12483 David S. Miller <davem@davemloft.net>
12484
12485 * powerpc.cc: New file.
12486 * Makefile.am (TARGETSOURCES): Add powerpc.cc
12487 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12488 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12489 * Makefile.in: Rebuild.
12490
12491 2008-06-09 Ian Lance Taylor <iant@google.com>
12492
12493 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12494 <exception>.
12495 (throwing, orig_terminate): New static variables.
12496 (terminate_handler): New static function.
12497 (t2): Set terminate handler.
12498
12499 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12500
12501 PR 6584
12502 * binary.cc (Binary_to_elf::sized_convert): Fix .data
12503 alignment.
12504
12505 2008-05-30 Cary Coutant <ccoutant@google.com>
12506
12507 * archive.cc (Archive::include_all_members) Correct to step
12508 over symbol table and extended name table in thin archives.
12509
12510 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12511
12512 PR 6407
12513 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12514 calculation.
12515
12516 2008-05-28 Caleb Howe <cshowe@google.com>
12517
12518 * reduced_debug_output.cc: New file.
12519 * reduced_debug_output.h: New file.
12520 * options.h (class General_options): Add --strip-debug-non-line.
12521 * options.cc (General_options::finalize): Add strip_debug_non_line
12522 to the strip heirarchy.
12523 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12524 fields.
12525 * layout.cc: Include "reduced_debug_output.h".
12526 (Layout::Layout): Initialize new fields.
12527 (line_only_debug_sections): New static array.
12528 (is_lines_only_debug_sections): New static inline function.
12529 (Layout::include_section): Handle --strip-debug-non-line.
12530 (Layout::make_output_section): If --strip-debug-non-line, build
12531 new output sections for .debug_abbrev and .debug_info.
12532 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12533 gold. Warn about possible overflow.
12534 (read_signed_LEB_128): Likewise.
12535 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12536 (read_signed_LEB_128): Declare.
12537 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12538 (HFILES): Add reduced_debug_output.h.
12539 * Makefile.in: Rebuild.
12540
12541 2008-05-21 Ian Lance Taylor <iant@google.com>
12542
12543 * mapfile.cc: New file.
12544 * mapfile.h: New file.
12545 * options.h (class General_options): Add -M/--print-map and -Map.
12546 * options.cc (General_options::finalize): Make -M equivalent to
12547 -Map -.
12548 * main.cc: Include <cstdio> and "mapfile.h".
12549 (main): Open mapfile if requested.
12550 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12551 constructor. Change caller.
12552 (queue_initial_tasks): Add mapfile parameter. Change caller.
12553 (queue_middle_tasks): Likewise.
12554 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12555 declarations.
12556 * archive.cc: Include "mapfile.h".
12557 (Archive::add_symbols): Add mapfile parameter. Change all
12558 callers. Pass mapfile, symbol, and reason to include_member.
12559 (Archive::include_all_members): Add mapfile parameter. Change all
12560 callers.
12561 (Archive::include_member): Add mapfile, sym, and why parameters.
12562 Change all callers. Report inclusion to map file.
12563 * archive.h: Include "fileread.h".
12564 (class Archive): Update declarations.
12565 (Archive::file): New const method.
12566 (class Add_archive_symbols): Add mapfile_ field. Update
12567 constructor. Change all callers.
12568 * readsyms.h (class Read_symbols): Likewise.
12569 (class Finish_group): Likewise.
12570 (class Read_script): Likewise.
12571 * common.cc: Include "mapfile.h".
12572 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12573 all callers.
12574 (Symbol_table::do_allocate_commons): Likewise.
12575 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12576 symbol allocation to mapfile.
12577 * common.h (class Allocate_commons_task): Add mapfile_ field.
12578 Update constructor. Change all callers.
12579 * symtab.h (class Symbol_table): Update declarations.
12580 * layout.cc: Include "mapfile.h".
12581 (Layout_task_runner::run): Print information to mapfile.
12582 (Layout::create_gold_note): Change Output_data_fixed_space to
12583 Output_data_zero_fill.
12584 (Layout::create_build_id): Likewise.
12585 (Layout::print_to_mapfile): New function.
12586 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12587 constructor. Change caller.
12588 (class Layout): Declare print_to_mapfile.
12589 * output.cc (Output_section::Input_section::print_to_mapfile): New
12590 function.
12591 (Output_section::add_input_section): If producing a map, always
12592 add to input_sections_ list.
12593 (Output_section::do_print_to_mapfile): New function.
12594 (Output_segment::print_sections_to_mapfile): New function.
12595 (Output_segment::print_section_list_to_mapfile): New function.
12596 * output.h: Include "mapfile.h".
12597 (Output_data::print_to_mapfile): New function.
12598 (Output_data::do_print_to_mapfile): New virtual function.
12599 (Output_segment_headers::do_print_to_mapfile): New function.
12600 (Output_file_header::do_print_to_mapfile): New function.
12601 (Output_data_const::do_print_to_mapfile): New function.
12602 (class Output_data_const_buffer): Add map_name_ field. Update
12603 constructor. Change all callers. Add do_print_to_mapfile
12604 function.
12605 (class Output_data_fixed_space): Likewise.
12606 (class Output_data_space): Likewise.
12607 (class Output_data_zero_fill): New class.
12608 (Output_data_strtab::do_print_to_mapfile): New function.
12609 (Output_data_reloc_base::do_print_to_mapfile): New function.
12610 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12611 (Output_data_group::do_print_to_mapfile): New function.
12612 (Output_data_got::do_print_to_mapfile): New function.
12613 (Output_data_dynamic::do_print_to_mapfile): New function.
12614 (Output_symtab_xindex::do_print_to_mapfile): New function.
12615 (class Output_section): Declare do_print_to_mapflie. Declare
12616 print_to_mapfile in Input_section.
12617 (class Output_segment): Declare new functions.
12618 * object.h (Sized_relobj::symbol_count): New function.
12619 * script-sections.cc
12620 (Output_section_element_dot_assignment::set_section_addresses):
12621 Change Output_data_fixed_space to Output_data_zero_fill.
12622 (Output_data_expression::do_print_to_mapfile): New function.
12623 * script.cc (read_input_script): Add mapfile parameter. Change
12624 all callers.
12625 * script.h (read_input_script): Update declaration.
12626 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12627 (Eh_frame::do_print_to_mapfile): New function.
12628 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12629 (Output_merge_string::do_print_to_mapfile): New function.
12630 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12631 function.
12632 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12633 function.
12634 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12635 function.
12636 * Makefile.am (CCFILES): Add mapfile.cc.
12637 (HFILES): Add mapfile.h.
12638 * Makefile.in: Rebuild.
12639
12640 2008-05-19 Ian Lance Taylor <iant@google.com>
12641
12642 * options.h (class General_options): Add -z relro.
12643 * layout.cc (Layout::Layout): Initialize relro_segment_.
12644 (Layout::add_output_section_data): Return the output section.
12645 (Layout::make_output_section): Rcognize relro sections and mark
12646 them appropriately.
12647 (Layout::attach_allocated_section_to_segment): Put relro sections
12648 in a PT_GNU_RELRO segment.
12649 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12650 section as relro.
12651 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12652 PT_TLS segments.
12653 (Layout::linkonce_mapping): Map d.rel.ro.local to
12654 .data.rel.ro.local.
12655 (Layout::output_section_name): Us .data.rel.ro.local for any
12656 section which begins with that.
12657 * layout.h (class Layout): Update add_output_section_data
12658 declaration. Add relro_segment_ field.
12659 * output.cc (Output_section::Output_section): Initialize is_relro_
12660 and is_relro_local_ fields.
12661 (Output_segment::add_output_section): Group relro sections.
12662 (Output_segment::is_first_section_relro): New function.
12663 (Output_segment::maximum_alignment): If there is a relro section,
12664 align the segment to the common page size.
12665 (Output_segment::set_section_addresses): Track whether we are
12666 looking at relro sections. If the last section is a relro
12667 section, align to the common page size.
12668 (Output_segment::set_section_list_addresses): Add in_relro
12669 parameter. Change all callers. Align to the page size when
12670 moving from relro to non-relro section.
12671 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12672 segment.
12673 * output.h (class Output_section): Add is_relro_ and
12674 is_relro_local_ fields.
12675 (Output_section::is_relro): New function.
12676 (Output_section::set_is_relro): New function.
12677 (Output_section::is_relro_local): New function.
12678 (Output_section::set_is_relro_local): New function.
12679 (class Output_segment): Update declarations.
12680 * i386.cc (Target_i386::got_section): Mark .got section as relro.
12681 * sparc.cc (Target_sparc::got_section): Likewise.
12682 * x86_64.cc (Target_x86_64::got_section): Likewise.
12683 * testsuite/relro_test_main.cc: New file.
12684 * testsuite/relro_test.cc: New file.
12685 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12686 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12687 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12688 (relro_test.so, relro_test_pic.o): New targets.
12689 * testsuite/Makefile.in: Rebuild.
12690
12691 2008-05-16 Ian Lance Taylor <iant@google.com>
12692
12693 * output.cc (Output_segment::add_output_section): Remove front
12694 parameter.
12695 * output.h (class Output_segment): Remove
12696 add_initial_output_section and overloaded add_output_section.
12697 Update declaration of remaining add_output_section.
12698 * layout.cc (Layout::create_interp): Call add_output_section
12699 rather than add_initial_output_section.
12700 (Layout::finish_dynamic_section): Likewise.
12701
12702 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12703 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
12704 know the dynamic type.
12705 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12706 field. Initialize it in constructor.
12707 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12708 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12709 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12710 reloc.
12711
12712 * output.cc (Output_reloc::get_address): Change return type to
12713 Elf_Addr.
12714 * output.h (class Output_reloc): Update get_address declaration.
12715 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12716 for section addresses.
12717
12718 2008-05-09 Ian Lance Taylor <iant@google.com>
12719
12720 PR 6493
12721 * gold.cc (gold_nomem): Use return value of write.
12722
12723 2008-05-08 Ian Lance Taylor <iant@google.com>
12724
12725 * symtab.c (Symbol::init_base_output_data): Add version
12726 parameter. Change all callers.
12727 (Symbol::init_base_output_segment): Likewise.
12728 (Symbol::init_base_constant): Likewise.
12729 (Symbol::init_base_undefined): Likewise.
12730 (Sized_symbol::init_output_data): Likewise.
12731 (Sized_symbol::init_output_segment): Likewise.
12732 (Sized_symbol::init_constant): Likewise.
12733 (Sized_symbol::init_undefined): Likewise.
12734 (Symbol_table::do_define_in_output_data): If the new symbol has a
12735 version, mark it as the default.
12736 (Symbol_table::do_define_in_output_segment): Likewise.
12737 (Symbol_table::do_define_as_constant): Likewise.
12738 * symtab.h (class Symbol): Update declarations.
12739 (class Sized_symbol): Likewise.
12740 * resolve.cc (Symbol::override_version): New function.
12741 (Symbol::override_base): Call override_version.
12742 (Symbol::override_base_with_special): Likewise.
12743 * testsuite/ver_script_8.script: New file.
12744 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12745 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12746 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12747 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12748
12749 2008-05-06 Ian Lance Taylor <iant@google.com>
12750
12751 PR 6049
12752 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12753 functions.
12754 (class General_options): Remove existing --undefined, and add
12755 --no-undefined instead. Add new --undefined as synonym for -u.
12756 * archive.cc (Archive::add_symbols): Check whether symbol was
12757 named with -u.
12758 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12759 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12760 all uses. Add IS_UNDEFINED. Update declarations to split
12761 different versions of init_base. Declare init_base_undefined.
12762 (Symbol::is_defined): Handle IS_UNDEFINED.
12763 (Symbol::is_undefined): Likewise.
12764 (Symbol::is_weak_undefined): Call is_undefined.
12765 (Symbol::is_absolute): Handle IS_CONSTANT.
12766 (class Sized_symbol): Update declarations to split different
12767 versions of init. Declare init_undefined.
12768 (class Symbol_table): Declare new functions.
12769 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12770 Change all callers.
12771 (Symbol::init_base_output_data): Likewise.
12772 (Symbol::init_base_output_segment): Likewise.
12773 (Symbol::init_base_constant): Likewise.
12774 (Symbol::init_base_undefined): New function.
12775 (Sized_symbol::init_object): Rename from init. Change all
12776 callers.
12777 (Sized_symbol::init_output_data): Likewise.
12778 (Sized_symbol::init_output_segment): Likewise.
12779 (Sized_symbol::init_constant): Likewise.
12780 (Sized_symbol::init_undefined): New function.
12781 (Symbol_table::add_undefined_symbols_from_command_line): New
12782 function.
12783 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12784 function.
12785 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12786 (Symbol::output_section): Likewise.
12787 (Symbol::set_output_section): Likewise.
12788 (Symbol_table::sized_finalize_symbol): Likewise.
12789 (Symbol_table::sized_write_globals): Likewise.
12790 * resolve.cc (Symbol_table::should_override): Likewise.
12791 (Symbol::override_base_with_special): Likewise.
12792
12793 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12794 symbol, change it to have default visibility.
12795 * testsuite/protected_1.cc: New file.
12796 * testsuite/protected_2.cc: New file.
12797 * testsuite/protected_3.cc: New file.
12798 * testsuite/protected_main_1.cc: New file.
12799 * testsuite/protected_main_2.cc: New file.
12800 * testsuite/protected_main_3.cc: New file.
12801 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12802 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12803 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12804 (protected_1.so): New target.
12805 (protected_1_pic.o, protected_2_pic.o): New targets.
12806 (protected_3_pic.o): New target.
12807 (check_PROGRAMS): Add protected_2.
12808 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12809 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12810 * testsuite/Makefile.in: Rebuild.
12811
12812 * options.h (DEFINE_var): Add set_user_set_##varname__.
12813 (DEFINE_bool_alias): New macro.
12814 (class General_options): Define -Bstatic using DEFINE_bool_alias
12815 rather than DEFINE_special. Add --undefined as an alias for -z
12816 defs.
12817 * options.cc (General_options::parse_Bstatic): Remove.
12818
12819 * options.h (class General_options): Add --fatal-warnings.
12820 * main.cc (main): Implement --fatal-warnings.
12821 * errors.h (Errors::warning_count): New function.
12822
12823 * options.h (class General_options): Add -Bsymbolic-functions.
12824 * symtab.h (Symbol::is_preemptible): Check for
12825 -Bsymbolic-functions.
12826
12827 2008-05-05 Ian Lance Taylor <iant@google.com>
12828
12829 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12830 as noVARNAME rather than no-VARNAME.
12831 (class General_options): Add option -z combreloc.
12832 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12833 get_address.
12834 (Output_reloc::sort_before) [SHT_REL]: New function.
12835 (Output_reloc::sort_before) [SHT_RELA]: New function.
12836 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12837 Sort_relocs_comparison.
12838 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12839 parameter. Change all callers.
12840 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12841 sort_relocs parameter. Change all callers.
12842 * output.cc (Output_reloc::get_address): New function, broken out
12843 of write_rel.
12844 (Output_reloc::write_rel): Call it.
12845 (Output_reloc::compare): New function.
12846 (Output_data_reloc_base::do_write): Optionally sort relocs.
12847
12848 * configure.ac: If targ_extra_obj is set, link it in.
12849 * configure.tgt: Initialize all variables.
12850 (x86_64*): Set targ_extra_obj and targ_extra_size.
12851 * configure: Rebuild.
12852
12853 * object.cc (Sized_relobj::include_section_group): Adjust section
12854 indexes read from group data. Build vector to pass to
12855 layout_group.
12856 * layout.cc (Layout::layout_group): Add flags and shndxes
12857 parameters. Remove contents parameter. Change caller. Update
12858 explicit instantiations.
12859 * layout.h (class Layout): Update layout_group declaration.
12860 * output.cc (Output_data_group::Output_data_group): Add flags and
12861 input_shndxes parameters. Remove contents parameter. Change
12862 caller.
12863 (Output_data_group::do_write): Change input_sections_ to
12864 input_shndxes_.
12865 * output.h (class Output_data_group): Update constructor
12866 declaration. Rename input_sections_ to input_shndxes_.
12867 * testsuite/many_sections_test.cc: Add template.
12868
12869 2008-04-30 Cary Coutant <ccoutant@google.com>
12870
12871 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12872
12873 * layout.cc (Layout::include_section): Refactored check for debug
12874 info section.
12875 (Layout::add_comdat): Add new parameters. Change type
12876 of signature parameter. Add object and shndx to signatures table.
12877 (Layout::find_kept_object): New function.
12878 * layout.h: Include <cstring>.
12879 (Layout::is_debug_info_section): New function.
12880 (Layout::add_comdat): Add new parameters.
12881 (Layout::find_kept_object): New function.
12882 (Layout::Kept_section): New struct.
12883 (Layout::Signatures): Change type of map range.
12884 * object.cc (Relobj::output_section_address): New function.
12885 (Sized_relobj::include_section_group): Add new parameters. Change
12886 calls to Layout::add_comdat. Change to build table of kept comdat
12887 groups and table mapping discarded sections to kept sections.
12888 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12889 (Sized_relobj::do_layout): Change calls to include_section_group and
12890 include_linkonce_section.
12891 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12892 value to zero when section is discarded.
12893 (Sized_relobj::map_to_kept_section): New function.
12894 * object.h (Relobj::output_section_address): New function.
12895 (Relobj::Comdat_group): New type.
12896 (Relobj::find_comdat_group): New function.
12897 (Relobj::Comdat_group_table): New type.
12898 (Relobj::Kept_comdat_section): New type.
12899 (Relobj::Kept_comdat_section_table): New type.
12900 (Relobj::add_comdat_group): New function.
12901 (Relobj::set_kept_comdat_section): New function.
12902 (Relobj::get_kept_comdat_section): New function.
12903 (Relobj::comdat_groups_): New field.
12904 (Relobj::kept_comdat_sections_): New field.
12905 (Symbol_value::input_value): Update comment.
12906 (Sized_relobj::map_to_kept_section) New function.
12907 (Sized_relobj::include_linkonce_section): Add new parameter.
12908 * target-reloc.h (Comdat_behavior): New type.
12909 (get_comdat_behavior): New function.
12910 (relocate_section): Add code to map a discarded section to the
12911 corresponding kept section when applying a relocation.
12912
12913 2008-04-30 Craig Silverstein <csilvers@google.com>
12914
12915 * dwarf_reader.cc (next_generation_count): New static var.
12916 (Addr2line_cache_entry): New struct.
12917 (addr2line_cache): New static var.
12918 (Dwarf_line_info::one_addr2line): Added caching.
12919 (Dwarf_line_info::clear_addr2line_cache): New function.
12920 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12921 cache-size parameter.
12922 (Dwarf_line_info::one_addr2line_cache): New function.
12923 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12924 new cache-size argument to one_addr2line(), and clear cache.
12925
12926 2008-04-28 Cary Coutant <ccoutant@google.com>
12927
12928 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12929 R_386_PC8 relocations.
12930
12931 2008-04-23 Ian Lance Taylor <iant@google.com>
12932
12933 * object.cc (Sized_relobj::include_section_group): Check for
12934 invalid section group.
12935
12936 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12937 header size.
12938
12939 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12940 than read for file header.
12941 * archive.cc (Archive::include_member): Likewise.
12942
12943 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12944
12945 * aclocal.m4: Regenerate.
12946 * configure: Regenerate.
12947
12948 2008-04-19 Ian Lance Taylor <iant@google.com>
12949
12950 * version.cc (version_string): Bump to 1.6.
12951
12952 * testsuite/Makefile.am (many_sections_r_test): New target.
12953 (many_sections_r_test_SOURCES): Remove.
12954 (many_sections_r_test_DEPENDENCIES): Remove.
12955 (many_sections_r_test_LDFLAGS): Remove.
12956 (many_sections_r_test_LDADD): Remove.
12957
12958 * object.cc (Sized_relobj::do_add_symbols): Always pass
12959 local_symbol_count_ to add_from_relobj.
12960
12961 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12962 every thousand variables.
12963 * testsuite/Makefile.in: Rebuild.
12964
12965 * object.cc (Xindex::initialize_symtab_xindex): New function.
12966 (Xindex::read_symtab_xindex): New function.
12967 (Xindex::sym_xindex_to_shndx): New function.
12968 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12969 available.
12970 (Sized_relobj::do_initialize_xindex): New function.
12971 (Sized_relobj::do_read_symbols): Adjust section links.
12972 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12973 parameter. Change all callers.
12974 (Sized_relobj::include_section_group): Adjust section links and
12975 symbol section indexes.
12976 (Sized_relobj::do_layout): Adjust section links.
12977 (Sized_relobj::do_count_local_symbols): Adjust section links and
12978 symbol section indexes.
12979 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12980 ordinary and special symbols.
12981 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12982 dynsym_xindex parameters. Change all callers. Adjust section
12983 links. Use SHN_XINDEX when needed.
12984 (Sized_relobj::get_symbol_location_info): Adjust section links.
12985 Don't get fooled by special symbols.
12986 * object.h (class Xindex): Define.
12987 (class Object): Add xindex_ parameter. Declare virtual functoin
12988 do_initialize_xindex.
12989 (Object::adjust_sym_shndx): New function.
12990 (Object::set_xindex): New protected function.
12991 (class Symbol_value): Add is_ordinary_shndx_ field.
12992 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12993 (Symbol_value::value): Assert ordinary section.
12994 (Symbol_value::initialize_input_to_output_map): Likewise.
12995 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12996 Change all callers.
12997 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12998 all callers.
12999 (class Sized_relobj): Update declarations.
13000 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13001 parameter. Change all callers.
13002 (Sized_relobj::adjust_shndx): New function.
13003 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13004 field.
13005 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13006 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
13007 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
13008 (Sized_dynobj::read_dynsym_section): Adjust section links.
13009 (Sized_dynobj::read_dynamic): Likewise.
13010 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
13011 section links.
13012 (Sized_dynobj::do_initialize_xindex): New function.
13013 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
13014 do_initialize_xindex.
13015 (Sized_dynobj::adjust_shndx): New function.
13016 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13017 dynsym_xindex_ fields.
13018 (Layout::finalize): Add a call to set_section_indexes before
13019 creating the symtab sections.
13020 (Layout::set_section_indexes): Don't do anything if the section
13021 already has a section index.
13022 (Layout::create_symtab_sections): Add shnum parameter. Change
13023 caller. Create .symtab_shndx section if needed.
13024 (Layout::create_shdrs): Add shstrtab_section parameter. Change
13025 caller.
13026 (Layout::allocated_output_section_count): New function.
13027 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13028 needed.
13029 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13030 fields. Update declarations.
13031 (Layout::symtab_xindex): New function.
13032 (Layout::dynsym_xindex): New function.
13033 (class Write_symbols_task): Add layout_ field.
13034 (Write_symbols_task::Write_symbols_task): Add layout parameter.
13035 Change caller.
13036 * output.cc (Output_section_headers::Output_section_headers): Add
13037 shstrtab_section parameter. Change all callers.
13038 (Output_section_headers::do_sized_write): Store overflow values
13039 for section count and section string table section index in
13040 section header zero.
13041 (Output_file_header::do_sized_write): Check for overflow of
13042 section count and section string table section index.
13043 (Output_symtab_xindex::do_write): New function.
13044 (Output_symtab_xindex::endian_do_write): New function.
13045 * output.h (class Output_section_headers): Add shstrtab_section_.
13046 Update declarations.
13047 (class Output_symtab_xindex): Define.
13048 (Output_section::has_out_shndx): New function.
13049 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13050 field.
13051 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13052 Change all callers.
13053 (Sized_symbol::init): Likewise.
13054 (Symbol::output_section): Check for ordinary symbol.
13055 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
13056 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
13057 callers.
13058 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13059 Change all callers. Simplify handling of symbols from sections
13060 not included in the link.
13061 (Symbol_table::add_from_dynobj): Handle ordinary symbol
13062 distinction.
13063 (Weak_alias_sorter::operator()): Assert that symbols are
13064 ordinary.
13065 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13066 distinction.
13067 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13068 parameters. Change all callers.
13069 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
13070 symbol distinction. Use SHN_XINDEX when needed.
13071 (Symbol_table::write_section_symbol): Add symtab_xindex
13072 parameter. Change all callers.
13073 (Symbol_table::sized_write_section_symbol): Likewise. Use
13074 SHN_XINDEX when needed.
13075 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
13076 declarations.
13077 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
13078 (Symbol::is_defined): Check is_ordinary.
13079 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13080 (Symbol::is_absolute, Symbol::is_common): Likewise.
13081 (class Sized_symbol): Update declarations.
13082 (class Symbol_table): Update declarations.
13083 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13084 parameters. Change all callers.
13085 (Sized_symbol::override): Likewise.
13086 (Symbol_table::override): Likewise.
13087 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
13088 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
13089 is_ordinary, and orig_st_shndx parameters. Change all callers.
13090 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13091 to be in an ordinary section.
13092 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13093 object and is_ordinary parameters. Change all callers.
13094 (Sized_dwarf_line_info::read_relocs): Add object parameter.
13095 Change all callers. Don't add undefined or non-ordinary symbols
13096 to reloc_map_.
13097 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13098 Change all callers.
13099 * dwarf_reader.h (class Sized_dwarf_line_info): Update
13100 declarations.
13101 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13102 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13103 (Sized_relobj::relocate_sections): Likewise.
13104 * target-reloc.h (scan_relocs): Adjust section symbol index.
13105 (scan_relocatable_relocs): Likewise.
13106 * i386.cc (Scan::local): Check for ordinary symbols.
13107 * sparc.cc (Scan::local): Likewise.
13108 * x86_64.cc (Scan::local): Likewise.
13109 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13110 to symbol_section_and_value.
13111 * testsuite/many_sections_test.cc: New file.
13112 * testsuite/Makefile.am (BUILT_SOURCES): Define.
13113 (check_PROGRAMS): Add many_sections_test.
13114 (many_sections_test_SOURCES): Define.
13115 (many_sections_test_DEPENDENCIES): Define.
13116 (many_sections_test_LDFLAGS): Define.
13117 (BUILT_SOURCES): Add many_sections_define.h.
13118 (many_sections_define.h): New target.
13119 (BUILT_SOURCES): Add many_sections_check.h.
13120 (many_sections_check.h): New target.
13121 (check_PROGRAMS): Add many_sections_r_test.
13122 (many_sections_r_test_SOURCES): Define.
13123 (many_sections_r_test_DEPENDENCIES): Define.
13124 (many_sections_r_test_LDFLAGS): Define.
13125 (many_sections_r_test_LDADD): Define.
13126 (many_sections_r_test.o): New target.
13127 * testsuite/Makefile.in: Rebuild.
13128
13129 2008-04-17 Cary Coutant <ccoutant@google.com>
13130
13131 * errors.cc (Errors::info): New function.
13132 (gold_info): New function.
13133 * errors.h (Errors::info): New function.
13134 * gold.h (gold_info): New function.
13135 * object.cc (Input_objects::add_object): Print trace output.
13136 * options.cc (options::parse_set): New function.
13137 (General_options::parse_wrap): Deleted.
13138 (General_options::General_options): Deleted initializer.
13139 * options.h (options::String_set): New typedef.
13140 (options::parse_set): New function.
13141 (DEFINE_set): New macro.
13142 (General_options::wrap): Changed to use DEFINE_set. Changed
13143 callers of any_wrap_symbols and is_wrap_symbol.
13144 (General_options::trace, General_options::trace_symbol):
13145 New options.
13146 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13147 (General_options::wrap_symbols_): Deleted.
13148 * symtab.cc (Symbol_table::add_from_object): Print trace output.
13149
13150 2008-04-17 David S. Miller <davem@davemloft.net>
13151
13152 * options.cc (General_options::parse_V): New function.
13153 * options.h: Add entries for -V and -Qy.
13154
13155 2008-04-17 Ian Lance Taylor <iant@google.com>
13156
13157 * common.cc (Symbol_table::allocate_commons): Remove options
13158 parameter. Change caller.
13159 (Symbol_table::do_allocate_commons): Remove options parameter.
13160 Change caller. Just call do_allocate_commons_list twice.
13161 (Symbol_table::do_allocate_commons_list): New function, broken out
13162 of do_allocate_commons.
13163 * common.h (class Allocate_commons_task): Remove options_ field.
13164 Update constructor.
13165 * symtab.cc (Symbol_table::Symbol_table): Initialize
13166 tls_commons_.
13167 (Symbol_table::add_from_object): Put TLS common symbols on
13168 tls_commons_ list.
13169 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13170 which are IN_OUTPUT_DATA.
13171 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
13172 allocate_commons and do_allocate_commons declarations. Declare
13173 do_allocate_commons_list.
13174 * gold.cc (queue_middle_tasks): Update creation of
13175 Allocate_commons_task to not pass options.
13176 * testsuite/Makefile.am (INCLUDES): Add -I.. .
13177 (TLS_TEST_C_FLAGS): New variable.
13178 (tls_test_c_pic.o): New target.
13179 (tls_test_shared.so): Link in tls_test_c_pic.o.
13180 (tls_test_c_pic_ie.o): New target.
13181 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13182 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13183 (tls_test_c.o): New target.
13184 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13185 (tls_pic_test_LDADD): Likewise.
13186 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13187 (tls_shared_gd_to_ie_test_LDADD): Likewise.
13188 (tls_test_c_gnu2.o): New target.
13189 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13190 tls_test_c_gnu2.o.
13191 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13192 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13193 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13194 * testsuite/tls_test.cc: Include "config.h".
13195 (t_last): Call t11_last.
13196 * testsuite/tls_test.h (t11, t11_last): Declare.
13197 * testsuite/tls_test_c.c: New file.
13198 * testsuite/tls_test_main.cc (thread_routine): Call t11.
13199 * configure.ac: Check for OpenMP support.
13200 * configure, config.in, Makefile.in: Rebuild.
13201 * testsuite/Makefile.in: Rebuild.
13202
13203 2008-04-16 Cary Coutant <ccoutant@google.com>
13204
13205 * i386.cc (Target_i386::define_tls_base_symbol): New function.
13206 (Target_i386::tls_base_symbol_defined_): New field.
13207 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13208 (Target_i386::Scan::global): Likewise.
13209 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13210 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13211 (Target_x86_64::tls_base_symbol_defined_): New field.
13212 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13213 (Target_x86_64::Scan::global): Likewise.
13214
13215 2008-04-16 Cary Coutant <ccoutant@google.com>
13216
13217 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13218 (Symbol::needs_plt_entry): Allow weak undefined symbols.
13219 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13220 building shared libraries.
13221 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13222 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13223 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13224 * testsuite/Makefile.in: Rebuild.
13225 * testsuite/weak_undef.h: New file.
13226 * testsuite/weak_undef_file1.cc: Add extra test cases.
13227 * testsuite/weak_undef_file2.cc: Likewise.
13228 * testsuite/weak_undef_test.cc: Likewise.
13229
13230 2008-04-16 David S. Miller <davem@davemloft.net>
13231
13232 * sparc.cc (Target_sparc::Scan): Change from struct to class.
13233 Add issued_non_pic_error_ field. Declare check_non_pic.
13234 (Target_sparc::Scan::check_non_pic): New function.
13235 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13236 (Target_sparc::Scan::global): Likewise.
13237
13238 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13239 * configure: Rebuild.
13240
13241 * options.h (DEFINE_enable): New macro.
13242 (new_dtags): New enable option.
13243 (initfirst, interpose, loadfltr, nodefaultlib,
13244 nodelete, nodlopen, nodump): New -z options.
13245 * layout.cc (Layout:finish_dynamic_section): If new
13246 dtags enabled, emit DT_RUNPATH. Also, emit a
13247 DT_FLAGS_1 containing any specified -z flags.
13248
13249 2008-04-16 Ian Lance Taylor <iant@google.com>
13250
13251 * copy-relocs.cc: New file.
13252 * copy-relocs.h: New file.
13253 * reloc.cc: Remove Copy_relocs code.
13254 * reloc.h: Likewise.
13255 * reloc-types.h (struct Reloc_types) [both versions]: Add
13256 get_reloc_addend_noerror.
13257 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13258 variants of add_global which take an addend which must be zero.
13259 * i386.cc: Include "copy-relocs.h".
13260 (class Target_i386): Change type of copy_relocs_ to variable,
13261 update initializer.
13262 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13263 Change all callers.
13264 (Target_i386::do_finalize_sections): Change handling of
13265 copy_relocs_.
13266 * sparc.cc: Include "copy-relocs.h".
13267 (class Target_sparc): Change type of copy_relocs_ to variable,
13268 update initializer.
13269 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13270 Change all callers.
13271 (Target_sparc::do_finalize_sections): Change handling of
13272 copy_relocs_.
13273 * x86_64.cc: Include "copy-relocs.h".
13274 (class Target_x86_64): Change type of copy_relocs_ to variable,
13275 update initializer.
13276 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13277 class. Change all callers.
13278 (Target_x86_64::do_finalize_sections): Change handling of
13279 copy_relocs_.
13280 * Makefile.am (CCFILES): Add copy-relocs.cc.
13281 (HFILES): Add copy-relocs.h.
13282
13283 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13284
13285 * testsuite/script_test_4.sh: Permit leading zeroes.
13286
13287 2008-04-15 Ian Lance Taylor <iant@google.com>
13288
13289 * script-sections.cc (Script_sections::create_segments): Use
13290 header_size_adjustment even when there is enough room for the
13291 headers.
13292 * testsuite/script_test_4.sh: New file.
13293 * testsuite/script_test_4.t: New file.
13294 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13295 (check_DATA): Add script_test_4.stdout.
13296 (MOSTLYCLEANFILES): Likewise.
13297 (script_test_4): New target.
13298 (script_test_4.stdout): New target.
13299 * testsuite/Makefile.in: Rebuild.
13300
13301 * sparc.cc: Add definitions for Output_data_plt_sparc class
13302 constants.
13303
13304 2008-04-14 David S. Miller <davem@davemloft.net>
13305
13306 * sparc.cc: New file.
13307 * Makefile.am (TARGETSOURCES): Add sparc.cc
13308 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13309 * configure.tgt: Document targ_extra_size and
13310 targ_extra_big_endian. Add entries for sparc-* and
13311 sparc64-*.
13312 * configure.ac: Handle targ_extra_size and
13313 targ_extra_big_endian.
13314 * Makefile.in: Rebuild.
13315 * configure: Likewise.
13316 * po/POTFILES.in: Likewise.
13317 * po/gold.pot: Likewise.
13318
13319 2008-04-14 Ian Lance Taylor <iant@google.com>
13320
13321 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13322 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13323 in the name/type/flags to section mapping. Don't call
13324 allocate_output_section.
13325 (Layout::choose_output_section): Change parameter from adjust_name
13326 to is_input_section. Don't permit input sections after sections
13327 are attached to segments. Don't call allocate_output_section.
13328 (Layout::layout_eh_frame): Call update_flags_for_input_section,
13329 not write_enable_output_section.
13330 (Layout::make_output_section): Don't push to
13331 unattached_section_list_ nor call attach_to_segment. Call
13332 attach_section_to_segment if sections are attached.
13333 (Layout::attach_sections_to_segments): New function.
13334 (Layout::attach_section_to_segment): New function.
13335 (Layout::attach_allocated_section_to_segment): Rename from
13336 attach_to_segment. Remove flags parameter.
13337 (Layout::allocate_output_section): Remove function.
13338 (Layout::write_enable_output_section): Remove function.
13339 * layout.h (class Layout): Update for above changes. Add new
13340 field sections_are_attached_.
13341 * output.h (Output_section::update_flags_for_input_section): New
13342 function.
13343 * output.cc (Output_section::add_input_section): Call
13344 update_flags_for_input_section.
13345 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13346
13347 2008-04-11 Cary Coutant <ccoutant@google.com>
13348
13349 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13350 thought unnecessary.
13351 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13352
13353 2008-04-11 Ian Lance Taylor <iant@google.com>
13354
13355 * output.h (class Output_section_data): Remove inline definition
13356 of set_addralign.
13357 * output.cc (Output_section_data::set_addralign): New function.
13358
13359 2008-04-11 Cary Coutant <ccoutant@google.com>
13360
13361 Add support for TLS descriptors for i386 and x86_64.
13362 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13363 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13364 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13365 GOT_TYPE_TLS_DESC.
13366 (Target_i386::got_mod_index_entry): Remove unnecessary code.
13367 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13368 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
13369 relocations.
13370 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13371 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13372 Fix problem with initial-exec relocations.
13373 (Target_i386::Relocate::relocate_tls): Likewise.
13374 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13375 relaxation.
13376 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13377 support for section-plus-offset dynamic table entries.
13378 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13379 (Output_data_dynamic::Dynamic_entry): Add support for
13380 section-plus-offset dynamic table entries.
13381 (Output_data_dynamic::Classification): Likewise.
13382 (Output_data_dynamic::classification_): Renamed offset_.
13383 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13384 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13385 (Target_x86_64::make_plt_section): New function.
13386 (Target_x86_64::reserve_tlsdesc_entries): New function.
13387 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13388 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13389 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13390 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13391 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13392 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13393 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13394 add extra PLT entry for TLS descriptors.
13395 (Output_data_plt_x86_64::got_): New field.
13396 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13397 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13398 fields.
13399 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13400 descriptors.
13401 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13402 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13403 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13404 R_386_TLS_DESC_CALL relocations.
13405 (Target_x86_64::Scan::global): Likewise.
13406 (Target_x86_64::do_finalize_sections): Add dynamic table entries
13407 for TLS descriptors.
13408 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13409 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13410 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13411 GD-to-IE relaxation.
13412 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13413 and TLS_DESCRIPTORS.
13414 * Makefile.in: Rebuild.
13415 * configure: Rebuild.
13416 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13417 (tls_test_shared2.so): New target.
13418 (tls_shared_gd_to_ie_test_SOURCES): New variable.
13419 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13420 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13421 (tls_shared_gd_to_ie_test_LDADD): New variable.
13422 (tls_shared_gnu2_gd_to_ie_test): New target.
13423 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13424 New targets.
13425 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13426 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13427 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13428 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13429 (tls_shared_gnu2_test): New target.
13430 (tls_test_gnu2_shared.so): New target.
13431 (tls_shared_gnu2_test_SOURCES): New variable.
13432 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13433 (tls_shared_gnu2_test_LDFLAGS): New variable.
13434 (tls_shared_gnu2_test_LDADD): New variable.
13435 * testsuite/Makefile.in: Rebuild.
13436 * testsuite/Makefile.
13437
13438 2008-04-11 Ian Lance Taylor <iant@google.com>
13439
13440 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13441 justsyms.t.
13442 * testsuite/Makefile.in: Rebuild.
13443
13444 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13445 long.
13446 * testsuite/script_test_2.cc (main): Adjust test.
13447
13448 2008-04-11 David S. Miller <davem@davemloft.net>
13449 Ian Lance Taylor <iant@google.com>
13450
13451 * options.h (General_options): Add entries for '-Y' and
13452 '-relax'.
13453 * options.cc (General_options:finalize): If -Y was used, add those
13454 entries to the library path instead of the default "/lib" and
13455 "/usr/lib".
13456
13457 2008-04-11 David S. Miller <davem@davemloft.net>
13458
13459 * testsuite/justsyms.t: Start at 0x100.
13460 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13461 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13462 long.
13463 * testsuite/script_test_2.cc: Adjust string and section length
13464 checks.
13465
13466 2008-04-09 Ian Lance Taylor <iant@google.com>
13467
13468 PR gold/5996
13469 * script-sections.cc (Sections_element::allocate_to_segment): Add
13470 orphan parameter.
13471 (Output_section_definition::allocate_to_segment): Likewise.
13472 (Orphan_output_section::allocate_to_segment): Likewise.
13473 (Script_sections::attach_sections_using_phdrs_clause): Don't
13474 propagate non-PT_LOAD segments to orphan sections.
13475 * testsuite/Makefile.am (script_test_3.stdout): Generate using
13476 readelf rather than objdump.
13477 * testsuite/script_test_3.sh: Adjust accordingly. Test that
13478 .interp section and PT_INTERP segment are the same size.
13479 * testsuite/Makefile.in: Rebuild.
13480
13481 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13482 aliases for symbols defined in the same object.
13483 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13484 (weak_alias_test_SOURCES): New variable.
13485 (weak_alias_test_DEPENDENCIES): New variable.
13486 (weak_alias_test_LDFLAGS): New variable.
13487 (weak_alias_test_LDADD): New variable.
13488 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13489 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13490 (weak_alias_test_3.o): New target.
13491 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13492 * testsuite/weak_alias_test_main.cc: New file.
13493 * testsuite/weak_alias_test_1.cc: New file.
13494 * testsuite/weak_alias_test_2.cc: New file.
13495 * testsuite/weak_alias_test_3.cc: New file.
13496
13497 2008-04-08 Ian Lance Taylor <iant@google.com>
13498
13499 * options.h (class General_options): Add --noinhibit-exec option.
13500 * main.cc (main): Check --noinhibit-exec.
13501
13502 * options.h (class General_options): Define --wrap as a special
13503 option. Add wrap_symbols_ field.
13504 (General_options::any_wrap_symbols): New function.
13505 (General_options::is_wrap_symbol): New function.
13506 * options.cc (General_options::parse_wrap): New function.
13507 (General_options::General_options): Initialize wrap_symbols_.
13508 * symtab.cc (Symbol_table::wrap_symbol): New function.
13509 (Symbol_table::add_from_object): Handle --wrap.
13510 * symtab.h (class Symbol_table): Declare wrap_symbol.
13511 * target.h (Target::wrap_char): New function.
13512 (Target::Target_info): Add wrap_char field.
13513 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13514 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13515 * testsuite/testfile.cc (Target_test::test_target_info):
13516 Likewise.
13517
13518 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13519 there is one.
13520
13521 * layout.h (class Layout): Add added_eh_frame_data_ field.
13522 * layout.cc (Layout::Layout): Initialize new field.
13523 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13524 output section until we find a section we merged successfully.
13525 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13526 that the size be non-zero.
13527
13528 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13529 qualifier.
13530
13531 2008-04-08 Craig Silverstein <csilvers@google.com>
13532
13533 * configure.ac: Export new conditional variable HAVE_ZLIB.
13534 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13535 on HAVE_ZLIB.
13536 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13537 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13538
13539 2008-04-07 Ian Lance Taylor <iant@google.com>
13540
13541 * version.cc (version_string): Set to "1.5".
13542
13543 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13544 Add issued_non_pic_error_ field. Declare check_non_pic.
13545 (Target_x86_64::Scan::check_non_pic): New function.
13546 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13547 (Target_x86_64::Scan::global): Likewise.
13548
13549 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13550 addend parameter. Change caller. Handle merge sections.
13551 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13552 Address to Addend. Don't add in the result of
13553 local_section_offset, pass down the addend and use the returned
13554 value.
13555 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13556 Update declarations of local_section_offset and symbol_value.
13557 * testsuite/two_file_test_1.cc (t18): New function.
13558 * testsuite/two_file_test_2.cc (f18): New function.
13559 * testsuite/two_file_test_main.cc (main): Call t18.
13560 * testsuite/two_file_test.h (t18, f18): Declare.
13561
13562 * configure.ac: Don't test for objdump, c++filt, or readelf.
13563 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13564 conditionals.
13565 (TEST_READELF): New variable.
13566 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13567 (check_PROGRAMS): Add two_file_strip_test.
13568 (two_file_strip_test): New target.
13569 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13570 (two_file_same_shared_strip_test_SOURCES): New variable.
13571 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13572 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13573 (two_file_same_shared_strip_test_LDADD): New variable.
13574 (two_file_shared_strip.so): New target.
13575 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13576 (ver_test_5.syms, ver_test_7.syms): Likewise.
13577 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13578 (strip_test_3.stdout): Use TEST_OBJDUMP.
13579 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13580
13581 2008-04-04 Cary Coutant <ccoutant@google.com>
13582
13583 * symtab.h (Symbol::is_weak_undefined): New function.
13584 (Symbol::is_strong_undefined): New function.
13585 (Symbol::is_absolute): New function.
13586 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13587 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13588 absolute symbols.
13589 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13590 (weak_undef_test): New target.
13591 * testsuite/Makefile.in: Rebuild.
13592 * testsuite/weak_undef_file1.cc: New file.
13593 * testsuite/weak_undef_file2.cc: New file.
13594 * testsuite/weak_undef_test.cc: New file.
13595
13596 2008-04-03 Craig Silverstein <csilvers@google.com>
13597
13598 * compressed_output.h (class Output_compressed_section): Use
13599 unsigned buffer.
13600 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13601 add zlib header.
13602 (zlib_compressed_suffix): Removed.
13603 (Output_compressed_section::set_final_data_size): Use unsigned
13604 buffers.
13605 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13606 Fix linker invocation.
13607 (flagstest_o_specialfile_and_compress_debug_sections):
13608 Likewise.
13609 * testsuite/Makefile.in: Regenerated.
13610
13611 2008-04-02 David S. Miller <davem@davemloft.net>
13612
13613 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13614 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13615
13616 2008-04-02 Craig Silverstein <csilvers@google.com>
13617
13618 * TODO: New file.
13619
13620 2008-04-02 Ian Lance Taylor <iant@google.com>
13621
13622 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13623 parameters. Update for new key type to views_. Change all
13624 callers.
13625 (File_read::read): Adjust for byteshift in returned view.
13626 (File_read::add_view): New function, broken out of
13627 find_and_make_view.
13628 (File_read::make_view): New function, broken out of
13629 find_and_make_view.
13630 (File_read::find_or_make_view): Add offset and aligned
13631 parameters. Rewrite accordingly. Change all callers.
13632 (File_read::get_view): Add offset and aligned parameters. Adjust
13633 for byteshift in return value.
13634 (File_read::get_lasting_view): Likewise.
13635 * fileread.h (class File_read): Update declarations.
13636 (class File_read::View): Add byteshift_ field. Add byteshift to
13637 constructor. Add byteshift method.
13638 * archive.h (Archive::clear_uncached_views): New function.
13639 (Archive::get_view): Add aligned parameter. Change all callers.
13640 * object.h (Object::get_view): Add aligned parameter. Change all
13641 callers.
13642 (Object::get_lasting_view): Likewise.
13643
13644 * fileread.cc (File_read::release): Don't call clear_views if
13645 there are multiple objects.
13646 * fileread.h (File_read::clear_uncached_views): New function.
13647 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13648 on the archive.
13649
13650 2008-03-31 Cary Coutant <ccoutant@google.com>
13651
13652 Add thin archive support.
13653 * archive.cc (Archive::armagt): New const.
13654 (Archive::setup): Remove task parameter and calls to unlock.
13655 (Archive::unlock_nested_archives): New function.
13656 (Archive::read_header): Add nested_off parameter. Change
13657 all callers.
13658 (Archive::interpret_header): Likewise.
13659 (Archive::include_all_members): Change to handle thin
13660 archives.
13661 (Archive::include_member): Likewise.
13662 * archive.h (Archive::Archive): Add new parameters and
13663 initializers.
13664 (Archive::armagt): New const.
13665 (Archive::setup): Remove task parameter.
13666 (Archive::unlock_nested_archives): New function.
13667 (Archive::read_header): Add nested_off parameter.
13668 (Archive::interpret_header): Likewise.
13669 (Archive::Nested_archive_table): New typedef.
13670 (Archive::is_thin_archive_): New field.
13671 (Archive::nested_archives_): New field.
13672 (Archive::options_): New field.
13673 (Archive::dirpath_): New field.
13674 (Archive::task_): New field.
13675 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13676 for thin archives. Pass additional parameters to
13677 Archive::Archive. Unlock the archive file after calling
13678 Archive::setup.
13679
13680 2008-03-29 Ian Lance Taylor <iant@google.com>
13681
13682 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13683 version symbol to be local.
13684 * testsuite/ver_test_4.sh: New file.
13685 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13686 (check_DATA): Add ver_test_4.syms.
13687 (ver_test_4.syms): New target.
13688 * testsuite/Makefile.in: Rebuild.
13689
13690 * output.cc
13691 (Output_section::Input_section_sort_entry::has_priority): New
13692 function.
13693 (Output_section::Input_section_sort_entry::match_file_name): New
13694 function.
13695 (Output_section::Input_section_sort_entry::match_section_name):
13696 Remove.
13697 (Output_section::Input_section_sort_entry::match_section_name_prefix):
13698 Remove.
13699 (Output_section::Input_section_sort_entry::match_section_file):
13700 Remove.
13701 (Output_section::Input_section_sort_compare::operator()): Rewrite
13702 using new Input_section_sort_entry functions. Sort crtbegin and
13703 crtend first. Sort sections with no priority before sections with
13704 a priority.
13705 * testsuite/initpri1.c (d3): Check j != 4.
13706 (cd5): New constructor/destructor function.
13707 (main): Check j != 2.
13708
13709 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13710 new symbol when resolving, don't call set_is_default.
13711 * testsuite/ver_test_7.cc: New file.
13712 * testsuite/ver_test_7.sh: New file.
13713 * testsuite/Makefile.am (ver_test_7.so): New target.
13714 (ver_test_7.o): New target.
13715 (check_SCRIPTS): Add ver_test_7.sh.
13716 (check_DATA): Add ver_test_7.syms.
13717 (ver_test_7.syms): New target.
13718
13719 2008-03-28 Ian Lance Taylor <iant@google.com>
13720
13721 * layout.cc (Layout::layout): If we see an input section with a
13722 name that needs sorting, set the must_sort flag for the output
13723 section.
13724 (Layout::make_output_section): If the name of the output section
13725 indicates that it might require sorting, set the may_sort flag.
13726 * output.h (Output_section::may_sort_attached_input_sections): New
13727 function.
13728 (Output_section::set_may_sort_attached_input_sections): New
13729 function.
13730 (Output_section::must_sort_attached_input_sections): New
13731 function.
13732 (Output_section::set_must_sort_attached_input_sections): New
13733 function.
13734 (class Output_section): Declare Input_section_sort_entry. Define
13735 Input_section_sort_compare. Declare
13736 sort_attached_input_sections. Add new fields:
13737 may_sort_attached_input_sections_,
13738 must_sort_attached_input_sections_,
13739 attached_input_sections_are_sorted_.
13740 * output.cc (Output_section::Output_section): Initialize new
13741 fields.
13742 (Output_section::add_input_section): Add an entry to
13743 input_sections_ if may_sort or must_sort are true.
13744 (Output_section::set_final_data_size): Call
13745 sort_attached_input_sections if necessary.
13746 (Output_section::Input_section_sort_entry): Define new class.
13747 (Output_section::Input_section_sort_compare::operator()): New
13748 function.
13749 (Output_section::sort_attached_input_sections): New function.
13750 * configure.ac: Check whether the compiler supports constructor
13751 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13752 * testsuite/initpri1.c: New file.
13753 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13754 CONSTRUCTOR_PRIORITY.
13755 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13756 (initpri1_LDFLAGS): New variable.
13757 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13758
13759 2008-03-27 Ian Lance Taylor <iant@google.com>
13760
13761 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13762 * testsuite/common_test_1.c: New file.
13763 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13764 (common_test_1_SOURCES): New variable.
13765 (common_test_1_DEPENDENCIES): New variable.
13766 (common_test_1_LDFLAGS): New variable.
13767
13768 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13769 and commons_ correctly when NAME/VERSION does not override
13770 NAME/NULL.
13771 * testsuite/ver_test_6.c: New file.
13772 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13773 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13774 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13775
13776 2008-03-26 Ian Lance Taylor <iant@google.com>
13777
13778 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13779 of an undefined symbol from a version script.
13780 * testsuite/Makefile.am (ver_test_5.so): New target.
13781 (ver_test_5.o): New target.
13782 (check_SCRIPTS): Add ver_test_5.sh.
13783 (check_DATA): Add ver_test_5.syms.
13784 (ver_test_5.syms): New target.
13785 * testsuite/ver_test_5.cc: New file.
13786 * testsuite/ver_test_5.script: New file.
13787 * testsuite/ver_test_5.sh: New file.
13788 * Makefile.in, testsuite/Makefile.in: Rebuild.
13789
13790 PR gold/5986
13791 Fix problems building gold with gcc 4.3.0.
13792 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13793 (gold_error_at_location, gold_warning_at_location): Use it.
13794 * configure.ac: Check whether we can compile and use a template
13795 function with a printf attribute.
13796 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13797 when jumping over bytes.
13798 * object.cc: Instantiate Object::read_section_data.
13799 * debug.h: Include <cstring>
13800 * dwarf_reader.cc: Include <algorithm>
13801 * main.cc: Include <cstring>.
13802 * options.cc: Include <cstring>.
13803 * output.cc: Include <cstring>.
13804 * script.cc: Include <cstring>.
13805 * script.h: Include <string>.
13806 * symtab.cc: Include <cstring> and <algorithm>.
13807 * target-select.cc: Include <cstring>.
13808 * version.cc: Include <string>.
13809 * testsuite/testmain.cc: Include <cstdlib>.
13810 * configure, config.in: Rebuild.
13811
13812 2008-03-25 Ian Lance Taylor <iant@google.com>
13813
13814 * options.cc: Include "../bfd/bfdver.h".
13815 (options::help): Print bug reporting address.
13816
13817 * version.cc (print_version): Adjust output for current value of
13818 BFD_VERSION_STRING.
13819
13820 * NEWS: New file.
13821
13822 * options.cc (options::help): Print list of supported targets.
13823 * target-select.h: Include <vector>.
13824 (class Target_selector): Make machine_, size_, and is_big_endian_
13825 fields const. Add bfd_name_ and instantiated_target_ fields.
13826 (Target_selector::Target_selector): Add bfd_name parameter.
13827 (Target_selector::recognize): Make non-virtual, call
13828 do_recognize.
13829 (Target_selector::recognize_by_name): Make non-virtual, call
13830 do_recognize_by_name.
13831 (Target_selector::supported_names): New function.
13832 (Target_selector::bfd_name): New function.
13833 (Target_selector::do_instantiate_target): New pure virtual
13834 function.
13835 (Target_selector::do_recognize): New virtual function.
13836 (Target_selector::do_recognize_by_name): New virtual function.
13837 (Target_selector::instantiate_target): New private function.
13838 (supported_target_names): Declare.
13839 * target-select.cc (Target_selector::Target_selector): Update for
13840 new parameter and fields.
13841 (select_target_by_name): Check that the name matches before
13842 calling recognize_by_name.
13843 (supported_target_names): New function.
13844 * i386.cc (class Target_selector_i386): Update Target_selector
13845 constructor call. Remove recognize and recognize_by_name. Add
13846 do_instantiate_target.
13847 * x86_64.cc (class Target_selector_x86_64): Likewise.
13848 * testsuite/testfile.cc (class Target_selector_test): Update for
13849 changes to Target_selector.
13850
13851 * README: Rewrite, with some notes on unsupported features.
13852
13853 2008-03-24 Cary Coutant <ccoutant@google.com>
13854
13855 * i386.cc (Target_i386::Got_type): New enum declaration.
13856 (Target_i386::Scan::local): Updated callers of Output_data_got
13857 member functions.
13858 (Target_i386::Scan::global): Likewise.
13859 (Target_i386::Relocate::relocate): Likewise.
13860 (Target_i386::Relocate::relocate_tls): Likewise.
13861 * object.h (Got_offset_list): New class.
13862 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13863 (Sized_relobj::local_got_offset): Likewise.
13864 (Sized_relobj::set_local_got_offset): Likewise.
13865 (Sized_relobj::local_has_tls_got_offset): Removed.
13866 (Sized_relobj::local_tls_got_offset): Removed.
13867 (Sized_relobj::set_local_tls_got_offset): Removed.
13868 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13869 * output.cc (Output_data_got::add_global): Added got_type parameter.
13870 (Output_data_got::add_global_with_rel): Likewise.
13871 (Output_data_got::add_global_with_rela): Likewise.
13872 (Output_data_got::add_global_pair_with_rel): New function.
13873 (Output_data_got::add_global_pair_with_rela): New function.
13874 (Output_data_got::add_local): Added got_type parameter.
13875 (Output_data_got::add_local_with_rel): Likewise.
13876 (Output_data_got::add_local_with_rela): Likewise.
13877 (Output_data_got::add_local_pair_with_rel): New function.
13878 (Output_data_got::add_local_pair_with_rela): New function.
13879 (Output_data_got::add_global_tls): Removed.
13880 (Output_data_got::add_global_tls_with_rel): Removed.
13881 (Output_data_got::add_global_tls_with_rela): Removed.
13882 (Output_data_got::add_local_tls): Removed.
13883 (Output_data_got::add_local_tls_with_rel): Removed.
13884 (Output_data_got::add_local_tls_with_rela): Removed.
13885 * output.h (Output_data_got::add_global): Added got_type parameter.
13886 (Output_data_got::add_global_with_rel): Likewise.
13887 (Output_data_got::add_global_with_rela): Likewise.
13888 (Output_data_got::add_global_pair_with_rel): New function.
13889 (Output_data_got::add_global_pair_with_rela): New function.
13890 (Output_data_got::add_local): Added got_type parameter.
13891 (Output_data_got::add_local_with_rel): Likewise.
13892 (Output_data_got::add_local_with_rela): Likewise.
13893 (Output_data_got::add_local_pair_with_rel): New function.
13894 (Output_data_got::add_local_pair_with_rela): New function.
13895 (Output_data_got::add_global_tls): Removed.
13896 (Output_data_got::add_global_tls_with_rel): Removed.
13897 (Output_data_got::add_global_tls_with_rela): Removed.
13898 (Output_data_got::add_local_tls): Removed.
13899 (Output_data_got::add_local_tls_with_rel): Removed.
13900 (Output_data_got::add_local_tls_with_rela): Removed.
13901 * resolve.cc (Symbol::override_base_with_special): Removed
13902 reference to has_got_offset_ field.
13903 * symtab.cc (Symbol::init_fields): Replaced initialization
13904 of got_offset_ with got_offsets_. Removed initialization
13905 of has_got_offset_
13906 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13907 (Symbol::got_offset): Likewise.
13908 (Symbol::set_got_offset): Likewise.
13909 (Symbol::has_tls_got_offset): Removed.
13910 (Symbol::tls_got_offset): Removed.
13911 (Symbol::set_tls_got_offset): Removed.
13912 (Symbol::got_offset_): Removed.
13913 (Symbol::tls_mod_got_offset_): Removed.
13914 (Symbol::tls_pair_got_offset_): Removed.
13915 (Symbol::got_offsets_): New field.
13916 (Symbol::has_got_offset): Removed.
13917 (Symbol::has_tls_mod_got_offset): Removed.
13918 (Symbol::has_tls_pair_got_offset): Removed.
13919 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13920 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13921 member functions.
13922 (Target_x86_64::Scan::global): Likewise.
13923 (Target_x86_64::Relocate::relocate): Likewise.
13924 (Target_x86_64::Relocate::relocate_tls): Likewise.
13925
13926 2008-03-25 Ben Elliston <bje@au.ibm.com>
13927
13928 * yyscript.y: Fix spelling error in comment.
13929
13930 2008-03-24 Ian Lance Taylor <iant@google.com>
13931
13932 * options.h (class General_options): Define build_id option.
13933 * layout.h (class Layout): Declare write_build_id, create_note,
13934 create_build_id. Add build_id_note_ member.
13935 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13936 "libiberty.h", "md5.h", "sha1.h".
13937 (Layout::Layout): Initialize eh_frame_data_,
13938 eh_frame_hdr_section_, and build_id_note_.
13939 (Layout::finalize): Call create_build_id.
13940 (Layout::create_note): New function, broken out of
13941 Layout::create_gold_note.
13942 (Layout::create_gold_note): Call create_note.
13943 (Layout::create_build_id): New function.
13944 (Layout::write_build_id): New function.
13945 (Close_task_runner::run): Call write_build_id.
13946
13947 * x86_64.cc: Correct license to GPLv3.
13948
13949 2008-03-23 Ian Lance Taylor <iant@google.com>
13950
13951 * options.cc: Include "demangle.h".
13952 (parse_optional_string): New function.
13953 (parse_long_option): Handle takes_optional_argument.
13954 (parse_short_option): Update dash_z initializer. Handle
13955 takes_optional_argument.
13956 (General_options::General_options): Initialize do_demangle_.
13957 (General_options::finalize): Set do_demangle_. Handle demangling
13958 style.
13959 * options.h (parse_optional_string): Declare.
13960 (struct One_option): Add optional_arg field. Update constructor.
13961 Update call constructor calls. Add takes_optional_argument
13962 function.
13963 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13964 (DEFINE_optional_string): Define.
13965 (General_options::demangle): Change from DEFINE_bool to
13966 DEFINE_optional_string.
13967 (General_options::no_demangle): New function.
13968 (General_options::do_demangle): New function.
13969 (General_options::set_do_demangle): New function.
13970 (General_options::execstack_status_): Move definition to end of
13971 class definition.
13972 (General_options::static_): Likewise.
13973 (General_options::do_demangle_): New field.
13974 * object.cc (big_endian>::get_symbol_location_info): Call
13975 Options::do_demangle, not Options::demangle.
13976 * symtab.cc (demangle): Likewise.
13977
13978 2008-03-22 Ian Lance Taylor <iant@google.com>
13979
13980 * gold.h: Include <cstddef> and <sys/types.h>
13981 * options.h: Include <cstring>.
13982
13983 2008-03-21 Ian Lance Taylor <iant@google.com>
13984
13985 * Added source code to GNU binutils.
This page took 0.323771 seconds and 5 git commands to generate.