* powerpc.c (Target_powerpc::Scan::global): Don't emit relative
[binutils-gdb.git] / gold / ChangeLog
1 2012-11-30 Alan Modra <amodra@gmail.com>
2
3 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
4 relocs against protected symbols when building 32-bit shared libs.
5
6 2012-11-30 Alan Modra <amodra@gmail.com>
7
8 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
9 param. Call got_section() to make .got. Update all callers
10 and their callers and so on.
11
12 2012-11-30 Alan Modra <amodra@gmail.com>
13
14 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
15 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
16 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
17 value if it already exists.
18
19 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
20
21 PR gold/14858
22 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
23
24 2012-11-14 Roland McGrath <mcgrathr@google.com>
25
26 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
27 than bfc instruction for data sandboxing.
28
29 2012-11-08 Alan Modra <amodra@gmail.com>
30
31 * po/POTFILES.in: Regenerate.
32
33 2012-11-05 Alan Modra <amodra@gmail.com>
34
35 * configure.ac: Apply 2012-09-10 change to config.in here.
36 * configure: Regenerate.
37
38 2012-11-05 Alan Modra <amodra@gmail.com>
39
40 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
41 (struct Opd_ent): Use "Address" rather than "Offset".
42 (Output_data_got_powerpc::got_base_offset): Return Valtype.
43 (Target_powerpc::got_section): Make public.
44 (Target_powerpc::scan_relocs): Move code setting symbols..
45 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
46 Create _SDA_BASE_ only when referenced.
47
48 2012-11-02 Roland McGrath <mcgrathr@google.com>
49
50 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
51 from last change.
52
53 2012-11-01 Roland McGrath <mcgrathr@google.com>
54
55 * target.h (Sized_target::relocate_relocs): Use Elf_Off
56 for offset_in_output_section parameter.
57 (Sized_target::relocate_special_relocatable): Likewise.
58 * arm.cc (Target_arm::relocate_relocs): Likewise.
59 (Target_arm::relocate_special_relocatable): Likewise.
60 * i386.cc (Target_i386::relocate_relocs): Likewise.
61 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
62 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
63 * target-reloc.h (relocate_relocs): Likewise.
64 * testsuite/testfile.cc (Target_test): Likewise.
65 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
66 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
67
68 * system.h: Move inclusion of <clocale> to after <libintl.h> in
69 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
70
71 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
72 parameter, which is unused in the [!F_SETFD] case.
73
74 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
75 SYMNDX to off_t before comparing it to this->data_size().
76 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
77 * incremental.cc (Output_section_incremental_inputs::do_write):
78 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
79
80 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
81
82 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
83
84 * gold.cc (Target_arm::do_adjust_elf_header): Add the
85 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
86 in EABI_VER5.
87
88 2012-10-29 Cary Coutant <ccoutant@google.com>
89
90 * dwp.cc (usage): Add file and exit status parameters;
91 add --help and --version options.
92 (print_version): New function.
93 (main): Add --help and --version options.
94
95 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
96
97 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
98 final_layout_sequence.txt.
99 * testsuite/Makefile.in: Regenerated.
100
101 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
102
103 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
104 COMPILE generated by automake.
105 (LINK1): Likewise.
106 (CXXCOMPILE1): Likewise.
107 (CXXLINK1): Likewise.
108 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
109 (LINK): Likewise.
110 (CXXCOMPILE): Likewise.
111 (CXXLINK): Likewise.
112 * testsuite/Makefile.in: Regenerated.
113
114 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
115
116 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
117 on bad fwrite return.
118
119 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
120
121 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
122 on val.
123
124 2012-10-23 Cary Coutant <ccoutant@google.com>
125
126 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
127 * testsuite/Makefile.in: Regenerate.
128 * testsuite/dwp_test.h: New source file.
129 * testsuite/dwp_test_1.cc: New source file.
130 * testsuite/dwp_test_1.s: New source file.
131 * testsuite/dwp_test_1.sh: New source file.
132 * testsuite/dwp_test_1b.cc: New source file.
133 * testsuite/dwp_test_1b.s: New source file.
134 * testsuite/dwp_test_2.cc: New source file.
135 * testsuite/dwp_test_2.s: New source file.
136 * testsuite/dwp_test_2.sh: New source file.
137 * testsuite/dwp_test_main.cc: New source file.
138 * testsuite/dwp_test_main.s: New source file.
139
140 2012-10-23 Cary Coutant <ccoutant@google.com>
141
142 * dwp.h: New header file.
143 * dwp.cc: New source file.
144 * gold.h: Move shared declarations to system.h.
145 * system.h: New header file.
146 * Makefile.am: Add dwp.
147 * Makefile.in: Regenerate.
148
149 2012-10-23 Cary Coutant <ccoutant@google.com>
150
151 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
152 Dwarf_info_reader::read_from_pointer.
153 (Dwarf_pubnames_table::read_header): Likewise.
154 (Dwarf_pubnames_table::next_name): Likewise.
155 (Dwarf_die::read_attributes): Likewise.
156 (Dwarf_die::skip_attributes): Likewise.
157 (Dwarf_info_reader::read_from_pointer): New function template.
158 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
159 (Dwarf_pubnames_table): Likewise.
160 (Dwarf_info_reader::read_from_pointer): New function template.
161 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
162 Dwarf_pubnames_table ctor.
163
164 2012-10-23 Cary Coutant <ccoutant@google.com>
165
166 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
167 abbrev_shndx.
168 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
169 abbrev_shndx_.
170 (Dwarf_info_reader::set_abbrev_shndx): New method.
171 (Dwarf_info_reader::abbrev_shndx_): New data member.
172
173 2012-10-23 Cary Coutant <ccoutant@google.com>
174
175 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
176 from object, not parameters.
177 (Dwarf_info_reader::parse): Likewise.
178 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
179 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
180 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
181 methods.
182
183 2012-10-23 Cary Coutant <ccoutant@google.com>
184
185 * fileread.cc (Input_file::Input_file): New constructor.
186 * fileread.h (class Input_file): Add new constructor.
187
188 2012-10-18 Alan Modra <amodra@gmail.com>
189
190 PR gold/14727
191 * object.cc (Relobj::is_section_name_included): Also match
192 .sdata personality section.
193
194 2012-10-18 Alan Modra <amodra@gmail.com>
195
196 * target-reloc.h (class Default_comdat_behavior): New, package up..
197 (get_comdat_behaviour): ..this.
198 (relocate_section): Add Relocate_comdat_behavior template arg,
199 adjust code to suit.
200 * arm.cc (Target_arm::relocate_section): Adjust to suit.
201 (Target_arm::scan_reloc_section): Likewise.
202 * i386.cc (Target_i386::relocate_section): Likewise.
203 * sparc.cc (Target_sparc::relocate_section): Likewise.
204 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
205 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
206 * powerpc.cc (class Relocate_comdat_behavior): New.
207 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
208 gold::relocate_section with new template arg.
209
210 2012-10-18 Alan Modra <amodra@gmail.com>
211
212 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
213 dynamic relocs for GOT_TPREL got entries, without symbol if
214 resolving locally.
215 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
216 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
217 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
218
219 2012-10-17 Alan Modra <amodra@gmail.com>
220
221 PR gold/14726
222 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
223
224 2012-10-16 Sriraman Tallam <tmsriram@google.com>
225
226 * layout.cc (Layout::include_section): Keep sections marked
227 SHF_EXCLUDE when doing relocatable links.
228
229 2012-10-16 Alan Modra <amodra@gmail.com>
230
231 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
232 (Target_powerpc::do_finalize_sections): Call it.
233 (Output_data_save_res): New class and supporting functions.
234 (Target_powerpc::symval_for_branch): Only look up .opd entry for
235 normal symbols defined in object files.
236
237 2012-10-12 Alan Modra <amodra@gmail.com>
238
239 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
240 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
241 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
242 section if scan_opd_relocs not yet called.
243 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
244
245 2012-10-12 Alan Modra <amodra@gmail.com>
246
247 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
248 add_local_ifunc_entry): Revert last change.
249 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
250
251 2012-10-05 Alan Modra <amodra@gmail.com>
252
253 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
254 do_plt_address_for_global): New functions.
255 (Output_data_got_powerpc::do_write): Don't segfault when linking
256 statically.
257 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
258 add_local_ifunc_entry): Return true on adding entry..
259 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
260 glink->add_entry call. Remove unused symtab param. Adjust calls.
261 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
262 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
263 set up symbols here.
264 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
265 syms here. Do so even when no .iplt. Don't segfault when linking
266 statically.
267 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
268 new variants without reloc param.
269 (Glink_sym_ent::Glink_sym_ent): Likewise.
270 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
271 reloc when refs will resolve to plt call stub.
272 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
273 R_PPC_PLTREL24 to resolve locally.
274 (Target_powerpc::Scan::global): Correct ifunc handling.
275 (Target_powerpc::Relocate::relocate): Correct local sym glink
276 lookup. Don't destroy "value" when we have a plt call stub,
277 and when checking plt call validity.
278 (Target_powerpc::do_dynsym_value): Simplify.
279
280 2012-10-05 Alan Modra <amodra@gmail.com>
281
282 * i386.cc (Output_data_plt_i386::address_for_global,
283 address_for_local): Add plt offset to returned value. Adjust uses.
284 * sparc.cc (Output_data_plt_sparc::address_for_global,
285 address_for_local): Likewise.
286 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
287 address_for_local): Likewise.
288 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
289 address_for_local): Likewise.
290 * target.h (Target::plt_address_for_global, plt_address_for_local):
291 Update comment.
292 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
293 (Output_data_got::Got_entry::write): Nor here.
294 * output.h: Comment fix.
295
296 2012-10-02 Jiong Wang <jiwang@tilera.com>
297
298 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
299 global_offset_table_ value for larget got.
300 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
301
302 2012-09-29 Alan Modra <amodra@gmail.com>
303
304 * powerpc.cc (Target_powerpc::iplt_): New output section.
305 (Target_powerpc::iplt_section, make_iplt_section,
306 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
307 (Target_powerpc::make_plt_entry): Handle ifunc syms.
308 Target_powerpc::plt_entry_count): Count iplt entries too.
309 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
310 reloc section in constructor. New params.
311 (Target_powerpc::make_plt_section): Create reloc section here instead.
312 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
313 functions.
314 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
315 (Output_data_glink::add_entry, find_entry): New functions to
316 deal with local syms.
317 (Glink_sym_ent): Add support for local syms.
318 (Output_data_glink::do_write): Handle ifunc plt entries.
319 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
320 (Target_powerpc::Scan::local, global): Handle ifunc syms.
321 (Target_powerpc::Relocate::relocate): Likewise.
322 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
323
324 2012-09-25 Alan Modra <amodra@gmail.com>
325
326 * object.h (Sized_relobj_file::adjust_local_symbol,
327 do_adjust_local_symbol): New functions.
328 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
329 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
330 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
331 and irregular opd entry spacing.
332 (Powerpc_relobj::do_read_relocs): Add opd size checks.
333 (Global_symbol_visitor_opd): New functor.
334 (Target_powerpc::do_finalize_sections): Omit global symbols defined
335 on deleted opd entries.
336
337 2012-09-15 Jiong Wang <jiwang@tilera.com>
338
339 * tilegx.cc: New file.
340 * Makefile.am (TARGETSOURCES): Add tilegx.cc
341 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
342 * configure.tgt: Add entries for tilegx*.
343 * configure.ac: Likewise.
344 * Makefile.in: Rebuild.
345 * configure: Likewise.
346 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
347 tilegx.
348
349 2012-09-13 Alan Modra <amodra@gmail.com>
350
351 * target-reloc.h (scan_relocs): Call scan.local for relocs
352 against symbols in discarded sections. Pass is_discarded
353 param.
354 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
355 Add is_discarded param.
356 * powerpc (Target_powerpc::Scan::local): Likewise. Use
357 is_discarded to flag opd entry as discarded. Don't emit dyn
358 relocs on such entries.
359 (Target_powerpc::Scan::global): Similarly detect and handle
360 such opd entries.
361 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
362 opd_ent_. Update all uses.
363 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
364 (Target_powerpc::relocate_section): Zero out discarded opd
365 entry relocs.
366
367 2012-09-12 Ian Lance Taylor <iant@google.com>
368
369 PR gold/14570
370 * output.cc: Rename Output_data_got template parameter from size
371 to got_size for all functions. Compile all variants of
372 Output_data_got.
373 (Output_data_got::Got_entry::write): Correct use of size for
374 symbol value. Use local_is_tls rather than casting to
375 Sized_relobj_file.
376 * object.h (class Object): Add local_is_tls and do_local_is_tls.
377 (class Sized_relobj_file): Add do_local_is_tls.
378 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
379
380 2012-09-11 Alan Modra <amodra@gmail.com>
381
382 PR gold/14566
383 * layout.cc (Layout::set_segment_offsets): When using
384 common-page-size alignment, ensure we are on a new max-page-size
385 page.
386 * output.cc (Output_segment::set_section_addresses): Use
387 abi_pagesize, not common_pagesize for relro boundary.
388 (Output_segment::set_offset): Likewise.
389
390 2012-09-11 Alan Modra <amodra@gmail.com>
391
392 * output.h (Output_data_got::add_global_tls, add_local_tls,
393 add_local_tls_pair): New functions.
394 (Output_data_got::add_local_pair_with_rel): Remove second
395 reloc param. Expand comment.
396 (Output_data_got::Got_entry): Rename use_plt_offset_ to
397 use_plt_or_tls_offset_, similarly for constructor param.
398 (Output_data_got::Got_entry::write): Add got_index param.
399 * output.cc (Output_data_got::add_global_tls, add_local_tls,
400 add_local_tls_pair): New functions.
401 (Output_data_got::Got_entry::write): Handle tls symbols
402 with use_plt_or_tls_offset_ set specially.
403 (Output_data_got::add_local_pair_with_rel): Only one reloc.
404 (Output_data_got::do_write): Replace iterator with index, pass
405 index to entry write function.
406 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
407 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
408 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
409 call.
410 * i386.cc (Target_i386::Scan::local): Likewise.
411 * sparc.cc (Target_sparc::Scan::local): Likewise.
412 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
413 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
414 do_tls_offset_for_global): New functions.
415 (Target_powerpc::Scan::local): Correct TLS relocations and got
416 entry values.
417 (Target_powerpc::Scan::global): Don't emit unnecessary
418 dynamic relocations on TLS GOT entries.
419
420 2012-09-10 Matthias Klose <doko@ubuntu.com>
421
422 * config.in: Disable sanity check for kfreebsd.
423
424 2012-09-10 Sterling Augustine <saugustine@google.com>
425
426 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
427 (Gdb_index::pubtypes_read): New parameter.
428 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
429 to calls.
430 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
431 pubtypes_object_.
432
433 2012-09-09 Alan Modra <amodra@gmail.com>
434
435 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
436 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
437 * gc.h (gc_process_relocs): Call target gc_add_reference.
438 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
439 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
440 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
441 unnecessary cast.
442 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
443 to cater for when we don't need code offset. Update use.
444 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
445 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
446 set_opd_valid): New functions.
447 (Target_powerpc::do_gc_add_reference): New function.
448 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
449 stashed refs.
450 (Target_powerpc::do_gc_mark_symbol): New function.
451
452 2012-09-06 Cary Coutant <ccoutant@google.com>
453
454 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
455 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
456 (Dwarf_die::skip_attributes): Likewise.
457 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
458 * testsuite/gdb_index_test.cc (inline_func_1): New function.
459 (main): Call it.
460 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
461
462 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
463
464 * testsuite/script_test_3.t: Add .got.plt output section
465 statement.
466 * testsuite/script_test_4.t: Likewise.
467
468 2012-09-05 Alan Modra <amodra@gmail.com>
469
470 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
471 update all uses and lose "enum" when using type.
472
473 2012-09-05 Alan Modra <amodra@gmail.com>
474
475 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
476 * configure: Regenerate.
477 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
478 (plugin_final_layout.stdout): Likewise.
479 (memory_test): Set page sizes to 0x1000.
480 * testsuite/Makefile.in: Regenerate.
481 * testsuite/discard_locals_test.sh: Add FIXME comment.
482 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
483 * testsuite/pr14265.t: Add .got output section statement.
484 * testsuite/script_test_2.t: Likewise.
485 * testsuite/script_test_3.t: Likewise.
486 * testsuite/script_test_4.t: Likewise.
487 * testsuite/script_test_5.t: Likewise.
488 * testsuite/script_test_6.t: Likewise.
489 * testsuite/script_test_7.t: Likewise.
490 * testsuite/script_test_9.t: Likewise.
491
492 2012-09-05 Alan Modra <amodra@gmail.com>
493
494 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
495 (Powerpc_relocate_functions::Status): New typedef.
496 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
497 (Target_powerpc::Scan::local): Handle REL64.
498 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
499 for REL32 and REL64.
500 (Target_powerpc::symval_for_branch): New function, extracted from..
501 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
502 checks. Report overflow errors.
503
504 2012-09-05 Alan Modra <amodra@gmail.com>
505
506 * object.h (Sized_relobj_file::emit_relocs): Delete.
507 (Sized_relobj_file::emit_relocs_reltype): Delete.
508 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
509 relocate_relocs for --emit-relocs.
510 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
511 * output.h: Update comment.
512 (Output_segment::first_section): New function.
513 (Output_segment::first_section_load_address): Use first_section.
514 * output.cc (Output_segment::first_section): New function extracted..
515 (Output_segment::first_section_load_address): ..from here. Delete.
516 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
517 * target.h (Sized_target::relocate_for_relocatable): Likewise.
518 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
519 adjust call to target.h function.
520 * i386.cc (Target_i386): Likewise.
521 * sparc.cc (Target_sparc): Likewise.
522 * x86_64.cc (Target_x86_64): Likewise.
523 * powerpc.cc (Target_powerpc): Likewise.
524 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
525 first tls section has section symbol for optimised local dynamic
526 output relocs.
527 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
528 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
529 optimised tls code.
530 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
531 Rename to relocate_relocs. Update error message.
532
533 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
534
535 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
536 --just-symbols.
537
538 2012-08-31 Alan Modra <amodra@gmail.com>
539
540 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
541 (Powerpc_relobj::toc_base_offset): New stub function.
542 (Target_powerpc): Add tp_offset, dtp_offset. Rename
543 got_mod_index_offset to tlsld_got_offset. Update all refs.
544 (Target_powerpc::Relocate::enum skip_tls): New.
545 (Target_powerpc::call_tls_get_addr_): New var.
546 (Target_powerpc::is_branch_reloc): Move to file scope.
547 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
548 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
549 New functions.
550 (Target_powerpc::enum Got_type): Delete old values, add new ones.
551 (powerpc_info): Correct common_pagesize for ppc64.
552 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
553 (Powerpc_relocate_functions): Add overflow check enums and functions.
554 Add non-shift version of rela, rela_ua. Delete all rel public
555 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
556 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
557 addr16_ha3, addr14 functions.
558 (Output_data_got_powerpc::add_constant_pair): New function.
559 (Output_data_got_powerpc::got_base_offset): Likewise.
560 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
561 (instruction constants): Sort, add some more.
562 (Output_data_glink::do_write): Add and use Address typedef. Use
563 object->toc_base_offset() stub for 64-bit.
564 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
565 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
566 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
567 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
568 Always treat .opd relocs as against locally defined symbol.
569 Correct condition for RELATIVE relocs.
570 (Target_powerpc::do_finalize_sections): Test for NULL sections.
571 (Target_powerpc::Relocate::relocate): Use plt call stub as value
572 for 32-bit syms with a plt entry. Correct ppc64 toc base
573 calculations. Handle TLS relocs, and more. Add overflow
574 checking and adjust for Powerpc_relocate_functions changes.
575 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
576 Reinstate --emit-relocs code with FIXME.
577
578 2012-08-30 Alan Modra <amodra@gmail.com>
579
580 * layout.cc (Layout::set_segment_offsets): Set p_align to
581 abi_pagesize, not common_pagesize.
582 (Layout::relaxation_loop_body): Similarly use abi_pagesize
583 to determine whether file header can go in segment.
584
585 2012-08-30 Alan Modra <amodra@gmail.com>
586
587 * output.h (Output_reloc::Output_reloc <output section>): Add
588 is_relative param. Adjust calls.
589 (Output_reloc::add_output_section_relative): New functions.
590 * output.cc (Output_reloc::Output_reloc <output section>): Handle
591 is_relative.
592 (Output_reloc::symbol_value): Handle SECTION_CODE.
593
594 2012-08-24 Sriraman Tallam <tmsriram@google.com>
595
596 * gold.cc (queue_middle_tasks): Call layout again when unique
597 segments for sections is desired.
598 * layout.cc (Layout::Layout): Initialize new members.
599 (Layout::get_output_section_flags): New function.
600 (Layout::choose_output_section): Call get_output_section_flags.
601 (Layout::layout): Make output section for mapping to a unique segment.
602 (Layout::insert_section_segment_map): New function.
603 (Layout::attach_allocated_section_to_segment): Make unique segment for
604 output sections marked so.
605 (Layout::segment_precedes): Check for unique segments when sorting.
606 * layout.h (Layout::Unique_segment_info): New struct.
607 (Layout::Section_segment_map): New typedef.
608 (Layout::insert_section_segment_map): New function.
609 (Layout::get_output_section_flags): New function.
610 (Layout::is_unique_segment_for_sections_specified): New function.
611 (Layout::set_unique_segment_for_sections_specified): New function.
612 (Layout::unique_segment_for_sections_specified_): New member.
613 (Layout::section_segment_map_): New member.
614 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
615 Rename is_gc_pass_one to is_pass_one.
616 Rename is_gc_pass_two to is_pass_two.
617 Rename is_gc_or_icf to is_two_pass.
618 Check for which pass based on whether symbols data is present.
619 Make it two pass when unique segments for sections is desired.
620 * output.cc (Output_section::Output_section): Initialize new
621 members.
622 * output.h (Output_section::is_unique_segment): New function.
623 (Output_section::set_is_unique_segment): New function.
624 (Output_section::is_unique_segment_): New member.
625 (Output_section::extra_segment_flags): New function.
626 (Output_section::set_extra_segment_flags): New function.
627 (Output_section::extra_segment_flags_): New member.
628 (Output_section::segment_alignment): New function.
629 (Output_section::set_segment_alignment): New function.
630 (Output_section::segment_alignment_): New member.
631 (Output_segment::Output_segment): Initialize is_unique_segment_.
632 (Output_segment::is_unique_segment): New function.
633 (Output_segment::set_is_unique_segment): New function.
634 (Output_segment::is_unique_segment_): New member.
635 * plugin.cc (allow_unique_segment_for_sections): New function.
636 (unique_segment_for_sections): New function.
637 (Plugin::load): Add new functions to transfer vector.
638 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
639 * Makefile.in: Regenerate.
640 * testsuite/plugin_final_layout.sh: Check if unique segment
641 functionality works.
642 * testsuite/plugin_section_order.c (onload): Check if new interfaces
643 are available.
644 (allow_unique_segment_for_sections): New global.
645 (unique_segment_for_sections): New global.
646 (claim_file_hook): Call allow_unique_segment_for_sections.
647 (all_symbols_read_hook): Call unique_segment_for_sections.
648
649 2012-08-22 Cary Coutant <ccoutant@google.com>
650
651 * layout.cc (Layout::include_section): Don't assert on GROUP
652 sections with --emit-relocs.
653
654 2012-08-21 Cary Coutant <ccoutant@google.com>
655
656 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
657 if --export-dynamic-symbol names an undef symbol.
658
659 2012-08-18 Alan Modra <amodra@gmail.com>
660
661 * powerpc.cc: Formatting and white space.
662 (Powerpc_relobj): Rename got2_section_ to special_.
663 Add opd_ent_shndx_ and opd_ent_off_ vectors.
664 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
665 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
666 (Target_powerpc): Add Address typedef and invalid_address. Use
667 throughout.
668 (Target_powerpc::is_branch_reloc): New function.
669 (Powerpc_relocate_functions): Add Address typedef, use throughout.
670 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
671 for dst_mask, value and addend.
672 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
673 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
674 (Output_data_glink::do_write): Correct toc base. Don't try to use
675 uint16_t for 24-bit offset. Use get_output_section_offset and
676 check return.
677 (Target_powerpc::Scan::local): Handle more relocs.
678 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
679 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
680 Plug in toc restoring insn after plt calls. Translate branches
681 to function descriptor symbols to corresponding entry point.
682 (Target_powerpc::relocate_for_relocatable): Check return from
683 get_output_section_offset.
684 * symtab.h: Comment typo.
685
686 2012-08-14 Ian Lance Taylor <iant@google.com>
687
688 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
689 unsupported_relocal_local to call unsupported_reloc_global.
690
691 2012-08-14 Nick Clifton <nickc@redhat.com>
692
693 PR ld/14265
694 * script-sections.cc (Sections_element::output_section_name): Add
695 keep return parameter.
696 (Output_section_element::match_name): Add keep return parameter.
697 Return the value of the keep_ member.
698 * script-sections.h (class Output_section): Update
699 output_section_name prototype.
700 * layout.cc (Layout::keep_input_section): New public member
701 function.
702 (Layout::choose_output_section): Pass keep parameter to
703 output_section_name.
704 * layout.h (class Layout): Add keep_input_section.
705 * object.cc (Sized_relobj_file::do_layout): Check for kept input
706 sections.
707 * testsuite/Makefile.am: Add a test.
708 * testsuite/Makefile.in: Regenerate.
709 * testsuite/pr14265.c: Source file for the test.
710 * testsuite/pr14265.t: Linker script for the test.
711 * testsuite/pr14265.sh: Shell script for the test.
712
713 2012-08-14 Alan Modra <amodra@gmail.com>
714
715 * target.h (Target::output_section_name): New function.
716 (Target::do_output_section_name): New function.
717 * layout.cc (Layout::choose_output_section): Call the above.
718 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
719
720 2012-08-14 Alan Modra <amodra@gmail.com>
721
722 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
723 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
724 for replace_constant call.
725 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
726 (Output_data_glink::do_print_to_mapfile): New function.
727 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
728 (Target_powerpc::Relocate::relocate): Likewise.
729
730 2012-08-14 Alan Modra <amodra@gmail.com>
731
732 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
733 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
734 (Output_data_glink::add_entry,find_entry): Remove shndx param.
735 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
736 all references to shndx_. Handle special case for R_PPC_PLTREL24
737 here.
738 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
739 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
740 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
741 here.
742 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
743 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
744
745 2012-08-12 Alan Modra <amodra@gmail.com>
746
747 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
748 (glink insn constants): Use uint32_t.
749 (Output_data_glink::add_entry): Use insert, not [] operator.
750
751 2012-08-11 Alan Modra <amodra@gmail.com>
752
753 * object.h (Sized_relobj_file::find_shdr): New function.
754 (Sized_relobj_file::find_special_sections): New function.
755 * object.cc (Sized_relobj_file::find_shdr): New function.
756 (Sized_relobj_file::find_eh_frame): Use find_shdr.
757 (Sized_relobj_file::find_special_sections): New function, split out..
758 (Sized_relobj_file::do_read_symbols): ..from here.
759 * output.h (Output_data_got::replace_constant): New function.
760 (Output_data_got::num_entries): New function.
761 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
762 (Output_data_got::got_offset): Protected rather than private.
763 (Output_data_got::replace_got_entry): New function.
764 * output.cc (Output_data_got::replace_got_entry): New function.
765 * powerpc.cc (class Powerpc_relobj): New.
766 (class Powerpc_relocate_functions): Delete all psymval variants or
767 convert to value,addend type. Delete pcrela, pcrela_unaligned.
768 Implement _ha functions using corresponding _hi function.
769 (Powerpc_relobj::find_special_sections): New function.
770 (Target_powerpc::do_make_elf_object): New function.
771 (class Output_data_got_powerpc): New.
772 (class Output_data_glink): New.
773 (class Powerpc_scan_relocatable_reloc): New.
774 Many more changes througout file.
775
776 2012-08-09 Nick Clifton <nickc@redhat.com>
777
778 * po/vi.po: Updated Vietnamese translation.
779
780 2012-08-07 Ian Lance Taylor <iant@google.com>
781
782 * layout.cc (Layout::add_target_dynamic_tags): If
783 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
784 plt_rel.
785
786 2012-07-30 Nick Clifton <nickc@redhat.com>
787
788 * po/gold.pot: Updated template.
789 * po/es.po: Updated Spanish translation.
790
791 2012-07-18 Cary Coutant <ccoutant@google.com>
792
793 PR gold/14344
794 * configure.ac: Add check for -gpubnames support.
795 * configure: Regenerate.
796 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
797 support; force -gno-pubnames.
798 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
799 support.
800 (gdb_index_test_4): New test.
801 * testsuite/Makefile.in: Regenerate.
802 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
803 * testsuite/gdb_index_test_2.sh: Likewise.
804 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
805 * testsuite/gdb_index_test_4.sh: New script.
806 * testsuite/gdb_index_test_comm.sh: New script with common code;
807 don't look for space after colon.
808
809 2012-07-16 Sriraman Tallam <tmsriram@google.com>
810
811 * gold.cc (queue_middle_tasks): Update function order only after
812 deferred objects due to plugins are processed.
813
814 2012-07-11 Ian Lance Taylor <iant@google.com>
815
816 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
817 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
818 (Target_arm::scan_reloc_for_stub): Likewise.
819 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
820 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
821 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
822 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
823 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
824
825 2012-07-10 Dodji Seketeli <dodji@redhat.com>
826 Ian Lance Taylor <iant@google.com>
827
828 PR gold/14309
829 * configure.ac: Test whether std::tr1::hash<off_t> works.
830 * gold.h: Add a specialization for std::tr1::hash<off_t> if
831 needed.
832 * output.h (class Output_fill): Add virtual destructor.
833 * configure, config.in: Rebuild.
834
835 2012-06-22 Roland McGrath <mcgrathr@google.com>
836
837 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
838
839 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
840
841 * plugin.cc (Plugin::load): Handle position independent executables.
842
843 2012-06-06 Cary Coutant <ccoutant@google.com>
844
845 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
846 add .debug_macro.
847 (lines_only_debug_sections): Likewise.
848 (gdb_fast_lookup_sections): New static array.
849 (is_gdb_debug_section): Rename formal parameter.
850 (is_lines_only_debug_section): Likewise.
851 (is_gdb_fast_lookup_section): New function.
852 (Layout::include_section): Check for ".zdebug_" prefix; pass
853 section name suffix to is_gdb_debug_section, et al.; check for
854 fast-lookup sections when building .gdb_index.
855 * options.h (--strip-debug-gdb): Update GDB version number.
856
857 2012-06-06 Cary Coutant <ccoutant@google.com>
858
859 * configure.ac: Add check for fallocate.
860 * configure: Regenerate.
861 * config.in: Regenerate.
862
863 * options.h (class General_options): Add --mmap-output-file and
864 --posix-fallocate options.
865 * output.cc: (posix_fallocate): Remove; replace with...
866 (gold_fallocate): New function.
867 (Output_file::map_no_anonymous): Call gold_fallocate.
868 (Output_file::map): Check --mmap-output-file option.
869
870 2012-06-05 Jing Yu <jingyu@google.com>
871
872 * gold.h (textdomain): Add do {} to empty while(0).
873 (bindtextdomain): Likewise.
874
875 2012-06-04 Cary Coutant <ccoutant@google.com>
876
877 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
878 has_dynsym_index.
879
880 2012-05-25 Sriraman Tallam <tmsriram@google.com>
881
882 * symtab.cc (Symbol_table::define_special_symbol):
883 Initialize *poldsym to prevent uninitialized variable errors.
884
885 2012-05-23 Cary Coutant <ccoutant@google.com>
886
887 * layout.cc (Layout::section_name_mapping): Add rules to handle
888 exact match on .data.rel.ro.local or .data.rel.ro.
889 (Layout::output_section_name): Check for exact matches.
890
891 2012-05-23 Cary Coutant <ccoutant@google.com>
892
893 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
894 more carefully.
895
896 2012-05-22 Cary Coutant <ccoutant@google.com>
897
898 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
899 object before exporting symbol.
900
901 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
902
903 * testsuite/tls_test.cc: Include "config.h" first.
904 * testsuite/tls_test_c.c: Likewise.
905
906 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
907 Nick Clifton <nickc@redhat.com>
908
909 PR 14072
910 * configure.in: Add check that sysdep.h has been included before
911 any system header files.
912 * configure: Regenerate.
913 * config.in: Regenerate.
914
915 2012-05-14 Cary Coutant <ccoutant@google.com>
916
917 * layout.cc (Layout::make_output_section): Mark .tdata section
918 as RELRO.
919 * testsuite/relro_test.cc: Add a TLS variable.
920
921 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
922
923 PR gold/14091
924 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
925 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
926 R_X86_64_64.
927
928 2012-05-08 Cary Coutant <ccoutant@google.com>
929
930 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
931 (lines_only_debug_sections): Likewise.
932
933 2012-05-02 Roland McGrath <mcgrathr@google.com>
934
935 * nacl.cc: New file.
936 * nacl.h: New file.
937 * Makefile.am (CCFILES, HFILES): Add them.
938 * Makefile.in: Regenerate.
939 * i386.cc (Output_data_plt_i386_nacl): New class.
940 (Output_data_plt_i386_nacl_exec): New class.
941 (Output_data_plt_i386_nacl_dyn): New class.
942 (Target_i386_nacl): New class.
943 (Target_selector_i386_nacl): New class.
944 (target_selector_i386): Use it instead of Target_selector_i386.
945 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
946 (Target_x86_64_nacl): New class.
947 (Target_selector_x86_64_nacl): New class.
948 (target_selector_x86_64, target_selector_x32): Use it instead of
949 Target_selector_x86_64.
950 * arm.cc (Output_data_plt_arm_nacl): New class.
951 (Target_arm_nacl): New class.
952 (Target_selector_arm_nacl): New class.
953 (target_selector_arm, target_selector_armbe): Use it instead of
954 Target_selector_arm.
955
956 * target-select.cc (select_target): Take new Input_file* and off_t
957 arguments, pass them on to recognize method of selector.
958 * object.cc (make_elf_sized_object): Update caller.
959 * parameters.cc (parameters_force_valid_target): Likewise.
960 * incremental.cc (make_sized_incremental_binary): Likewise.
961 * target-select.h: Update decl.
962 (Target_selector::recognize): Take new Input_file* argument,
963 pass it on to do_recognize.
964 (Target_selector::do_recognize): Take new Input_file* argument.
965 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
966 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
967 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
968 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
969
970 * target.h (Target::Target_info): New members isolate_execinstr
971 and rosegment_gap.
972 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
973 * arm.cc (Target_arm::arm_info): Update initializer.
974 * i386.cc (Target_i386::i386_info): Likewise.
975 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
976 * sparc.cc (Target_sparc::sparc_info): Likewise.
977 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
978 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
979 * layout.cc (Layout::attach_allocated_section_to_segment):
980 Take new const Target* argument. If target->isolate_execinstr(), act
981 like --rosegment.
982 (Layout::find_first_load_seg): Take new const Target* argument;
983 if target->isolate_execinstr(), reject PF_X segments.
984 (Layout::relaxation_loop_body): Update caller.
985 (Layout::set_segment_offsets): If target->isolate_execinstr(),
986 reset file offset to zero when we hit LOAD_SEG, and then do a second
987 loop over the segments before LOAD_SEG to reassign offsets after
988 addresses have been determined. Handle target->rosegment_gap().
989 (Layout::attach_section_to_segment): Take new const Target* argument;
990 pass it to attach_allocated_section_to_segment.
991 (Layout::make_output_section): Update caller.
992 (Layout::attach_sections_to_segments): Take new const Target* argument;
993 pass it to attach_section_to_segment.
994 * gold.cc (queue_middle_tasks): Update caller.
995 * layout.h (Layout): Update method decls with new arguments.
996
997 * arm.cc (Target_arm::Target_arm): Take optional argument for the
998 Target_info pointer to use.
999 (Target_arm::do_make_data_plt): New virtual method.
1000 (Target_arm::make_data_plt): New method that calls it.
1001 (Target_arm::make_plt_entry): Use it.
1002 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1003 for the section alignment.
1004 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1005 method.
1006 (Output_data_plt_arm::first_plt_entry_offset): Call it.
1007 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1008 method.
1009 (Output_data_plt_arm::get_plt_entry_size): Call it.
1010 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1011 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1012 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1013 method.
1014 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1015 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1016 method instead of sizeof(plt_entry).
1017 (Output_data_plt_arm::add_entry): Likewise.
1018 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1019 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1020 than static method.
1021 (Target_arm::plt_entry_size): Likewise.
1022 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1023 Move to ...
1024 (Output_data_plt_arm_standard): ... here, new class.
1025 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1026 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1027 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1028
1029 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1030 Take additional argument for the PLT entry size.
1031 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1032 Use get_plt_entry_size method rather than plt_entry_size variable.
1033 (Output_data_plt_x86_64::reserve_slot): Likewise.
1034 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1035 (Output_data_plt_x86_64::add_entry): Likewise.
1036 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1037 (Output_data_plt_x86_64::address_for_global): Likewise.
1038 (Output_data_plt_x86_64::address_for_local): Likewise.
1039 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1040 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1041 Make method non-static.
1042 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1043 method.
1044 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1045 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1046 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1047 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1048 virtual method.
1049 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1050 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1051 virtual method.
1052 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1053 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1054 virtual method.
1055 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1056 (Output_data_plt_x86_64::plt_entry_size)
1057 (Output_data_plt_x86_64::first_plt_entry)
1058 (Output_data_plt_x86_64::plt_entry)
1059 (Output_data_plt_x86_64::tlsdesc_plt_entry)
1060 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1061 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1062 (Output_data_plt_x86_64_standard): ... here, new class.
1063 (Target_x86_64::Target_x86_64): Take optional argument for the
1064 Target_info pointer to use.
1065 (Target_x86_64::do_make_data_plt): New virtual method.
1066 (Target_x86_64::make_data_plt): New method to call it.
1067 (Target_x86_64::init_got_plt_for_update): Use that.
1068 Call this->plt_->add_eh_frame method here.
1069 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1070 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1071 rather than static method.
1072 (Target_x86_64::plt_entry_size): Likewise.
1073 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1074 rather than plt_entry_size variable. Move guts of PLT filling to...
1075 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1076 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1077 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1078
1079 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1080 additional argument for the section alignment.
1081 Don't do add_eh_frame_for_plt here.
1082 (Output_data_plt_i386::first_plt_entry_offset): Make the method
1083 non-static. Use get_plt_entry_size method rather than plt_entry_size
1084 variable.
1085 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1086 method.
1087 (Output_data_plt_i386::get_plt_entry_size): Call it.
1088 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1089 (Output_data_plt_i386::add_eh_frame): New method to call it.
1090 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1091 method.
1092 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1093 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1094 method.
1095 (Output_data_plt_i386::fill_plt_entry): New method to call it.
1096 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1097 method instead of plt_entry_size.
1098 (Output_data_plt_i386::plt_entry_size)
1099 (Output_data_plt_i386::plt_eh_frame_fde_size)
1100 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1101 (Output_data_plt_i386_standard): ... here, new class.
1102 (Output_data_plt_i386_exec): New class.
1103 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1104 (Output_data_plt_i386_exec::first_plt_entry): ... here.
1105 (Output_data_plt_i386::exec_plt_entry): Move to ...
1106 (Output_data_plt_i386_exec::plt_entry): ... here.
1107 (Output_data_plt_i386_dyn): New class.
1108 (Output_data_plt_i386::first_plt_entry): Move to ...
1109 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1110 (Output_data_plt_i386::dyn_plt_entry): Move to ...
1111 (Output_data_plt_i386_dyn::plt_entry): ... here.
1112 (Target_i386::Target_i386): Take optional argument for the Target_info
1113 pointer to use.
1114 (Target_i386::do_make_data_plt): New virtual method.
1115 (Target_i386::make_data_plt): New method to call it.
1116 (Target_i386::make_plt_section): Use that.
1117 Call this->plt_->add_eh_frame method here.
1118 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1119 rather than plt_entry_size variable.
1120 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1121 (Output_data_plt_i386::address_for_local): Likewise.
1122 (Output_data_plt_i386::do_write): Likewise.
1123 Move guts of PLT filling to...
1124 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1125 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1126 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1127 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1128
1129 2012-05-01 Cary Coutant <ccoutant@google.com>
1130
1131 * dwarf_reader.cc (Dwarf_die::read_attributes)
1132 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1133 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1134 * reduced_debug_output.cc
1135 (Output_reduced_debug_info_section::get_die_end): Remove
1136 DW_FORM_GNU_ref_index. Add default case.
1137
1138 2012-04-26 Mark Wielaard <mjw@redhat.com>
1139
1140 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1141 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1142 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1143 DW_AT_high_pc as offset from DW_AT_low_pc.
1144
1145 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1146 * testsuite/Makefile.in: Regenerate.
1147 * testsuite/gdb_index_test_3.c: New test source file.
1148 * testsuite/gdb_index_test_3.sh: New test source file.
1149
1150 2012-04-25 Ian Lance Taylor <iant@google.com>
1151
1152 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1153 pointer.
1154 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1155 as a class, not a struct.
1156 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1157 (Target_arm::apply_cortex_a8_workaround): Likewise.
1158 * gc.h: Declare Reloc_types as a struct, not a class.
1159 * object.h: Declare Symbols_data as a struct.
1160 * reloc.h: Declare Read_relocs_data as a struct.
1161 * target.h: Declare Relocate_info as a struct.
1162
1163 2012-04-24 David S. Miller <davem@davemloft.net>
1164
1165 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1166 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1167 and R_SPARC_WPLT30.
1168
1169 2012-04-24 Cary Coutant <ccoutant@google.com>
1170
1171 * incremental-dump.cc (find_input_containing_global): Replace
1172 magic number with symbolic constant.
1173 (dump_incremental_inputs): Update version number.
1174 * incremental.cc (Output_section_incremental_inputs): Update version
1175 number; import symbolic constants from Incremental_inputs_reader.
1176 (Incremental_inputs::create_data_sections): Align relocations
1177 section correctly for 64-bit targets.
1178 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1179 constants; add padding.
1180 (Output_section_incremental_inputs::write_header): Add assert for
1181 header_size.
1182 (Output_section_incremental_inputs::write_input_files): Add assert
1183 for input_entry_size.
1184 (Output_section_incremental_inputs::write_info_blocks): Add padding;
1185 add assert for object_info_size, input_section_entry_size,
1186 global_sym_entry_size.
1187 * incremental.h (Incremental_inputs_reader): Add symbolic constants
1188 for data structure sizes; use them.
1189 (Incremental_input_entry_reader): Import symbolic constants from
1190 Incremental_inputs_reader; use them.
1191
1192 2012-04-23 David S. Miller <davem@davemloft.net>
1193
1194 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1195 and elf_flags_set_.
1196 (Target_sparc::Target_sparc): Initialize new fields.
1197 (Target_sparc::do_make_elf_object): New function.
1198 (Target_sparc::do_adjust_elf_header): New function.
1199
1200 2012-04-23 Cary Coutant <ccoutant@google.com>
1201
1202 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1203 CU range table of gdb index.
1204
1205 2012-04-20 David S. Miller <davem@davemloft.net>
1206
1207 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1208 instead of false.
1209
1210 2012-04-16 David S. Miller <davem@davemloft.net>
1211
1212 * sparc.cc (Target_sparc::got_address): New function.
1213 (Sparc_relocate_functions::gdop_hix22): New function.
1214 (Sparc_relocate_functions::gdop_lox10): New function.
1215 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1216 relocs.
1217 (Target_sparc::Scan::local): Likewise if the global symbol is not
1218 preemptible and is not IFUNC.
1219 (Target_sparc::Relocate::relocate): Perform GOTDATA code
1220 transformations for local and non-preemptible non-IFUNC global
1221 symbols.
1222
1223 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1224 writing out 64-bit part of ranges.
1225
1226 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1227 -fpic and -fpie respectively.
1228 * Makefile.in: Regenerate.
1229
1230 * sparc.cc (class Target_sparc): Add rela_ifunc_.
1231 (Target_sparc::Target_sparc): Initialize new field.
1232 (Target_sparc::do_plt_section_for_global): New function.
1233 (Target_sparc::do_plt_section_for_local): New function.
1234 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1235 (Target_sparc::make_plt_section): New function, broken out of
1236 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
1237 (Target_sparc::make_plt_entry): Call make_plt_section.
1238 (Target_sparc::make_local_ifunc_plt_entry): New function.
1239 (Target_sparc::rela_ifunc_section): New function.
1240 (Target_sparc::plt_section): Remove const.
1241 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
1242 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1243 and ifunc_count_ fields.
1244 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1245 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1246 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1247 (Output_data_plt_sparc::rela_ifunc): New function.
1248 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1249 (Output_data_plt_sparc::has_ifunc_section): New function.
1250 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1251 (Output_data_plt_sparc::address_for_global): New function.
1252 (Output_data_plt_sparc::address_for_local): New function.
1253 (Output_data_plt_sparc::plt_index_to_offset): New function.
1254 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1255 and entry_count.
1256 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1257 entry_count.
1258 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1259 R_SPARC_JMP_IREL to switch.
1260 (Target_sparc::Scan::check_non_pic): Likewise.
1261 (Target_sparc::Scan::local): Handle IFUNC symbols.
1262 (Target_sparc::Scan::local): Likewise.
1263 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1264 and plt_address_for_local.
1265 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1266 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1267
1268 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1269 (class Output_data_reloc): Adjust calls to Output_reloc_type.
1270 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1271 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1272 global relocs too.
1273 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1274 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1275 calls.
1276 * sparc.cc (Target_sparc::Scan::global): Likewise.
1277 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1278
1279 2012-04-16 Cary Coutant <ccoutant@google.com>
1280
1281 * archive.cc (Library_base::should_include_member): Check for
1282 --export-dynamic-symbol.
1283 * options.h (class General_options): Add --export-dynamic-symbol.
1284 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1285 --export-dynamic-symbol.
1286 (Symbol_table::gc_mark_undef_symbols): Likewise.
1287 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1288
1289 2012-04-12 David S. Miller <davem@davemloft.net>
1290
1291 * sparc.cc (Reloc::wdisp10): New relocation method.
1292 (Reloc::h34): Likewise.
1293 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1294 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1295 R_SPARC_WDISP10.
1296 (Target_sparc::Scan::local): Likewise.
1297 (Target_sparc::Scan::global): Likewise.
1298 (Target_sparc::Relocate::relocate): Likewise.
1299
1300 2012-04-09 Cary Coutant <ccoutant@google.com>
1301
1302 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1303 low_pc == 0.
1304
1305 2012-04-06 Ian Lance Taylor <iant@google.com>
1306
1307 * timer.cc: #include <unistd.h>.
1308
1309 2012-04-06 Roland McGrath <mcgrathr@google.com>
1310
1311 * configure.in (AC_CHECK_HEADERS): Add locale.h.
1312 * config.in: Regenerate.
1313 * configure: Regenerate.
1314
1315 2012-04-05 Nick Clifton <nickc@redhat.com>
1316
1317 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1318 (AM_LC_MESSAGES): Add.
1319 * aclocal.m4: Regenerate.
1320 * config.in: Regenerate.
1321 * configure: Regenerate.
1322
1323 2012-03-21 Cary Coutant <ccoutant@google.com>
1324
1325 * Makefile.am: Add gdb-index.cc, gdb-index.h.
1326 * Makefile.in: Regenerate.
1327 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1328 (Sized_elf_reloc_mapper::symbol_section): New function.
1329 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1330 (make_elf_reloc_mapper): New function.
1331 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1332 (Dwarf_abbrev_table::do_read_abbrevs): New function.
1333 (Dwarf_abbrev_table::do_get_abbrev): New function.
1334 (Dwarf_ranges_table::read_ranges_table): New function.
1335 (Dwarf_ranges_table::read_range_list): New function.
1336 (Dwarf_pubnames_table::read_section): New function.
1337 (Dwarf_pubnames_table::read_header): New function.
1338 (Dwarf_pubnames_table::next_name): New function.
1339 (Dwarf_die::Dwarf_die): New function.
1340 (Dwarf_die::read_attributes): New function.
1341 (Dwarf_die::skip_attributes): New function.
1342 (Dwarf_die::set_name): New function.
1343 (Dwarf_die::set_linkage_name): New function.
1344 (Dwarf_die::attribute): New function.
1345 (Dwarf_die::string_attribute): New function.
1346 (Dwarf_die::int_attribute): New function.
1347 (Dwarf_die::uint_attribute): New function.
1348 (Dwarf_die::ref_attribute): New function.
1349 (Dwarf_die::child_offset): New function.
1350 (Dwarf_die::sibling_offset): New function.
1351 (Dwarf_info_reader::check_buffer): New function.
1352 (Dwarf_info_reader::parse): New function.
1353 (Dwarf_info_reader::do_parse): New function.
1354 (Dwarf_info_reader::do_read_string_table): New function.
1355 (Dwarf_info_reader::lookup_reloc): New function.
1356 (Dwarf_info_reader::get_string): New function.
1357 (Dwarf_info_reader::visit_compilation_unit): New function.
1358 (Dwarf_info_reader::visit_type_unit): New function.
1359 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1360 Sized_elf_reloc_mapper.
1361 (Sized_dwarf_line_info::symbol_section): Remove function.
1362 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1363 (Sized_dwarf_line_info::read_line_mappings): Remove object
1364 parameter, adjust callers.
1365 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1366 * dwarf_reader.h: Include <sys/types.h>.
1367 (class Track_relocs): Remove forward declaration.
1368 (class Elf_reloc_mapper): New class.
1369 (class Sized_elf_reloc_mapper): New class.
1370 (class Dwarf_abbrev_table): New class.
1371 (class Dwarf_range_list): New class.
1372 (class Dwarf_ranges_table): New class.
1373 (class Dwarf_pubnames_table): New class.
1374 (class Dwarf_die): New class.
1375 (class Dwarf_info_reader): New class.
1376 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1377 (Sized_dwarf_line_info::symbol_section): Remove member function.
1378 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1379 base class.
1380 * gdb-index.cc: New source file.
1381 * gdb-index.h: New source file.
1382 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1383 and .debug_types sections, call Layout::add_to_gdb_index.
1384 (Sized_relobj_incr::do_section_name): Implement.
1385 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1386 return type; Implement.
1387 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1388 return type.
1389 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1390 parameter list and return type.
1391 (Sized_incr_dynobj::do_section_contents): Likewise.
1392 * layout.cc: Include gdb-index.h.
1393 (Layout::Layout): Initialize gdb_index_data_.
1394 (Layout::init_fixed_output_section): Check for .gdb_index section.
1395 (Layout::add_to_gdb_index): New function. Instantiate.
1396 * layout.h: Add forward declaration for class Gdb_index.
1397 (Layout::add_to_gdb_index): New member function.
1398 (Layout::gdb_index_data_): New data member.
1399 * main.cc: Include gdb-index.h.
1400 (main): Print statistics for gdb index.
1401 * object.cc (Object::section_contents): Move code into
1402 do_section_contents.
1403 (need_decompressed_section): Check for sections needed when building
1404 gdb index.
1405 (build_compressed_section_map): Likewise.
1406 (Sized_relobj_file::do_read_symbols): Need local symbols when building
1407 gdb index.
1408 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1409 sections; call Layout::add_to_gdb_index.
1410 (Sized_relobj_file::do_decompressed_section_contents): Call
1411 do_section_contents directly.
1412 * object.h (Object::do_section_contents): Adjust parameter list and
1413 return type.
1414 (Object::do_decompressed_section_contents): Call do_section_contents
1415 directly.
1416 (Sized_relobj_file::do_section_contents): Adjust parameter list and
1417 return type.
1418 * options.h (class General_options): Add --gdb-index option.
1419 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1420 list and return type.
1421 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1422 * reloc.h (Track_relocs::checkpoint): New function.
1423 (Track_relocs::reset): New function.
1424
1425 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1426 New test cases.
1427 * testsuite/Makefile.in: Regenerate.
1428 * testsuite/gdb_index_test.cc: New test source file.
1429 * testsuite/gdb_index_test_1.sh: New test source file.
1430 * testsuite/gdb_index_test_2.sh: New test source file.
1431
1432 2012-03-19 Doug Kwan <dougkwan@google.com>
1433
1434 * arm.cc (Target_arm::do_define_standard_symbols): New method.
1435 (Target_arm::do_finalize_sections): Remove code which defines
1436 __exidx_start and __exidx_end. Make symbol table parameter
1437 anonymous as it is not used.
1438 * gold.cc (queue_middle_tasks): Call target hook to define any
1439 target-specific symbols.
1440 * target.h (Target::define_standard_symbols): New method.
1441 (Target::do_define_standard_symbols): Same.
1442 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1443 * testsuite/Makefile.in: Regenerate.
1444 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1445 and __exidx_end.
1446 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1447 relocations are generated for __exidx_start and __exidx_end.
1448
1449 2012-03-16 Doug Kwan <dougkwan@google.com>
1450
1451 * testsuite/Makefile.am: Disable test initpri3b.
1452 * testsuite/Makefile.in: Regenerate.
1453
1454 2012-03-15 Doug Kwan <dougkwan@google.com>
1455
1456 * arm.cc (Target_arm::got_section): Make .got section read-only
1457 if -z now is given.
1458
1459 2012-03-15 Ian Lance Taylor <iant@google.com>
1460
1461 PR gold/13850
1462 * layout.cc (Layout::make_output_section): Correctly mark
1463 SHT_INIT_ARRAY, et. al., as relro.
1464
1465 2012-03-14 Doug Kwan <dougkwan@google.com>
1466
1467 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1468 dynamic relocations for protected symbols in shared objects.
1469
1470 2012-03-13 Ian Lance Taylor <iant@google.com>
1471
1472 * resolve.cc (Symbol_table::resolve): When merging common symbols,
1473 keep the larger alignment.
1474
1475 2012-03-12 Cary Coutant <ccoutant@google.com>
1476
1477 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1478 handling of DW_LNE_define_file.
1479
1480 2012-03-12 Cary Coutant <ccoutant@google.com>
1481
1482 * reduced_debug_output.cc
1483 (Output_reduced_debug_info_section::get_die_end): Add new FORM
1484 codes to switch.
1485
1486 2012-02-29 Cary Coutant <ccoutant@google.com>
1487
1488 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1489
1490 2012-02-29 Cary Coutant <ccoutant@google.com>
1491
1492 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1493 Call Object::decompressed_section_contents.
1494 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1495 New dtor.
1496 (Sized_dwarf_line_info::buffer_start_): New data member.
1497 * merge.cc (Output_merge_data::do_add_input_section): Call
1498 Object::decompressed_section_contents.
1499 (Output_merge_string::do_add_input_section): Likewise.
1500 * object.cc (need_decompressed_section): New function.
1501 (build_compressed_section_map): Decompress sections needed later.
1502 (Sized_relobj_file::do_decompressed_section_contents): New function.
1503 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1504 * object.h (Object::decompressed_section_contents): New function.
1505 (Object::discard_decompressed_sections): New function.
1506 (Object::do_decompressed_section_contents): New function.
1507 (Object::do_discard_decompressed_sections): New function.
1508 (Compressed_section_info): New type.
1509 (Compressed_section_map): Include decompressed section contents.
1510 (Sized_relobj_file::do_decompressed_section_contents): New function.
1511 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1512
1513 2012-02-16 Cary Coutant <ccoutant@google.com>
1514
1515 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1516 * testsuite/Makefile.in: Regenerate.
1517
1518 2012-02-14 Cary Coutant <ccoutant@google.com>
1519
1520 * options.cc (General_options::finalize): Disallow -pie and -static.
1521
1522 2012-02-03 Doug Kwan <dougkwan@google.com>
1523
1524 * arm.cc (Arm_relocate_functions::abs8,
1525 Arm_relocate_functions::abs16): Use
1526 Bits::has_signed_unsigned_overflow32.
1527 (Arm_relocate_functions::thm_abs8): Correct range of
1528 overflow check.
1529 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1530 in assertions.
1531
1532 2012-02-02 Doug Kwan <dougkwan@google.com>
1533
1534 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1535 position independent outputs, not just shared objects.
1536
1537 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
1538
1539 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1540 * configure: Regenerated.
1541
1542 2012-01-27 Ian Lance Taylor <iant@google.com>
1543
1544 * reloc.h (Bits): New class with static functions, copied from
1545 namespace utils in arm.cc.
1546 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
1547 instead.
1548
1549 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1550
1551 * incremental.cc (write_info_blocks): Correct relocation offset.
1552
1553 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1554
1555 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1556 (Relocate::tls_gd_to_le): Likewise.
1557
1558 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1559
1560 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1561
1562 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1563
1564 * configure.ac: Check if -mcmodel=medium works.
1565 * configure: Regenerated.
1566
1567 2012-01-24 Cary Coutant <ccoutant@google.com>
1568
1569 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1570 definition and ...
1571 (read_unsigned_LEB_128_x): ... this new function.
1572 (read_signed_LEB_128): Replaced with inline definition and ...
1573 (read_signed_LEB_128_x): ... this new function.
1574 * int_encoding.h (read_unsigned_LEB_128_x): New function.
1575 (read_unsigned_LEB_128): Add inline definition.
1576 (read_signed_LEB_128_x): New function.
1577 (read_signed_LEB_128): Add inline definition.
1578 * testsuite/Makefile.am (leb128_unittest): New unit test.
1579 * testsuite/Makefile.in: Regenerate.
1580 * testsuite/leb128_unittest.cc: New unit test.
1581
1582 2012-01-23 Ian Lance Taylor <iant@google.com>
1583
1584 PR gold/13617
1585 * i386.cc (Target_i386::do_code_fill): When using a jmp
1586 instruction, pad with nop instructions.
1587 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1588
1589 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1590
1591 * x86_64.cc (gc_process_relocs): Add typename on types used in
1592 template.
1593 (scan_relocs): Likewise.
1594 (relocate_section): Likewise.
1595 (apply_relocation): Likewise.
1596
1597 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1598
1599 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1600 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1601 under x32.
1602
1603 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1604
1605 * x86_64.cc: Initial support for x32.
1606
1607 2012-01-03 Cary Coutant <ccoutant@google.com>
1608
1609 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1610 Use abstract base class for GOT.
1611 * gold/output.h (class Output_data_got_base): New abstract base class.
1612 (class Output_data_got): Derive from new base class, adjust ctors.
1613 (Output_data_got::reserve_slot): Make virtual; rename to
1614 do_reserve_slot; Adjust callers.
1615 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1616 pointer to abstract base class.
1617 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1618
1619 2011-12-18 Ian Lance Taylor <iant@google.com>
1620
1621 * object.h (Relobj::local_symbol_value): New function.
1622 (Relobj::local_plt_offset): New function.
1623 (Relobj::local_has_got_offset): New function.
1624 (Relobj::local_got_offset): New function.
1625 (Relobj::set_local_got_offset): New function.
1626 (Relobj::do_local_symbol_value): New pure virtual function.
1627 (Relobj::do_local_plt_offset): Likewise.
1628 (Relobj::do_local_has_got_offset): Likewise.
1629 (Relobj::do_local_got_offset): Likewise.
1630 (Relobj::do_set_local_got_offset): Likewise.
1631 (Sized_relobj::do_local_has_got_offset): Rename from
1632 local_has_got_offset.
1633 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1634 (Sized_relobj::do_set_local_got_offset): Rename from
1635 set_local_got_offset.
1636 (Sized_relobj_file::do_local_plt_offset): Rename from
1637 local_plt_offset.
1638 (Sized_relobj_file::do_local_symbol_value): New function.
1639 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1640 local_plt_offset.
1641 * output.cc (Output_data_got::Got_entry::write): Change object to
1642 Relobj. Use local_symbol_value.
1643 (Output_data_got::add_global_with_rel): Change rel_dyn to
1644 Output_data_reloc_generic*. Use add_global_generic.
1645 (Output_data_got::add_global_with_rela): Remove. Change all
1646 callers to use add_global_with_rel.
1647 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1648 Output_data_reloc_generic*. Use add_global_generic.
1649 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1650 callers to use add_global_pair_with_rel.
1651 (Output_data_got::add_local): Change object to Relobj*.
1652 (Output_data_got::add_local_plt): Likewise.
1653 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1654 change rel_dyn to Output_data_reloc_generic*. Use
1655 add_local_generic.
1656 (Output_data_got::add_local_with_rela): Remove. Change all
1657 callers to use all_local_with_rel.
1658 (Output_data_got::add_local_pair_with_rel): Change object to
1659 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1660 add_output_section_generic.
1661 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1662 callers to use add_local_pair_with_rel.
1663 (Output_data_got::reserve_local): Change object to Relobj*.
1664 * output.h: (class Output_data_reloc_generic): Add pure virtual
1665 declarations for add_global_generic, add_local_generic,
1666 add_output_section_generic.
1667 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1668 functions for Output_data_reloc_generic. Update declarations for
1669 changes listed in output.cc.
1670 (class Output_data_got): Change template parameter to got_size.
1671 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1672 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1673 function.
1674 (Sized_relobj_incr::do_local_plt_offset): New function.
1675 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1676 add_global_generic.
1677
1678 2011-12-17 Cary Coutant <ccoutant@google.com>
1679
1680 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1681 * resolve.cc (Symbol_table::resolve): Likewise.
1682 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1683 arrays.
1684 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1685
1686 2011-12-16 Ian Lance Taylor <iant@google.com>
1687
1688 * output.h (Output_data_reloc_generic::add): Only call
1689 add_dynamic_reloc if this is a dynamic reloc section.
1690
1691 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1692
1693 PR gold/13505
1694 * target-reloc.h (apply_relocation): Replace <64, false> with
1695 <size, big_endian>.
1696
1697 2011-11-25 Nick Clifton <nickc@redhat.com>
1698
1699 * po/it.po: New Italian translation.
1700
1701 2011-11-17 Sterling Augustine <saugustine@google.com>
1702
1703 * script.cc (script_include_directive): Implement.
1704 (read_script_file): New local variables name and search_path. Update
1705 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1706 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1707 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1708
1709 2011-11-11 Sterling Augustine <saugustine@google.com>
1710
1711 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1712 (file_or_sections_cmd): Likewise.
1713
1714 2011-11-11 Doug Kwan <dougkwan@google.com>
1715
1716 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1717 if --just-symbols is given.
1718
1719 2011-11-10 Doug Kwan <dougkwan@google.com>
1720
1721 PR gold/13362
1722 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1723 when processing data relocs.
1724 * reloc.h (Relocate_functions::rel_unaligned): New method.
1725 (Relocate_functions::pcrel_unaligned): Ditto.
1726 (Relocate_functions::rel32_unaligned): Ditto.
1727 (Relocate_functions::pcrel32_unaligned): Ditto.
1728
1729 2011-11-09 Doug Kwan <dougkwan@google.com>
1730
1731 PR gold/13362
1732 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1733 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1734 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1735 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1736 (Relocate_functions::rel_unaligned): New.
1737 (Relocate_functions::rel32_unaligned): New.
1738 * target-reloc.h (relocate_for_relocatable): Add code to handle
1739 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1740 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1741 arm_unaligned_reloc_r): New targets.
1742 * testsuite/Makefile.in: Regenerate.
1743 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1744 linking.
1745
1746 2011-11-02 Ian Lance Taylor <iant@google.com>
1747
1748 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1749 NATIVE_LINKER.
1750 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1751 * options.cc (General_options::finalize): Use library search path
1752 from configure script if specified. If not native and no sysroot,
1753 only search TOOLLIBDIR.
1754 * options.h (Search_directory::Search_directory): Change name to
1755 const std::string&.
1756 (General_options::add_to_library_path_with_sysroot): Change arg to
1757 const std::string&.
1758 * configure, Makefile.in, config.in: Rebuild.
1759
1760 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1761
1762 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1763 we are working around the ARM1176 Erratum.
1764 * options.h (General_options::fix_arm1176): Add option.
1765 * testsuite/Makefile.am: Add testcases, and keep current ones
1766 working.
1767 * testsuite/Makefile.in: Regenerate.
1768 * testsuite/arm_fix_1176.s: New file.
1769 * testsuite/arm_fix_1176.sh: Likewise.
1770
1771 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1772
1773 * arm.cc (Target_arm::Target_arm): Remove initialisation of
1774 may_use_blx_.
1775 (Target_arm::may_use_blx): Remove method.
1776 (Target_arm::set_may_use_blx): Likewise.
1777 (Target_arm::may_use_v4t_interworking): New method.
1778 (Target_arm::may_use_v5t_interworking): Likewise.
1779 (Target_arm::may_use_blx_): Remove member variable.
1780 (Arm_relocate_functions::arm_branch_common): Check for v5T
1781 interworking.
1782 (Arm_relocate_functions::thumb_branch_common): Likewise.
1783 (Reloc_stub::stub_type_for_reloc): Likewise.
1784 (Target_arm::do_finalize_sections): Correct interworking checks.
1785 * testsuite/Makefile.am: Add new tests.
1786 * testsuite/Makefile.in: Regenerate.
1787 * testsuite/arm_farcall_arm_arm.s: New test.
1788 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1789 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1790 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1791 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1792 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1793 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1794 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1795
1796 2011-10-31 Cary Coutant <ccoutant@google.com>
1797
1798 PR gold/13023
1799 * expression.cc (Expression::eval_with_dot): Add
1800 is_section_dot_assignment parameter.
1801 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1802 absolute and assigning to dot within a section.
1803 * script-sections.cc
1804 (Output_section_element_assignment::set_section_addresses): Pass
1805 dot_section to set_if_absolute.
1806 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1807 as is_section_dot_assignment flag to eval_with_dot.
1808 (Output_section_element_dot_assignment::set_section_addresses):
1809 Likewise.
1810 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1811 parameter. Also set value if relative to dot_section; set the
1812 symbol's output_section.
1813 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1814 parameter. Adjust all callers.
1815 (Expression::eval_maybe_dot): Likewise.
1816 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1817 Adjust all callers.
1818 * testsuite/script_test_2.t: Test assignment of an absolute value
1819 to dot within an output section element.
1820
1821 2011-10-31 Cary Coutant <ccoutant@google.com>
1822
1823 * options.h (class General_options): Add --[no-]gnu-unique options.
1824 * symtab.cc (Symbol_table::sized_write_globals): Convert
1825 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1826
1827 2011-10-31 Cary Coutant <ccoutant@google.com>
1828
1829 PR gold/13359
1830 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1831 unnecessary assertion.
1832 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1833
1834 2011-10-31 Sriraman Tallam <tmsriram@google.com>
1835
1836 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1837 gc_mark_symbol.
1838 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1839 gc_mark_symbol.
1840 Change to just keep the section associated with symbol.
1841 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1842 they are externally visible and --export-dynamic is turned on.
1843 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1844
1845 2011-10-19 Ian Lance Taylor <iant@google.com>
1846
1847 PR gold/13163
1848 * script-sections.cc
1849 (Output_section_element_dot_assignment::needs_output_section): New
1850 function.
1851
1852 2011-10-19 Ian Lance Taylor <iant@google.com>
1853
1854 PR gold/13204
1855 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1856 --section-start option was seen.
1857 * options.h (General_options::any_section_start): New function.
1858
1859 2011-10-18 David S. Miller <davem@davemloft.net>
1860
1861 PR binutils/13301
1862 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1863 member to track relocation locations that have moved during TLS
1864 reloc optimizations.
1865 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1866 (Target_sparc::Relocate::relocate): Adjust view down by 4
1867 bytes if it matches reloc_adjust_addr_.
1868 (Target_sparc::Relocate::relocate_tls): Always move the
1869 __tls_get_addr call delay slot instruction forward 4 bytes when
1870 performing relaxation.
1871
1872 2011-10-18 Cary Coutant <ccoutant@google.com>
1873
1874 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1875 (Output_file::map_no_anonymous): Check for non-zero
1876 return code from posix_fallocate.
1877
1878 2011-10-17 Cary Coutant <ccoutant@google.com>
1879
1880 PR gold/13245
1881 * plugin.cc (is_visible_from_outside): Check for symbols
1882 referenced from dynamic objects.
1883 * resolve.cc (Symbol_table::resolve): Don't count references
1884 from dynamic objects as references from real ELF files.
1885 * testsuite/plugin_test_2.sh: Adjust expected result.
1886
1887 2011-10-17 Cary Coutant <ccoutant@google.com>
1888
1889 * gold.cc: Include timer.h.
1890 (queue_middle_tasks): Stamp time.
1891 (queue_final_tasks): Likewise.
1892 * main.cc (main): Store timer in parameters. Print timers
1893 for each pass.
1894 * parameters.cc (Parameters::Parameters): Initialize timer_.
1895 (Parameters::set_timer): New function.
1896 (set_parameters_timer): New function.
1897 * parameters.h (Parameters::set_timer): New function.
1898 (Parameters::timer): New function.
1899 (Parameters::timer_): New data member.
1900 (set_parameters_timer): New function.
1901 * timer.cc (Timer::stamp): New function.
1902 (Timer::get_pass_time): New function.
1903 * timer.h (Timer::stamp): New function.
1904 (Timer::get_pass_time): New function.
1905 (Timer::pass_times_): New data member.
1906
1907 2011-10-17 Cary Coutant <ccoutant@google.com>
1908
1909 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1910 task for members of lib groups.
1911
1912 2011-10-17 Cary Coutant <ccoutant@google.com>
1913
1914 PR gold/13288
1915 * fileread.cc (File_read::find_view): Add assert.
1916 (File_read::make_view): Move bounds check (replace with assert)...
1917 (File_read::find_or_make_view): ... to here.
1918
1919 2011-10-12 Cary Coutant <ccoutant@google.com>
1920
1921 * output.cc (Output_file::open_base_file): Handle case where
1922 ::read returns less than requested size.
1923
1924 2011-10-10 Cary Coutant <ccoutant@google.com>
1925
1926 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1927 Initialize defined_count_.
1928 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1929 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1930 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1931 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1932 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1933 * incremental.h (Sized_relobj_incr::defined_count_): New data
1934 member.
1935 (Sized_incr_dynobj::defined_count_): New data member.
1936 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1937 Return zeroes instead of internal error.
1938
1939 2011-10-10 Cary Coutant <ccoutant@google.com>
1940
1941 PR gold/13249
1942 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1943 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1944 * output.h (class Output_reloc): Add use_plt_offset flag.
1945 (Output_reloc::type_): Adjust size of bit field.
1946 (Output_reloc::use_plt_offset_): New bit field.
1947 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1948 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1949 flag. Adjust all callers.
1950 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1951 creating RELATIVE relocations.
1952
1953 2011-10-10 Nick Clifton <nickc@redhat.com>
1954
1955 * po/es.po: Updated Spanish translation.
1956 * po/fi.po: Updated Finnish translation.
1957
1958 2011-10-03 Diego Novillo <dnovillo@google.com>
1959
1960 * options.cc (parse_uint): Fix dereference of RETVAL.
1961
1962 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1963
1964 * layout.h (section_order_map_): New member.
1965 (get_section_order_map): New member function.
1966 * output.cc (Output_section::add_input_section): Check for patterns
1967 only when --section-ordering-file is specified.
1968 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1969 output_sections have been formed.
1970 * layout.cc (Layout_Layout): Initialize section_order_map_.
1971 * plugin.cc (update_section_order): Store order in order_map. Do not
1972 update the order.
1973 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1974 * testsuite/Makefile.in: Regenerate.
1975 * testsuite/plugin_section_order.c: New file.
1976 * testsuite/plugin_final_layout.cc: New file.
1977 * testsuite/plugin_final_layout.sh: New file.
1978
1979 2011-09-29 Cary Coutant <ccoutant@google.com>
1980
1981 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1982 Check for NULL.
1983 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1984 symbols during incremental update.
1985 (Symbol_table::add_from_dynobj): Likewise.
1986
1987 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1988 Ian Lance Taylor <iant@google.com>
1989
1990 * symtab.cc (Symbol_table::define_special_symbol): Always
1991 canonicalize version string.
1992
1993 2011-09-26 Cary Coutant <ccoutant@google.com>
1994
1995 * gold.cc (queue_initial_tasks): Move option checks ...
1996 * options.cc (General_options::finalize): ... to here. Disable
1997 some options; make others fatal.
1998
1999 2011-09-26 Cary Coutant <ccoutant@google.com>
2000
2001 gcc PR lto/47247
2002 * plugin.cc (get_symbols_v2): New function.
2003 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2004 (is_referenced_from_outside): New function.
2005 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2006 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2007 (get_symbols): Pass version parameter.
2008 (get_symbols_v2): New function.
2009 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2010 parameter.
2011 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2012 (onload): Add LDPT_GET_SYMBOLS_V2.
2013 (all_symbols_read_hook): Use get_symbols_v2; check for
2014 LDPR_PREVAILING_DEF_IRONLY_EXP.
2015 * testsuite/plugin_test_3.sh: Update expected results.
2016
2017 2011-09-23 Simon Baldwin <simonb@google.com>
2018
2019 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2020 configuration options.
2021 * configure: Regenerate.
2022 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2023 * Makefile.in: Regenerate.
2024 * testsuite/Makefile.in: Regenerate.
2025
2026 2011-09-19 Sriraman Tallam <tmsriram@google.com>
2027
2028 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2029
2030 2011-09-19 Cary Coutant <ccoutant@google.com>
2031
2032 * incremental.cc (can_incremental_update): Fix typo in comment.
2033 * incremental.h (can_incremental_update): Likewise.
2034
2035 2011-09-18 Cary Coutant <ccoutant@google.com>
2036
2037 * incremental.cc (can_incremental_update): New function.
2038 * incremental.h (can_incremental_update): New function.
2039 * layout.cc (Layout::init_fixed_output_section): Call it.
2040 (Layout::make_output_section): Don't allow patch space in .eh_frame.
2041 * object.cc (Sized_relobj_file::do_layout): Call
2042 can_incremental_update.
2043
2044 2011-09-13 Cary Coutant <ccoutant@google.com>
2045
2046 * configure.ac: Check for glibc support for gnu_indirect_function
2047 support with static linking, setting automake conditional
2048 IFUNC_STATIC.
2049 * Makefile.in: Regenerate.
2050 * configure: Regenerate.
2051
2052 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2053 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2054 for IFUNC_STATIC.
2055 * testsuite/Makefile.in: Regenerate.
2056
2057 2011-09-13 Cary Coutant <ccoutant@google.com>
2058
2059 * incremental.cc (Sized_relobj_incr::do_layout): Call
2060 report_comdat_group for kept comdat sections.
2061 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2062 * testsuite/Makefile.in: Regenerate.
2063 * testsuite/incr_comdat_test_1.cc: New source file.
2064 * testsuite/incr_comdat_test_2_v1.cc: New source file.
2065 * testsuite/incr_comdat_test_2_v2.cc: New source file.
2066 * testsuite/incr_comdat_test_2_v3.cc: New source file.
2067
2068 2011-09-13 Ian Lance Taylor <iant@google.com>
2069
2070 * object.cc (Sized_relobj_file::do_layout): Remove unused local
2071 variable external_symbols_offset.
2072
2073 2011-09-12 Ian Lance Taylor <iant@google.com>
2074
2075 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2076 triggered if object has no symbols.
2077
2078 2011-09-09 David S. Miller <davem@davemloft.net>
2079
2080 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2081 (Output_fill_debug_line::do_write): Likewise.
2082
2083 2011-08-29 Cary Coutant <ccoutant@google.com>
2084
2085 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2086 casts to match formatting specs.
2087 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2088
2089 2011-08-26 Cary Coutant <ccoutant@google.com>
2090
2091 * layout.cc (Free_list::allocate): Provide guarantee of minimum
2092 remaining hole size when allocating.
2093 (Layout::make_output_section): Set fill methods for debug sections.
2094 * layout.h (Free_list::Free_list_node): Move from private to
2095 public.
2096 (Free_list::set_min_hole_size): New function.
2097 (Free_list::begin, Free_list::end): New functions.
2098 (Free_list::min_hole_): New data member.
2099 * output.cc: Include dwarf.h.
2100 (Output_fill_debug_info::do_minimum_hole_size): New function.
2101 (Output_fill_debug_info::do_write): New function.
2102 (Output_fill_debug_line::do_minimum_hole_size): New function.
2103 (Output_fill_debug_line::do_write): New function.
2104 (Output_section::Output_section): Initialize new data member.
2105 (Output_section::set_final_data_size): Ensure patch space is larger
2106 than minimum hole size.
2107 (Output_section::do_write): Fill holes in debug sections.
2108 * output.h (Output_fill): New class.
2109 (Output_fill_debug_info): New class.
2110 (Output_fill_debug_line): New class.
2111 (Output_section::set_free_space_fill): New function.
2112 (Output_section::free_space_fill_): New data member.
2113 * testsuite/Makefile.am (incremental_test_3): Add
2114 --incremental-patch option.
2115 (incremental_test_4): Likewise.
2116 (incremental_test_5): Likewise.
2117 (incremental_test_6): Likewise.
2118 (incremental_copy_test): Likewise.
2119 (incremental_common_test_1): Likewise.
2120 * testsuite/Makefile.in: Regenerate.
2121
2122 2011-08-26 Nick Clifton <nickc@redhat.com>
2123
2124 * po/es.po: Updated Spanish translation.
2125
2126 2011-08-01 Cary Coutant <ccoutant@google.com>
2127
2128 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2129 * gold/testsuite/Makefile.in: Regenerate.
2130 * gold/testsuite/justsyms_exec.c: New source file.
2131 * gold/testsuite/justsyms_lib.c: New source file.
2132
2133 2011-08-01 Cary Coutant <ccoutant@google.com>
2134
2135 * layout.cc (Layout::set_segment_offsets): Don't realign text
2136 segment if -Ttext was specified.
2137 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2138 file type.
2139 * object.h (Sized_relobj_file::e_type): New function.
2140 (Sized_relobj_file::e_type_): New data member.
2141 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2142 base address for ET_EXEC files.
2143 * target.cc (Target::do_make_elf_object_implementation): Allow
2144 ET_EXEC files with --just-symbols option.
2145
2146 2011-07-28 Cary Coutant <ccoutant@google.com>
2147
2148 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2149 Add thread_number parameter.
2150 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2151 * workqueue-threads.cc
2152 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2153 current thread if its thread number is greater than desired thread
2154 count.
2155 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2156 Add thread_number parameter.
2157 (Workqueue::should_cancel_thread): Likewise.
2158 (Workqueue::find_runnable_or_wait): Pass thread_number to
2159 should_cancel_thread.
2160 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2161 parameter.
2162
2163 2011-07-22 Sriraman Tallam <tmsriram@google.com>
2164
2165 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2166 only after checking if it cannot be forced local.
2167 * symtab.h (is_externally_visible): Check if the symbol is not forced
2168 local.
2169
2170 2011-07-15 Ian Lance Taylor <iant@google.com>
2171
2172 * options.h (class General_options): Add --print-output-format.
2173 Move -EL next to -EB, for better --help output.
2174 * target-select.cc: Include <cstdio>, "options.h", and
2175 "parameters.h".
2176 (Target_selector::do_target_bfd_name): New function.
2177 (print_output_format): New function.
2178 * target-select.h (class Target_selector): Update declarations.
2179 (Target_selector::target_bfd_name): New function.
2180 (print_output_format): Declare.
2181 * main.cc: Include "target-select.h".
2182 (main): Handle --print-output-format.
2183 * gold.cc: Include "target-select.h".
2184 (queue_initial_tasks): Handle --print-output-format when there are
2185 no input files.
2186 * parameters.cc (parameters_force_valid_target): Give a better
2187 error message if -EB/-EL does not match target.
2188 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2189 function.
2190
2191 2011-07-15 Ian Lance Taylor <iant@google.com>
2192
2193 * i386.cc (class Output_data_plt_i386): Add layout_ field.
2194 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2195 (Output_data_plt_i386::do_write): Write address of .dynamic
2196 section to first entry in .got.plt section.
2197 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2198 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2199 Initialize layout_.
2200 (Output_data_plt_x86_64::do_write): Write address of .dynamic
2201 section to first entry in .got.plt section.
2202 * layout.h (Layout::dynamic_section): New function.
2203
2204 2011-07-13 Sriraman Tallam <tmsriram@google.com>
2205
2206 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2207 to claim_file call.
2208 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2209 input_section_position_, and input_section_glob_.
2210 (read_layout_from_file): Call function section_ordering_specified.
2211 * layout.h (is_section_ordering_specified): New function.
2212 (section_ordering_specified): New function.
2213 (section_ordering_specified_): New boolean member.
2214 * main.cc(main): Call load_plugins after layout object is defined.
2215 * output.cc (Output_section::add_input_section): Use
2216 function section_ordering_specified to check if section ordering is
2217 needed.
2218 * output.cc (Output_section::add_relaxed_input_section): Use
2219 function section_ordering_specified to check if section ordering is
2220 needed.
2221 (Output_section::update_section_layout): New function.
2222 (Output_section::sort_attached_input_sections): Check if input section
2223 must be reordered.
2224 * output.h (Output_section::update_section_layout): New function.
2225 * plugin.cc (get_section_count): New function.
2226 (get_section_type): New function.
2227 (get_section_name): New function.
2228 (get_section_contents): New function.
2229 (update_section_order): New function.
2230 (allow_section_ordering): New function.
2231 (Plugin::load): Add the new interfaces to the transfer vector.
2232 (Plugin_manager::load_plugins): New parameter.
2233 (Plugin_manager::all_symbols_read): New parameter.
2234 (Plugin_manager::claim_file): New parameter. Save the elf object for
2235 unclaimed objects.
2236 (Plugin_manager::get_elf_object): New function.
2237 (Plugin_manager::get_view): Change to directly use the bool to check
2238 if get_view is called from claim_file_hook.
2239 * plugin.h (input_objects): New function
2240 (Plugin__manager::load_plugins): New parameter.
2241 (Plugin_manager::claim_file): New parameter.
2242 (Plugin_manager::get_elf_object): New function.
2243 (Plugin_manager::in_claim_file_handler): New function.
2244 (Plugin_manager::in_claim_file_handler_): New member.
2245 (layout): New function.
2246 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2247 handler with an extra parameter. Make the elf object before calling
2248 claim_file handler.
2249 * testsuite/plugin_test.c (get_section_count): New function pointer.
2250 (get_section_type): New function pointer.
2251 (get_section_name): New function pointer.
2252 (get_section_contents): New function pointer.
2253 (update_section_order): New function pointer.
2254 (allow_section_ordering): New function pointer.
2255 (onload): Check if the new interfaces exist.
2256
2257 2011-07-13 Ian Lance Taylor <iant@google.com>
2258
2259 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2260 relro section.
2261 * x86_64.cc (Target_x86_64::got_section): Likewise.
2262 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2263 (relro_now_test_SOURCES): New variable.
2264 (relro_now_test_DEPENDENCIES): New variable.
2265 (relro_now_test_LDFLAGS): New variable.
2266 (relro_now_test_LDADD): New variable.
2267 (relro_now_test.so): New target.
2268 * testsuite/Makefile.in: Rebuild.
2269
2270 2011-07-12 Ian Lance Taylor <iant@google.com>
2271
2272 PR gold/12980
2273 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2274 GLOB_DAT relocation rather than a RELATIVE relocation for a
2275 protected symbol when creating a shared library.
2276 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2277 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2278 * testsuite/protected_main_1.cc (main): Test that protected
2279 function has same address.
2280
2281 2011-07-11 Ian Lance Taylor <iant@google.com>
2282
2283 PR gold/12979
2284 * options.h (class General_options): Add -Bgroup.
2285 * options.cc (General_options::finalize): If -Bgroup is set,
2286 default to --unresolved-symbols=report-all.
2287 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2288 * target-reloc.h (issue_undefined_symbol_error): Handle
2289 --unresolved-symbols=report-all.
2290
2291 2011-07-08 Ian Lance Taylor <iant@google.com>
2292
2293 PR gold/11985
2294 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2295 if linker script discards key sections.
2296 (Layout::create_dynamic_symtab): Likewise.
2297 (Layout::assign_local_dynsym_offsets): Likewise.
2298 (Layout::sized_create_version_sections): Likewise.
2299 (Layout::create_interp): Likewise.
2300 (Layout::finish_dynamic_section): Likewise.
2301 (Layout::set_dynamic_symbol_size): Likewise.
2302
2303 2011-07-08 Ian Lance Taylor <iant@google.com>
2304
2305 PR gold/12386
2306 * options.h (class General_options): Add --unresolved-symbols.
2307 * target-reloc.h (issue_undefined_symbol_error): Check
2308 --unresolved-symbols. Add comments.
2309
2310 2011-07-08 Ian Lance Taylor <iant@google.com>
2311
2312 * testsuite/odr_violation2.cc (Ordering::operator()): Make
2313 expression more complex.
2314
2315 2011-07-08 Ian Lance Taylor <iant@google.com>
2316
2317 PR gold/11317
2318 * target-reloc.h (issue_undefined_symbol_error): New inline
2319 function, broken out of relocate_section.
2320 (relocate_section): Call issue_undefined_symbol_error.
2321 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2322 there is no TLS segment if we are about to issue an undefined
2323 symbol error.
2324 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2325
2326 2011-07-08 Ian Lance Taylor <iant@google.com>
2327
2328 PR gold/12279
2329 * resolve.cc (Symbol_table::should_override): Add fromtype
2330 parameter. Change all callers. Give error when linking together
2331 TLS and non-TLS symbol.
2332 (Symbol_table::should_override_with_special): Add fromtype
2333 parameter. Change all callers.
2334 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2335 there is no TLS segment if we have reported some errors.
2336 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2337
2338 2011-07-08 Ian Lance Taylor <iant@google.com>
2339
2340 PR gold/12372
2341 * target.h (Target::plt_address_for_global): New function.
2342 (Target::plt_address_for_local): New function.
2343 (Target::plt_section_for_global): Remove.
2344 (Target::plt_section_for_local): Remove.
2345 (Target::do_plt_address_for_global): New virtual function.
2346 (Target::do_plt_address_for_local): New virtual function.
2347 (Target::do_plt_section_for_global): Remove.
2348 (Target::do_plt_section_for_local): Remove.
2349 (Target::register_global_plt_entry): Add Symbol_table and Layout
2350 parameters.
2351 * output.cc (Output_data_got::Got_entry::write): Use
2352 plt_address_for_global and plt_address_for_local.
2353 * layout.cc (Layout::add_target_dynamic_tags): Use size and
2354 address of output section.
2355 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2356 got_irelative_, and irelative_count_ fields. Update
2357 declarations.
2358 (Output_data_plt_i386::has_irelative_section): New function.
2359 (Output_data_plt_i386::entry_count): Add irelative_count_.
2360 (Output_data_plt_i386::set_final_data_size): Likewise.
2361 (class Target_i386): Add got_irelative_ and rel_irelative_
2362 fields. Update declarations.
2363 (Target_i386::Target_i386): Initialize new fields.
2364 (Target_i386::do_plt_address_for_global): New function replacing
2365 do_plt_section_for_global.
2366 (Target_i386::do_plt_address_for_local): New function replacing
2367 do_plt_section_for_local.
2368 (Target_i386::got_section): Create got_irelative_.
2369 (Target_i386::rel_irelative_section): New function.
2370 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2371 fields. Don't define __rel_iplt_{start,end}.
2372 (Output_data_plt_i386::add_entry): Add symtab and layout
2373 parameters. Change all callers. Use different PLT and GOT for
2374 IFUNC symbols.
2375 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2376 layout parameters. Change all callers. Use different PLT and
2377 GOT.
2378 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2379 (Output_data_plt_i386::rel_irelative): New function.
2380 (Output_data_plt_i386::address_for_global): New function.
2381 (Output_data_plt_i386::address_for_local): New function.
2382 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
2383 IRELATIVE GOT when changing IFUNC GOT entries.
2384 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2385 reloc.
2386 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2387 if we didn't create an IRELATIVE GOT.
2388 (Target_i386::Relocate::relocate): Use plt_address_for_global and
2389 plt_address_for_local.
2390 (Target_i386::do_dynsym_value): Use plt_address_for_global.
2391 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2392 got_irelative_, and irelative_count_ fields. Update
2393 declarations.
2394 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2395 Initialize new fields. Remove symtab parameter. Change all
2396 callers.
2397 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2398 irelative_count_.
2399 (Output_data_plt_x86_64::has_irelative_section): New function.
2400 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2401 (class Target_x86_64): Add got_irelative_ and rel_irelative_
2402 fields. Update declarations.
2403 (Target_x86_64::Target_x86_64): Initialize new fields.
2404 (Target_x86_64::do_plt_address_for_global): New function replacing
2405 do_plt_section_for_global.
2406 (Target_x86_64::do_plt_address_for_local): New function replacing
2407 do_plt_section_for_local.
2408 (Target_x86_64::got_section): Create got_irelative_.
2409 (Target_x86_64::rela_irelative_section): New function.
2410 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
2411 all callers. Don't create __rel_iplt_{start,end}.
2412 (Output_data_plt_x86_64::add_entry): Add symtab and layout
2413 parameters. Change all callers. Use different PLT and GOT for
2414 IFUNC symbols.
2415 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2416 layout parameters. Change all callers. Use different PLT and
2417 GOT.
2418 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2419 parameters. Change all callers. Use different PLT and GOT for
2420 IFUNC symbols.
2421 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2422 (Output_data_plt_x86_64::rela_irelative): New function.
2423 (Output_data_plt_x86_64::address_for_global): New function.
2424 (Output_data_plt_x86_64::address_for_local): New function.
2425 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2426 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2427 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2428 (Target_x86_64::register_global_plt_entry): Add symtab and layout
2429 parameters.
2430 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2431 reloc.
2432 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2433 symbols if we didn't create an IRELATIVE GOT.
2434 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2435 plt_address_for_local.
2436 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2437 * testsuite/ifuncvar1.c: New test file.
2438 * testsuite/ifuncvar2.c: New test file.
2439 * testsuite/ifuncvar3.c: New test file.
2440 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2441 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2442 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2443 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2444 * testsuite/Makefile.in: Rebuild.
2445
2446 2011-07-07 Cary Coutant <ccoutant@google.com>
2447
2448 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2449 (two_file_test_1_ndebug.o): Likewise.
2450 (two_file_test_1b_ndebug.o): Likewise.
2451 (two_file_test_2_ndebug.o): Likewise.
2452 (two_file_test_main_ndebug.o): Likewise.
2453 (incremental_test_2): Link with no-debug versions.
2454
2455 2011-07-06 Cary Coutant <ccoutant@google.com>
2456
2457 * gold/incremental.cc
2458 (Output_section_incremental_inputs::write_info_blocks): Check for
2459 hidden and internal symbols.
2460
2461 2011-07-06 Cary Coutant <ccoutant@google.com>
2462
2463 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2464 Check disposition for startup file.
2465 (Incremental_inputs::report_command_line): Ignore
2466 --incremental-startup-unchanged option.
2467 * options.cc (General_options::parse_incremental_startup_unchanged):
2468 New function.
2469 (General_options::General_options): Initialize new data member.
2470 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2471 (General_options): Add --incremental-startup-unchanged option.
2472 (General_options::incremental_startup_disposition): New function.
2473 (General_options::incremental_startup_disposition_): New data member.
2474
2475 2011-07-06 Cary Coutant <ccoutant@google.com>
2476
2477 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2478 input file index to Script_info ctor.
2479 (Sized_incremental_binary::do_file_has_changed): Find the
2480 command-line argument for files named in scripts.
2481 * incremental.h (Script_info::Script_info): New ctor
2482 with input file index.
2483 (Script_info::input_file_index): New function.
2484 (Script_info::input_file_index_): New data member.
2485 (Incremental_binary::get_library): Add const.
2486 (Incremental_binary::get_script_info): Add const.
2487 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2488 * testsuite/Makefile.am (incremental_test_5): New test case.
2489 (incremental_test_6): New test case.
2490 * testsuite/Makefile.in: Regenerate.
2491
2492 2011-07-06 Cary Coutant <ccoutant@google.com>
2493
2494 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2495 debug output when command lines differ.
2496
2497 2011-07-06 Cary Coutant <ccoutant@google.com>
2498
2499 * incremental.cc (Incremental_inputs::report_command_line): Ignore
2500 --incremental-patch option.
2501 * layout.cc (Free_list::allocate): Extend allocation beyond original
2502 end if enabled.
2503 (Layout::make_output_section): Mark sections that should get
2504 patch space.
2505 * options.cc (parse_percent): New function.
2506 * options.h (parse_percent): New function.
2507 (DEFINE_percent): New macro.
2508 (General_options): Add --incremental-patch option.
2509 * output.cc (Output_section::Output_section): Initialize new data
2510 members.
2511 (Output_section::add_input_section): Print section name when out
2512 of patch space.
2513 (Output_section::add_output_section_data): Likewise.
2514 (Output_section::set_final_data_size): Add patch space when
2515 doing --incremental-full.
2516 (Output_section::do_reset_address_and_file_offset): Remove patch
2517 space.
2518 (Output_segment::set_section_list_addresses): Print debug output
2519 only if --incremental-update.
2520 * output.h (Output_section::set_is_patch_space_allowed): New function.
2521 (Output_section::is_patch_space_allowed_): New data member.
2522 (Output_section::patch_space_): New data member.
2523 * parameters.cc (Parameters::incremental_full): New function.
2524 * parameters.h (Parameters::incremental_full): New function
2525 * testsuite/Makefile.am (incremental_test_2): Add test for
2526 --incremental-patch option.
2527 * testsuite/Makefile.in: Regenerate.
2528 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2529 (t18): Remove function body.
2530
2531 2011-07-05 Doug Kwan <dougkwan@google.com>
2532
2533 PR gold/12771
2534 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2535 Arm_Address type for relocation result.
2536 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
2537 overflow check.
2538 (Arm_relocate_functions::abs32): Use unaligned access.
2539 (Arm_relocate_functions::rel32): Ditto.
2540 (Arm_relocate_functions::prel31): Ditto.
2541 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2542 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2543 static data relocations.
2544 * testsuite/Makefile.in: Regnerate.
2545 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2546
2547 2011-07-05 Ian Lance Taylor <iant@google.com>
2548
2549 PR gold/12392
2550 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2551 symbols if necessary.
2552 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2553
2554 2011-07-05 Ian Lance Taylor <iant@google.com>
2555
2556 PR gold/12952
2557 * resolve.cc (Symbol::override_base_with_special): Simply override
2558 version with special symbol version, ignoring previous version.
2559
2560 2011-07-05 Ian Lance Taylor <iant@google.com>
2561
2562 * object.cc (Sized_relobj_file::include_section_group): Add
2563 information to comment about signature location.
2564
2565 2011-07-02 Ian Lance Taylor <iant@google.com>
2566
2567 PR gold/12957
2568 * options.h (class General_options): Add -f and -F.
2569 * options.cc (General_options::finalize): Fatal error if -f/-F
2570 are used without -shared.
2571 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2572
2573 2011-07-02 Ian Lance Taylor <iant@google.com>
2574
2575 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2576
2577 2011-07-01 Ian Lance Taylor <iant@google.com>
2578
2579 PR gold/12525
2580 PR gold/12952
2581 * resolve.cc (Symbol::override_base_with_special): Don't override
2582 the version if the overriding symbol has a different name.
2583 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2584 all callers. If we give an error about an undefined version,
2585 define the base version if necessary.
2586 * dynobj.h (class Versions): Update declaration.
2587 * testsuite/weak_alias_test_5.cc: New file.
2588 * testsuite/weak_alias_test.script: New file.
2589 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2590 and versioned_alias have the right value, and call t2.
2591 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2592 weak_alias_test_5.so.
2593 (weak_alias_test_LDADD): Likewise.
2594 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2595 * testsuite/Makefile.in: Rebuild.
2596
2597 2011-07-01 Ian Lance Taylor <iant@google.com>
2598
2599 PR gold/12525
2600 * options.h (class General_options): Support -z notext.
2601 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2602 -Wl,-z,notext.
2603 (two_file_shared_nonpic.so): Likewise.
2604 (two_file_shared_mixed.so): Likewise.
2605 (two_file_shared_mixed_1.so): Likewise.
2606 (weak_undef_lib_nonpic.so): Likewise.
2607 (alt/weak_undef_lib_nonpic.so): Likewise.
2608 (tls_test_shared_nonpic.so): Likewise.
2609 * testsuite/Makefile.in: Rebuild.
2610
2611 2011-07-01 Ian Lance Taylor <iant@google.com>
2612
2613 PR gold/12525
2614 * configure.ac: Test whether static linking works, setting
2615 the automake conditional HAVE_STATIC.
2616 * testsuite/Makefile.am: Disable tests using -static if
2617 HAVE_STATIC is not true.
2618 * configure, testsuite/Makefile.in: Rebuild.
2619
2620 2011-07-01 Ian Lance Taylor <iant@google.com>
2621
2622 PR gold/12525
2623 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2624 Assert if we see DW_EH_PE_indirect.
2625 * target.h (Target::ehframe_datarel_base): New function.
2626 (Target::do_ehframe_datarel_base): New target function.
2627 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2628 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2629 function.
2630
2631 2011-07-01 Ian Lance Taylor <iant@google.com>
2632
2633 PR gold/12571
2634 * options.h (class General_options): Add
2635 --ld-generated-unwind-info.
2636 * ehframe.cc (Fde::write): Add address parameter. Change all
2637 callers. If associated with PLT, fill in address and size.
2638 (Cie::set_output_offset): Only add merge mapping if there is an
2639 object.
2640 (Cie::write): Add address parameter. Change all callers.
2641 (Eh_frame::add_ehframe_for_plt): New function.
2642 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2643 input_offset_ fields into union u_, with new plt field.
2644 (Fde::Fde): Adjust for new union field.
2645 (Fde::Fde) [Output_data version]: New constructor.
2646 (Fde::add_mapping): Only add merge mapping if there is an object.
2647 (class Cie): Update declarations.
2648 (class Eh_frame): Declare add_ehframe_for_plt.
2649 * layout.cc (Layout::layout_eh_frame): Break out code into
2650 make_eh_frame_section, and call it.
2651 (Layout::make_eh_frame_section): New function.
2652 (Layout::add_eh_frame_for_plt): New function.
2653 * layout.h (class Layout): Update declarations.
2654 * merge.cc (Merge_map::add_mapping): Add assertion.
2655 * i386.cc: Include "dwarf.h".
2656 (class Output_data_plt_i386): Make first_plt_entry,
2657 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2658 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2659 and plt_eh_frame_fde.
2660 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2661 boundary. Call add_eh_frame_for_plt if appropriate.
2662 * x86_64.cc: Include "dwarf.h".
2663 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2664 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2665 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2666 and plt_eh_frame_fde.
2667 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2668 appropriate.
2669
2670 2011-06-29 Ian Lance Taylor <iant@google.com>
2671
2672 PR gold/12629
2673 * object.cc (Sized_relobj_file::layout_section): Change shdr
2674 parameter to be const.
2675 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2676 out of do_layout.
2677 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2678 appropriate. Call layout_eh_frame_section.
2679 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2680 sections.
2681 * object.h (class Sized_relobj_file): Update declarations.
2682
2683 2011-06-29 Ian Lance Taylor <iant@google.com>
2684
2685 PR gold/12652
2686 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2687 modifier.
2688 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2689
2690 2011-06-29 Ian Lance Taylor <iant@google.com>
2691
2692 PR gold/12675
2693 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2694 SHT_X86_64_UNWIND.
2695 * layout.cc (Layout::layout_eh_frame): Likewise.
2696
2697 2011-06-29 Ian Lance Taylor <iant@google.com>
2698
2699 PR gold/12695
2700 * layout.cc (Layout::symtab_section_shndx): New function.
2701 * layout.h (class Layout): Declare symtab_section_shndx.
2702 * output.cc (Output_section::write_header): Call it.
2703
2704 2011-06-29 Ian Lance Taylor <iant@google.com>
2705
2706 PR gold/12818
2707 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2708 symbols which are not used in a relocation.
2709
2710 2011-06-28 Ian Lance Taylor <iant@google.com>
2711
2712 PR gold/12898
2713 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2714 script create indistinguishable segments.
2715 (Layout::set_segment_offsets): Use stable_sort when sorting
2716 segments. Pass this to Compare_segments constructor.
2717 * layout.h (class Layout): Make segment_precedes non-static.
2718 (class Compare_segments): Change from struct to class. Add
2719 layout_ field. Add constructor.
2720 * script-sections.cc
2721 (Script_sections::attach_sections_using_phdrs_clause): Rename
2722 local orphan to is_orphan. Don't report failure to put empty
2723 section in segment. On attachment failure, report name of
2724 section, and attach to first PT_LOAD segment.
2725
2726 2011-06-28 Ian Lance Taylor <iant@google.com>
2727
2728 PR gold/12934
2729 * target-select.cc (Target_selector::Target_selector): Add
2730 emulation parameter. Change all callers.
2731 (select_target_by_bfd_name): Rename from select_target_by_name.
2732 Change all callers.
2733 (select_target_by_emulation): New function.
2734 (supported_emulation_names): New function.
2735 * target-select.h (class Target_selector): Add emulation_ field.
2736 Update declarations.
2737 (Target_selector::recognize_by_bfd_name): Rename from
2738 recognize_by_name. Change all callers.
2739 (Target_selector::supported_bfd_names): Rename from
2740 supported_names. Change all callers.
2741 (Target_selector::recognize_by_emulation): New function.
2742 (Target_selector::supported_emulations): New function.
2743 (Target_selector::emulation): New function.
2744 (Target_selector::do_recognize_by_bfd_name): Rename from
2745 do_recognize_by_name. Change all callers.
2746 (Target_selector::do_supported_bfd_names): Rename from
2747 do_supported_names. Change all callers.
2748 (Target_selector::do_recognize_by_emulation): New function.
2749 (Target_selector::do_supported_emulations): New function.
2750 (select_target_by_bfd_name): Change name in declaration.
2751 (select_target_by_emulation): Declare.
2752 (supported_emulation_names): Declare.
2753 * parameters.cc (parameters_force_valid_target): Try to find
2754 target based on emulation from -m option.
2755 * options.h (class General_options): Change doc string for -m.
2756 * options.cc (help): Print emulations.
2757 (General_options::parse_V): Likewise.
2758 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2759 Add emulation parameter. Change all callers.
2760
2761 2011-06-28 Ian Lance Taylor <iant@google.com>
2762
2763 * target.h (class Target): Add osabi_ field.
2764 (Target::osabi): New function.
2765 (Target::set_osabi): New function.
2766 (Target::Target): Initialize osabi_.
2767 (Target::do_adjust_elf_header): Make pure virtual.
2768 (Sized_target::do_adjust_elf_header): Declare.
2769 * target.cc (Sized_target::do_adjust_elf_header): New function.
2770 (class Sized_target): Instantiate all versions.
2771 * freebsd.h (class Target_freebsd): Remove.
2772 (Target_selector_freebsd::do_recognize): Call set_osabi on
2773 Target.
2774 (Target_selector_freebsd::do_recognize_by_name): Likewise.
2775 (Target_selector_freebsd::set_osabi): Remove.
2776 * i386.cc (class Target_i386): Inherit from Sized_target rather
2777 than Target_freebsd.
2778 * x86_64.cc (class Target_x86_64): Likewise.
2779
2780 2011-06-28 Ian Lance Taylor <iant@google.com>
2781
2782 * target.h (Target::can_check_for_function_pointers): Rewrite.
2783 Make non-virtual.
2784 (Target::can_icf_inline_merge_sections): Likewise.
2785 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2786 (Target::Target_info): Add can_icf_inline_merge_sections field.
2787 (Target::do_can_check_for_function_pointers): New virtual
2788 function.
2789 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2790 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2791 from can_check_for_function_pointers, move in file.
2792 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2793 section_may_have_icf_unsafe_poineters, move in file.
2794 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2795 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2796 Rename from can_check_for_function_pointers, move in file.
2797 (Target_i386::can_icf_inline_merge_sections): Remove.
2798 (Target_i386::i386_info): Initialize
2799 can_icf_inline_merge_sections.
2800 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2801 Initialize can_icf_inline_merge_sections.
2802 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2803 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2804 Rename from can_check_for_function_pointers, move in file.
2805 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2806 (Target_x86_64::x86_64_info): Initialize
2807 can_icf_inline_merge_sections.
2808 * testsuite/testfile.cc (Target_test::test_target_info):
2809 Likewise.
2810 * icf.cc (get_section_contents): Correct formatting.
2811
2812 2011-06-27 Ian Lance Taylor <iant@google.com>
2813
2814 * symtab.cc (Symbol::versioned_name): New function.
2815 (Symbol_table::add_to_final_symtab): Use versioned_name when
2816 appropriate.
2817 (Symbol_table::sized_write_symbol): Likewise.
2818 * symtab.h (class Symbol): Declare versioned_name.
2819 * stringpool.h (class Stringpool_template): Add variant of add
2820 which takes a std::basic_string.
2821 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2822 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2823 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2824 (ver_test_12.o): New target.
2825 * testsuite/Makefile.in: Rebuild.
2826
2827 2011-06-27 Doug Kwan <dougkwan@google.com>
2828
2829 * arm.cc (Arm_relocate_functions::thm_jump8,
2830 Arm_relocate_functions::thm_jump11): Use a wider signed
2831 type to compute offset.
2832 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2833 arm_thm_jump8.
2834 * testsuite/Makefile.in: Regenerate.
2835 * testsuite/arm_branch_in_range.sh: Check test results of
2836 arm_thm_jump11 and arm_thm_jump8.
2837 * testsuite/arm_thm_jump11.s: New test source file.
2838 * testsuite/arm_thm_jump11.t: New linker script.
2839 * testsuite/arm_thm_jump8.s: New test source file.
2840 * testsuite/arm_thm_jump8.t: New linker script.
2841
2842 2011-06-24 Ian Lance Taylor <iant@google.com>
2843
2844 * layout.cc: Include "object.h".
2845 (ctors_sections_in_init_array): New static variable.
2846 (Layout::is_ctors_in_init_array): New function.
2847 (Layout::layout): Add entry to ctors_sections_in_init_array if
2848 appropriate.
2849 * layout.h (class Layout): Declare is_ctors_in_init_array.
2850 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2851 is_ctors_reverse_view is set.
2852 (Sized_relobj_file::write_sections): Add layout parameter. Change
2853 all callers. Set is_ctors_reverse_view field of View_size.
2854 (Sized_relobj_file::reverse_words): New function.
2855 * object.h (Sized_relobj_file::View_size): Add
2856 is_ctors_reverse_view field.
2857 (class Sized_relobj_file): Update declarations.
2858 * testsuite/initpri3.c: New test.
2859 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2860 initpri3b.
2861 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2862 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2863 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2864 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2865 * testsuite/Makefile.in: Rebuild.
2866
2867 2011-06-24 Cary Coutant <ccoutant@google.com>
2868
2869 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2870 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2871 (debug_msg_cdebug.err): New targets.
2872 * testsuite/Makefile.in: Regenerate.
2873 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2874 Fix checks for link with shared library.
2875
2876 2011-06-24 Doug Kwan <dougkwan@google.com>
2877
2878 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2879 skip empty text sections.
2880 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2881
2882 2011-06-22 Ian Lance Taylor <iant@google.com>
2883
2884 PR gold/12910
2885 * options.h (class General_options): Add --ctors-in-init-array.
2886 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2887 friends as SHT_PROGBITS for merging sections.
2888 (Layout::layout): Remove special handling of .init_array and
2889 friends. Don't sort if doing relocatable link. Sort for .ctors
2890 and .dtors if ctors_in_init_array.
2891 (Layout::make_output_section): Force correct section types for
2892 .init_array and friends. Don't sort if doing relocatable link,
2893 Don't sort .ctors and .dtors if ctors_in_init_array.
2894 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2895 (Layout::output_section_name): Add relobj parameter. Change all
2896 callers. Handle .ctors. and .dtors. in code rather than table.
2897 Handle .ctors and .dtors if ctors_in_init_array.
2898 (Layout::match_file_name): New function, moved from output.cc.
2899 * layout.h (class Layout): Update declarations.
2900 * output.cc: Include "layout.h".
2901 (Input_section_sort_entry::get_priority): New function.
2902 (Input_section_sort_entry::match_file_name): Just call
2903 Layout::match_file_name.
2904 (Output_section::Input_section_sort_init_fini_compare::operator()):
2905 Handle .ctors and .dtors. Sort by explicit priority rather than
2906 by name.
2907 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2908 * testsuite/initpri2.c: New test.
2909 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2910 (check_PROGRAMS): Add initpri2.
2911 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2912 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2913 * configure, testsuite/Makefile.in: Rebuild.
2914
2915 2011-06-19 Ian Lance Taylor <iant@google.com>
2916
2917 PR gold/12880
2918 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2919 .interp section to a PT_INTERP segment even if we have seen a
2920 --dynamic-linker option. Don't do it if we have seen a PHDRS
2921 clause in a linker script.
2922 (Layout::finalize): Don't create a .interp section if we've
2923 already create a PT_INTERP segment.
2924 (Layout::create_interp): Always call choose_output_section (revert
2925 patch of 2011-06-17). Don't create PT_INTERP segment.
2926 * script-sections.cc
2927 (Script_sections::create_note_and_tls_segments): Add a .interp
2928 section to a PT_INTERP segment even if we have seen a
2929 --dynamic-linker option.
2930
2931 2011-06-18 Ian Lance Taylor <iant@google.com>
2932
2933 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2934 merely because a non-PT_LOAD segment has a dynamic reloc.
2935
2936 2011-06-18 Ian Lance Taylor <iant@google.com>
2937
2938 * layout.cc (Layout::finish_dynamic_section): Don't create
2939 DT_FLAGS entry if not needed.
2940
2941 2011-06-18 Ian Lance Taylor <iant@google.com>
2942
2943 PR gold/12745
2944 * layout.cc (Layout::layout_eh_frame): Correct handling of
2945 writable .eh_frame section.
2946
2947 2011-06-17 Ian Lance Taylor <iant@google.com>
2948
2949 PR gold/12893
2950 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2951 symbol is redefined with the exact same object and value.
2952
2953 2011-06-17 Ian Lance Taylor <iant@google.com>
2954
2955 PR gold/12880
2956 * layout.h (class Layout): Add interp_segment_ field.
2957 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2958 (Layout::attach_allocated_section_to_segment): If making shared
2959 library, put .interp section in PT_INTERP segment.
2960 (Layout::finalize): Also call create_interp if -dynamic-linker
2961 option was used.
2962 (Layout::create_interp): Assert that there is no PT_INTERP
2963 segment. If not using a SECTIONS clause, use make_output_section.
2964 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2965 * script-sections.cc
2966 (Script_sections::create_note_and_tls_segments): If making shared
2967 library, put .interp section in PT_INTERP segment.
2968
2969 2011-06-17 Ian Lance Taylor <iant@google.com>
2970
2971 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2972 when making a shared library.
2973
2974 2011-06-17 Ian Lance Taylor <iant@google.com>
2975
2976 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2977 parameter. Change all callers. Don't issue warning about PC32
2978 against locally defined symbol.
2979
2980 2011-06-16 Ian Lance Taylor <iant@google.com>
2981
2982 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2983 occurs in same object.
2984
2985 2011-06-14 Alan Modra <amodra@gmail.com>
2986
2987 * po/POTFILES.in: Regenerate.
2988
2989 2011-06-09 Ian Lance Taylor <iant@google.com>
2990
2991 * script-sections.cc
2992 (Orphan_output_section::set_section_addresses): For a relocatable
2993 link set address to 0.
2994
2995 2011-06-09 Cary Coutant <ccoutant@google.com>
2996
2997 PR gold/12804
2998 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2999 used with --compress-debug-sections.
3000 * gold/object.cc (Sized_relobj_file::do_layout): Report
3001 uncompressed size of compressed input sections.
3002
3003 2011-06-08 Cary Coutant <ccoutant@google.com>
3004
3005 PR gold/12804
3006 * testsuite/two_file_test_2_v1.cc: Change initialization of
3007 v2 to keep it in .data.
3008
3009 2011-06-07 Cary Coutant <ccoutant@google.com>
3010
3011 * common.cc (Symbol_table::do_allocate_commons_list): Call
3012 gold_fallback.
3013 * errors.cc (Errors::fatal): Adjust call to gold_exit.
3014 (Errors::fallback): New function.
3015 (gold_fallback): New function.
3016 * errors.h (Errors::fallback): New function.
3017 * gold.cc (gold_exit): Change status parameter to enum; adjust
3018 all callers.
3019 (queue_initial_tasks): Call gold_fallback.
3020 * gold.h: Include cstdlib.
3021 (Exit_status): New enum type.
3022 (gold_exit): Change status parameter to enum.
3023 (gold_fallback): New function.
3024 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3025 (Layout::create_symtab_sections): Likewise.
3026 (Layout::create_shdrs): Likewise.
3027 * main.cc (main): Adjust call to gold_exit.
3028 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3029 (Output_data_got::add_got_entry_pair): Likewise.
3030 (Output_section::add_input_section): Likewise.
3031 (Output_section::add_output_section_data): Likewise.
3032 (Output_segment::set_section_list_addresses): Likewise.
3033 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3034
3035 2011-06-07 Cary Coutant <ccoutant@google.com>
3036
3037 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3038 for incremental links.
3039 * output.cc (Output_segment::set_section_list_addresses): Remove
3040 FIXME and test for TLS or BSS.
3041
3042 2011-06-07 Cary Coutant <ccoutant@google.com>
3043
3044 * testsuite/Makefile.am: Add incremental_copy_test,
3045 incremental_common_test_1.
3046 * testsuite/Makefile.in: Regenerate.
3047 * testsuite/common_test_1_v1.c: New source file.
3048 * testsuite/common_test_1_v2.c: New source file.
3049 * testsuite/copy_test_v1.cc: New source file.
3050
3051 2011-06-07 Cary Coutant <ccoutant@google.com>
3052
3053 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3054 update, allocate common from bss section's free list.
3055 * incremental-dump.cc (dump_incremental_inputs): Print flag for
3056 linker-defined symbols.
3057 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3058 Skip GOT and PLT entries that are no longer referenced.
3059 (Output_section_incremental_inputs::write_info_blocks): Mark
3060 linker-defined symbols.
3061 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3062 * output.cc (Output_section::allocate): New function.
3063 * output.h (Output_section::allocate): New function.
3064 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3065 linker-defined symbols.
3066 (Symbol::override_base_with_special): Copy is_predefined_ flag.
3067 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3068 (Symbol::init_base_output_data): Likewise.
3069 (Symbol::init_base_output_segment): Likewise.
3070 (Symbol::init_base_constant): Likewise.
3071 (Sized_symbol::init_output_data): Likewise.
3072 (Sized_symbol::init_output_segment): Likewise.
3073 (Sized_symbol::init_constant): Likewise.
3074 (Symbol_table::do_define_in_output_data): Likewise.
3075 (Symbol_table::do_define_in_output_segment): Likewise.
3076 (Symbol_table::do_define_as_constant): Likewise.
3077 * symtab.h (Symbol::is_predefined): New function.
3078 (Symbol::init_base_output_data): Add is_predefined parameter.
3079 (Symbol::init_base_output_segment): Likewise.
3080 (Symbol::init_base_constant): Likewise.
3081 (Symbol::is_predefined_): New data member.
3082 (Sized_symbol::init_output_data): Add is_predefined parameter.
3083 (Sized_symbol::init_output_segment): Likewise.
3084 (Sized_symbol::init_constant): Likewise.
3085 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3086
3087 2011-06-07 Cary Coutant <ccoutant@google.com>
3088
3089 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3090 instead of emit_copy_reloc.
3091 (Copy_relocs::emit_copy_reloc): Refactor.
3092 (Copy_relocs::make_copy_reloc): New function.
3093 (Copy_relocs::add_copy_reloc): Remove.
3094 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3095 section.
3096 (Copy_relocs::make_copy_reloc): New function.
3097 (Copy_relocs::add_copy_reloc): Remove.
3098 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3099 unchanged input files.
3100 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3101 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3102 Reserve BSS space for COPY relocations.
3103 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3104 (Output_section_incremental_inputs::write_info_blocks): Record
3105 whether a symbol is copied from a shared object.
3106 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3107 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3108 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3109 (Incremental_input_entry_reader::get_output_symbol_index): Add
3110 is_copy parameter.
3111 (Incremental_binary::emit_copy_relocs): New function.
3112 (Incremental_binary::do_emit_copy_relocs): New function.
3113 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3114 new data member.
3115 (Sized_incremental_binary::add_copy_reloc): New function.
3116 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3117 (Sized_incremental_binary::Copy_reloc): New struct.
3118 (Sized_incremental_binary::Copy_relocs): New typedef.
3119 (Sized_incremental_binary::copy_relocs_): New data member.
3120 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3121 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3122 * target.h (Sized_target::emit_copy_reloc): New function.
3123 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3124
3125 2011-06-02 Cary Coutant <ccoutant@google.com>
3126
3127 PR gold/12163
3128 * gold/archive.cc (Archive::Archive): Initialize new data member.
3129 (Archive::include_all_members): Return if archive has already been
3130 included.
3131 * gold/archive.h (Archive::include_all_members_): New data member.
3132
3133 2011-06-02 Nick Clifton <nickc@redhat.com>
3134
3135 * dynobj.h: Fix spelling mistake in comment.
3136 * output.cc: Likewise.
3137
3138 2011-05-31 Doug Kwan <dougkwan@google.com>
3139 Asier Llano
3140
3141 PR gold/12826
3142 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3143 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3144 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
3145 redundant arm_exidx_test.so.
3146 * testsuite/Makefile.in: Regenerate.
3147 (check_SCRIPTS): Add pr12826.sh
3148 (check_DATA): Add pr12826.stdout
3149 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3150 * testsuite/pr12826.sh: New file.
3151 * testsuite/pr12826_1.s: Ditto.
3152 * testsuite/pr12826_1.s: Ditto.
3153
3154 2011-05-30 Ian Lance Taylor <iant@google.com>
3155
3156 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3157 sections.
3158
3159 2011-05-29 Ian Lance Taylor <iant@google.com>
3160
3161 PR gold/12804
3162 * testsuite/Makefile.am: Use different file name for two_file_test
3163 temporary file for each incremental test.
3164 * testsuite/Makefile.in: Rebuild.
3165
3166 2011-05-29 Ian Lance Taylor <iant@google.com>
3167
3168 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3169 binary input file is empty.
3170
3171 2011-05-27 Ian Lance Taylor <iant@google.com>
3172
3173 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3174 (ver_test_9.so): Likewise.
3175 * testsuite/Makefile.in: Rebuild.
3176
3177 2011-05-26 Cary Coutant <ccoutant@google.com>
3178
3179 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3180 * incremental.cc (Incremental_inputs::report_input_section): Fix
3181 comment, indentation.
3182 (Incremental_inputs::report_comdat_group): New function.
3183 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3184 of data for incremental input file entry.
3185 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3186 group count, COMDAT group signatures.
3187 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3188 an unchanged input file.
3189 * incremental.h (Incremental_object_entry::Incremental_object_entry):
3190 Initialize new data member.
3191 (Incremental_object_entry::add_comdat_group): New function.
3192 (Incremental_object_entry::get_comdat_group_count): New function.
3193 (Incremental_object_entry::get_comdat_signature_key): New function.
3194 (Incremental_object_entry::groups_): New data member.
3195 (Incremental_inputs::report_comdat_group): New function.
3196 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3197 data for incremental input file entry.
3198 (Incremental_input_entry_reader::get_comdat_group_count): New function.
3199 (Incremental_input_entry_reader::get_input_section): Adjust size of
3200 data for incremental input file entry.
3201 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3202 (Incremental_input_entry_reader::get_comdat_group_signature): New
3203 function.
3204 * object.cc (Sized_relobj::include_section_group): Report kept
3205 COMDAT groups for incremental links.
3206
3207 2011-05-24 David Meyer <pdox@google.com>
3208
3209 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3210 with name parameter. Add found_name parameter.
3211 * fileread.cc (Input_file::find_file): Adjust code accordingly.
3212 * dirsearch.h (class Dirsearch): Update declaration.
3213
3214 2011-05-24 Ian Lance Taylor <iant@google.com>
3215
3216 * archive.cc (Library_base::should_include_member): Pull in object
3217 from archive if it defines the entry symbol.
3218 * parameters.cc (Parameters::entry): New function.
3219 * parameters.h (class Parameters): Declare entry.
3220 * output.h (class Output_file_header): Remove entry_ field.
3221 * output.cc (Output_file_header::Output_file_header): Remove entry
3222 parameter. Change all callers.
3223 (Output_file_header::entry): Use parameters->entry.
3224 * gold.cc (queue_middle_tasks): Likewise.
3225 * plugin.cc (Plugin_hook::run): Likewise.
3226
3227 2011-05-24 Cary Coutant <ccoutant@google.com>
3228
3229 * gold.cc (queue_initial_tasks): Pass incremental base filename
3230 to Output_file::open_base_file; don't print error message.
3231 * incremental-dump.cc (main): Adjust call to
3232 Output_file::open_for_modification.
3233 * incremental-dump.cc (main): Likewise.
3234 * incremental.cc (Incremental_inputs::report_command_line):
3235 Ignore --incremental-base option when comparing command lines.
3236 Ignore parameter when given as separate argument.
3237 * options.h (class General_options): Add --incremental-base.
3238 * output.cc (Output_file::Output_file):
3239 (Output_file::open_base_file): Add base_name and writable parameters;
3240 read base file into new file; print error message here.
3241 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3242 callers.
3243 * output.h (Output_file::open_for_modification): Rename to...
3244 (Output_file::open_base_file): ...this; add base_name and
3245 writable parameters; adjust all callers.
3246 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3247 callers.
3248 * testsuite/Makefile.am (incremental_test_4): Test
3249 --incremental-base.
3250 * testsuite/Makefile.in: Regenerate.
3251
3252 2011-05-24 Cary Coutant <ccoutant@google.com>
3253
3254 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3255 incremental_test_4.
3256 * testsuite/Makefile.in: Regenerate.
3257 * testsuite/two_file_test_1_v1.cc: New test source file.
3258 * testsuite/two_file_test_1b_v1.cc: New test source file.
3259 * testsuite/two_file_test_2_v1.cc: New test source file.
3260
3261 2011-05-24 Cary Coutant <ccoutant@google.com>
3262
3263 * dynobj.h (Dynobj::do_dynobj): New function.
3264 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3265 flag and soname for shared objects.
3266 * incremental.cc (Incremental_inputs::report_object): Make
3267 either Incremental_object_entry or Incremental_dynobj_entry; add
3268 soname to string table.
3269 (Incremental_inputs::report_input_section): Add assertion.
3270 (Output_section_incremental_inputs::set_final_data_size): Adjust
3271 type of input file entry for shared libraries; adjust size of
3272 shared library info entry.
3273 (Output_section_incremental_inputs::write_input_files): Write
3274 as_needed flag for shared libraries.
3275 (Output_section_incremental_inputs::write_info_blocks): Adjust type
3276 of input file entry for shared libraries; write soname.
3277 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3278 soname from incremental info.
3279 * incremental.h (enum Incremental_input_flags): Add
3280 INCREMENTAL_INPUT_AS_NEEDED.
3281 (Incremental_input_entry::Incremental_input_entry): Initialize new
3282 data member.
3283 (Incremental_input_entry::set_as_needed): New function.
3284 (Incremental_input_entry::as_needed): New function.
3285 (Incremental_input_entry::do_dynobj_entry): New function.
3286 (Incremental_input_entry::as_needed_): New data member.
3287 (Incremental_object_entry::Incremental_object_entry): Don't check
3288 for shared library.
3289 (Incremental_object_entry::do_type): Likewise.
3290 (class Incremental_dynobj_entry): New class.
3291 (Incremental_input_entry_reader::as_needed): New function.
3292 (Incremental_input_entry_reader::get_soname): New function.
3293 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3294 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3295 size of shared library info entry.
3296 * layout.cc (Layout::finish_dynamic_section): Don't test for
3297 incremental link when adding DT_NEEDED entries.
3298 * object.h (Object::Object): Initialize new data member.
3299 (Object::dynobj): New function.
3300 (Object::set_as_needed): New function.
3301 (Object::as_needed): New function.
3302 (Object::do_dynobj): New function.
3303 (Object::as_needed_): New data member.
3304
3305 2011-05-24 Cary Coutant <ccoutant@google.com>
3306
3307 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3308 info; adjust display of GOT entries.
3309 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3310 vector of input objects; remove file_status_.
3311 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3312 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3313 got_plt reader; call target hooks to reserve GOT entries.
3314 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3315 of input file info header and GOT info entry.
3316 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3317 relocation info.
3318 (Got_plt_view_info::got_descriptor): Remove.
3319 (Got_plt_view_info::sym_index): New data member.
3320 (Got_plt_view_info::input_index): New data member.
3321 (Local_got_offset_visitor::visit): Write input file index.
3322 (Global_got_offset_visitor::visit): Write 0 for input file index.
3323 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3324 with sym_index and input_index.
3325 (Output_section_incremental_inputs::write_got_plt): Adjust size of
3326 incremental info GOT entry; replace got_descriptor with input_index.
3327 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3328 map from input file index to object.
3329 (Sized_relobj_incr::do_layout): Replace direct data member reference
3330 with accessor function.
3331 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3332 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3333 Adjust size of input file info header.
3334 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3335 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3336 (Incremental_input_entry_reader::get_input_section): Adjust size of
3337 input file info header.
3338 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3339 of incremental info GOT entry.
3340 (Incremental_got_plt_reader::get_got_desc): Remove.
3341 (Incremental_got_plt_reader::get_got_symndx): New function.
3342 (Incremental_got_plt_reader::get_got_input_index): New function.
3343 (Sized_incremental_binary::Sized_incremental_binary): Remove
3344 file_status_; add input_objects_.
3345 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3346 (Sized_incremental_binary::set_file_is_unchanged): Remove.
3347 (Sized_incremental_binary::file_is_unchanged): Remove.
3348 (Sized_incremental_binary::set_input_object): New function.
3349 (Sized_incremental_binary::input_object): New function.
3350 (Sized_incremental_binary::file_status_): Remove.
3351 (Sized_incremental_binary::input_objects_): New data member.
3352 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3353 references.
3354 (Sized_relobj_incr::invalid_address): Move to base class.
3355 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3356 class.
3357 (Sized_relobj_incr::do_output_section_offset): Likewise.
3358 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3359 (Sized_relobj_incr::section_offsets_): Likewise.
3360 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3361 function.
3362 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3363 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3364 with accessor function.
3365 (Sized_relobj_file::do_layout): Likewise.
3366 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3367 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3368 (Sized_relobj_file::compute_final_local_value): Replace refs to
3369 section_offsets_ with accessor function.
3370 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3371 * object.h (Relobj::Relobj): Initialize new data members.
3372 (Relobj::add_dyn_reloc): New function.
3373 (Relobj::first_dyn_reloc): New function.
3374 (Relobj::dyn_reloc_count): New function.
3375 (Relobj::first_dyn_reloc_): New data member.
3376 (Relobj::dyn_reloc_count_): New data member.
3377 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3378 references.
3379 (Sized_relobj::Address): New typedef.
3380 (Sized_relobj::invalid_address): Move here from child class.
3381 (Sized_relobj::Sized_relobj): Initialize new data members.
3382 (Sized_relobj::sized_relobj): New function.
3383 (Sized_relobj::is_output_section_offset_invalid): Move here from
3384 child class.
3385 (Sized_relobj::get_output_section_offset): Likewise.
3386 (Sized_relobj::local_has_got_offset): Likewise.
3387 (Sized_relobj::local_got_offset): Likewise.
3388 (Sized_relobj::set_local_got_offset): Likewise.
3389 (Sized_relobj::do_for_all_local_got_entries): Likewise.
3390 (Sized_relobj::clear_got_offsets): New function.
3391 (Sized_relobj::section_offsets): Move here from child class.
3392 (Sized_relobj::do_output_section_offset): Likewise.
3393 (Sized_relobj::do_set_section_offset): Likewise.
3394 (Sized_relobj::Local_got_offsets): Likewise.
3395 (Sized_relobj::local_got_offsets_): Likewise.
3396 (Sized_relobj::section_offsets_): Likewise.
3397 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3398 references.
3399 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3400 class.
3401 (Sized_relobj_file::sized_relobj): New function
3402 (Sized_relobj_file::local_has_got_offset): Move to base class.
3403 (Sized_relobj_file::local_got_offset): Likewise.
3404 (Sized_relobj_file::set_local_got_offset): Likewise.
3405 (Sized_relobj_file::get_output_section_offset): Likewise.
3406 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3407 (Sized_relobj_file::do_output_section_offset): Likewise.
3408 (Sized_relobj_file::do_set_section_offset): Likewise.
3409 (Sized_relobj_file::Local_got_offsets): Likewise.
3410 (Sized_relobj_file::local_got_offsets_): Likewise.
3411 (Sized_relobj_file::section_offsets_): Likewise.
3412 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3413 (all constructors).
3414 (set_needs_dynsym_index): Convert relobj to derived class pointer.
3415 (Output_reloc::get_symbol_index): Likewise.
3416 (Output_reloc::local_section_offset): Likewise.
3417 (Output_reloc::get_address): Likewise.
3418 (Output_reloc::symbol_value): Likewise.
3419 (Output_data_got::reserve_slot): Move to class definition.
3420 (Output_data_got::reserve_local): New function.
3421 (Output_data_got::reserve_slot_for_global): Remove.
3422 (Output_data_got::reserve_global): New function.
3423 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3424 (all constructors, two instantiations).
3425 (Output_reloc::get_relobj): New function (two instantiations).
3426 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3427 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3428 (Output_data_reloc::add_global): Adjust type of relobj.
3429 (Output_data_reloc::add_global_relative): Likewise.
3430 (Output_data_reloc::add_symbolless_global_addend): Likewise.
3431 (Output_data_reloc::add_local): Likewise.
3432 (Output_data_reloc::add_local_relative): Likewise.
3433 (Output_data_reloc::add_symbolless_local_addend): Likewise.
3434 (Output_data_reloc::add_local_section): Likewise.
3435 (Output_data_reloc::add_output_section): Likewise.
3436 (Output_data_reloc::add_absolute): Likewise.
3437 (Output_data_reloc::add_target_specific): Likewise.
3438 (Output_data_got::reserve_slot): Move definition here.
3439 (Output_data_got::reserve_local): New function.
3440 (Output_data_got::reserve_global): New function.
3441 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3442 section_offsets_ with accessor function.
3443 (Sized_relobj_file::write_sections): Likewise.
3444 (Sized_relobj_file::do_relocate_sections): Likewise.
3445 * target.h (Sized_target::reserve_local_got_entry): New function.
3446 (Sized_target::reserve_global_got_entry): New function.
3447 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3448 (Target_x86_64::reserve_global_got_entry): New function.
3449 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3450
3451 2011-05-23 Cary Coutant <ccoutant@google.com>
3452
3453 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3454 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3455 bit when checking got_type.
3456 * incremental.cc (Sized_incremental_binary::setup_readers):
3457 Store symbol table and string table locations; initialize bit vector
3458 of file status flags.
3459 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3460 unchanged files.
3461 (Sized_incremental_binary::do_process_got_plt): New function.
3462 (Sized_incremental_binary::get_symtab_view): Use stored locations.
3463 (Output_section_incremental_inputs::set_final_data_size): Record
3464 file index for each input file.
3465 (Output_section_incremental_inputs::write_got_plt): Store file index
3466 instead of input entry offset for each GOT entry.
3467 * incremental.h
3468 (Incremental_input_entry::Incremental_input_entry): Initialize new
3469 data member.
3470 (Incremental_input_entry::set_offset): Store file index.
3471 (Incremental_input_entry::get_file_index): New function.
3472 (Incremental_input_entry::file_index_): New data member.
3473 (Incremental_binary::process_got_plt): New function.
3474 (Incremental_binary::do_process_got_plt): New function.
3475 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3476 data members.
3477 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3478 (Sized_incremental_binary::set_file_is_unchanged): New function.
3479 (Sized_incremental_binary::file_is_unchanged): New function.
3480 (Sized_incremental_binary::do_process_got_plt): New function.
3481 (Sized_incremental_binary::file_status_): New data member.
3482 (Sized_incremental_binary::main_symtab_loc_): New data member.
3483 (Sized_incremental_binary::main_strtab_loc_): New data member.
3484 * output.cc (Output_data_got::Got_entry::write): Add case
3485 RESERVED_CODE.
3486 (Output_data_got::add_global): Call add_got_entry.
3487 (Output_data_got::add_global_plt): Likewise.
3488 (Output_data_got::add_global_with_rel): Likewise.
3489 (Output_data_got::add_global_with_rela): Likewise.
3490 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3491 (Output_data_got::add_global_pair_with_rela): Likewise.
3492 (Output_data_got::add_local): Call add_got_entry.
3493 (Output_data_got::add_local_plt): Likewise.
3494 (Output_data_got::add_local_with_rel): Likewise.
3495 (Output_data_got::add_local_with_rela): Likewise.
3496 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3497 (Output_data_got::add_local_pair_with_rela): Likewise.
3498 (Output_data_got::reserve_slot): New function.
3499 (Output_data_got::reserve_slot_for_global): New function.
3500 (Output_data_got::add_got_entry): New function.
3501 (Output_data_got::add_got_entry_pair): New function.
3502 (Output_section::add_output_section_data): Edit FIXME.
3503 * output.h
3504 (Output_section_data_build::Output_section_data_build): New
3505 constructor with size parameter.
3506 (Output_data_space::Output_data_space): Likewise.
3507 (Output_data_got::Output_data_got): Initialize new data member; new
3508 constructor with size parameter.
3509 (Output_data_got::add_constant): Call add_got_entry.
3510 (Output_data_got::reserve_slot): New function.
3511 (Output_data_got::reserve_slot_for_global): New function.
3512 (class Output_data_got::Got_entry): Add RESERVED_CODE.
3513 (Output_data_got::add_got_entry): New function.
3514 (Output_data_got::add_got_entry_pair): New function.
3515 (Output_data_got::free_list_): New data member.
3516 * target.h (Sized_target::init_got_plt_for_update): New function.
3517 (Sized_target::register_global_plt_entry): New function.
3518 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3519 Initialize new data member; call init; add constructor with PLT count.
3520 (Output_data_plt_x86_64::init): New function.
3521 (Output_data_plt_x86_64::add_relocation): New function.
3522 (Output_data_plt_x86_64::reserve_slot): New function.
3523 (Output_data_plt_x86_64::free_list_): New data member.
3524 (Target_x86_64::init_got_plt_for_update): New function.
3525 (Target_x86_64::register_global_plt_entry): New function.
3526 (Output_data_plt_x86_64::add_entry): Allocate from free list for
3527 incremental updates.
3528 (Output_data_plt_x86_64::add_relocation): New function.
3529 * testsuite/object_unittest.cc (Object_test): Set default options.
3530
3531 2011-05-16 Ian Lance Taylor <iant@google.com>
3532
3533 * options.h (class General_options): Make -i a synonym for -r.
3534
3535 2011-05-16 Ian Lance Taylor <iant@google.com>
3536
3537 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3538
3539 2011-05-10 Cary Coutant <ccoutant@google.com>
3540
3541 * object.cc (Sized_relobj::do_count_local_symbols): Check for
3542 strip_all (-s).
3543
3544 2011-05-06 Ian Lance Taylor <iant@google.com>
3545
3546 * layout.cc (Layout::layout): If the output section flags change,
3547 update the ordering.
3548
3549 2011-04-25 Cary Coutant <ccoutant@google.com>
3550
3551 * incremental-dump.cc (dump_incremental_inputs): Print local
3552 symbol info for each input file.
3553 * incremental.cc
3554 (Output_section_incremental_inputs::set_final_data_size): Add local
3555 symbol info to input file entries in incremental info.
3556 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3557 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3558 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3559 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3560 implementation.
3561 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3562 (Sized_incr_relobj::do_relocate): Write the local symbols.
3563 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3564 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3565 Adjust size of input file header.
3566 (Incremental_inputs_reader::get_local_symbol_offset): New function.
3567 (Incremental_inputs_reader::get_local_symbol_count): New function.
3568 (Incremental_inputs_reader::get_input_section): Adjust size of input
3569 file header.
3570 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3571 (Sized_incr_relobj::This): New typedef.
3572 (Sized_incr_relobj::sym_size): New const data member.
3573 (Sized_incr_relobj::Local_symbol): New struct.
3574 (Sized_incr_relobj::do_output_local_symbol_count): New function.
3575 (Sized_incr_relobj::do_local_symbol_offset): New function.
3576 (Sized_incr_relobj::local_symbol_count_): New data member.
3577 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3578 (Sized_incr_relobj::local_symbol_index_): New data member.
3579 (Sized_incr_relobj::local_symbol_offset_): New data member.
3580 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3581 (Sized_incr_relobj::local_symbols_): New data member.
3582 * object.h (Relobj::output_local_symbol_count): New function.
3583 (Relobj::local_symbol_offset): New function.
3584 (Relobj::do_output_local_symbol_count): New function.
3585 (Relobj::do_local_symbol_offset): New function.
3586 (Sized_relobj::do_output_local_symbol_count): New function.
3587 (Sized_relobj::do_local_symbol_offset): New function.
3588
3589 2011-04-22 Vladimir Simonov <sv@sw.ru>
3590
3591 * descriptors.cc (set_close_on_exec): New function.
3592 (Descriptors::open): Use set_close_on_exec.
3593 * output.cc (S_ISLNK): Define if not defined.
3594
3595 2011-04-22 Cary Coutant <ccoutant@google.com>
3596
3597 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3598 global symbol map.
3599 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3600 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3601 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3602 relocations.
3603 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3604 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3605 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3606 * incremental.h
3607 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3608 function.
3609 (Incremental_binary::apply_incremental_relocs): New function.
3610 (Incremental_binary::do_apply_incremental_relocs): New function.
3611 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3612 data member.
3613 (Sized_incremental_binary::add_global_symbol): New function.
3614 (Sized_incremental_binary::global_symbol): New function.
3615 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3616 (Sized_incremental_binary::symbol_map_): New data member.
3617 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3618 * target.h (Sized_target::apply_relocation): New function.
3619 * target-reloc.h (apply_relocation): New function.
3620 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3621
3622 2011-04-22 Doug Kwan <dougkwan@google.com>
3623
3624 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3625 flag of a SHT_ARM_EXIDX section.
3626 * testsuite/Makefile.am (arm_exidx_test): New test rules.
3627 * testsuite/Makefile.in: Regenerate.
3628 * testsuite/arm_exidx_test.s: New file.
3629 * testsuite/arm_exidx_test.sh: Same.
3630
3631 2011-04-20 Cary Coutant <ccoutant@google.com>
3632
3633 PR gold/12689
3634 * archive.h (Incremental_archive_entry::Archive_member):
3635 Initialize arg_serial_ (second constructor).
3636
3637 2011-04-17 Ian Lance Taylor <iant@google.com>
3638
3639 * object.cc (Relocate_info::location): Simplify location string.
3640 * errors.cc (Errors::error_at_location): Don't print program
3641 name.
3642 (Errors::warning_at_location): Likewise.
3643 (Errors::undefined_symbol): Likewise.
3644 * testsuite/debug_msg.sh: Update accordingly.
3645
3646 2011-04-14 Cary Coutant <ccoutant@google.com>
3647
3648 * gold/layout.cc (Layout::symtab_section_offset): New function.
3649 * gold/layout.h (Layout::symtab_section_offset): New function.
3650 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3651
3652 2011-04-12 Ian Lance Taylor <iant@google.com>
3653
3654 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3655 with MREMAP_MAYMOVE.
3656 * output.h (class Output_file): Add map_is_allocated_ field.
3657 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3658 not available, provide stubs. If mremap is not available, #define
3659 it to gold_mremap.
3660 (MREMAP_MAYMOVE): Define if not defined.
3661 (Output_file::Output_file): Initialize map_is_allocated_.
3662 (Output_file::resize): Check map_is_allocated_.
3663 (Output_file::map_anonymous): If mmap fails, use malloc.
3664 (Output_file::unmap): Don't do anything for an anonymous map.
3665 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3666 is not available, provide stubs.
3667 (File_read::View::~View): Use free rather than delete[].
3668 (File_read::make_view): Use malloc rather than new[]. If mmap
3669 fails, use malloc.
3670 (File_read::find_or_make_view): Use malloc rather than new[].
3671 * gold.h: Remove HAVE_REMAP code.
3672 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3673 exists. Rename mremap to gold_mremap. If mmap is not available
3674 don't do anything.
3675 * configure, config.in: Rebuild.
3676
3677 2011-04-11 Ian Lance Taylor <iant@google.com>
3678
3679 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3680 initialize local variable v.
3681
3682 2011-04-11 Cary Coutant <ccoutant@google.com>
3683
3684 * archive.cc (Archive::include_member): Adjust call to
3685 report_object.
3686 (Add_archive_symbols::run): Track argument serial numbers.
3687 (Lib_group::include_member): Likewise.
3688 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3689 * archive.h (Incremental_archive_entry::Archive_member):
3690 Initialize arg_serial_.
3691 (Archive_member::arg_serial_): New data member.
3692 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3693 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3694 incremental link.
3695 (Sized_dynobj::do_for_all_local_got_entries): New function.
3696 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3697 function.
3698 * fileread.cc (get_mtime): New function.
3699 * fileread.h (get_mtime): New function.
3700 * gold.cc (queue_initial_tasks): Check for incremental update.
3701 (process_incremental_input): New function.
3702 (queue_middle_tasks): Don't force valid target for incremental
3703 update.
3704 * incremental-dump.cc (find_input_containing_global): Adjust
3705 size of symbol info entry.
3706 (dump_incremental_inputs): Dump argument serial number and
3707 in_system_directory flag; bias shndx by 1; print symbol names
3708 when dumping per-file symbol lists; use new symbol info readers.
3709 * incremental.cc
3710 (Output_section_incremental_inputs:update_data_size): New function.
3711 (Sized_incremental_binary::setup_readers): Setup input readers
3712 for each input file; build maps for files added from libraries
3713 and scripts.
3714 (Sized_incremental_binary::check_input_args): New function.
3715 (Sized_incremental_binary::do_check_inputs): Build map of argument
3716 serial numbers to input arguments.
3717 (Sized_incremental_binary::do_file_has_changed): Rename
3718 do_file_is_unchanged to this; compare file modification times.
3719 (Sized_incremental_binary::do_init_layout): New function.
3720 (Sized_incremental_binary::do_reserve_layout): New function.
3721 (Sized_incremental_binary::do_get_input_reader): Remove.
3722 (Sized_incremental_binary::get_symtab_view): New function.
3723 (Incremental_checker::can_incrementally_link_output_file): Remove.
3724 (Incremental_inputs::report_command_line): Exclude --debug options.
3725 (Incremental_inputs::report_archive_begin): Add parameter; track
3726 argument serial numbers; don't put input file entry for archive
3727 before archive members.
3728 (Incremental_inputs::report_archive_end): Put input file entry
3729 for archive after archive members.
3730 (Incremental_inputs::report_object): Add parameter; track argument
3731 serial numbers and in_system_directory flag.
3732 (Incremental_inputs::report_script): Add parameter; track argument
3733 serial numbers.
3734 (Output_section_incremental_inputs::set_final_data_size): Adjust
3735 size of symbol info entry; check for forwarding symbols.
3736 (Output_section_incremental_inputs::write_input_files): Write
3737 in_system_directory flag and argument serial number.
3738 (Output_section_incremental_inputs::write_info_blocks): Map section
3739 indices between incremental info and original input file; store
3740 input section index for each symbol.
3741 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3742 change operator() to visit().
3743 (class Global_got_offset_visitor): Likewise.
3744 (class Global_symbol_visitor_got_plt):
3745 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3746 classes.
3747 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3748 (Sized_incr_relobj::do_read_symbols): New function.
3749 (Sized_incr_relobj::do_layout): New function.
3750 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3751 (Sized_incr_relobj::do_add_symbols): New function.
3752 (Sized_incr_relobj::do_should_include_member): New function.
3753 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3754 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3755 (Sized_incr_relobj::do_section_size): New function.
3756 (Sized_incr_relobj::do_section_name): New function.
3757 (Sized_incr_relobj::do_section_contents): New function.
3758 (Sized_incr_relobj::do_section_flags): New function.
3759 (Sized_incr_relobj::do_section_entsize): New function.
3760 (Sized_incr_relobj::do_section_address): New function.
3761 (Sized_incr_relobj::do_section_type): New function.
3762 (Sized_incr_relobj::do_section_link): New function.
3763 (Sized_incr_relobj::do_section_info): New function.
3764 (Sized_incr_relobj::do_section_addralign): New function.
3765 (Sized_incr_relobj::do_initialize_xindex): New function.
3766 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3767 (Sized_incr_relobj::do_read_relocs): New function.
3768 (Sized_incr_relobj::do_gc_process_relocs): New function.
3769 (Sized_incr_relobj::do_scan_relocs): New function.
3770 (Sized_incr_relobj::do_count_local_symbols): New function.
3771 (Sized_incr_relobj::do_finalize_local_symbols): New function.
3772 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3773 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3774 (Sized_incr_relobj::do_relocate): New function.
3775 (Sized_incr_relobj::do_set_section_offset): New function.
3776 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3777 (Sized_incr_dynobj::do_read_symbols): New function.
3778 (Sized_incr_dynobj::do_layout): New function.
3779 (Sized_incr_dynobj::do_add_symbols): New function.
3780 (Sized_incr_dynobj::do_should_include_member): New function.
3781 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3782 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3783 (Sized_incr_dynobj::do_section_size): New function.
3784 (Sized_incr_dynobj::do_section_name): New function.
3785 (Sized_incr_dynobj::do_section_contents): New function.
3786 (Sized_incr_dynobj::do_section_flags): New function.
3787 (Sized_incr_dynobj::do_section_entsize): New function.
3788 (Sized_incr_dynobj::do_section_address): New function.
3789 (Sized_incr_dynobj::do_section_type): New function.
3790 (Sized_incr_dynobj::do_section_link): New function.
3791 (Sized_incr_dynobj::do_section_info): New function.
3792 (Sized_incr_dynobj::do_section_addralign): New function.
3793 (Sized_incr_dynobj::do_initialize_xindex): New function.
3794 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3795 (make_sized_incremental_object): New function.
3796 (Incremental_library::copy_unused_symbols): New function.
3797 (Incremental_library::do_for_all_unused_symbols): New function.
3798 * incremental.h (enum Incremental_input_flags): New type.
3799 (class Incremental_checker): Remove.
3800 (Incremental_input_entry::Incremental_input_entry): Add argument
3801 serial number.
3802 (Incremental_input_entry::arg_serial): New function.
3803 (Incremental_input_entry::set_is_in_system_directory): New function.
3804 (Incremental_input_entry::is_in_system_directory): New function.
3805 (Incremental_input_entry::arg_serial_): New data member.
3806 (Incremental_input_entry::is_in_system_directory_): New data member.
3807 (class Script_info): Move here from script.h.
3808 (Script_info::Script_info): Add filename parameter.
3809 (Script_info::filename): New function.
3810 (Script_info::filename_): New data member.
3811 (Incremental_script_entry::Incremental_script_entry): Add argument
3812 serial number.
3813 (Incremental_object_entry::Incremental_object_entry): Likewise.
3814 (Incremental_object_entry::add_input_section): Build list of input
3815 sections with map to original shndx.
3816 (Incremental_object_entry::get_input_section_index): New function.
3817 (Incremental_object_entry::shndx_): New data member.
3818 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3819 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3820 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3821 serial number.
3822 (Incremental_inputs::report_archive_begin): Likewise.
3823 (Incremental_inputs::report_object): Likewise.
3824 (Incremental_inputs::report_script): Likewise.
3825 (class Incremental_global_symbol_reader): New class.
3826 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3827 and store flags and input file type.
3828 (Incremental_input_entry_reader::arg_serial): New function.
3829 (Incremental_input_entry_reader::type): Extract type from flags.
3830 (Incremental_input_entry_reader::is_in_system_directory): New function.
3831 (Incremental_input_entry_reader::get_input_section_count): Call
3832 accessor function for type.
3833 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3834 function for type; adjust size of global symbol entry.
3835 (Incremental_input_entry_reader::get_global_symbol_count): Call
3836 accessor function for type.
3837 (Incremental_input_entry_reader::get_object_count): Likewise.
3838 (Incremental_input_entry_reader::get_object_offset): Likewise.
3839 (Incremental_input_entry_reader::get_member_count): Likewise.
3840 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3841 (Incremental_input_entry_reader::get_member_offset): Likewise.
3842 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3843 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3844 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3845 (Incremental_input_entry_reader::get_global_symbol_reader): New
3846 function.
3847 (Incremental_input_entry_reader::get_output_symbol_index): New
3848 function.
3849 (Incremental_input_entry_reader::type_): Remove.
3850 (Incremental_input_entry_reader::flags_): New data member.
3851 (Incremental_inputs_reader::input_file_offset): New function.
3852 (Incremental_inputs_reader::input_file_index): New function.
3853 (Incremental_inputs_reader::input_file): Call input_file_offset.
3854 (Incremental_inputs_reader::input_file_at_offset): New function.
3855 (Incremental_relocs_reader::get_r_type): Reformat.
3856 (Incremental_relocs_reader::get_r_shndx): Reformat.
3857 (Incremental_relocs_reader::get_r_offset): Reformat.
3858 (Incremental_relocs_reader::data): New function.
3859 (Incremental_binary::Incremental_binary): Initialize new data members.
3860 (Incremental_binary::check_inputs): Add cmdline parameter.
3861 (Incremental_binary::file_is_unchanged): Remove.
3862 (Input_reader::arg_serial): New function.
3863 (Input_reader::get_unused_symbol_count): New function.
3864 (Input_reader::get_unused_symbol): New function.
3865 (Input_reader::do_arg_serial): New function.
3866 (Input_reader::do_get_unused_symbol_count): New function.
3867 (Input_reader::do_get_unused_symbol): New function.
3868 (Incremental_binary::input_file_count): New function.
3869 (Incremental_binary::get_input_reader): Change signature to use
3870 index instead of filename.
3871 (Incremental_binary::file_has_changed): New function.
3872 (Incremental_binary::get_input_argument): New function.
3873 (Incremental_binary::get_library): New function.
3874 (Incremental_binary::get_script_info): New function.
3875 (Incremental_binary::init_layout): New function.
3876 (Incremental_binary::reserve_layout): New function.
3877 (Incremental_binary::output_file): New function.
3878 (Incremental_binary::do_check_inputs): New function.
3879 (Incremental_binary::do_file_is_unchanged): Remove.
3880 (Incremental_binary::do_file_has_changed): New function.
3881 (Incremental_binary::do_init_layout): New function.
3882 (Incremental_binary::do_reserve_layout): New function.
3883 (Incremental_binary::do_input_file_count): New function.
3884 (Incremental_binary::do_get_input_reader): Change signature.
3885 (Incremental_binary::input_args_map_): New data member.
3886 (Incremental_binary::library_map_): New data member.
3887 (Incremental_binary::script_map_): New data member.
3888 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3889 new data members.
3890 (Sized_incremental_binary::output_section): New function.
3891 (Sized_incremental_binary::inputs_reader): Add const.
3892 (Sized_incremental_binary::symtab_reader): Add const.
3893 (Sized_incremental_binary::relocs_reader): Add const.
3894 (Sized_incremental_binary::got_plt_reader): Add const.
3895 (Sized_incremental_binary::get_symtab_view): New function.
3896 (Sized_incremental_binary::Inputs_reader): New typedef.
3897 (Sized_incremental_binary::Input_entry_reader): New typedef.
3898 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3899 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3900 (Sized_incremental_binary::do_file_has_changed): New function.
3901 (Sized_incremental_binary::do_init_layout): New function.
3902 (Sized_incremental_binary::do_reserve_layout): New function.
3903 (Sized_input_reader::Inputs_reader): Remove.
3904 (Sized_input_reader::Input_entry_reader): Remove.
3905 (Sized_input_reader::do_arg_serial): New function.
3906 (Sized_input_reader::do_get_unused_symbol_count): New function.
3907 (Sized_input_reader::do_get_unused_symbol): New function.
3908 (Sized_incremental_binary::do_input_file_count): New function.
3909 (Sized_incremental_binary::do_get_input_reader): Change signature;
3910 use index instead of filename.
3911 (Sized_incremental_binary::section_map_): New data member.
3912 (Sized_incremental_binary::input_entry_readers_): New data member.
3913 (class Sized_incr_relobj): New class.
3914 (class Sized_incr_dynobj): New class.
3915 (make_sized_incremental_object): New function.
3916 (class Incremental_library): New class.
3917 * layout.cc (Free_list::num_lists): New static data member.
3918 (Free_list::num_nodes): New static data member.
3919 (Free_list::num_removes): New static data member.
3920 (Free_list::num_remove_visits): New static data member.
3921 (Free_list::num_allocates): New static data member.
3922 (Free_list::num_allocate_visits): New static data member.
3923 (Free_list::init): New function.
3924 (Free_list::remove): New function.
3925 (Free_list::allocate): New function.
3926 (Free_list::dump): New function.
3927 (Free_list::print_stats): New function.
3928 (Layout_task_runner::run): Resize output file for incremental updates.
3929 (Layout::Layout): Initialize new data members.
3930 (Layout::set_incremental_base): New function.
3931 (Layout::init_fixed_output_section): New function.
3932 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3933 incremental updates.
3934 (Layout::create_gold_note): Do not create gold note section for
3935 incremental updates.
3936 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3937 for incremental updates.
3938 (Layout::set_section_offsets): For incremental updates, allocate space
3939 from free list.
3940 (Layout::create_symtab_sections): Layout with offsets relative to
3941 start of section; for incremental updates, allocate space from free
3942 list.
3943 (Layout::create_shdrs): For incremental updates, allocate space from
3944 free list.
3945 (Layout::finish_dynamic_section): For incremental updates, do not
3946 check --as-needed (fixed in subsequent patch).
3947 * layout.h (class Free_list): New class.
3948 (Layout::set_incremental_base): New function.
3949 (Layout::incremental_base): New function.
3950 (Layout::init_fixed_output_section): New function.
3951 (Layout::allocate): New function.
3952 (Layout::incremental_base_): New data member.
3953 (Layout::free_list_): New data member.
3954 * main.cc (main): Print Free_list statistics.
3955 * object.cc (Relobj::finalize_incremental_relocs): Add
3956 clear_counts parameter; clear counts only when clear_counts is set.
3957 (Sized_relobj::Sized_relobj): Initialize new base class.
3958 (Sized_relobj::do_layout): Don't report special sections.
3959 (Sized_relobj::do_for_all_local_got_entries): New function.
3960 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3961 symtab_off to all symbol table offsets.
3962 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3963 * object.h (class Got_offset_list): Move to top of file.
3964 (Object::Object): Allow case where input_file == NULL.
3965 (Object::~Object): Likewise.
3966 (Object::input_file): Assert that input_file != NULL.
3967 (Object::lock): Allow case where input_file == NULL.
3968 (Object::unlock): Likewise.
3969 (Object::is_locked): Likewise.
3970 (Object::token): Likewise.
3971 (Object::release): Likewise.
3972 (Object::is_incremental): New function.
3973 (Object::get_mtime): New function.
3974 (Object::for_all_local_got_entries): New function.
3975 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3976 (Object::set_is_in_system_directory): New function.
3977 (Object::is_in_system_directory): New function.
3978 (Object::do_is_incremental): New function.
3979 (Object::do_get_mtime): New function.
3980 (Object::do_for_all_local_got_entries): New function.
3981 (Object::is_in_system_directory_): New data member.
3982 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3983 (class Sized_relobj_base): New class.
3984 (class Sized_relobj): Derive from Sized_relobj_base.
3985 (class Sized_relobj::Symbols): Redeclare from base class.
3986 (class Sized_relobj::local_got_offset_list): Remove.
3987 (class Sized_relobj::Output_sections): Redeclare from base class.
3988 (class Sized_relobj::do_for_all_local_got_entries): New function.
3989 (class Sized_relobj::write_local_symbols): Add offset parameter.
3990 (class Sized_relobj::local_symbol_offset_): Update comment.
3991 (class Sized_relobj::local_dynsym_offset_): Update comment.
3992 * options.cc (Input_arguments::add_file): Remove const.
3993 * options.h (Input_file_argument::Input_file_argument):
3994 Initialize arg_serial_ (all constructors).
3995 (Input_file_argument::set_arg_serial): New function.
3996 (Input_file_argument::arg_serial): New function.
3997 (Input_file_argument::arg_serial_): New data member.
3998 (Input_arguments::Input_arguments): Initialize file_count_.
3999 (Input_arguments::add_file): Remove const.
4000 (Input_arguments::number_of_input_files): New function.
4001 (Input_arguments::file_count_): New data member.
4002 (Command_line::number_of_input_files): Call
4003 Input_arguments::number_of_input_files.
4004 * output.cc (Output_segment_headers::Output_segment_headers):
4005 Set current size.
4006 (Output_section::Input_section::current_data_size): New function.
4007 (Output_section::Output_section): Initialize new data members.
4008 (Output_section::add_input_section): Don't do merge sections for
4009 an incremental link; allocate space from free list for an
4010 incremental update.
4011 (Output_section::add_output_section_data): Allocate space from
4012 free list for an incremental update.
4013 (Output_section::update_data_size): New function.
4014 (Output_section::set_fixed_layout): New function.
4015 (Output_section::reserve): New function.
4016 (Output_segment::set_section_addresses): Remove const.
4017 (Output_segment::set_section_list_addresses): Remove const; allocate
4018 space from free list for an incremental update.
4019 (Output_segment::set_offset): Adjust size of RELRO segment for an
4020 incremental update.
4021 * output.h (Output_data::current_data_size): Move here from
4022 child classes.
4023 (Output_data::pre_finalize_data_size): New function.
4024 (Output_data::update_data_size): New function.
4025 (Output_section_headers::update_data_size): new function.
4026 (Output_section_data_build::current_data_size): Move to Output_data.
4027 (Output_data_strtab::update_data_size): New function.
4028 (Output_section::current_data_size): Move to Output_data.
4029 (Output_section::set_fixed_layout): New function.
4030 (Output_section::has_fixed_layout): New function.
4031 (Output_section::reserve): New function.
4032 (Output_section::update_data_size): New function.
4033 (Output_section::has_fixed_layout_): New data member.
4034 (Output_section::free_list_): New data member.
4035 (Output_segment::set_section_addresses): Remove const.
4036 (Output_segment::set_section_list_addresses): Remove const.
4037 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4038 New function.
4039 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4040 New function.
4041 * readsyms.cc (Read_symbols::do_read_symbols): Add library
4042 parameter when calling Add_symbols constructor; store argument
4043 serial number for members of a lib group.
4044 (Add_symbols::locks): Allow case where token == NULL.
4045 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4046 (Read_member::~Read_member): New function.
4047 (Read_member::is_runnable): New function.
4048 (Read_member::locks): New function.
4049 (Read_member::run): New function.
4050 (Check_script::~Check_script): New function.
4051 (Check_script::is_runnable): New function.
4052 (Check_script::locks): New function.
4053 (Check_script::run): New function.
4054 (Check_library::~Check_library): New function.
4055 (Check_library::is_runnable): New function.
4056 (Check_library::locks): New function.
4057 (Check_library::run): New function.
4058 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4059 (Add_symbols::library_): New data member.
4060 (class Read_member): New class.
4061 (class Check_script): New class.
4062 (class Check_library): New class.
4063 * reloc.cc (Read_relocs::is_runnable): Allow case where
4064 token == NULL.
4065 (Read_relocs::locks): Likewise.
4066 (Scan_relocs::locks): Likewise.
4067 (Relocate_task::locks): Likewise.
4068 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4069 to clear counters.
4070 (Sized_relobj::incremental_relocs_scan): Fix comment.
4071 (Sized_relobj::do_relocate): Pass output file offset to
4072 write_local_symbols.
4073 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4074 from class declaration.
4075 * script.cc (read_input_script): Allocate Script_info; pass
4076 argument serial number to report_script.
4077 * script.h (class Script_info): Move to incremental.h.
4078 * symtab.cc (Symbol_table::add_from_incrobj): New function.
4079 * symtab.h (Symbol_table::add_from_incrobj): New function.
4080 (Symbol_table::set_file_offset): New function.
4081
4082 2011-04-05 Cary Coutant <ccoutant@google.com>
4083
4084 * incremental-dump.cc (dump_incremental_inputs): Change signature
4085 to take a Sized_incremental_binary; change caller. Use readers
4086 in Sized_incremental_binary.
4087 * incremental.cc
4088 (Sized_incremental_binary::find_incremental_inputs_sections):
4089 Rename do_find_incremental_inputs_sections to this.
4090 (Sized_incremental_binary::setup_readers): New function.
4091 (Sized_incremental_binary::do_check_inputs): Check
4092 has_incremental_info_ flag; move setup code to setup_readers;
4093 use input readers.
4094 (Sized_incremental_binary::do_file_is_unchanged): New function.
4095 (Sized_incremental_binary::do_get_input_reader): New function.
4096 * incremental.h (class Incremental_binary): Move to end of file.
4097 (Incremental_binary::file_is_unchanged): New function.
4098 (Incremental_binary::do_file_is_unchanged): New function.
4099 (Incremental_binary::Input_reader): New class.
4100 (Incremental_binary::get_input_reader): New function.
4101 (class Sized_incremental_binary): Move to end of file.
4102 (Sized_incremental_binary::Sized_incremental_binary): Setup the
4103 input section reader classes.
4104 (Sized_incremental_binary::has_incremental_info): New function.
4105 (Sized_incremental_binary::inputs_reader): New function.
4106 (Sized_incremental_binary::symtab_reader): New function.
4107 (Sized_incremental_binary::relocs_reader): New function.
4108 (Sized_incremental_binary::got_plt_reader): New function.
4109 (Sized_incremental_binary::do_file_is_unchanged): New function.
4110 (Sized_incremental_binary::Sized_input_reader): New class.
4111 (Sized_incremental_binary::get_input_reader): New function.
4112 (Sized_incremental_binary::find_incremental_inputs_sections):
4113 Rename do_find_incremental_inputs_sections to this.
4114 (Sized_incremental_binary::setup_readers): New function.
4115 (Sized_incremental_binary::has_incremental_info_): New data member.
4116 (Sized_incremental_binary::inputs_reader_): New data member.
4117 (Sized_incremental_binary::symtab_reader_): New data member.
4118 (Sized_incremental_binary::relocs_reader_): New data member.
4119 (Sized_incremental_binary::got_plt_reader_): New data member.
4120 (Sized_incremental_binary::current_input_file_): New data member.
4121
4122 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
4123
4124 PR gold/12640
4125 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4126 violation.
4127
4128 2011-03-30 Cary Coutant <ccoutant@google.com>
4129
4130 * archive.cc (Archive::include_member): Adjust call to report_object.
4131 (Add_archive_symbols::run): Add script_info to call to
4132 report_archive_begin.
4133 (Lib_group::include_member): Adjust call to report_object.
4134 (Add_lib_group_symbols::run): Adjust call to report_object.
4135 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4136 blocks. Add object count for script input files.
4137 * incremental.cc (Incremental_inputs::report_archive_begin): Add
4138 script_info parameter; change all callers.
4139 (Incremental_inputs::report_object): Add script_info parameter;
4140 change all callers.
4141 (Incremental_inputs::report_script): Store backpointer to
4142 incremental info entry.
4143 (Output_section_incremental_inputs::set_final_data_size): Record
4144 additional information for scripts.
4145 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4146 * incremental.h (Incremental_script_entry::add_object): New function.
4147 (Incremental_script_entry::get_object_count): New function.
4148 (Incremental_script_entry::get_object): New function.
4149 (Incremental_script_entry::objects_): New data member; adjust
4150 constructor.
4151 (Incremental_inputs::report_archive_begin): Add script_info parameter.
4152 (Incremental_inputs::report_object): Add script_info parameter.
4153 (Incremental_inputs_reader::get_object_count): New function.
4154 (Incremental_inputs_reader::get_object_offset): New function.
4155 * options.cc (Input_arguments::add_file): Return reference to
4156 new input argument.
4157 * options.h (Input_argument::set_script_info): New function.
4158 (Input_argument::script_info): New function.
4159 (Input_argument::script_info_): New data member; adjust all
4160 constructors.
4161 (Input_file_group::add_file): Return reference to new input argument.
4162 (Input_file_lib::add_file): Likewise.
4163 (Input_arguments::add_file): Likewise.
4164 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4165 * script.cc (Parser_closure::Parser_closure): Add script_info
4166 parameter; adjust all callers.
4167 (Parser_closure::script_info): New function.
4168 (Parser_closure::script_info_): New data member.
4169 (read_input_script): Report scripts earlier to incremental info.
4170 (script_add_file): Set script_info in Input_argument.
4171 (script_add_library): Likewise.
4172 * script.h (Script_options::Script_info): Rewrite class.
4173
4174 2011-03-29 Cary Coutant <ccoutant@google.com>
4175
4176 * archive.cc (Library_base::should_include_member): Move
4177 method here from class Archive.
4178 (Archive::Archive): Initialize base class.
4179 (Archive::should_include_member): Move to base class.
4180 (Archive::do_for_all_unused_symbols): New function.
4181 (Add_archive_symbols::run): Remove redundant access to
4182 incremental_inputs.
4183 (Lib_group::Lib_group): Initialize base class.
4184 (Lib_group::do_filename): New function.
4185 (Lib_group::include_member): Pass pointer to Lib_group to
4186 report_object.
4187 (Lib_group::do_for_all_unused_symbols): New function.
4188 (Add_lib_group_symbols::run): Report archive information for
4189 incremental links.
4190 * archive.h (class Library_base): New base class.
4191 (class Archive): Derive from Library_base.
4192 (Archive::filename): Move to base class.
4193 (Archive::set_incremental_info): Likewise.
4194 (Archive::incremental_info): Likewise.
4195 (Archive::Should_include): Likewise.
4196 (Archive::should_include_member): Likewise.
4197 (Archive::Armap_entry): Remove.
4198 (Archive::Unused_symbol_iterator): Remove.
4199 (Archive::unused_symbols_begin): Remove.
4200 (Archive::unused_symbols_end): Remove.
4201 (Archive::do_filename): New function.
4202 (Archive::do_get_mtime): New function.
4203 (Archive::do_for_all_unused_symbols): New function.
4204 (Archive::task_): Move to base class.
4205 (Archive::incremental_info_): Likewise.
4206 (class Lib_group): Derive from Library_base.
4207 (Lib_group::do_filename): New function.
4208 (Lib_group::do_get_mtime): New function.
4209 (Lib_group::do_for_all_unused_symbols): New function.
4210 (Lib_group::task_): Move to base class.
4211 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4212 function.
4213 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4214 function.
4215 * incremental.cc (Incremental_inputs::report_archive_begin):
4216 Use Library_base; call library's get_mtime; add incremental inputs
4217 entry before members.
4218 (class Unused_symbol_visitor): New class.
4219 (Incremental_inputs::report_archive_end): Use Library_base; use
4220 visitor class to record unused symbols; don't add incremental inputs
4221 entry after members.
4222 (Incremental_inputs::report_object): Use Library_base.
4223 * incremental.h
4224 (Incremental_archive_entry::Incremental_archive_entry): Remove
4225 unused Archive parameter.
4226 (Incremental_inputs::report_archive_begin): Use Library_base.
4227 (Incremental_inputs::report_archive_end): Likewise.
4228 (Incremental_inputs::report_object): Likewise.
4229 * object.cc (Sized_relobj::do_for_all_global_symbols): New
4230 function.
4231 * object.h (Object::for_all_global_symbols): New function.
4232 (Object::do_for_all_global_symbols): New function.
4233 (Sized_relobj::do_for_all_global_symbols): New function.
4234 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
4235 function.
4236 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
4237 function.
4238
4239 2011-03-27 Ian Lance Taylor <iant@google.com>
4240
4241 * archive.cc (Archive::interpret_header): Return -1 if something
4242 goes wrong. Change callers accordingly.
4243
4244 2011-03-25 Cary Coutant <ccoutant@google.com>
4245
4246 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4247 * testsuite/Makefile.in: Regenerate.
4248
4249 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
4250
4251 * plugin.cc (get_view): New.
4252 (Plugin::load): Pass get_view to the plugin.
4253 (Plugin_manager::get_view): New.
4254
4255 2011-03-21 Ian Lance Taylor <iant@google.com>
4256
4257 * testsuite/final_layout.sh: Rewrite to not use dc.
4258 * testsuite/relro_test.sh: Fail if dc is not present.
4259
4260 2011-03-21 Sriraman Tallam <tmsriram@google.com>
4261
4262 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4263 Change == to -eq.
4264 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4265 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4266 Change == to -eq.
4267 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4268 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4269
4270 2011-03-14 Ian Lance Taylor <iant@google.com>
4271
4272 * script-sections.cc (Sort_output_sections::script_compare):
4273 Rename from is_before, change return type.
4274 (Sort_output_sections::operator()): Adjust accordingly.
4275
4276 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
4277
4278 PR gold/12572
4279 * testsuite/odr_violation2.cc: Add comment to make all error line
4280 numbers double digits.
4281 * testsuite/debug_msg.sh: Adjust expected errors.
4282
4283 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
4284
4285 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4286 but mark earlier ones as non-canonical
4287 (offset_to_iterator): Update search target and example
4288 (do_addr2line): Return extra lines in a vector*
4289 (format_file_lineno): Extract from do_addr2line
4290 (one_addr2line): Add vector* out-param
4291 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4292 when a lineno entry appeared last for its instruction
4293 (Dwarf_line_info): Add vector* out-param
4294 * object.cc (Relocate_info): Pass NULL for the vector* out-param
4295 * symtab.cc (Odr_violation_compare): Include the lineno in the
4296 comparison again.
4297 (linenos_from_loc): New. Combine the canonical line for an
4298 address with its other lines.
4299 (True_if_intersect): New. Helper functor to make
4300 std::set_intersection a query.
4301 (detect_odr_violations): Compare sets of lines instead of just
4302 one line for each function. This became less deterministic, but
4303 has fewer false positives.
4304 * symtab.h: Declarations.
4305 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4306 mix an optimized and non-optimized object in the same binary
4307 (odr_violation2.so): Same.
4308 * testsuite/Makefile.in: Regenerate from Makefile.am.
4309 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4310 * testsuite/debug_msg.sh: Update line numbers and add
4311 assertions.
4312 * testsuite/odr_violation1.cc: Use OdrDerived, in a
4313 non-optimized context.
4314 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4315 isn't inlined, and use OdrDerived in an optimized context.
4316 * testsuite/odr_header1.h: Defines OdrDerived, where
4317 optimization will change the
4318 first-instruction-in-the-destructor's file and line number.
4319 * testsuite/odr_header2.h: Defines OdrBase.
4320
4321 2011-03-09 Ian Lance Taylor <iant@google.com>
4322
4323 * fileread.cc (File_read::clear_views): Don't delete the whole
4324 file view.
4325
4326 2011-03-08 Ian Lance Taylor <iant@google.com>
4327
4328 PR gold/12525
4329 * fileread.cc: #include <climits>.
4330 (GOLD_IOV_MAX): Define.
4331 (File_read::read_multiple): Limit number of entries by iov_max.
4332 * fileread.h (class File_read): Always set max_readv_entries to
4333 128.
4334
4335 2011-03-07 Ian Lance Taylor <iant@google.com>
4336
4337 PR gold/12525
4338 * options.h (class General_options): Add -dy and -dn.
4339
4340 2011-03-02 Cary Coutant <ccoutant@google.com>
4341
4342 * testsuite/script_test_9.t: Add TLS segment.
4343
4344 2011-03-02 Simon Baldwin <simonb@google.com>
4345
4346 * configure.ac: Add check for gnu_indirect_function support in
4347 the toolchain building binutils.
4348 * configure: Rebuild.
4349
4350 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
4351
4352 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4353 plugin only symbols.
4354 (Symbol_table::sized_finalize_symbol) Mark symbol only present
4355 in plugin files as not needed in the symbol table.
4356
4357 2011-02-11 Sriraman Tallam <tmsriram@google.com>
4358
4359 * output.cc (Output_section::add_input_section): Delay fill
4360 generation for section ordering.
4361
4362 2011-02-09 Ian Lance Taylor <iant@google.com>
4363
4364 PR gold/12316
4365 * object.h (class Sized_relobj): Remove clear_local_symbols.
4366 * reloc.cc (Sized_relobj::do_relocate): Don't call
4367 clear_local_symbols.
4368
4369 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
4370
4371 * plugin.cc (is_visible_from_outside): Return true for symbols
4372 in the -u option.
4373
4374 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
4375
4376 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4377 filename.
4378
4379 2011-02-02 Sriraman Tallam <tmsriram@google.com>
4380
4381 * icf.h (is_section_foldable_candidate): Change type of parameter
4382 to std::string.
4383 * icf.cc (Icf::find_identical_sections): Change type of local variable
4384 section_name to be std::string.
4385 (is_function_ctor_or_dtor): Change type of parameter to std::string.
4386
4387 2011-01-25 Ian Lance Taylor <iant@google.com>
4388
4389 * script.cc (script_add_extern): Rewrite to use
4390 add_symbol_reference.
4391
4392 2011-01-25 Doug Kwan <dougkwan@google.com>
4393
4394 * icf.cc (get_section_contents): Always lock section's object.
4395
4396 2011-01-24 Ian Lance Taylor <iant@google.com>
4397
4398 * options.h (class General_options): Accept
4399 --no-detect-odr-violations.
4400
4401 2011-01-24 Ian Lance Taylor <iant@google.com>
4402
4403 * version.cc (version_string): Bump to 1.11.
4404
4405 2011-01-24 Ian Lance Taylor <iant@google.com>
4406
4407 * plugin.cc (class Plugin_rescan): Define new class.
4408 (Plugin_manager::claim_file): Set any_claimed_.
4409 (Plugin_manager::save_archive): New function.
4410 (Plugin_manager::save_input_group): New function.
4411 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4412 necessary.
4413 (Plugin_manager::new_undefined_symbol): New function.
4414 (Plugin_manager::rescan): New function.
4415 (Plugin_manager::rescannable_defines): New function.
4416 (Plugin_manager::add_input_file): Set any_added_.
4417 * plugin.h (class Plugin_manager): define new fields rescannable_,
4418 undefined_symbols_, any_claimed_, and any_added_. Declare
4419 Plugin_rescan as friend. Declare new functions.
4420 (Plugin_manager::Rescannable): Define type.
4421 (Plugin_manager::Rescannable_list): Define type.
4422 (Plugin_manager::Undefined_symbol_list): Define type.
4423 (Plugin_manager::Plugin_manager): Initialize new fields.
4424 * archive.cc (Archive::defines_symbol): New function.
4425 (Add_archive_symbols::run): Pass archive to plugins if any.
4426 * archive.h (class Archive): Declare defines_symbol.
4427 * readsyms.cc (Input_group::~Input_group): New function.
4428 (Finish_group::run): Pass input_group to plugins if any.
4429 * readsyms.h (class Input_group): Declare destructor.
4430 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4431 any.
4432
4433 2011-01-10 Ian Lance Taylor <iant@google.com>
4434
4435 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4436 section as relro.
4437 (Layout::set_segment_offsets): Reset increase_relro before calling
4438 set_section_addresses a second time.
4439
4440 2011-01-04 Cary Coutant <ccoutant@google.com>
4441
4442 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4443 sections before NOBITS sections.
4444
4445 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
4446
4447 * version.cc (print_version): Update copyright to 2011.
4448
4449 2010-12-23 Cary Coutant <ccoutant@google.com>
4450
4451 * output.h (Output_data_reloc::add_output_section): Pass OD instead
4452 of OS to this->add. Add OD parameter to second form of the function.
4453
4454 2010-12-20 Ian Lance Taylor <iant@google.com>
4455
4456 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4457 second of two consecutive entries with same offset.
4458
4459 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4460
4461 * testsuite/Makefile.am (ifuncmain2static_LDADD)
4462 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4463 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4464 to avoid unneeded links against $(LDADD).
4465 * testsuite/Makefile.in: Regenerate.
4466
4467 2010-12-15 Ian Lance Taylor <iant@google.com>
4468
4469 PR gold/12324
4470 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4471 for R_X86_64_32 and R_X86_64_PC32.
4472 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4473 ver_matching_def_pic.o.
4474 (ver_matching_def_pic.o): New target.
4475
4476 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4477
4478 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4479 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4480 Move definition before File_read::View member definitions.
4481 (File_read::View::~View): Initialize and hold lock before
4482 updating current_mapped_bytes.
4483
4484 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4485
4486 * dwarf_reader.cc: Remove outdated comment.
4487 * gold-threads.cc: Fix typo in error message.
4488 * archive.cc: Fix typos in comments.
4489 * archive.h: Likewise.
4490 * arm-reloc-property.cc: Likewise.
4491 * arm-reloc-property.h: Likewise.
4492 * arm-reloc.def: Likewise.
4493 * arm.cc: Likewise.
4494 * attributes.h: Likewise.
4495 * cref.cc: Likewise.
4496 * ehframe.cc: Likewise.
4497 * fileread.h: Likewise.
4498 * gold.h: Likewise.
4499 * i386.cc: Likewise.
4500 * icf.cc: Likewise.
4501 * incremental.h: Likewise.
4502 * int_encoding.cc: Likewise.
4503 * layout.h: Likewise.
4504 * main.cc: Likewise.
4505 * merge.h: Likewise.
4506 * object.cc: Likewise.
4507 * object.h: Likewise.
4508 * options.cc: Likewise.
4509 * readsyms.cc: Likewise.
4510 * reduced_debug_output.cc: Likewise.
4511 * reloc.cc: Likewise.
4512 * script-sections.cc: Likewise.
4513 * sparc.cc: Likewise.
4514 * symtab.h: Likewise.
4515 * target-reloc.h: Likewise.
4516 * target.cc: Likewise.
4517 * target.h: Likewise.
4518 * timer.cc: Likewise.
4519 * timer.h: Likewise.
4520 * x86_64.cc: Likewise.
4521
4522 2010-12-09 Cary Coutant <ccoutant@google.com>
4523
4524 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4525 stack.
4526 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4527 parameter; change all callers.
4528 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4529 * options.h (warn_execstack): New option.
4530
4531 2010-12-07 Doug Kwan <dougkwan@google.com>
4532
4533 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4534 like function call relocations.
4535
4536 2010-12-07 Ian Lance Taylor <iant@google.com>
4537
4538 * archive.cc (Archive::get_elf_object_for_member): Permit
4539 punconfigured to be NULL.
4540 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4541 (Archive::include_member): Pass NULL to get_elf_object_for_member
4542 if we searched for the archive and this is the first included
4543 object.
4544
4545 2010-12-01 Ian Lance Taylor <iant@google.com>
4546
4547 * dwarf_reader.h (class Sized_dwarf_line_info): Add
4548 track_relocs_type_ field.
4549 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4550 Set track_relocs_type_.
4551 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4552 contents when using RELA relocs.
4553 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4554 reloc_map_.
4555 * reloc.cc (Track_relocs::next_addend): New function.
4556 * reloc.h (class Track_relocs): Declare next_addend.
4557
4558 2010-12-01 Ian Lance Taylor <iant@google.com>
4559
4560 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4561 virtual destructor.
4562
4563 2010-12-01 Ian Lance Taylor <iant@google.com>
4564
4565 * README: Update compilers known to work and fail.
4566
4567 2010-11-23 Matthias Klose <doko@ubuntu.com>
4568
4569 * configure.in: For --enable-gold, handle value `default' instead of
4570 `both*'. Always install ld as ld.bfd, install as ld if gold is
4571 not the default.
4572 * configure: Regenerate.
4573
4574 2010-11-18 Doug Kwan <dougkwan@google.com>
4575
4576 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4577 and right_alignment to be zero. Store result alignment only if it is
4578 greater than existing alignment.
4579
4580 2010-11-16 Cary Coutant <ccoutant@google.com>
4581
4582 PR gold/12220
4583 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4584 Check for ".zdebug_line".
4585
4586 2010-11-16 Doug Kwan <dougkwan@google.com>
4587 Cary Coutant <ccoutant@google.com>
4588
4589 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4590 by reference; adjust all callers.
4591 * output.cc (Output_segment::set_section_addresses): Adjust references
4592 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4593 list is empty.
4594 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4595 end at page boundary.
4596
4597 2010-11-16 Cary Coutant <ccoutant@google.com>
4598
4599 PR gold/12220
4600 * layout.cc (Layout::choose_output_section): Transform names of
4601 compressed sections even when using a script with a SECTIONS clause.
4602 (Layout::output_section_name): Remove code to transform
4603 compressed debug section names.
4604 * output.cc (Output_section::add_input_section): Use uncompressed
4605 section size when tracking input sections.
4606
4607 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4608
4609 * symtab.h (Symbol::NON_PIC_REF): Remove.
4610 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4611 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4612 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4613 (Symbol::use_plt_offset): Take a flags argument and pass it
4614 directly to needs_dynamic_reloc. Restrict check for undefined
4615 weak symbols to function calls.
4616 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4617 (Target_arm::Scan::global): Use it.
4618 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4619 (Target_arm::Relocate::relocate): Likewise.
4620 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4621 parameter with an r_type parameter. Use get_reference_flags
4622 to get the flags.
4623 (Target_arm::Relocate::relocate): Update accordingly.
4624 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4625 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4626 (Target_i386::Scan::global): Likewise.
4627 (Target_i386::Relocate::relocate): Likewise.
4628 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4629 parameter with an r_type parameter. Use get_reference_flags
4630 to get the flags.
4631 (Target_i386::Relocate::relocate): Update accordingly.
4632 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4633 (Target_powerpc::Scan::global): Use it.
4634 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4635 (Target_powerpc::Relocate::relocate): Likewise.
4636 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4637 (Target_sparc::Scan::global): Use it.
4638 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4639 (Target_sparc::Relocate::relocate): Likewise.
4640 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4641 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4642 (Target_x86_64::Scan::global): Likewise.
4643 (Target_x86_64::Relocate::relocate): Likewise.
4644
4645 2010-11-08 Doug Kwan <dougkwan@google.com>
4646 Cary Coutant <ccoutant@google.com>
4647
4648 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4649 (Arm_exidx_merge_section::section_contents_): New data member.
4650 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4651 (Arm_input_section::~Arm_input_section): De-allocate memory.
4652 (Arm_input_section::original_contents_): New data member.
4653 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4654 in parameters instead of calling Object::section_contents without
4655 locking.
4656 (Arm_output_section::group_section): New parameter TASK. Pass it
4657 to callees that need locking objects.
4658 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4659 to lock EXIDX input sections. Fix a formatting issue. Call
4660 Arm_exidx_merged_section::build_contents to create merged section
4661 contents.
4662 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4663 to lock object of stub table owner.
4664 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4665 TEXT_SIZE to initialize data member TEXT_SIZE_.
4666 (Arm_exidx_input_section::addralign): Fix typo in comment.
4667 (Arm_exidx_input_section::text_size): New method.
4668 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4669 that require locking objects. Lock objects before scanning for stubs
4670 and updating local symbols.
4671 (Arm_input_section<big_endian>::init): Copy contents of original
4672 input section.
4673 (Arm_input_section<big_endian>::do_write): Use saved contents of
4674 original input section instead of calling Object::section_contents
4675 without locking.
4676 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4677 size without calling Object::section_size().
4678 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4679 for size. Allocate a buffer for merged EXIDX entries.
4680 (Arm_exidx_merged_section::build_contents): New method.
4681 (Arm_exidx_merged_section::do_write): Move merge section contents
4682 building code to Arm_exidx_merged_section::build_contetns. Write
4683 out contetns in buffer instead of building it on the fly.
4684 (Arm_relobj::make_exidx_input_section): Also pass text section size
4685 to Arm_exidx_input_section constructor.
4686 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4687 (Arm_dynobj::do_read_symbols): Fix memory leak.
4688 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4689 * target.h: (class Task): Add forward declaration.
4690 (Target::relax): Add new parameter TASK and pass it to
4691 Target::do_relax().
4692 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4693
4694 2010-11-05 Cary Coutant <ccoutant@google.com>
4695
4696 PR gold/10708
4697 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4698 object when reading from the file.
4699 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4700 second layout pass.
4701 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4702 when reading section contents.
4703 (get_section_contents): Likewise.
4704 (icf::find_identical_sections): Likewise.
4705 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4706 object when reading from the file.
4707 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4708 the object when doing deferred section layout.
4709
4710 2010-11-03 Nick Clifton <nickc@redhat.com>
4711
4712 PR gold/12001
4713 * script.h (class Symbol_assignment: name): New member. Returns
4714 the name of the symbol.
4715 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4716 Returns true if the given symbol name is on the list of
4717 assignments wating to be processed.
4718 * archive.cc (should_incldue_member): If the symbol is undefined,
4719 check to see if it is on the list of symbols pending assignment.
4720
4721 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4722
4723 * script-sections.cc (Script_sections::find_memory_region): Check
4724 for a NULL output section pointer.
4725
4726 2010-10-29 Doug Kwan <dougkwan@google.com>
4727
4728 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4729 Output_section::add_relaxed_input_section.
4730 * output.cc (Output_section::add_relaxed_input_section): Add new
4731 arguments LAYOUT and NAME. Set section order index.
4732 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4733 Copy section order index.
4734 * output.h (Output_section::add_relaxed_input_section): Add new
4735 arguments LAYOUT and NAME.
4736
4737 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4738
4739 * testsuite/Makefile.am: Move gcctestdir/ld rule to
4740 NATIVE_OR_CROSS_LINKER.
4741 * testsuite/Makefile.in: Regenerate.
4742
4743 2010-10-20 Doug Kwan <dougkwan@google.com>
4744
4745 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4746 without SHF_LINK_ORDER flags.
4747 * layout.cc (Layout::choose_output_section): Do not filter
4748 SHF_LINK_ORDER flag in a relocatable link.
4749
4750 2010-10-17 Cary Coutant <ccoutant@google.com>
4751
4752 * output.h (Output_segment::set_section_addresses): Change function
4753 signature. Update all callers.
4754 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4755 sections.
4756 (Output_segment::set_section_addresses): Align after last TLS
4757 section. Add padding before last relro section instead of after.
4758
4759 2010-10-17 Doug Kwan <dougkwan@google.com>
4760
4761 * gold/arm.cc (Target_arm::got_section): Use correct order and set
4762 GOT output section to be writable.
4763
4764 2010-10-14 Cary Coutant <ccoutant@google.com>
4765
4766 * debug.h (DEBUG_INCREMENTAL): New flag.
4767 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4768 * gold.cc (queue_initial_tasks): Check parameters for incremental link
4769 mode.
4770 * incremental.cc (report_command_line): Ignore all forms of
4771 --incremental.
4772 * layout.cc (Layout::Layout): Check parameters for incremental link
4773 mode.
4774 * options.cc (General_options::parse_incremental): New function.
4775 (General_options::parse_no_incremental): New function.
4776 (General_options::parse_incremental_full): New function.
4777 (General_options::parse_incremental_update): New function.
4778 (General_options::incremental_mode_): New data member.
4779 (General_options::finalize): Check incremental_mode_.
4780 * options.h (General_options): Update help text for --incremental.
4781 Add --no-incremental, --incremental-full, --incremental-update.
4782 (General_options::Incremental_mode): New enum type.
4783 (General_options::incremental_mode): New function.
4784 (General_options::incremental_mode_): New data member.
4785 * parameters.cc (Parameters::incremental_mode_): New data member.
4786 (Parameters::set_options): Set incremental_mode_.
4787 (Parameters::set_incremental_full): New function.
4788 (Parameters::incremental): New function.
4789 (Parameters::incremental_update): New function.
4790 (set_parameters_incremental_full): New function.
4791 * parameters.h (Parameters::set_incremental_full): New function.
4792 (Parameters::incremental): New function.
4793 (Parameters::incremental_update): New function.
4794 (Parameters::incremental_mode_): New data member.
4795 (set_parameters_incremental_full): New function.
4796 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4797 incremental link mode.
4798 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4799 (Sized_relobj::do_relocate_sections): Likewise.
4800 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4801 option.
4802 * testsuite/Makefile.in: Regenerate.
4803 * testsuite/incremental_test.sh: Filter all forms of --incremental.
4804
4805 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4806
4807 * script-sections.h (class Script_sections): Make
4808 Sections_elements typedef public.
4809 * script-sections.cc (class Sort_output_sections): Add elements_
4810 field. Add constructor which sets it; change all callers.
4811 (Sort_output_sections::is_before): New function.
4812 (Sort_output_sections::operator()): Call is_before.
4813 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4814 conditional.
4815 * testsuite/script_test_10.sh: New test. Test script section
4816 order.
4817 * testsuite/script_test_10.t: Likewise.
4818 * testsuite/script_test_10.s: Likewise.
4819 * testsuite/Makefile.am: Wrap the cross linker tests and the
4820 common tests into NATIVE_OR_CROSS_LINKER.
4821 (check_SCRIPTS): Add script_test_10.sh.
4822 (check_DATA): Add script_test_10.stdout.
4823 (script_test_10.o, script_test_10): New targets.
4824 (script_test_10.stdout): New target.
4825 * configure, testsuite/Makefile.in: Regenerate.
4826
4827 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4828
4829 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4830 error for the deprecated relocations.
4831 (Target_arm::Scan::global): Likewise.
4832 (Target_arm::Relocate::relocate): Likewise.
4833
4834 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4835
4836 * fileread.cc (Input_file::find_file): Initialize *found_name
4837 and *namep when using the fallback search for case 4.
4838
4839 2010-10-11 Cary Coutant <ccoutant@google.com>
4840
4841 * options.h (class General_options): Redefine -z lazy as an alias for
4842 the negation of -z now.
4843
4844 2010-10-11 Ian Lance Taylor <iant@google.com>
4845
4846 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4847 binding.
4848
4849 2010-10-06 Nick Clifton <nickc@redhat.com>
4850
4851 * script-sections.cc(class Memory_region): Remove
4852 current_lma_offset_ field. Rename current_vma_offset_ to
4853 current_offset_. Add last_section_ field.
4854 (Memory_region::get_current_vma_address): Rename to
4855 get_current_address.
4856 (Memory_region::get_current_lma_address): Delete.
4857 (Memory_region::increment_vma_offset): Rename to
4858 increment_offset.
4859 (Memory_region::increment_lma_offset): Delete.
4860 (Memory_region::attributes_compatible): New method. Returns
4861 true if the provided section is compatible with the region.
4862 (Memory_region::get_last_section): New method. Returns the last
4863 section to use the region.
4864 (Memory_region::set_last_section): New method. Stores the last
4865 section to use the region.
4866 (Script_sections::block_in_region): New method. Returns true if
4867 a block of memory is contained within a region.
4868 (Script_sections::find_memory_region): New method. Locates a
4869 memory region to be used to set a VMA or LMA address.
4870 (Output_section_definition::set_section_addresses): Add code to
4871 check for addresses set by memory regions.
4872 (Output_segment::set_section_addresses): Remove memory region
4873 walking code.
4874 (Script_sections::create_segment): Add a warning if a header
4875 segment is created outside of any region.
4876 * script-sections.h (class Script_sections): Add prototypes for
4877 find_memory_region and block_in_region methods.
4878 * testsuite/memory_test.s: Use .long instead of .word.
4879 * testsuite/memory_test.t: Add some more output sections.
4880 * testsuite/memory_test.sh: Update expected output.
4881
4882 2010-10-02 Doug Kwan <dougkwan@google.com>
4883
4884 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4885 defintion to symtab.h
4886 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4887 declaration to defintion.
4888
4889 2010-10-01 Nick Clifton <nickc@redhat.com>
4890
4891 * expression.cc (eval): Replace dummy argument with NULL.
4892 (eval_maybe_dot): Check for a NULL result section pointer.
4893 (Symbol_expression::value): Likewise.
4894 (Dot_expression::value): Likewise.
4895 (BINARY_EXPRESSION): Likewise.
4896 (Max_expression::value): Likewise.
4897 (Min_expression::value): Likewise.
4898 (Absolute_expression::value): Likewise.
4899 (Addr_expression::value_from_output_section): Likewise.
4900 (Loaddddr_expression::value_from_output_section): Likewise.
4901 (Segment_start_expression::value): Likewise.
4902 * script-sections.cc
4903 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4904 argument with NULL.
4905 (Sections_elememt_dot_assignment::set_section_addresses):
4906 Likewise.
4907 (Output_data_expression::do_write_to_buffer): Likewise.
4908 (Output_section_definition::finalize_symbols): Likewise.
4909 (Output_section_definition::set_section_addresses): Likewise.
4910
4911 2010-09-30 Doug Kwan <dougkwan@google.com>
4912
4913 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4914
4915 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4916
4917 * target.h (Target::can_icf_inline_merge_sections): New virtual
4918 function.
4919 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4920 virtual function.
4921 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4922 virtual function.
4923 * icf.cc (get_section_contents): Inline merge sections only when
4924 target allows it.
4925
4926 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4927
4928 * configure: Regenerate.
4929
4930 2010-09-17 Ian Lance Taylor <iant@google.com>
4931
4932 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4933 * testsuite/Makefile.am (memory_test.o): New target.
4934 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4935 memory_test.t.
4936 * testsuite/Makefile.in: Rebuild.
4937
4938 2010-09-17 Doug Kwan <dougkwan@google.com>
4939
4940 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4941 defintion if relocation uses GOT entries of the symbol.
4942 * testsuite/icf_safe_test.sh: Fix test.
4943 * testsuite/icf_safe_so_test.sh: Fix test.
4944
4945 2010-09-16 Cary Coutant <ccoutant@google.com>
4946
4947 * script_sections.cc (class Memory_region): Remove "NULL" from
4948 vector initializations.
4949
4950 2010-09-15 Cary Coutant <ccoutant@google.com>
4951
4952 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4953 Resolve forwarding symbols.
4954
4955 2010-09-15 Doug Kwan <dougkwan@google.com>
4956
4957 * gold/testsuite/script_test_3.t: Add ARM special sections.
4958 * gold/testsuite/script_test_4.t: Same.
4959 * gold/testsuite/script_test_5.t: Same.
4960 * gold/testsuite/script_test_6.t: Same.
4961 * gold/testsuite/script_test_7.t: Same.
4962 * gold/testsuite/script_test_7.t: Same.
4963 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4964
4965 2010-09-14 Cary Coutant <ccoutant@google.com>
4966
4967 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4968 (Target_x86_64::Relocate::relocate_tls): Replace check for
4969 saw_tls_block_reloc_ with test for executable section.
4970
4971 2010-09-12 Cary Coutant <ccoutant@google.com>
4972
4973 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4974 position-independent executables to shared libraries need dynamic
4975 relocations.
4976 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4977 position-independent executables.
4978 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4979 * testsuite/Makefile.in: Regenerate.
4980
4981 2010-09-10 Nick Clifton <nickc@redhat.com>
4982
4983 PR gold/11997
4984 * testsuite/memory_test.t: Discard any sections that are not
4985 needed.
4986
4987 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4988
4989 PR gold/11996
4990 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4991 "This::" to work around a bug in gcc 4.2.
4992
4993 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4994
4995 2010-09-09 Rafael Espindola <espindola@google.com>
4996
4997 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4998 sections with different PF_X flags in the same segment.
4999 (Layout::find_first_load_seg): Search all segments to find the first
5000 one.
5001 * options.h (rosegment): New.
5002
5003 2010-09-08 Rafael Espindola <espindola@google.com>
5004
5005 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5006
5007 2010-09-08 Doug Kwan <dougkwan@google.com>
5008
5009 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5010 (Arm_relobj::do_relocate_sections): Add new parameter for output
5011 file to match the parent.
5012 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5013 of local symbols instead of input values. Update code to track
5014 changes in gold::relocate_section.
5015 * object.cc (Sized_relobj::compute_final_local_value): New methods.
5016 (Sized_relobj::compute_final_local_value_internal): New methods.
5017 (Sized_relobj::do_finalize_local_symbols): Move code from loop
5018 body into private version of Sized_relobj::compute_final_local_value.
5019 Call the inline method.
5020 * object.h (Symbol_value::Symbol_value): Define destructor. Free
5021 merged symbol value if there is one.
5022 (Symbol_value::has_output_value): New method defintiion.
5023 (Sized_relobj::Compute_final_local_value_status): New enum type.
5024 (Sized_relobj::compute_final_local_value): New methods.
5025 (Sized_relobj::compute_final_local_value_internal): New methods.
5026 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5027 and arm_cortex_a8.sh.
5028 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5029 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5030 New tests.
5031 * Makefile.in: Regenerate.
5032 * testsuite/arm_bl_out_of_range.s: Update test.
5033 * testsuite/thumb_bl_out_of_range.s: Ditto.
5034 * testsuite/thumb_blx_out_of_range.s: Ditto.
5035 * testsuite/arm_branch_out_of_range.sh: New file.
5036 * testsuite/arm_cortex_a8.sh: Ditto.
5037 * testsuite/arm_cortex_a8_b.s: Ditto.
5038 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5039 * testsuite/arm_cortex_a8_b_local.s: Ditto.
5040 * testsuite/arm_cortex_a8_bl.s: Ditto.
5041 * testsuite/arm_cortex_a8_blx.s: Ditto.
5042 * testsuite/arm_cortex_a8_local.s: Ditto.
5043 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5044 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5045
5046 2010-09-08 Rafael Espindola <espindola@google.com>
5047
5048 * Makefile.am (memory_test.stdout): Run readelf with -W.
5049 * Makefile.in: Regenerate.
5050 * testsuite/memory_test.sh: Make the regexps accept both 32 and
5051 64 bit output.
5052
5053 2010-09-08 Rafael Espindola <espindola@google.com>
5054
5055 * script-sections.cc (Script_sections::add_memory_region): Convert
5056 field precision to int.
5057 * script.cc (script_set_section_region, script_set_section_region):
5058 Convert field precision to int.
5059
5060 2010-09-08 Rafael Espindola <espindola@google.com>
5061
5062 * arm.cc (do_finalize_sections): Create the __exidx_start and
5063 __exdix_end symbols even when the section is missing.
5064
5065 2010-09-08 Nick Clifton <nickc@redhat.com>
5066
5067 * README: Remove claim that MEMORY is not supported.
5068 * expression.cc (script_exp_function_origin)
5069 (script_exp_function_length): Move from here to ...
5070 * script.cc: ... here.
5071 (script_set_section_region, script_add_memory)
5072 (script_parse_memory_attr, script_include_directive): New
5073 functions.
5074 * script-sections.cc
5075 (class Memory_region): New class.
5076 (class Output_section_definition): Add set_memory_region,
5077 set_section_vma, set_section_lma and get_section_name methods.
5078 (class Script_Sections): Add add_memory_region,
5079 find_memory_region, find_memory_region_origin,
5080 find_memory_region_length and set_memory_region methods.
5081 Have set_section_addresses method walk the list of set memory
5082 regions.
5083 Extend the print methos to display memory regions.
5084 * script-sections.h: Add prototypes for new methods.
5085 Add enum for MEMORY region attributes.
5086 * yyscript.y: Add support for parsing MEMORY regions.
5087 * script-c.h: Add prototypes for new functions.
5088 * testsuite/Makefile.am: Add test of MEMORY region functionality.
5089 * testsuite/Makefile.in: Regenerate.
5090 * testsuite/memory_test.sh: New script.
5091 * testsuite/memory_test.s: New assembler source file.
5092 * testsuite/memory_test.t: New linker script.
5093
5094 2010-08-27 Doug Kwan <dougkwan@google.com>
5095
5096 * gold/resolve.cc (Symbol_table::should_override): Let a weak
5097 reference override an existing dynamic weak reference.
5098 * testsuite/Makefile.am: Add new test dyn_weak_ref.
5099 * testsuite/Makefile.in: Regenerate.
5100 * testsuite/dyn_weak_ref.sh: New file.
5101 * testsuite/dyn_weak_ref_1.c: Ditto.
5102 * testsuite/dyn_weak_ref_2.c: Ditto.
5103
5104 2010-08-27 Ian Lance Taylor <iant@google.com>
5105
5106 * incremental.h (class Incremental_input_entry): Add virtual
5107 destructor.
5108
5109 2010-08-27 Ian Lance Taylor <iant@google.com>
5110
5111 * testsuite/start_lib_test_3.c: Mark t3 as used.
5112
5113 2010-08-27 Nick Clifton <nickc@redhat.com>
5114
5115 * options.cc (version_script): Fix small typo in previous
5116 whitespace tidyup.
5117
5118 2010-08-25 Nick Clifton <nickc@redhat.com>
5119
5120 * archive.cc: Formatting fixes: Remove whitespace between
5121 typename and following asterisk. Remove whitespace between
5122 function name and opening parenthesis.
5123 * archive.h: Likewise.
5124 * arm.cc: Likewise.
5125 * attributes.cc: Likewise.
5126 * attributes.h: Likewise.
5127 * common.cc: Likewise.
5128 * copy-relocs.cc: Likewise.
5129 * dirsearch.h: Likewise.
5130 * dynobj.cc: Likewise.
5131 * ehframe.cc: Likewise.
5132 * ehframe.h: Likewise.
5133 * expression.cc: Likewise.
5134 * fileread.cc: Likewise.
5135 * fileread.h: Likewise.
5136 * gc.h: Likewise.
5137 * gold-threads.cc: Likewise.
5138 * gold.cc: Likewise.
5139 * i386.cc: Likewise.
5140 * icf.h: Likewise.
5141 * incremental-dump.cc: Likewise.
5142 * incremental.cc: Likewise.
5143 * layout.cc: Likewise.
5144 * layout.h: Likewise.
5145 * main.cc: Likewise.
5146 * merge.cc: Likewise.
5147 * merge.h: Likewise.
5148 * object.cc: Likewise.
5149 * object.h: Likewise.
5150 * options.cc: Likewise.
5151 * options.h: Likewise.
5152 * output.cc: Likewise.
5153 * output.h: Likewise.
5154 * plugin.cc: Likewise.
5155 * plugin.h: Likewise.
5156 * powerpc.cc: Likewise.
5157 * reloc.cc: Likewise.
5158 * script-c.h: Likewise.
5159 * script-sections.cc: Likewise.
5160 * script.cc: Likewise.
5161 * stringpool.cc: Likewise.
5162 * symtab.cc: Likewise.
5163 * symtab.h: Likewise.
5164 * target.cc: Likewise.
5165 * timer.cc: Likewise.
5166 * timer.h: Likewise.
5167 * version.cc: Likewise.
5168 * x86_64.cc: Likewise.
5169
5170 2010-08-24 Nick Clifton <nickc@redhat.com>
5171
5172 PR 11899
5173 * layout.cc (segment_precedes): Sort segments by their physical
5174 addresses, if they have been set.
5175
5176 2010-08-23 Cary Coutant <ccoutant@google.com>
5177
5178 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5179 symbols data.
5180 (Lib_group::include_member): Unlock object after deleting its
5181 symbols data.
5182 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5183 the bug fixed here.
5184
5185 2010-08-19 Neil Vachharajani <nvachhar@google.com>
5186 Cary Coutant <ccoutant@google.com>
5187
5188 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5189 constructor, and set_blocker.
5190 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5191 readsyms_blocker_.
5192 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5193 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5194 * testsuite/Makefile.am (start_lib_test): New test case.
5195 * testsuite/Makefile.in: Regenerate.
5196 * testsuite/start_lib_test_main.c: New file.
5197 * testsuite/start_lib_test_1.c: New file.
5198 * testsuite/start_lib_test_2.c: New file.
5199 * testsuite/start_lib_test_3.c: New file.
5200
5201 2010-08-19 Ian Lance Taylor <iant@google.com>
5202
5203 * Makefile.in: Rebuild with automake 1.11.1.
5204 * aclocal.m4: Likewise.
5205 * testsuite/Makefile.in: Likewise.
5206
5207 2010-08-19 Ian Lance Taylor <iant@google.com>
5208
5209 PR 10893
5210 * i386.cc (class Output_data_plt_i386): Update declarations.
5211 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
5212 local_ifuncs_ fields.
5213 (Target_i386::do_plt_section_for_global): New function.
5214 (Target_i386::do_plt_section_for_local): New function.
5215 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5216 parameter; change all callers. Initialize global_ifuncs_ and
5217 local_ifuncs_. If doing a static link define __rel_iplt_start and
5218 __rel_iplt_end.
5219 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5220 (Output_data_plt_i386::add_local_ifunc_entry): New function.
5221 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5222 symbols.
5223 (Target_i386::make_plt_section): New function, broken out of
5224 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
5225 (Target_i386::make_plt_entry): Call make_plt_section.
5226 (Target_i386::make_local_ifunc_plt_entry): New function.
5227 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5228 (Target_i386::Scan::local): Handle IFUNC symbols. Add
5229 R_386_IRELATIVE to switch.
5230 (Target_i386::Scan::global): Likewise.
5231 (Target_i386::Relocate::relocate): Likewise.
5232 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5233 switch.
5234 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5235 (Target_x86_64::do_plt_section_for_global): New function.
5236 (Target_x86_64::do_plt_section_for_local): New function.
5237 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5238 parameter; change all callers. If doing a static link define
5239 __rela_iplt_start and __rela_iplt_end.
5240 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5241 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5242 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5243 to point to .plt.
5244 (Target_x86_64::make_local_ifunc_plt_entry): New function.
5245 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5246 switch.
5247 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5248 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
5249 R_X86_64_IRELATIVE to switch.
5250 (Target_x86_64::Scan::global): Likewise.
5251 (Target_x86_64::Relocate::relocate): Likewise.
5252 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5253 switch.
5254 * target.h (class Target): Add plt_section_for_global and
5255 plt_section_for_local functions. Add do_plt_section_for_global
5256 and do_plt_section_for_local virtual functions.
5257 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
5258 clarifying comments.
5259 (Symbol::use_plt_offset): Handle IFUNC symbol.
5260 * object.cc (Sized_relobj::Sized_relobj): Initialize
5261 local_plt_offsets_.
5262 (Sized_relobj::local_has_plt_offset): New function.
5263 (Sized_relobj::local_plt_offset): New function.
5264 (Sized_relobj::set_local_plt_offset): New function.
5265 (Sized_relobj::do_count): Handle IFUNC symbol.
5266 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
5267 a bit away from input_shndx_ field. Add set_is_func_symbol and
5268 is_ifunc_symbol functions.
5269 (class Sized_relobj): Update declarations. Remove Tls_got_entry
5270 and Local_tls_got_offsets. Define Local_plt_offsets. Add
5271 local_plt_offsets_ field.
5272 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5273 * output.h (class Output_section_data): Add non-const
5274 output_section function.
5275 (class Output_data_got): Update declarations.
5276 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5277 Add use_plt_offset parameter to global and local constructors.
5278 Change all callers. Change local_sym_index_ field to 31 bits.
5279 Change GSYM_CODE and CONSTANT_CODE accordingly.
5280 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5281 doing a static link don't set sh_link field.
5282 (Output_data_got::Got_entry::write): Use PLT offset if
5283 appropriate.
5284 (Output_data_got::add_global_plt): New function.
5285 (Output_data_got::add_local_plt): New function.
5286 * target-reloc.h (relocate_section): Handle IFUNC symbol.
5287 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5288 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5289 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5290 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5291 IFUNC conditional.
5292 * testsuite/ifunc-sel.h: New file.
5293 * testsuite/ifuncmain1.c: New file.
5294 * testsuite/ifuncmain1vis.c: New file.
5295 * testsuite/ifuncmod1.c: New file.
5296 * testsuite/ifuncdep2.c: New file.
5297 * testsuite/ifuncmain2.c: New file.
5298 * testsuite/ifuncmain3.c: New file.
5299 * testsuite/ifuncmod3.c: New file.
5300 * testsuite/ifuncmain4.c: New file.
5301 * testsuite/ifuncmain5.c: New file.
5302 * testsuite/ifuncmod5.c: New file.
5303 * testsuite/ifuncmain6pie.c: New file.
5304 * testsuite/ifuncmod6.c: New file.
5305 * testsuite/ifuncmain7.c: New file.
5306 * configure, testsuite/Makefile.in: Rebuild.
5307
5308 2010-08-18 Ian Lance Taylor <iant@google.com>
5309
5310 * incremental.cc
5311 (Output_section_incremental_inputs::write_input_files): Add cast
5312 to avoid signed/unsigned comparison warning.
5313 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5314
5315 2010-08-12 Cary Coutant <ccoutant@google.com>
5316
5317 * common.cc (Sort_commons::operator()): Remove unnecessary code.
5318
5319 2010-08-13 Ian Lance Taylor <iant@google.com>
5320
5321 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5322
5323 2010-08-12 Cary Coutant <ccoutant@google.com>
5324 Doug Kwan <dougkwan@google.com>
5325
5326 * resolve.cc (Symbol_table::should_override): When a weak dynamic
5327 defintion overrides non-weak undef, remember that the original undef
5328 is not weak.
5329 * symtab.cc (Symbol_table::sized_write_global): For undef without
5330 an original weak binding, set binding to global in output.
5331 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5332 * testsuite/Makefile.in: Regenerate.
5333 * testsuite/strong_ref_weak_def.sh: New file.
5334 * testsuite/strong_ref_weak_def_1.c: Ditto.
5335 * testsuite/strong_ref_weak_def_2.c: Ditto.
5336
5337 2010-08-12 Cary Coutant <ccoutant@google.com>
5338
5339 * testsuite/incremental_test.sh: Rewrite.
5340 * testsuite/incremental_test_1.c: Rewrite.
5341 * testsuite/incremental_test_2.c: Rewrite.
5342
5343 2010-08-12 Cary Coutant <ccoutant@google.com>
5344
5345 * arm.cc (Target_arm::got_size): Add const.
5346 (Target_arm::got_entry_count): New function.
5347 (Target_arm::plt_entry_count): New function.
5348 (Target_arm::first_plt_entry_offset): New function.
5349 (Target_arm::plt_entry_size): New function.
5350 (Output_data_plt_arm::entry_count): New function.
5351 (Output_data_plt_arm::first_plt_entry_offset): New function.
5352 (Output_data_plt_arm::get_plt_entry_size): New function.
5353 * i386.cc (Target_i386::got_size): Add const.
5354 (Target_i386::got_entry_count): New function.
5355 (Target_i386::plt_entry_count): New function.
5356 (Target_i386::first_plt_entry_offset): New function.
5357 (Target_i386::plt_entry_size): New function.
5358 (Output_data_plt_i386::entry_count): New function.
5359 (Output_data_plt_i386::first_plt_entry_offset): New function.
5360 (Output_data_plt_i386::get_plt_entry_size): New function.
5361 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5362 find_incremental_inputs_sections. Dump incremental_got_plt section.
5363 * incremental.cc: Include target.h.
5364 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5365 parameter. Adjust all callers. Find incremental_got_plt section.
5366 (Incremental_inputs::create_data_sections): Create incremental_got_plt
5367 section.
5368 (Output_section_incremental_inputs::set_final_data_size): Calculate
5369 size of incremental_got_plt section.
5370 (Output_section_incremental_inputs::do_write): Write the
5371 incremental_got_plt section.
5372 (Got_plt_view_info): New struct.
5373 (Local_got_offset_visitor): New class.
5374 (Global_got_offset_visitor): New class.
5375 (Global_symbol_visitor_got_plt): New class.
5376 (Output_section_incremental_inputs::write_got_plt): New function.
5377 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5378 Add parameter. Adjust all callers.
5379 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5380 (Incremental_inputs::got_plt_section): New function.
5381 (Incremental_inputs::got_plt_section_): New data member.
5382 (Incremental_got_plt_reader): New class.
5383 * layout.cc (Layout::create_incremental_info_sections): Add the
5384 incremental_got_plt section.
5385 * object.h (Got_offset_list::get_list): New function.
5386 (Got offset_list::for_all_got_offsets): New function.
5387 (Sized_relobj::local_got_offset_list): New function.
5388 * powerpc.cc (Target_powerpc::got_size): Add const.
5389 (Target_powerpc::got_entry_count): New function.
5390 (Target_powerpc::plt_entry_count): New function.
5391 (Target_powerpc::first_plt_entry_offset): New function.
5392 (Target_powerpc::plt_entry_size): New function.
5393 (Output_data_plt_powerpc::entry_count): New function.
5394 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5395 (Output_data_plt_powerpc::get_plt_entry_size): New function.
5396 * sparc.cc (Target_sparc::got_size): Add const.
5397 (Target_sparc::got_entry_count): New function.
5398 (Target_sparc::plt_entry_count): New function.
5399 (Target_sparc::first_plt_entry_offset): New function.
5400 (Target_sparc::plt_entry_size): New function.
5401 (Output_data_plt_sparc::entry_count): New function.
5402 (Output_data_plt_sparc::first_plt_entry_offset): New function.
5403 (Output_data_plt_sparc::get_plt_entry_size): New function.
5404 * symtab.h (Symbol::got_offset_list): New function.
5405 (Symbol_table::for_all_symbols): New function.
5406 * target.h (Sized_target::got_entry_count): New function.
5407 (Sized_target::plt_entry_count): New function.
5408 (Sized_target::plt_entry_size): New function.
5409 * x86_64.cc (Target_x86_64::got_size): Add const.
5410 (Target_x86_64::got_entry_count): New function.
5411 (Target_x86_64::plt_entry_count): New function.
5412 (Target_x86_64::first_plt_entry_offset): New function.
5413 (Target_x86_64::plt_entry_size): New function.
5414 (Output_data_plt_x86_64::entry_count): New function.
5415 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5416 (Output_data_plt_x86_64::get_plt_entry_size): New function.
5417
5418 2010-08-12 Cary Coutant <ccoutant@google.com>
5419
5420 * archive.cc: Include incremental.h.
5421 (Archive::Archive): Initialize incremental_info_.
5422 (Archive::include_member): Record archive members in incremental info.
5423 (Add_archive_symbols::run): Record begin and end of an archive in
5424 incremental info.
5425 (Lib_group::include_member): Record objects in incremental info.
5426 * archive.h (Incremental_archive_entry): Forward declaration.
5427 (Archive::set_incremental_info): New member function.
5428 (Archive::incremental_info): New member function.
5429 (Archive::Unused_symbol_iterator): New class.
5430 (Archive::unused_symbols_begin): New member function.
5431 (Archive::unused_symbols_end): New member function.
5432 (Archive::incremental_info_): New data member.
5433 * incremental-dump.cc (find_input_containing_global): New function.
5434 (dump_incremental_inputs): Dump new incremental info sections.
5435 * incremental.cc: Include symtab.h.
5436 (Output_section_incremental_inputs): New class.
5437 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5438 new incremental info sections.
5439 (Sized_incremental_binary::do_check_inputs): Likewise.
5440 (Incremental_inputs::report_archive): Remove.
5441 (Incremental_inputs::report_archive_begin): New function.
5442 (Incremental_inputs::report_archive_end): New function.
5443 (Incremental_inputs::report_object): New function.
5444 (Incremental_inputs::finalize_inputs): Remove.
5445 (Incremental_inputs::report_input_section): New function.
5446 (Incremental_inputs::report_script): Rewrite.
5447 (Incremental_inputs::finalize): Do nothing but finalize string table.
5448 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5449 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5450 (Incremental_inputs::create_data_sections): New function.
5451 (Incremental_inputs::relocs_entsize): New function.
5452 (Output_section_incremental_inputs::set_final_data_size): New function.
5453 (Output_section_incremental_inputs::do_write): New function.
5454 (Output_section_incremental_inputs::write_header): New function.
5455 (Output_section_incremental_inputs::write_input_files): New function.
5456 (Output_section_incremental_inputs::write_info_blocks): New function.
5457 (Output_section_incremental_inputs::write_symtab): New function.
5458 * incremental.h (Incremental_script_entry): Forward declaration.
5459 (Incremental_object_entry): Forward declaration.
5460 (Incremental_archive_entry): Forward declaration.
5461 (Incremental_inputs): Forward declaration.
5462 (Incremental_inputs_header_data): Remove.
5463 (Incremental_inputs_header): Remove.
5464 (Incremental_inputs_header_write): Remove.
5465 (Incremental_inputs_entry_data): Remove.
5466 (Incremental_inputs_entry): Remove.
5467 (Incremental_inputs_entry_write): Remove.
5468 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5469 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5470 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5471 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5472 Likewise.
5473 (Incremental_input_entry): New class.
5474 (Incremental_script_entry): New class.
5475 (Incremental_object_entry): New class.
5476 (Incremental_archive_entry): New class.
5477 (Incremental_inputs::Incremental_inputs): Initialize new data members.
5478 (Incremental_inputs::report_inputs): Remove.
5479 (Incremental_inputs::report_archive): Remove.
5480 (Incremental_inputs::report_archive_begin): New function.
5481 (Incremental_inputs::report_archive_end): New function.
5482 (Incremental_inputs::report_object): Change prototype.
5483 (Incremental_inputs::report_input_section): New function.
5484 (Incremental_inputs::report_script): Change prototype.
5485 (Incremental_inputs::get_reloc_count): New function.
5486 (Incremental_inputs::set_reloc_count): New function.
5487 (Incremental_inputs::create_data_sections): New function.
5488 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5489 (Incremental_inputs::inputs_section): New function.
5490 (Incremental_inputs::symtab_section): New function.
5491 (Incremental_inputs::relocs_section): New function.
5492 (Incremental_inputs::get_stringpool): Add const.
5493 (Incremental_inputs::command_line): Add const.
5494 (Incremental_inputs::inputs): Remove.
5495 (Incremental_inputs::command_line_key): New function.
5496 (Incremental_inputs::input_file_count): New function.
5497 (Incremental_inputs::input_files): New function.
5498 (Incremental_inputs::relocs_entsize): New function.
5499 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5500 (Incremental_inputs::finalize_inputs): Remove.
5501 (Incremental_inputs::Input_info): Remove.
5502 (Incremental_inputs::lock_): Remove.
5503 (Incremental_inputs::inputs_): Change type.
5504 (Incremental_inputs::inputs_map_): Remove.
5505 (Incremental_inputs::current_object_entry_): New data member.
5506 (Incremental_inputs::inputs_section_): New data member.
5507 (Incremental_inputs::symtab_section_): New data member.
5508 (Incremental_inputs::relocs_section_): New data member.
5509 (Incremental_inputs::reloc_count_): New data member.
5510 (Incremental_inputs_reader): New class.
5511 (Incremental_symtab_reader): New class.
5512 (Incremental_relocs_reader): New class.
5513 * layout.cc (Layout::finalize): Move finalization of incremental info
5514 and creation of incremental info sections to follow finalization of
5515 symbol table. Set offsets for postprocessing sections.
5516 (Layout::create_incremental_info_sections): Call
5517 Incremental_inputs::create_data_sections. Add incremental symtab
5518 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
5519 sections to layout after input sections.
5520 * layout.h (struct Timespec): Forward declaration.
5521 (Layout::incremental_inputs): Add const.
5522 (Layout::create_incremental_info_sections): Add parameter.
5523 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5524 * object.cc: Include incremental.h.
5525 (Relobj::finalize_incremental_relocs): New function.
5526 (Sized_relobj::do_layout): Record input sections in incremental info.
5527 * object.h (Object::output_section): New function.
5528 (Object::output_section_offset): Moved from Relobj.
5529 (Object::get_incremental_reloc_base): New function.
5530 (Object::get_incremental_reloc_count): New function.
5531 (Object::do_output_section): New function.
5532 (Object::do_output_section_offset): Moved from Relobj.
5533 (Object::do_get_incremental_reloc_base): New function.
5534 (Object::do_get_incremental_reloc_count): New function.
5535 (Object::Object): Initialize new data members.
5536 (Relobj::output_section): Renamed do_output_section and moved to
5537 protected.
5538 (Relobj::output_section_offset): Moved to Object.
5539 (Relobj::do_get_incremental_reloc_base): New function.
5540 (Relobj::do_get_incremental_reloc_count): New function.
5541 (Relobj::allocate_incremental_reloc_counts): New function.
5542 (Relobj::count_incremental_reloc): New function.
5543 (Relobj::finalize_incremental_relocs): New function.
5544 (Relobj::next_incremental_reloc_index): New function.
5545 (Relobj::reloc_counts_): New data member.
5546 (Relobj::reloc_bases_): New data member.
5547 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
5548 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
5549 (Sized_relobj::incremental_relocs_scan): New function.
5550 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5551 (Sized_relobj::incremental_relocs_write): New function.
5552 (Sized_relobj::incremental_relocs_write_reltype): New function.
5553 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5554 incremental link.
5555 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5556 archives and object files elsewhere.
5557 (Add_symbols::run): Report object files here.
5558 (Finish_group::run): Report end of archive at end of group.
5559 * reloc.cc: Include layout.h, incremental.h.
5560 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5561 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5562 (Sized_relobj::incremental_relocs_scan): New function.
5563 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5564 (Sized_relobj::do_relocate_sections): Write incremental relocations.
5565 (Sized_relobj::incremental_relocs_write): New function.
5566 (Sized_relobj::incremental_relocs_write_reltype): New function.
5567 * script.cc (read_input_script): Rewrite test for incremental link.
5568 Change call to Incremental_inputs::report_script.
5569 * symtab.h (Symbol_table::first_global_index): New function.
5570 (Symbol_table::output_count): New function.
5571
5572 2010-08-12 Doug Kwan <dougkwan@google.com>
5573
5574 * arm.cc (Target_arm::merge_object_attributes): Check command line
5575 options --no-wchar-size-warning and --no-enum-size-warning.
5576 * options.h (General_options): Add ld-compatible options
5577 --no-enum-size-warning and --no-wchar-size-warning.
5578
5579 2010-08-04 Ian Lance Taylor <iant@google.com>
5580
5581 * x86_64.cc (Target_x86_64::Scan::local): Use
5582 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5583 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5584 (Target_x86_64::Scan::global): Likewise.
5585 (Target_x86_64::Relocate::relocate): Likewise.
5586 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5587 Likewise.
5588
5589 2010-08-03 Cary Coutant <ccoutant@google.com>
5590
5591 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5592 to reserve space in merged_strings vector. Keep total input size
5593 for stats.
5594 (Output_merge_string::do_print_merge_stats): Print total input size.
5595 * merge.h (Output_merge_string): Add input_size_ field.
5596 * stringpool.cc (Stringpool_template::string_length): Move
5597 implementations out of Stringpool_template class and place in
5598 stringpool.h.
5599 * stringpool.h (string_length): Move out of Stringpool_template.
5600
5601 2010-08-03 Ian Lance Taylor <iant@google.com>
5602
5603 PR 11712
5604 * layout.cc (relaxation_loop_body): If address of load segment is
5605 set, adjust address to include headers if possible.
5606
5607 2010-08-03 Ian Lance Taylor <iant@google.com>
5608
5609 * version.cc (version_string): Bump to 1.10.
5610
5611 2010-08-03 Ian Lance Taylor <iant@google.com>
5612
5613 PR 11805
5614 * layout.h (enum Output_section_order): Define.
5615 (class Layout): Update declarations.
5616 * layout.cc (Layout::get_output_section): Add order parameter.
5617 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5618 is_first_non_relro parameters. Change all callers.
5619 (Layout::choose_output_section): Likewise.
5620 (Layout::add_output_section_data): Likewise.
5621 (Layout::make_output_section): Likewise. Set order.
5622 (Layout::default_section_order): New function.
5623 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5624 * output.cc (Output_section::Output_section): Initialize order_.
5625 Don't initialize deleted fields.
5626 (Output_segment::Output_segment): Don't initialize deleted
5627 fields.
5628 (Output_segment::add_output_section_to_load): New function
5629 replacing add_output_section. Change all callers to call this or
5630 add_output_section_to_nonload.
5631 (Output_segment::add_output_section_to_nonload): New function.
5632 (Output_segment::remove_output_section): Rewrite.
5633 (Output_segment::add_initial_output_data): Likewise.
5634 (Output_segment::has_any_data_sections): Likewise.
5635 (Output_segment::is_first_section_relro): Likewise.
5636 (Output_segment::maximum_alignment): Likewise.
5637 (Output_segment::has_dynamic_reloc): New function replacing
5638 dynamic_reloc_count. Change all callers.
5639 (Output_segment::has_dynamic_reloc_list): New function replacing
5640 dynamic_reloc_count_list. Change all callers.
5641 (Output_segment::set_section_addresses): Rewrite.
5642 (Output_segment::set_offset): Rewrite.
5643 (Output_segment::find_first_and_last_list): Remove.
5644 (Output_segment::set_tls_offsets): Rewrite.
5645 (Output_segment::first_section_load_address): Likewise.
5646 (Output_segment::output_section_count): Likewise.
5647 (Output_segment::section_with_lowest_load_address): Likewise.
5648 (Output_segment::write_section_headers): Likewise.
5649 (Output_segment::print_sections_to_map): Likewise.
5650 * output.h (class Output_data): Remove dynamic_reloc_count_
5651 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5652 (Output_data::add_dynamic_reloc): Rewrite.
5653 (Output_data::has_dynamic_reloc): New function.
5654 (Output_data::dynamic_reloc_count): Remove.
5655 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5656 is_last_relro_, is_first_non_relro_, is_interp_,
5657 is_dynamic_linker_section_ fields. Add order and set_order
5658 functions. Remove is_relro_local, set_is_relro_local,
5659 is_last_relro, set_is_last_relro, is_first_non_relro,
5660 set_is_first_non_relro functions, is_interp, set_is_interp,
5661 is_dynamic_linker_section, and set_is_dynamic_linker_section
5662 functions.
5663 (class Output_segment): Change Output_data_list from std::list to
5664 std:;vector. Add output_lists_ field. Remove output_data_ and
5665 output_bss_ fields. Update declarations.
5666
5667 2010-08-02 Ian Lance Taylor <iant@google.com>
5668
5669 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5670 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5671 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5672
5673 2010-08-02 Ian Lance Taylor <iant@google.com>
5674
5675 PR 11855
5676 * script.cc (Script_options::Script_options): Initialize
5677 symbol_definitions_ and symbol_references_.
5678 (Script_options::add_symbol_assignment): Update
5679 symbol_definitions_ and symbol_references_.
5680 (Script_options::add_symbol_reference): New function.
5681 (script_symbol): New function.
5682 * script.h (class Script_options): Add symbol_definitions_ and
5683 symbol_references_ fields.
5684 (Script_options::referenced_const_iterator): New type.
5685 (Script_options::referenced_begin): New function.
5686 (Script_options::referenced_end): New function.
5687 (Script_options::is_referenced): New function.
5688 (Script_options::any_unreferenced): New function.
5689 * script-c.h (script_symbol): Declare.
5690 * yyscript.y (exp): Call script_symbol.
5691 * symtab.cc: Include "script.h".
5692 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5693 Change all callers. Check symbols referenced by scripts.
5694 (Symbol_table::add_undefined_symbols_from_command_line): Add
5695 layout parameter. Change all callers.
5696 (Symbol_table::do_add_undefined_symbols_from_command_line):
5697 Likewise. Break out loop body. Check symbols referenced by
5698 scripts.
5699 (Symbol_table::add_undefined_symbol_from_command_line): New
5700 function broken out of
5701 do_add_undefined_symbols_from_command_line.
5702 * symtab.h (class Symbol_table): Update declarations.
5703 * archive.cc: Include "layout.h".
5704 (Archive::should_include_member): Add layout parameter. Change
5705 all callers. Check for symbol mentioned in expression.
5706 * archive.h (class Archive): Update declaration.
5707 * object.cc (Sized_relobj::do_should_include_member): Add layout
5708 parameter.
5709 * object.h (Object::should_include_member): Add layout parameter.
5710 Change all callers.
5711 (Object::do_should_include_member): Add layout parameter.
5712 (class Sized_relobj): Update declaration.
5713 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5714 parameter.
5715 * dynobj.h (class Sized_dynobj): Update declaration.
5716 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5717 layout parameter.
5718 * plugin.h (class Sized_pluginobj): Update declaration.
5719
5720 2010-08-02 Ian Lance Taylor <iant@google.com>
5721
5722 PR 11866
5723 * output.cc (Output_segment::set_offset): Search for the first and
5724 last sections rather than assuming that the list is in order.
5725 (Output_segment::find_first_and_last_list): New function.
5726 * output.h (class Output_segment): Update declarations.
5727 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5728 (relro_strip_test_SOURCES): New variable.
5729 (relro_strip_test_DEPENDENCIES): New variable.
5730 (relro_strip_test_LDFLAGS): New variable.
5731 (relro_strip_test_LDADD): New variable.
5732 (relro_strip_test.so): New target.
5733
5734 2010-08-02 Ian Lance Taylor <iant@google.com>
5735
5736 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5737 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5738 (Target_i386::got_tlsdesc_section): New function.
5739 (Target_i386::got_section): Create space for GOT entries for
5740 TLSDESC relocations.
5741 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5742 R_386_TLS_GOTDESC.
5743 (Target_i386::Scan::global): Likewise.
5744 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5745 using TLSDESC GOT.
5746 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5747 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5748 (Target_x86_64::got_tlsdesc_section): New function.
5749 (Target_x86_64::got_section): Create space for GOT entries for
5750 TLSDESC relocations.
5751 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5752 R_386_TLS_GOTDESC.
5753 (Target_x86_64::Scan::global): Likewise.
5754 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5755 using TLSDESC GOT.
5756
5757 2010-08-02 Ian Lance Taylor <iant@google.com>
5758
5759 * testsuite/final_layout.sh: Use dc to convert from hex to
5760 decimal.
5761
5762 2010-07-29 Sriraman Tallam <tmsriram@google.com>
5763
5764 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5765 paramter to the call to gold::gc_process_relocs.
5766 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5767 paramter to the call to gold::gc_process_relocs.
5768 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5769 parameter to the call to gold::gc_process_relocs.
5770 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5771 template parameter to the call to gold::gc_process_relocs.
5772 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5773 paramter to the call to gold::gc_process_relocs.
5774 * gc.h (get_embedded_addend_size): New function.
5775 (gc_process_relocs): Save the size of the reloc for use by ICF.
5776 * icf.cc (get_section_contents): Get the addend from the text section
5777 for SHT_REL relocation sections.
5778 * icf.h (Icf::Reloc_addend_size_info): New typedef.
5779 (Icf::Reloc_info): Add new member reloc_addend_size_info.
5780 * int_encoding.h (read_from_pointer): New overloaded function.
5781 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5782 * testsuite/icf_sht_rel_addend_test.sh: New file.
5783 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5784 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5785
5786 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5787
5788 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5789 * Makefile.in: Regenerate.
5790 * testsuite/Makefile.in: Regenerate.
5791
5792 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5793
5794 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5795 * gold/testsuite/debug_msg.cc: Likewise.
5796 * gold/testsuite/odr_violation1.cc
5797 * gold/testsuite/odr_violation2.cc
5798
5799 2010-07-21 Cary Coutant <ccoutant@google.com>
5800
5801 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5802 string, and length fields.
5803 (Output_merge_string::Merged_strings_list): New type.
5804 (Output_merge_string::Merged_strings_lists): New typedef.
5805 (Output_merge_string): Replace merged_strings_ with
5806 merged_strings_lists_.
5807 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5808 Merged_strings_list per input object and section. Don't store pointer
5809 to the string. Don't store length with each merged string entry.
5810 (Output_merge_string::finalize_merged_data): Loop over list of merged
5811 strings lists. Recompute length of each merged string.
5812
5813 2010-07-15 Cary Coutant <ccoutant@google.com>
5814
5815 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5816 here.
5817
5818 2010-07-14 Ian Lance Taylor <iant@google.com>
5819
5820 * descriptors.cc (Descriptors::open): Report correct name in error
5821 message.
5822
5823 2010-07-13 Doug Kwan <dougkwan@google.com>
5824
5825 * arm.cc (Arm_input_section::Arm_input_section): For a
5826 SHT_ARM_EXIDX section, always keeps the input sections.
5827 (Arm_input_section::set_exidx_section_link): New method.
5828 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5829 has_errors_ to false.
5830 (Arm_exidx_input_section::has_errors,
5831 Arm_exidx_input_section::set_has_errors): New methods.
5832 (Arm_exidx_input_section::has_errors_): New data member.
5833 (Arm_relobj::get_exidx_shndx_list): New method.
5834 (Arm_output_section::append_text_sections_to_list): Do not skip
5835 section without SHF_EXECINSTR.
5836 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5837 errors.
5838 (Arm_relobj::make_exidx_input_section): Add new parameter for text
5839 section header. Make error messages more verbose. Check for
5840 a non-executable section linked to an EXIDX section.
5841 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5842 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5843 check that there is no deferred EXIDX section if we exit early.
5844 Instead of not making an EXIDX section in case of an error, make one
5845 and set the has_errors flag of it.
5846 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5847 in a relocatable link.
5848 (Target_arm::do_relax): Look for the EXIDX output section instead of
5849 assuming that it is called .ARM.exidx.
5850 (Target_arm::fix_exidx_coverage): Add a new parameter for input
5851 section list. Do not check for SHF_EXECINSTR section flags but
5852 skip any input section with errors.
5853 * output.cc (Output_section::Output_section): Initialize
5854 always_keeps_input_sections_ to false.
5855 (Output_section::add_input_section): Check for
5856 always_keeps_input_sections_.
5857 * output.h (Output_section::always_keeps_input_sections,
5858 Output_section::set_always_keeps_input_sections): New methods.
5859 (Output_section::always_keeps_input_sections): New data member.
5860
5861 2010-07-13 Rafael Espindola <espindola@google.com>
5862
5863 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5864 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5865
5866 2010-07-13 Philip Herron <herron.philip@googlemail.com>
5867 Ian Lance Taylor <iant@google.com>
5868
5869 * output.h (Output_section_lookup_maps::add_merge_section):
5870 Correct check of whether value was inserted.
5871 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5872 (Output_section_lookup_maps::add_relaxed_input_section):
5873 Likewise.
5874 * arm.cc (Target_arm::got_section): Remove used local os.
5875 * i386.cc (Target_i386::got_section): Likewise.
5876 * x86_64.cc (Target_x86_64::got_section): Likewise.
5877 * sparc.cc (Target_sparc::got_section): Likewise.
5878 (Target_sparc::relocate): Remove unused local have_got_offset.
5879 * powerpc.cc (Target_powerpc::relocate): Likewise.
5880
5881 2010-07-13 Ian Lance Taylor <iant@google.com>
5882
5883 * compressed_output.cc (zlib_decompress): Fix signature in
5884 !HAVE_ZLIB_H case.
5885
5886 * archive.cc (Archive::include_member): Unlock an external member
5887 of a thin archive. Don't bother to delete an object we know is
5888 NULL.
5889
5890 2010-07-12 Cary Coutant <ccoutant@google.com>
5891
5892 * compressed_output.cc (zlib_decompress): New function.
5893 (get_uncompressed_size): New function.
5894 (decompress_input_section): New function.
5895 * compressed_output.h (get_uncompressed_size): New function.
5896 (decompress_input_section): New function.
5897 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5898 Handle compressed debug sections.
5899 * layout.cc (is_compressed_debug_section): New function.
5900 (Layout::output_section_name): Map compressed section names to
5901 canonical names.
5902 * layout.h (is_compressed_debug_section): New function.
5903 (is_debug_info_section): Recognize compressed debug sections.
5904 * merge.cc: Include compressed_output.h.
5905 (Output_merge_data::do_add_input_section): Handle compressed
5906 debug sections.
5907 (Output_merge_string::do_add_input_section): Handle compressed
5908 debug sections.
5909 * object.cc: Include compressed_output.h.
5910 (Sized_relobj::Sized_relobj): Initialize new data members.
5911 (build_compressed_section_map): New function.
5912 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5913 * object.h (Object::section_is_compressed): New method.
5914 (Object::do_section_is_compressed): New method.
5915 (Sized_relobj::Compressed_section_map): New type.
5916 (Sized_relobj::do_section_is_compressed): New method.
5917 (Sized_relobj::compressed_sections_): New data member.
5918 * output.cc (Output_section::add_input_section): Handle compressed
5919 debug sections.
5920 * reloc.cc: Include compressed_output.h.
5921 (Sized_relobj::write_sections): Handle compressed debug sections.
5922
5923 2010-07-08 Cary Coutant <ccoutant@google.com>
5924
5925 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5926 weak when resolving to a dynamic def.
5927 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5928 for weak undef/dynamic def cases. Adjust callers.
5929 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5930 undef_binding_weak_.
5931 (Symbol_table::sized_write_globals): Adjust symbol binding.
5932 (Symbol_table::sized_write_symbol): Add binding parameter.
5933 * symtab.h (Symbol::set_undef_binding): New method.
5934 (Symbol::is_undef_binding_weak): New method.
5935 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5936 (Symbol_table::should_override): Add new parameter.
5937 (Symbol_table::sized_write_symbol): Add new parameter.
5938
5939 * testsuite/weak_undef_file1.cc: Add new test case.
5940 * testsuite/weak_undef_file2.cc: Fix header comment.
5941 * testsuite/weak_undef_test.cc: Add new test case.
5942
5943 2010-06-29 Doug Kwan <dougkwan@google.com>
5944
5945 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5946 Initialize USE_SYMBOL_.
5947 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5948 definition.
5949 (Arm_reloc_property::uses_symbol_): New data member declaration.
5950 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5951 uses symbol value and symbol is undefined but not weakly undefined.
5952
5953 2010-06-28 Rafael Espindola <espindola@google.com>
5954
5955 * plugin.cc (Plugin::load): Use dlerror.
5956
5957 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5958
5959 * symtab.cc (detect_odr_violations): When reporting an ODR
5960 violation, report an object where the symbol is defined.
5961
5962 2010-06-25 Doug Kwan <dougkwan@google.com>
5963
5964 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5965 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5966 definition.
5967 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5968 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5969 target hook to detect function points.
5970 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5971 * icf.h (Icf::check_section_for_function_pointers): Change type of
5972 parameter SECTION_NAME to const reference to std::string. Use
5973 target hook to determine if section may have unsafe pointers.
5974 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5975 method definition.
5976
5977 2010-06-21 Rafael Espindola <espindola@google.com>
5978
5979 * fileread.cc (Input_file::find_fie): New
5980 (Input_file::open): Use Input_file::find_fie.
5981 * fileread.h (Input_file::find_fie): New
5982 * plugin.cc (set_extra_library_path): New.
5983 (Plugin::load): Add set_extra_library_path to the transfer vector.
5984 (Plugin_manager::set_extra_library_path): New.
5985 (Plugin_manager::add_input_file): Use the extra search path if set.
5986 (set_extra_library_path(): New.
5987 * plugin.h (Plugin_manager): Add set_extra_library_path and
5988 extra_search_path_.
5989
5990 2010-06-19 Cary Coutant <ccoutant@google.com>
5991
5992 * layout.cc (gdb_sections): Add .debug_types.
5993 (lines_only_debug_sections): Likewise.
5994
5995 2010-06-18 Rafael Espindola <espindola@google.com>
5996
5997 * plugin.cc (add_input_file,add_input_library)
5998 (Plugin_manager::add_input_file): Make filename arguments const.
5999 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6000 const.
6001
6002 2010-06-16 Doug Kwan <dougkwan@google.com>
6003
6004 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6005 .ARM.attributes section if we have not merged any input
6006 attributes sections.
6007
6008 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6009
6010 * arm.cc: Allow combining objects with no EABI version
6011 information.
6012
6013 2010-06-15 Rafael Espindola <espindola@google.com>
6014
6015 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6016
6017 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6018
6019 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6020 (struct iovec): Correct !HAVE_READV definition.
6021
6022 2010-06-10 Cary Coutant <ccoutant@google.com>
6023
6024 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6025 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6026 reloc sections.
6027 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6028
6029 PR 11683
6030 * symtab.h (Symbol::is_placeholder): New member function.
6031 * target-reloc.h (relocate_section): Check for placeholder symbols.
6032
6033 * testsuite/Makefile.am (plugin_test_8): New test.
6034 (plugin_test_9): New test.
6035 * testsuite/Makefile.in: Regenerate.
6036
6037 2010-06-09 Nick Clifton <nickc@redhat.com>
6038
6039 * yyscript.y (input_list_element): Allow strings prefixed with
6040 the '-' character. Treat these as libraries.
6041 * script.cc (script_add_library): New function. Adds a library
6042 specified by "-l<name>" found in an input script.
6043 * script-c.h: Add prototype for script_add_library.
6044
6045 2010-06-07 Doug Kwan <dougkwan@google.com>
6046
6047 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6048 Restrict stub-group size to be within long conditional branch
6049 range when working around cortex-A8 erratum.
6050
6051 2010-06-07 Damien Diederen <dd@crosstwine.com>
6052
6053 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6054 #ifdef typo.
6055
6056 2010-06-03 Sriraman Tallam <tmsriram@google.com>
6057
6058 PR gold/11658
6059 * output.cc
6060 (Output_section::Input_section_sort_entry::compare_section_ordering):
6061 Change to return non-zero correctly.
6062 (Output_section::Input_section_sort_section_order_index_compare
6063 ::operator()): Change to fix ambiguity in comparisons.
6064
6065 2010-06-01 Sriraman Tallam <tmsriram@google.com>
6066
6067 * gold.h (is_wildcard_string): New function.
6068 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6069 (Layout::layout_eh_frame): Ditto.
6070 (Layout::find_section_order_index): New method.
6071 (Layout::read_layout_from_file): New method.
6072 * layout.h (Layout::find_section_order_index): New method.
6073 (Layout::read_layout_from_file): New method.
6074 (Layout::input_section_position_): New private member.
6075 (Layout::input_section_glob_): New private member.
6076 * main.cc (main): Call read_layout_from_file here.
6077 * options.h (--section-ordering-file): New option.
6078 * output.cc (Output_section::input_section_order_specified_): New
6079 member.
6080 (Output_section::Output_section): Initialize new member.
6081 (Output_section::add_input_section): Add new parameter.
6082 Keep input sections when --section-ordering-file is used.
6083 (Output_section::set_final_data_size): Sort input sections when
6084 section ordering file is specified.
6085 (Output_section::Input_section_sort_entry): Add new parameter.
6086 Check sorting type.
6087 (Output_section::Input_section_sort_entry::compare_section_ordering):
6088 New method.
6089 (Output_section::Input_section_sort_compare::operator()): Change to
6090 consider section_order_index.
6091 (Output_section::Input_section_sort_init_fini_compare::operator()):
6092 Change to consider section_order_index.
6093 (Output_section::Input_section_sort_section_order_index_compare
6094 ::operator()): New method.
6095 (Output_section::sort_attached_input_sections): Change to sort
6096 according to section order when specified.
6097 (Output_section::add_input_section<32, true>): Add new parameter.
6098 (Output_section::add_input_section<64, true>): Add new parameter.
6099 (Output_section::add_input_section<32, false>): Add new parameter.
6100 (Output_section::add_input_section<64, false>): Add new parameter.
6101 * output.h (Output_section::add_input_section): Add new parameter.
6102 (Output_section::input_section_order_specified): New
6103 method.
6104 (Output_section::set_input_section_order_specified): New method.
6105 (Input_section::Input_section): Initialize section_order_index_.
6106 (Input_section::section_order_index): New method.
6107 (Input_section::set_section_order_index): New method.
6108 (Input_section::section_order_index_): New member.
6109 (Input_section::Input_section_sort_section_order_index_compare): New
6110 struct.
6111 (Output_section::input_section_order_specified_): New member.
6112 * script-sections.cc (is_wildcard_string): Delete and move modified
6113 method to gold.h.
6114 (Output_section_element_input::Output_section_element_input): Modify
6115 call to is_wildcard_string.
6116 (Output_section_element_input::Input_section_pattern
6117 ::Input_section_pattern): Ditto.
6118 (Output_section_element_input::Output_section_element_input): Ditto.
6119 * testsuite/Makefile.am (final_layout): New test case.
6120 * testsuite/Makefile.in: Regenerate.
6121 * testsuite/final_layout.cc: New file.
6122 * testsuite/final_layout.sh: New file.
6123
6124 2010-06-01 Rafael Espindola <espindola@google.com>
6125
6126 * plugin.cc (Plugin::load): Pass the output name to the plugin.
6127
6128 2010-06-01 Rafael Espindola <espindola@google.com>
6129
6130 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6131 visibility of symbols.
6132
6133 2010-05-27 Doug Kwan <dougkwan@google.com>
6134
6135 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6136 from start of output section instead of address for a local symbol
6137 in a merged or relaxed section when doing a relocatable link.
6138
6139 2010-05-26 Rafael Espindola <espindola@google.com>
6140
6141 PR 11604
6142 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6143 adding sections the garbage collector removed.
6144 * gold/testsuite/Makefile.am: Add test.
6145 * gold/testsuite/Makefile.in: Regenerate.
6146 * gold/testsuite/plugin_test_7.sh: New.
6147 * gold/testsuite/plugin_test_7_1.c: New.
6148 * gold/testsuite/plugin_test_7_2.c: New.
6149
6150 2010-05-26 Rafael Espindola <espindola@google.com>
6151
6152 * script-sections.cc (Output_section_definition::set_section_addresses):
6153 Check for --section-start.
6154
6155 2010-05-26 Doug Kwan <dougkwan@google.com>
6156
6157 * arm.cc (Arm_scan_relocatable_relocs): New class.
6158 (Target_arm::relocate_special_relocatable): New method.
6159 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6160 (Arm_relocate_functions::thumb_branch_common): Same.
6161 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6162 instead of Default_scan_relocatable_relocs.
6163 * target-reloc.h (relocate_for_relocatable): Let target handle
6164 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6165 * target.h (Sized_target::relocate_special_relocatable): New method.
6166
6167 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6168
6169 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6170
6171 2010-05-23 Doug Kwan <dougkwan@google.com>
6172
6173 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6174 instead of a cast.
6175 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6176 with a direct branch, not a conditional branch, to a stub.
6177 * merge.cc (Output_merge_base::record_input_section): New method
6178 defintion.
6179 (Output_merge_data::do_add_input_section): Record input section if
6180 keeps-input-sections flag is set.
6181 (Output_merge_string::do_add_input_section): Ditto.
6182 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6183 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6184 INPUT_SECTIONS_.
6185 (Output_merge_base::keeps_input_sections,
6186 Output_merge_base::set_keeps_input_sections,
6187 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6188 method definitions.
6189 (Output_merge_base::Input_sections): New type declaration.
6190 (Output_merge_base::input_sections_begin,
6191 Output_merge_base::input_sections_end,
6192 Output_merge_base::do_set_keeps_input_sections): New method definitions.
6193 (Output_merge_base::bool keeps_input_sections_,
6194 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6195 Output_merge_base::input_sections_): New data members.
6196 (Output_merge_data::do_set_keeps_input_sections): New method
6197 defintion.
6198 (Output_merge_string::do_set_keeps_input_sections): Ditto.
6199 * output.cc (Output_section::Input_section::relobj): Move method
6200 defintion from class declaration to here and handle merge sections.
6201 (Output_section::Input_section::shndx): Ditto.
6202 (Output_section::Output_section): Remove initializations of removed
6203 data members and initialize new data member LOOKUP_MAPS_.
6204 (Output_section::add_input_section): Set keeps-input-sections flag
6205 for a newly created merge output section as appropriate. Adjust code
6206 to use Output_section_lookup_maps class.
6207 (Output_section::add_relaxed_input_section): Adjst code for lookup
6208 maps code refactoring.
6209 (Output_section::add_merge_input_section): Add a new parameter
6210 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
6211 class. If adding input section to a newly created merge output
6212 section fails, remove the new merge section.
6213 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6214 Adjust code for use of the Output_section_lookup_maps class.
6215 (Output_section::find_merge_section): Ditto.
6216 (Output_section::build_lookup_maps): New method defintion.
6217 (Output_section::find_relaxed_input_section): Adjust code to use
6218 Output_section_lookup_maps class.
6219 (Output_section::get_input_sections): Export merge sections. Adjust
6220 code to use Output_section_lookup_maps class.
6221 (Output_section:::add_script_input_section): Adjust code to use
6222 Output_section_lookup_maps class. Update lookup maps for merge
6223 sections also.
6224 (Output_section::discard_states): Use Output_section_lookup_maps.
6225 (Output_section::restore_states): Same.
6226 * output.h (Merge_section_properties): Move class defintion out of
6227 Output_section.
6228 (Output_section_lookup_maps): New class.
6229 (Output_section::Input_section::is_merge_section): New method
6230 defintion.
6231 (Output_section::Input_section::relobj): Move defintion out of class
6232 defintion. Declare method only.
6233 (Output_section::Input_section::shndx): Ditto.
6234 (Output_section::Input_section::output_merge_base): New method defintion.
6235 (Output_section::Input_section::u2_.pomb): New union field.
6236 (Output_section::Merge_section_by_properties_map,
6237 Output_section::Output_section_data_by_input_section_map,
6238 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6239 Remove types.
6240 (Output_section::add_merge_input_section): Add new parameter
6241 KEEPS_INPUT_SECTIONS.
6242 (Output_section::build_lookup_maps): New method declaration.
6243 (Output_section::merge_section_map_,
6244 Output_section::merge_section_by_properties_map_,
6245 Output_section::relaxed_input_section_map_,
6246 Output_section::is_relaxed_input_section_map_valid_): Remove data
6247 members.
6248 (Output_section::lookup_maps_): New data member.
6249
6250 2010-05-21 Doug Kwan <dougkwan@google.com>
6251
6252 PR gold/11619
6253 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6254 avoid a compilation error.
6255
6256 2010-05-19 Rafael Espindola <espindola@google.com>
6257
6258 * script-sections.cc (Output_section_definition::allocate_to_segment):
6259 Update the phdrs_list even when the output section is NULL.
6260 * testsuite/Makefile.am: Add test.
6261 * testsuite/Makefile.in: Regenerate.
6262 * testsuite/script_test_9.cc: New.
6263 * testsuite/script_test_9.sh: New.
6264 * testsuite/script_test_9.t: New.
6265
6266 2010-05-19 Doug Kwan <dougkwan@google.com>
6267
6268 * arm.cc (Arm_input_section::original_size): New method.
6269 (Arm_input_section::do_addralign): Add a cast.
6270 (Arm_input_section::do_output_offset): Remove static cast.
6271 (Arm_input_section::original_addralign,
6272 Arm_input_section::original_size_): Change type to uint32_t.
6273 (Arm_input_section::init): Add safe casts for section alignment
6274 and size.
6275 (Arm_input_section::set_final_data_size): Do not set address and
6276 offset of stub table.
6277 (Arm_output_section::fix_exidx_coverage): Change use of of
6278 Output_section::Simple_input_section to that of
6279 Output_section::Input_section.
6280 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6281 except for the first pass.
6282 * output.cc (Output_section::get_input_sections): Change type of
6283 input_sections to std::list<Input_section>.
6284 (Output_section::add_script_input_section): Rename from
6285 Output_section::add_simple_input_section. Change type of SIS
6286 parameter from Simple_input_section to Input_section.
6287 * output.h (Output_section::Simple_input_section): Remove class.
6288 (Output_section::Input_section): Change class visibility to public.
6289 (Output_section::Input_section::addralign): Use stored alignments
6290 for special input sections if set.
6291 (Output_section::Input_section::set_addralign): New method.
6292 (Output_section::get_input_sections): Change parameter type from
6293 list of Simple_input_section to list of Input_section.
6294 (Output_section::add_script_input_section): Rename from
6295 Output_section::add_simple_input_section. Change first parameter's
6296 type from Simple_input_section to Input_section and remove the
6297 second and third parameters.
6298 * script-sections.cc (Input_section::Input_section_list): Change
6299 type to list of Output_section::Input_section/
6300 (Input_section_info::Input_section_info): Change parameter type of
6301 INPUT_SECTION to Output_section::Input_section.
6302 (Input_section_info::input_section): Change return type.
6303 (Input_section_info::input_section_): Change type to
6304 Output_section::Input_section.
6305 (Output_section_element_input::set_section_addresses): Adjust code
6306 to use Output_section::Input_section instead of
6307 Output_section::Simple_input_section. Adjust code for renaming
6308 of Output_section::add_simple_input_section.
6309 (Orphan_output_section::set_section_addresses): Ditto.
6310
6311 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6312
6313 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6314 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6315
6316 2010-05-18 Rafael Espindola <espindola@google.com>
6317
6318 * options.cc (General_options::finalize): Handle -nostdlib.
6319 * options.h (nostdlib): New option.
6320 * script.cc (script_add_search_dir): Handle -nostdlib.
6321
6322 2010-05-12 Doug Kwan <dougkwan@google.com>
6323
6324 * arm.cc (Target_arm::do_finalize_sections): Create an empty
6325 attributes section only if there no attributes section after merging.
6326 (Target_arm::merge_object_attributes): Move value of
6327 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6328 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6329 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6330 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6331 and arm_attr_merge_7.stdout.
6332 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6333 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6334 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6335 arm_attr_merge_7b.o): New rules.
6336 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6337 arm_attr_merge_7
6338 * testsuite/Makefile.in: Regenerate.
6339 * testsuite/arm_attr_merge.sh: New file.
6340 * testsuite/arm_attr_merge_[67][ab].s: Same.
6341
6342 2010-05-05 Nick Clifton <nickc@redhat.com>
6343
6344 * po/es.po: Updated Spanish translation.
6345
6346 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6347
6348 * Makefile.am (install-exec-local): Properly install gold as
6349 default cross linker.
6350 * Makefile.in: Regenerated.
6351
6352 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6353 Nick Clifton <nickc@redhat.com>
6354
6355 * configure.ac (install_as_default): Define and set to false
6356 unless --enable-gold or --enable-gold=both/gold has been
6357 specified.
6358 * configure: Regenerate.
6359
6360 * Makefile.am (install-exec-local): Install the executable as
6361 'ld.gold'. If install_as_default is true then also install it as
6362 'ld'.
6363 * Makefile.in: Regenerated.
6364
6365 2010-04-24 Ian Lance Taylor <iant@google.com>
6366
6367 * layout.cc (Layout::layout_reloc): In relocatable link don't
6368 combine reloc sections for grouped sections.
6369
6370 2010-04-23 Sriraman Tallam <tmsriram@google.com>
6371
6372 * gc.h (gc_process_relocs): Pass information on relocs pointing to
6373 sections that are not ordinary to icf.
6374 * icf.cc (get_section_contents): Handle relocation pointing to section
6375 with no object or shndx information.
6376 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6377 * testsuite/Makefile.in: Regenerate.
6378 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6379 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6380
6381 2010-04-22 Ian Lance Taylor <iant@google.com>
6382
6383 * expression.cc (Expression::Expression_eval_info): Add
6384 result_alignment_pointer field.
6385 (Expression::eval_with_dot): Add result_alignment_pointer
6386 parameter. Change all callers.
6387 (Expression::eval_maybe_dot): Likewise.
6388 (class Binary_expression): Add alignment_pointer parameter to
6389 left_value and right_value. Change all callers.
6390 (BINARY_EXPRESSION): Set result alignment.
6391 (class Trinary_expression): Add alignment_pointer parameter to
6392 arg2_value and arg3_value. Change all callers.
6393 (Trinary_cond::value): Set result alignment.
6394 (Max_expression::value, Min_expression::value): Likewise.
6395 (Align_expression::value): Likewise.
6396 * script-sections.cc (class Sections_element): Add dot_alignment
6397 parameter to set_section_addresses virtual function. Update
6398 instantiations.
6399 (class Output_section_element): Likewise.
6400 (Script_sections::create_segments): Add dot_alignment parameter.
6401 Change all callers.
6402 (Script_sections::create_segments_from_phdrs_clause): Likewise.
6403 (Script_sections::set_phdrs_clause_addresses): Likewise.
6404 * script-sections.h: Update declarations.
6405 * script.h: Update declarations.
6406 * output.h (Output_segment::set_minimum_p_align): Don't decrease
6407 min_p_align.
6408 * testsuite/script_test_3.t: Set large alignment.
6409 * testsuite/script_test_3.sh: Make sure that at least one LOAD
6410 segment has expected alignment.
6411
6412 2010-04-22 Nick Clifton <nickc@redhat.com>
6413
6414 * po/gold.pot: Updated by the Translation project.
6415 * po/vi.po: Updated Vietnamese translation.
6416
6417 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
6418
6419 * testsuite/Makefile.am (check_PROGRAMS): Add
6420 icf_virtual_function_folding_test.
6421 * testsuite/Makefile.in: Regenerated.
6422
6423 2010-04-15 Andrew Haley <aph@redhat.com>
6424
6425 * options.h (merge_exidx_entries): New option.
6426 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6427 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6428 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6429 (Target_arm::merge_exidx_entries): New function.
6430 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6431 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6432 to Arm_exidx_fixup constructor.
6433 Add new arg, merge_exidx_entries.
6434 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6435 Arm_output_section::fix_exidx_coverage.
6436
6437 2010-04-18 Sriraman Tallam <tmsriram@google.com>
6438
6439 * icf.cc (get_section_contents): Check for preemptible functions.
6440 Ignore addend when appropriate.
6441 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
6442 section folded.
6443 (add_from_relobj): Check for section folded.
6444 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6445 * symtab.h (should_add_dynsym_entry): Add new parameter.
6446 * target-reloc.h (scan_relocs): Check for section folded.
6447 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6448 Check reloc types for function pointers in shared objects.
6449 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6450 case.
6451 (icf_preemptible_functions_test): New test case.
6452 (icf_string_merge_test): New test case.
6453 * testsuite.Makefile.in: Regenerate.
6454 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6455 bar_glob. Refactor code.
6456 * testsuite/icf_preemptible_functions_test.cc: New file.
6457 * testsuite/icf_preemptible_functions_test.sh: New file.
6458 * testsuite/icf_string_merge_test.cc: New file.
6459 * testsuite/icf_string_merge_test.sh: New file.
6460 * testsuite/icf_virtual_function_folding_test.cc: New file.
6461 * testsuite/icf_virtual_function_folding_test.sh: New file.
6462
6463 2010-04-14 Doug Kwan <dougkwan@google.com>
6464
6465 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6466 for local symbol recounting if we remove a section due to ICF.
6467 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6468 there are no regular objects in input.
6469
6470 2010-04-13 Doug Kwan <dougkwan@google.com>
6471
6472 * arm.cc (Arm_input_section::set_final_data_size): Compute
6473 accurate final data size instead of using current data size.
6474
6475 2010-04-09 Doug Kwan <dougkwan@google.com>
6476
6477 * layout.cc (Layout::choose_output_section): Handle script section
6478 types.
6479 (Layout::make_output_section_for_script): Add section type parameter.
6480 Handle script section types.
6481 * layout.h (Layout::make_output_section_for_script): Add section
6482 type parameter.
6483 * output.cc (Output_section::Output_section): Initialize data member
6484 is_noload_.
6485 (Output_section::do_reset_address_and_file_offset): Do not set address
6486 to 0 if section is a NOLOAD section.
6487 * output.h (Output_section::is_noload): New method.
6488 (Output_section::set_is_noload): Ditto.
6489 (Output_section::is_noload_): New data member.
6490 * script-c.h (Script_section_type): New enum type.
6491 (struct Parser_output_section_header): Add new file section_type.
6492 * script-sections.cc (Sections_element::output_section_name): Add
6493 parameter for returning script section type.
6494 (Output_section_definition::output_section_name): Ditto.
6495 (Output_section_definition::section_type)P; New method.
6496 (Output_section_definiton::script_section_type_name): Ditto.
6497 (Output_section_definition::script_section_type_): New data member.
6498 (Output_section_definition::Output_section_definition): Initialize
6499 data member Output_section_definition::script_section_type_.
6500 (Output_section_definition::create_sections): Pass script section type
6501 to Layout::make_output_section_for_script.
6502 (Output_section_definition::output_section_name): Return script
6503 section type to caller.
6504 (Output_section_definition::set_section_address): Do not advance
6505 dot value and load address if section type is NOLOAD. Set address
6506 of NOLOAD sections regardless of section flags.
6507 (Output_section_definition::print): Print section type if it is
6508 not SCRIPT_SECTION_TYPE_NONE.
6509 (Output_section_definition::section_type): New method.
6510 (Output_section_definition::script_section_type_name): Ditto.
6511 (Script_sections::output_section_name): Add new parameter
6512 PSECTION_TYPE for returning script section type. Pass it to
6513 section elements. Handle discard sections.
6514 (Sort_output_sections::operator()): Handle NOLOAD sections.
6515 * script-sections.h (Script_sections::Section_type): New enum type.
6516 (Script_sections::output_section_name): Add a new parameter for
6517 returning script section type.
6518 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6519 INFO and NOLOAD.
6520 * yyscript.y (union): Add new field SECTION_TYPE.
6521 (COPY, DSECT, INFO, NOLOAD): New tokens.
6522 (opt_address_and_section_type): Change type to output_section_header.
6523 (section_type): New non-terminal
6524 (section_header): Handle section type.
6525 (opt_address_and_section_type): Return section type value.
6526
6527 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
6528
6529 * testsuite/plugin_common_test_1.c (foo): Add prototype.
6530 * testsuite/plugin_common_test_2.c (foo): Likewise.
6531
6532 2010-04-08 Doug Kwan <dougkwan@google.com>
6533
6534 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6535 Output_merge_data.
6536 * output.cc (Output_section::add_merge_input_section): Simplify
6537 code and return status of Output_merge_base::add_input_section.
6538 Update merge section map only if Output_merge_base::add_input_section
6539 returns true.
6540
6541 2010-04-07 Doug Kwan <dougkwan@google.com>
6542
6543 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6544 if section is marked as containing instructions but has no mapping
6545 symbols.
6546 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6547 correct section index.
6548 (Arm_relobj::find_linked_text_section): Ditto.
6549
6550 2010-04-07 Cary Coutant <ccoutant@google.com>
6551
6552 * archive.cc (include_member): Destroy Read_symbols_data object before
6553 releasing file.
6554 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6555 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6556 (Read_symbols_data::~Read_symbols_data) New destructor.
6557 (Section_relocs::Section_relocs) New constructor.
6558 (Section_relocs::~Section_relocs) New destructor.
6559 (Read_relocs_data::Read_relocs_data) New constructor.
6560 (Read_relocs_data::~Read_relocs_data) New destructor.
6561 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6562 pointers to NULL after deleting.
6563
6564 2010-04-07 Doug Kwan <dougkwan@google.com>
6565
6566 * arm.cc: Replace "endianity" with "endianness" in comments.
6567 (Arm_exidx_cantunwind): Ditto.
6568 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6569 (Arm_relobj::merge_flags_and_attributes): New method.
6570 (Arm_relobj::merge_flags_and_attributes_): New data member.
6571 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6572 (Arm_relobj::scan_sections_for_stubs): Ditto.
6573 (Arm_relobj::do_read_symbols): Check to see if we really want to
6574 merge processor-specific flags and attributes. Exit early if
6575 an object is empty except for section names and the undefined symbol.
6576 (Target_arm::do_finalize_sections): Move check for ELF format to
6577 Arm_relobj::do_read_symbols. Merge processor specific flags and
6578 attributes from a regular object only when we have determined that
6579 it is aapropriate. Do not create an .ARM.attributes section in
6580 output if there is no regular input object.
6581 (Target_arm::merge_processor_specific_flags): Check
6582 --warn-mismatch before printing any error.
6583 (Target_arm::merge_object_attributes): Ditto.
6584 * gold.cc (queue_middle_tasks): Handle the case in which there is
6585 no regular object in input.
6586 * options.cc (General_options::parse_EB): New method.
6587 (General_options::parse_EL): Same.
6588 (General_options::General_options): Initialize endianness_.
6589 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6590 New options.
6591 (General_options::Endianness): New enum.
6592 (General_options::endianness): New method.
6593 (General_options::endianness_): New data member.
6594 * parameters.cc (Parameters::set_options): Check target endianness.
6595 (Parameters::set_target_once): Ditto.
6596 (Parameters::check_target_endianness): New method.
6597 (parameters_force_valid_target): If either -EL or -EB is specified,
6598 use it to define endianness of default target.
6599 * parameters.h (Parameters::check_target_endianness): New method
6600 declaration.
6601 * target.h (class Target): Change "endianity" to "endianness"
6602 in comments.
6603
6604 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6605
6606 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6607 * configure: Regenerate.
6608 * Makefile.in: Regenerate.
6609 * testsuite/Makefile.in: Regenerate.
6610
6611 2010-04-06 Cary Coutant <ccoutant@google.com>
6612
6613 gcc PR lto/42757
6614 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6615 prevailing definitions of common symbols.
6616 * testsuite/plugin_test_6.sh: New test case.
6617 * testsuite/plugin_common_test_1.c: New test case.
6618 * testsuite/plugin_common_test_2.c: New test case.
6619 * testsuite/Makefile.am (plugin_test_6): New test case.
6620 * testsuite/Makefile.in: Regenerate.
6621
6622 2010-04-06 Nick Clifton <nickc@redhat.com>
6623
6624 * po/vi.po: New Vietnamese translation.
6625
6626 2010-03-30 Doug Kwan <dougkwan@google.com>
6627
6628 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6629
6630 2010-03-25 Doug Kwan <dougkwan@google.com>
6631
6632 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6633 to avoid a conversion warning on a 32-bit host.
6634
6635 2010-03-24 Ian Lance Taylor <iant@google.com>
6636
6637 * testsuite/script_test_3.t: Add a TLS segment.
6638 * testsuite/Makefile.am (check_PROGRAMS): Add
6639 tls_phdrs_script_test.
6640 (tls_phdrs_script_test_SOURCES): Define.
6641 (tls_phdrs_script_test_DEPENDENCIES): Define.
6642 (tls_phdrs_script_test_LDFLAGS): Define.
6643 (tls_phdrs_script_test_LDADD): Define.
6644 * testsuite/Makefile.in: Rebuild.
6645
6646 2010-03-23 Cary Coutant <ccoutant@google.com>
6647
6648 * fileread.cc (find_or_make_view): Fix comment.
6649
6650 2010-03-23 Ian Lance Taylor <iant@google.com>
6651
6652 * script-sections.cc (class Orphan_section_placement): Define
6653 PLACE_TLS and PLACE_TLS_BSS.
6654 (Orphan_section_placement::Orphan_section_placement): Initialize
6655 new places.
6656 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6657 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6658 (tls_script_test_SOURCES): Define.
6659 (tls_script_test_DEPENDENCIES): Define.
6660 (tls_script_test_LDFLAGS): Define.
6661 (tls_script_test_LDADD): Define.
6662 * testsuite/Makefile.in: Rebuild.
6663
6664 2010-03-22 Doug Kwan <dougkwan@google.com>
6665
6666 * arm.cc (Arm_relocate_functions::abs8,
6667 Arm_relocate_functions::abs16): Use correct check for overflow
6668 specified in the ARM ELF specs.
6669 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6670 target of a BLX instruction specially.
6671 (Reloc_stub::stub_type_for_reloc): Ditto.
6672 (Relocate::relocate): Use symbolic names instead of numeric relocation
6673 codes to report error.
6674 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6675 workaround.
6676 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6677 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6678 thumb2_blx_out_of_range.stdout
6679 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6680 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6681 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6682 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6683 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6684 thumb2_blx_in_range, thumb2_blx_in_range.o,
6685 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6686 thumb2_blx_out_of_range.o): New rules.
6687 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6688 thumb2_blx_in_range and thumb2_blx_out_of_range.
6689 * testsuite/Makefile.in: Regenerate.
6690 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6691 * testsuite/thumb_blx_in_range.s: New file.
6692 * testsuite/thumb_blx_out_of_range.s: New file.
6693
6694 2010-03-22 Rafael Espindola <espindola@google.com>
6695
6696 * archive.cc (Should_include): Move to archive.h.
6697 (should_include_member): Make it a member of Archive.
6698 (Lib_group): New.
6699 (Add_lib_group_symbols): New.
6700 * archive.h: Include options.h.
6701 (Archive_member): Moved from Archive.
6702 (Should_include): Moved from archive.cc.
6703 (Lib_group): New.
6704 (Add_lib_group_symbols): New.
6705 * dynobj.cc (do_should_include_member): New.
6706 * dynobj.h (do_should_include_member): New.
6707 * gold.cc (queue_initial_tasks): Update call to queue.
6708 * main.cc (main): Print lib group stats.
6709 * object.cc (do_should_include_member): New.
6710 * object.h: Include archive.h.
6711 (Object::should_include_member): New.
6712 (Object::do_should_include_member): New.
6713 (Sized_relobj::do_should_include_member): New.
6714 * options.cc (General_options::parse_start_lib): New.
6715 (General_options::parse_end_lib): New.
6716 (Input_arguments::add_file): Handle lib groups.
6717 (Input_arguments::start_group): Check we are not in a lib.
6718 (Input_arguments::start_lib): New.
6719 (Input_arguments::end_lib): New.
6720 * options.h (General_options): Add start_lib and end_lib.
6721 (Input_argument::lib_): New.
6722 (Input_argument::lib): New.
6723 (Input_argument::is_lib): New.
6724 (Input_file_lib): New.
6725 (Input_arguments::in_lib_): New.
6726 (Input_arguments::in_lib): New.
6727 (Input_arguments::start_lib): New.
6728 (Input_arguments::end_lib_): New.
6729 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6730 in unused members as preempted.
6731 (Sized_pluginobj::do_should_include_member): New.
6732 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6733 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6734 return the blocker.
6735 (Read_symbols::do_whole_lib_group): New.
6736 (Read_symbols::do_lib_group): New.
6737 (Read_symbols::do_read_symbols): Handle lib groups.
6738 (Read_symbols::get_name): Handle lib groups.
6739 * readsyms.h (Read_symbols): Add an archive member pointer.
6740 (Read_symbols::do_whole_lib_group): New.
6741 (Read_symbols::do_lib_group): New.
6742 (Read_symbols::member_): New.
6743 * script.cc (read_input_script): Update call to queue_soon.
6744
6745 2010-03-19 Doug Kwan <dougkwan@google.com>
6746
6747 * arm.cc (Stub_table::Stub_table): Initialize new data members
6748 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6749 (Stub_table::add_reloc_stub): Assign stub offset and update
6750 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6751 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6752 New data members.
6753 (Stub_table::update_data_size_and_addralign): Use
6754 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6755 instead of going over all reloc stubs.
6756 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6757 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6758 Stringpool_template::offset_ to size of Stringpool_char.
6759 (Stringpool_template::new_key_offset): Remove code to initialize
6760 Stringpool_template::offset_.
6761 * stringpool.h (Stringpool_template::set_no_zero_null): Set
6762 Stringpool_template::offset_ to zero.
6763
6764 2010-03-15 Doug Kwan <dougkwan@google.com>
6765
6766 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6767 offset_.
6768 (Stringpool_template::new_key_offset): New method.
6769 (Stringpool_template::add_string): Assign offsets when adding new
6770 strings.
6771 (Stringpool_template::set_string_offsets): Do not set string offsets
6772 when not optimizing.
6773 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6774 member size_.
6775 (Chunked_vector::clear): Clear size_.
6776 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6777 (Chunked_vector::size): Return size_.
6778 (Chunked_vector::push_back): Use size_ to find insert position.
6779 (Chunked_vector::size_): New data member.
6780 (Stringpool_template::set_no_zero_null): Assert string set is empty.
6781 (Stringpool_template::new_key_offset): New method declaration.
6782 (Stringpool_template::offset_): New data member.
6783
6784 2010-03-15 Rafael Espindola <espindola@google.com>
6785
6786 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6787 Add_symbols' constructor.
6788 * readsyms.h (Add_symbols): Remove the input_group member.
6789
6790 2010-03-10 Ian Lance Taylor <iant@google.com>
6791
6792 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6793 target to ask whether a reference to a symbol requires a stack
6794 split.
6795 * target.h (Target::is_call_to_non_split): New function.
6796 (Target::do_is_call_to_non_split): Declare virtual function.
6797 * target.cc: Include "symtab.h".
6798 (Target::do_is_call_to_non_split): New function.
6799 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6800
6801 2010-03-10 Cary Coutant <ccoutant@google.com>
6802
6803 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6804 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6805 (File_read::open[2]): Add whole_file_view_ to list of views.
6806 (File_read::make_view): Remove test of whole_file_view_.
6807 (File_read::find_or_make_view): Create whole_file_view_ if
6808 necessary.
6809 (File_read::clear_views): Replace bool parameter with enum;
6810 adjust all callers. Don't delete views with permanent data;
6811 do delete cached views and views from archives if
6812 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6813 if clearing the corresponding view.
6814 * fileread.h (File_read::Clear_views_mode): New enum.
6815 (File_read::View::is_permanent_view): New method.
6816 (File_read::clear_views): Replace bool parameter
6817 with enum; adjust all callers.
6818 * options.h (General_options): Change keep_files_mapped option;
6819 add map_whole_files.
6820 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6821 releasing the file.
6822 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6823 the file.
6824
6825 2010-03-10 David S. Miller <davem@davemloft.net>
6826
6827 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6828
6829 2010-03-09 Sriraman Tallam <tmsriram@google.com>
6830
6831 * icf.cc (get_section_contents): Add '@' marker after processing the
6832 merge reloc.
6833
6834 2010-03-08 Doug Kwan <dougkwan@google.com>
6835
6836 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6837 due to a conversion warning.
6838 (Arm_relobj::update_output_local_symbol_count): Check for local
6839 symbol with unset output index.
6840
6841 2010-03-05 Ian Lance Taylor <iant@google.com>
6842
6843 * options.h (class General_options): Add --spare-dynamic-tags.
6844 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6845 --spare-dynamic-tags.
6846
6847 2010-03-05 Ian Lance Taylor <iant@google.com>
6848
6849 * incremental.cc: Include "libiberty.h".
6850
6851 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6852
6853 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6854 function, is_info_ member.
6855 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6856 (Versions::Versions): Update caller.
6857 (Versions::define_base_version): Likewise.
6858 (Versions::add_def): Likewise.
6859
6860 2010-03-03 Sriraman Tallam <tmsriram@google.com>
6861
6862 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6863 (Scan::possible_function_pointer_reloc): New function.
6864 (Scan::local_reloc_may_be_function_pointer): Change to call
6865 possible_function_pointer_reloc.
6866 (Scan::global_reloc_may_be_function_pointer): Ditto.
6867 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6868 relocations in ".data.rel.ro._ZTV" section.
6869 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6870 * testsuite/icf_safe_so_test.cc: Ditto.
6871 * testsuite/icf_safe_test.cc: Ditto.
6872 * testsuite/icf_safe_test.sh: Ditto.
6873
6874 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6875 Ian Lance Taylor <iant@google.com>
6876
6877 * target-reloc.h (relocate_section): Check the symbol table index
6878 for -1U before setting the local symbol index.
6879 (scan_relocatable_relocs): If copying the relocation, record that
6880 the local symbol is required.
6881 * object.h (Symbol_value::is_output_symtab_index_set): New
6882 function.
6883 (Symbol_value::may_be_discarded_from_output_symtab): New
6884 function.
6885 (Symbol_value::has_output_symtab_entry): New function.
6886 (Symbol_value::needs_output_symtab_entry): Remove.
6887 (Symbol_value::output_symtab_index): Make sure the symbol index is
6888 set.
6889 (Symbol_value::set_output_symtab_index): Make sure the symbol
6890 index is not set. Make sure the new index is valid.
6891 (Symbol_value::set_must_have_output_symtab_entry): New function.
6892 (Symbol_value::has_output_dynsym_entry): New function.
6893 (Symbol_value::set_output_dynsym_index): Make sure the new index
6894 is valid.
6895 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6896 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6897 local symbol if permitted.
6898 (Sized_relobj::do_finalize_local_symbols): Call
6899 is_output_symtab_index_set rather than needs_output_symtab_entry.
6900 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6901 rather than needs_output_symtab_entry. Call
6902 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6903 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6904 is_output_symtab_index_set rather than needs_output_symtab_entry.
6905 * testsuite/discard_locals_relocatable_test.c: New file.
6906 * testsuite/discard_locals_test.sh: Test -r.
6907 * testsuite/Makefile.am (check_DATA): Add
6908 discard_locals_relocatable_test1.syms,
6909 discard_local_relocatable_test2.syms.
6910 (MOSTLYCLEANFILES): Likewise. Also add
6911 discard_locals_relocatable_test1.lout and
6912 discard_locals_relocatable_test2.out.
6913 (discard_locals_relocatable_test1.syms): New target.
6914 (discard_locals_relocatable_test.o): New target.
6915 (discard_locals_relocatable_test1.out): New target.
6916 (discard_locals_relocatable_test2.syms): New target.
6917 (discard_locals_relocatable_test2.out): New target.
6918 (various): Add missing ../ld-new dependencies.
6919 * testsuite/Makefile.in: Rebuild.
6920
6921 2010-03-03 Nick Clifton <nickc@redhat.com>
6922
6923 * po/fi.po: New Finnish translation.
6924
6925 2010-03-01 Doug Kwan <dougkwan@google.com>
6926
6927 * layout.cc (Layout::Layout): Force section types of .init_array*,
6928 .preinit_array* and .fini_array* sections.
6929 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6930 Fix check of return value of std::string::find.().
6931 (Output_section::Input_section_sort_compare::operator()): Remove
6932 comment about .init_array.
6933 (Output_section::Input_section_sort_init_fini_compare::operator()):
6934 New method.
6935 (Output_section::sort_attached_input_sections): Handle .init_array
6936 and .fini_array specially.
6937 * output.h (Output_section::Inut_section_sort_compare): Update
6938 comment.
6939 (Output_section::Input_section_sort_init_fini_compare): New struct.
6940
6941 2010-02-26 Doug Kwan <dougkwan@google.com>
6942
6943 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6944 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6945 * testsuite/debug_msg.sh: Avoid matching source line number for
6946 use of global variable undef_int.
6947
6948 2010-02-26 Doug Kwan <dougkwan@google.com>
6949
6950 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6951 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6952 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6953 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6954 * options.cc (General_options::General_options): Initialize member
6955 fix_v4bx_.
6956 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6957 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6958 and rm_no_fix_v4bx.stdout
6959 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6960 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6961 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6962 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6963 and arm_no_fix_v4bx.
6964 * Makefile.in: Regenerate.
6965 * testsuite/arm_fix_v4bx.s: New file.
6966 * testsuite/arm_fix_v4bx.sh: Ditto.
6967
6968 2010-02-24 Doug Kwan <dougkwan@google.com>
6969
6970 * arm.cc (Target_arm::got_section): Make the .got section the first
6971 non RELRO section in the data segment.
6972 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6973 suffixes of section names.
6974
6975 2010-02-24 Doug Kwan <dougkwan@google.com>
6976
6977 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6978 flags and attributes merging if an input file is a binary file.
6979 * fileread.cc (Input_file::open): Record format of original file.
6980 * fileread.h (Input_file::Format): New enum type.
6981 (Input_file::Input_file): Initialize data member format_.
6982 (Input_file::format): New method definition.
6983 (Input_file::format_):: New data member.
6984
6985 2010-02-24 Doug Kwan <dougkwan@google.com>
6986
6987 * arm.cc (Arm_output_data_got): New class.
6988 (ARM_TCB_SIZE): New constant
6989 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6990 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6991 If user uses a script with a SECTIONS clause, issue only a warning
6992 for a misplaced EXIDX input section. Otherwise, issue an error.
6993 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6994 garbage collection.
6995 (Target_arm::got_mode_index_entry): Handle static linking.
6996 (Target_arm::Scan::local): Ditto.
6997 (Target_arm::Scan::global): Ditto.
6998 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6999 all incorrectly implemented relocations.
7000 (Target_arm::fix_exidx_coverage): Pass layout to
7001 Arm_output_section::fix_exidx_coverage.
7002 * layout.cc (Layout::section_name_mapping): Remove trailing dots
7003 from ".ARM.exidx." and ".ARM.extab.".
7004
7005 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7006
7007 * arm.cc (Target_arm::do_finalize_sections): Create attribute
7008 section if it does not already exist.
7009 * attributes.cc (Attributes_section_data::Attributes_section_data):
7010 Don't crash if size is zero.
7011
7012 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7013 Ian Lance Taylor <iant@google.com>
7014
7015 * gold.cc (queue_middle_tasks): If no input files were opened,
7016 exit.
7017 * workqueue.h (Task_function::Task_function): Assert that there is
7018 a blocker.
7019
7020 2010-02-22 Doug Kwan <dougkwan@google.com>
7021
7022 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7023 * icf.cc (get_section_contents): Cast snprintf arguments to long long
7024 types to avoid warnings due to different uint64_t implementations
7025 on different hosts.
7026
7027 2010-02-21 Doug Kwan <dougkwan@google.com>
7028
7029 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7030 handling of the maximum backward branch offset.
7031 (Arm_relocate_functions::thumb_branch_common): Ditto.
7032 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7033 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7034 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7035 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7036 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7037 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7038 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7039 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7040 thumb_bl_out_of_range thumb_bl_out_of_range.o,
7041 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7042 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7043 thumb2_bl_out_of_range.o): New rules.
7044 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7045 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7046 thumb2_bl_out_of_range
7047 * testsuite/Makefile.in: Regenerate.
7048 * testsuite/arm_bl_in_range.s: New file.
7049 * testsuite/arm_bl_out_of_range.s: Ditto.
7050 * testsuite/arm_branch_in_range.sh: Ditto.
7051 * testsuite/arm_branch_range.t: Ditto.
7052 * testsuite/thumb2_branch_range.t: Ditto.
7053 * testsuite/thumb_bl_in_range.s: Ditto.
7054 * testsuite/thumb_bl_out_of_range.s: Ditto.
7055 * testsuite/thumb_branch_range.t: Ditto.
7056
7057 2010-02-20 Sriraman Tallam <tmsriram@google.com>
7058
7059 * gc.h (gc_process_relocs): Change vectors to point to the new list.
7060 Add reloc offset information.
7061 * icf.cc (get_section_contents): Change iterators to point to the new
7062 vectors. Add reloc offset information to the contents.
7063 * icf.h (Icf::Sections_reachable_info): New typedef.
7064 (Icf::Sections_reachable_list): New typedef.
7065 (Icf::Offset_info): New typedef.
7066 (Icf::Reloc_info): New struct typedef.
7067 (Icf::Reloc_info_list): New typedef.
7068 (Icf::symbol_reloc_list): Delete method.
7069 (Icf::addend_reloc_list): Delete method.
7070 (Icf::section_reloc_list): Delete method.
7071 (Icf::reloc_info_list): New method.
7072 (Icf::reloc_info_list_): New member.
7073
7074 2010-02-19 Doug Kwan <dougkwan@google.com>
7075
7076 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7077 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7078 * arm.cc (Arm_relocation_functions): New forward declaration.
7079 (Target_arm::Target_arm): Initialize new data members
7080 got_mod_index_offset_ and tls_base_symbol_defined_.
7081 (Target_arm::Relocate::relocate_tls): New method.
7082 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7083 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7084 New methods.
7085 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7086 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7087 (Target_arm::got_mod_index_offset_,
7088 Target_arm::tls_base_symbol_defined_): New data members.
7089 (Target_arm::Scan::local, Target::Scan::global,
7090 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7091 relocations.
7092
7093 2010-02-18 Doug Kwan <dougkwan@google.com>
7094
7095 * arm.cc (Arm_relobj::find_linked_text_section): New method.
7096 (Arm_relobj::make_exidx_input_section): Pass section index of linked
7097 text section as a parameter becuase some broken tools may not set
7098 the link in section header.
7099 (Target_arm::has_got_section): New method.
7100 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7101 without any mapping symbol as data only. Remove warning.
7102 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7103 link in its section header, try to discover the link by inspecting the
7104 REL31 relocation at the beginning of the section.
7105 (Target_arm::Scan::check_non_pic): Report name of offending relocation
7106 in error message.
7107 (Target_arm::Scan::global): Treat any reference to the symbol
7108 _GLOBAL_OFFSET_TABLE_ as a GOT access.
7109
7110 2010-02-12 Sriraman Tallam <tmsriram@google.com>
7111
7112 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7113 (Scan::global_reloc_may_be_function_pointer): New function.
7114 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7115 (Scan::global_reloc_may_be_function_pointer): New function.
7116 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7117 (Scan::global_reloc_may_be_function_pointer): New function.
7118 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7119 (Scan::global_reloc_may_be_function_pointer): New function.
7120 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7121 (Scan::global_reloc_may_be_function_pointer): New function.
7122 (Scan::possible_function_pointer_reloc): New function.
7123 (Target_x86_64::can_check_for_function_pointers): New function.
7124 * gc.h (gc_process_relocs): Scan relocation types to determine if
7125 function pointers were taken for targets that support it.
7126 * icf.cc (Icf::find_identical_sections): Include functions for
7127 folding in safe ICF whose pointer is not taken.
7128 * icf.h (Secn_fptr_taken_set): New typedef.
7129 (fptr_section_id_): New member.
7130 (section_has_function_pointers): New function.
7131 (set_section_has_function_pointers): New function.
7132 (check_section_for_function_pointers): New function.
7133 * options.h: Fix comment for safe ICF option.
7134 * target.h (can_check_for_function_pointers): New function.
7135 * testsuite/Makefile.am: Add icf_safe_so_test test case.
7136 Modify icf_safe_test for X86-64.
7137 * testsuite/Makefile.in: Regenerate.
7138 * testsuite/icf_safe_so_test.cc: New file.
7139 * testsuite/icf_safe_so_test.sh: New file.
7140 * testsuite/icf_safe_test.cc (kept_func_3): New function.
7141 (main): Change to take pointer to function kept_func_3.
7142 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7143 folding is done correctly for X86-64.
7144
7145 2010-02-12 David S. Miller <davem@davemloft.net>
7146
7147 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7148 is_symbolless parameter.
7149 (Output_reloc<SHT_REL>::is_symbolless): New.
7150 (Output_reloc<SHT_REL>::is_symbolless_): New.
7151 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7152 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7153 (Output_reloc<SHT_RELA>::is_symbolless): New.
7154 (Output_data_reloc::add_global): Handle is_symbolless.
7155 (Output_data_reloc::add_global_relative): Likewise.
7156 (Output_data_reloc::add_local): Likewise.
7157 (Output_data_reloc::add_local_relative): Likewise.
7158 (Output_data_reloc::add_symbolless_global_addend): New.
7159 (Output_data_reloc::add_symbolless_local_addend): New.
7160 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7161 is_symbolless.
7162 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7163 instead of ->is_relative_
7164 (Output_reloc::write): Likewise.
7165 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7166 (Output_reloc::write_rel): Simplify.
7167
7168 * sparc.cc (Target_sparc::Scan::local): Use
7169 ->add_symbolless_local_addend as needed.
7170 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7171 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
7172 based upon relocation offset.
7173
7174 2010-02-11 Doug Kwan <dougkwan@google.com>
7175
7176 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7177 (Target_arm::Scan::global): Ditto. Also remove a comment before the
7178 beginning of function.
7179 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7180 and MOVT_ABS relocations. Those are non issued in scanning. Fix
7181 parameter is_32bit in calls to should_apply_static_reloc.
7182 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7183 (check_DATA): Add arm_abs_global.stdout.
7184 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7185 arm_abs_global.stdout): New rules.
7186 (MOSTLLYCLEANFILES): Add arm_abs_global
7187 * Makefile.in: Regenerate.
7188 * testsuite/arm_abs_global.s: New file.
7189 * testsuite/arm_abs_global.sh: Ditto.
7190 * testsuite/arm_abs_lib.s: Ditto.
7191
7192 2010-02-11 Ian Lance Taylor <iant@google.com>
7193
7194 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7195 Read_relocs task.
7196 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
7197 Allocate_commons_task first.
7198 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7199 task, rather than symtab_lock_.
7200 (Gc_process_relocs::~Gc_process_relocs): New function.
7201 (Gc_process_relocs::is_runnable): Check this_blocker_.
7202 (Gc_process_relocs::locks): Use next_blocker_ rather than
7203 blocker_.
7204 (Scan_relocs::~Scan_relocs): New function.
7205 (Scan_relocs::is_runnable): Check this_blocker_ rather than
7206 symtab_lock_.
7207 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
7208 next_blocker_.
7209 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7210 fields. Add this_blocker_ and next_blocker_ fields. Adjust
7211 constructor accordingly.
7212 (class Gc_process_relocs): Likewise.
7213 (class Scan_relocs): Likewise.
7214 * common.h (class Allocate_commons_task): Remove symtab_lock_
7215 field, and corresponding constructor parameter.
7216 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7217 symtab_lock_.
7218 (Allocate_commons_task::locks): Likewise.
7219
7220 2010-02-11 Ian Lance Taylor <iant@google.com>
7221
7222 * gold-threads.h (class Once): Define.
7223 (class Initialize_lock): Rewrite as child of Once.
7224 * gold-threads.cc (class Once_initialize): Define.
7225 (once_pointer_control): New static variable.
7226 (once_pointer, once_arg): New static variables.
7227 (c_run_once): New static function.
7228 (Once::Once, Once::run_once, Once::internal_run): New functions.
7229 (class Initialize_lock_once): Remove.
7230 (initialize_lock_control): Remove.
7231 (initialize_lock_pointer): Remove.
7232 (initialize_lock_once): Remove.
7233 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7234 (Initialize_lock::initialize): Rewrite.
7235 (Initialize_lock::do_run_once): New function.
7236 * archive.cc (Archive::interpret_header): Only clear name if it is
7237 not already empty.
7238 * fileread.cc: Include "gold-threads.h"
7239 (file_counts_lock): New static variable.
7240 (file_counts_initialize_lock): Likewise.
7241 (File_read::release): Only increment counts when using --stats.
7242 Use a lock around the increment.
7243 * parameters.cc (class Set_parameters_target_once): Define.
7244 (set_parameters_target_once): New static variable.
7245 (Parameters::Parameters): Move here from parameters.h.
7246 (Parameters::set_target): Rewrite.
7247 (Parameters::set_target_once): New function.
7248 (Parameters::clear_target): Move here and rewrite.
7249 * parameters.h (class Parameters): Update declarations. Add
7250 set_parameters_target_once_ field.
7251 (Parameters::Parameters): Move to parameters.cc.
7252 (Parameters::clear_target): Likewise.
7253 * readsyms.cc (Read_symbols::do_group): Create a Start_group
7254 task.
7255 (Start_group::~Start_group): New function.
7256 (Start_group::is_runnable): New function.
7257 (Start_group::locks, Start_group::run): New functions.
7258 (Finish_group::run): Change saw_undefined to size_t.
7259 * readsyms.h (class Start_group): Define.
7260 (class Finish_group): Change saw_undefined_ field to size_t.
7261 (Finish_group::Finish_group): Remove saw_undefined and
7262 this_blocker parameters. Change all callers.
7263 (Finish_group::set_saw_undefined): New function.
7264 (Finish_group::set_blocker): New function.
7265 * symtab.h (class Symbol_table): Change saw_undefined to return
7266 size_t. Change saw_undefined_ field to size_t.
7267 * target-select.cc (Set_target_once::do_run_once): New function.
7268 (Target_selector::Target_selector): Initialize set_target_once_
7269 field. Don't initialize lock_ and initialize_lock_ fields.
7270 (Target_selector::instantiate_target): Rewrite.
7271 (Target_selector::set_target): New function.
7272 * target-select.h (class Set_target_once): Define.
7273 (class Target_selector): Update declarations. Make
7274 Set_target_once a friend. Remove lock_ and initialize_lock_
7275 fields. Add set_target_once_ field.
7276
7277 2010-02-10 Ian Lance Taylor <iant@google.com>
7278
7279 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7280 queueing any tasks.
7281 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
7282 (queue_middle_tasks): Add all blockers before queueing any tasks.
7283 (queue_final_tasks): Likewise.
7284 * token.h (Task_token::add_blockers): New function.
7285 * object.h (Input_objects::number_of_relobjs): New function.
7286
7287 2010-02-10 Ian Lance Taylor <iant@google.com>
7288
7289 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7290 shared, not if not position independent.
7291 * x86_64.cc (Relocate::relocate_tls): Likewise.
7292 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7293 (tls_pie_pic_test): New target.
7294 * testsuite/Makefile.in: Rebuild.
7295
7296 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7297 (tls_test_main_pie.o, tls_test_pie.o): New targets.
7298 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7299 * testsuite/Makefile.in: Rebuild.
7300
7301 2010-02-09 David S. Miller <davem@davemloft.net>
7302
7303 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7304 R_SPARC_RELATIVE using ->add_local_relative().
7305 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7306
7307 * output.h (Output_data_dynamic::add_section_size): New method
7308 that takes two Output_data objects.
7309 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7310 entry param. Handle it in initializers.
7311 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7312 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7313 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7314 arg.
7315 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7316 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7317 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7318 for dynrel_includes_plt.
7319 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7320 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7321 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7322 before .rela.plt
7323 (Target_sparc::do_finalize_sections): Update to pass true for
7324 dynrel_includes_plt.
7325 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7326 output before .rela.plt
7327 (Target_powerpc::do_finalize_sections): Update to pass true for
7328 dynrel_includes_plt when 32-bit.
7329
7330 2010-02-08 Doug Kwan <dougkwan@google.com>
7331
7332 * arm.cc (Arm_relobj::simple_input_section_output_address): New
7333 method.
7334 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7335 Arm_relobj::scan_section_for_cortex_a8_stubs,
7336 Arm_relobj::do_relocation_section): Instead of calling
7337 Output_section::output_address, use faster
7338 Arm_relobj::simple_input_section_output_address.
7339
7340 2010-02-08 David S. Miller <davem@davemloft.net>
7341
7342 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7343 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7344 relocation helper function.
7345
7346 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7347 just like R_SPARC_GOT{10,13,22}.
7348 (Target_sparc::Scan::local): Likewise.
7349 (Target_sparc::Relocate:relocate): Likewise.
7350
7351 2010-02-06 Ian Lance Taylor <iant@google.com>
7352
7353 * configure.ac: Rewrite targetobjs duplicate removal code to use
7354 only shell constructs.
7355 * configure: Rebuild.
7356
7357 2010-02-05 Doug Kwan <dougkwan@google.com>
7358
7359 PR 11247
7360 * arm.cc (Arm_relobj::section_is_scannable): New method.
7361 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7362 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7363
7364 2010-02-04 Doug Kwan <dougkwan@google.com>
7365
7366 PR 11247
7367 * arm-reloc-property.cc (cstdio): Include.
7368 * configure.ac (targetobjs): Remove duplicates.
7369 * configure: Regenerate.
7370 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7371 big and little endian version for a given address size.
7372
7373 2010-02-03 Doug Kwan <dougkwan@google.com>
7374
7375 * arm-reloc-property.cc
7376 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7377 definition.
7378 * arm-reloc-property.h
7379 (Arm_reloc_property_table::get_implemented_static_reloc_property):
7380 New method definition.
7381 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7382 declaration.
7383 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7384 overflow to N.
7385 (GOT_PREL): Change implemented to Y.
7386 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7387 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7388 (Arm_relocate_functions::movw_abs_nc): Remove method.
7389 (Arm_relocate_functions::movt_abs): Ditto.
7390 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7391 (Arm_relocate_functions::thm_movt_abs): Ditto.
7392 (Arm_relocate_functions::movw_rel_nc): Ditto.
7393 (Arm_relocate_functions::movw_rel): Ditto.
7394 (Arm_relocate_functions::movt_rel): Ditto.
7395 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7396 (Arm_relocate_functions:thm_movw_rel): Ditto.
7397 (Arm_relocate_functions:thm_movt_rel): Ditto.
7398 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7399 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7400 New method definitions.
7401 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7402 (Arm_relocation_functions::arm_grp_ldr): Ditto.
7403 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7404 (Arm_relocation_functions::arm_grp_ldc): Ditto.
7405 (Target_arm::Relocate::relocate): Check for non-static or
7406 unimplemented relocation code and exit early. Change calls to
7407 Target_arm::reloc_uses_thumb_bit and
7408 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7409 instead. Refactor code to handle similar relocations to increase
7410 code sharing. Remove check for unsupported relocation code in switch
7411 statement.
7412 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7413 relocation property table to find out size. Change error message to
7414 print out the name of a relocation code instead of the numeric value.
7415 (Target_arm::scan_reloc_for_stub): Use relocation property table
7416 instead of calling Target_arm::reloc_uses_thumb_bit().
7417
7418 2010-02-02 Doug Kwan <dougkwan@google.com>
7419
7420 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7421 types of relaxed input section.
7422
7423 2010-02-02 Doug Kwan <dougkwan@google.com>
7424
7425 * Makefile.am (HFILES): Add arm-reloc-property.h.
7426 (DEFFILES): New.
7427 (TARGETSOURCES): Add arm-reloc-property.cc
7428 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7429 (libgold_a_SOURCES): $(DEFFILES)
7430 * Makefile.in: Regenerate.
7431 * arm-reloc-property.cc: New file.
7432 * arm-reloc-property.h: New file.
7433 * arm-reloc.def: New file.
7434 * arm.cc: Update comments.
7435 (arm-reloc-property.h): New included header.
7436 (arm_reloc_property_table): New global variable.
7437 (Target_arm::do_select_as_default_target): New method definition.
7438 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7439 arm-reloc-property to targ_extra_obj.
7440 * parameters.cc (set_parameters_target): Call
7441 Target::select_as_default_target().
7442 * target.h (Target::select_as_default_target): New method definition.
7443 (Target::do_select_as_default_target): Same.
7444
7445 2010-02-01 Doug Kwan <dougkwan@google.com>
7446
7447 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7448 first_output_text_section_.
7449 (Arm_exidx_fixup::first_output_text_section): New method definition.
7450 (Arm_exidx_fixup::first_output_text_section_): New data member.
7451 (Arm_exidx_fixup::process_exidx_section): Record the first text
7452 output section seen.
7453 (Arm_output_section::fix_exidx_coverage): Set correct linked section
7454 and entsize in output section header.
7455
7456 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7457
7458 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7459 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7460 (Arm_relocate_functions::thm_alu11): New Method.
7461 (Arm_relocate_functions::thm_pc8): New Method.
7462 (Arm_relocate_functions::thm_pc12): New Method.
7463 (Target_arm::Scan::local): Handle the relocations.
7464 (Target_arm::Scan::global): Likewise.
7465 (Target_arm::Relocate::relocate): Likewise.
7466 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7467
7468 2010-01-29 Doug Kwan <dougkwan@google.com>
7469
7470 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7471 of relocation types as ld.
7472
7473 2010-01-29 Doug Kwan <dougkwan@google.com>
7474
7475 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7476 to public.
7477 (Arm_relocate_functions::thumb_branch_common): Ditto.
7478 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7479 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7480 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7481 Arm_relocate_functions::jump24): Remove.
7482 (Target_arm::Relocate::relocate): Adjust code to call
7483 Arm_relocation_functions::arm_branch_common and
7484 Arm_relocation_functions::thumb_branch_common instead of their removed
7485 wrappers. Merge switch-cases together to reduce source code size.
7486
7487 2010-01-29 Doug Kwan <dougkwan@google.com>
7488
7489 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7490 output_local_symbol_count_needs_update_.
7491 (Arm_relobj::output_local_symbol_count_needs_update,
7492 Arm_relobj::set_output_local_symbol_count_needs_update,
7493 Arm_relobj::update_output_local_symbol_count): New methods.
7494 (Arm_relobj::output_local_symbol_count_needs_update_): New data
7495 member.
7496 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7497 of pointed function as in a R_ARM_PREL31 relocation.
7498 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7499 for output local symbol count updating.
7500 (Target_arm::do_relax): Update output local symbol counts in objects
7501 if necessary.
7502 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7503
7504 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7505
7506 * arm.cc: Added support for the ARM relocations:
7507 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7508 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7509 (Arm_relocate_functions::movw_rel_nc): Renamed (was
7510 movw_prel_nc).
7511 (Arm_relocate_functions::movw_rel): New method.
7512 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7513 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7514 thm_movw_prel_nc).
7515 (Arm_relocate_functions::thm_movw_rel): New method.
7516 (Arm_relocate_functions::thm_movt_rel): Renamed (was
7517 thm_movt_prel).
7518 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7519 relocations.
7520 (Target_arm::Scan::global): Likewise.
7521 (Target_arm::Relocate::relocate): Likewise.
7522 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7523 Likewise.
7524
7525 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7526
7527 * arm.cc: Added support for ARM group relocations.
7528 (Target_arm::reloc_needs_sym_origin): New method.
7529 (Arm_relocate_functions::calc_grp_kn): New method.
7530 (Arm_relocate_functions::calc_grp_residual): New method.
7531 (Arm_relocate_functions::calc_grp_gn): New method.
7532 (Arm_relocate_functions::arm_grp_alu): New Method.
7533 (Arm_relocate_functions::arm_grp_ldr): New Method.
7534 (Arm_relocate_functions::arm_grp_ldrs): New Method.
7535 (Arm_relocate_functions::arm_grp_ldc): New Method.
7536 (Target_arm::Scan::local): Handle the ARM group relocations.
7537 (Target_arm::Scan::global): Likewise.
7538 (Target_arm::Relocate::relocate): Likewise.
7539 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7540 Likewise.
7541
7542 2010-01-26 Doug Kwan <dougkwan@google.com>
7543
7544 * arm.cc (set): Include.
7545 (class Arm_exidx_fixup): Change type of last_input_section_ to const
7546 pointer type.
7547 (Arm_output_section::Text_section_list): New type.
7548 (Arm_output_section::append_text_sections_to_list): New method.
7549 (Arm_output_section::fix_exidx_coverage): Ditto.
7550 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7551 (Arm_relobj::convert_input_section_to_relaxed_section): Use
7552 Relobj::set_section_offset() instead of
7553 Sized_relobj::invalidate_section_offset().
7554 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7555 parameter for section headers. Ignore relocation sections for
7556 unallocated sections and EXIDX sections.
7557 (Target_arm::fix_exidx_coverage): New method.
7558 (Target_arm::output_section_address_less_than): New type.
7559 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7560 linked text section instead of the EXIDX section.
7561 (Arm_output_section::create_stub_group): Add an assertion to check
7562 that this is not an EXIDX output section.
7563 (Arm_output_section::append_text_sections_to_list): New method.
7564 (Arm_output_section::fix_exidx_coverage): Ditto.
7565 (Arm_relobj::scan_sections_for_stubs): Adjust call to
7566 Arm_relobj::section_needs_reloc_stub_scanning.
7567 (Target_arm::do_relax): Fix EXIDX output section coverage in the
7568 first pass.
7569 (Target_arm::fix_exidx_coverage): New method.
7570 * object.h (Relobj::set_output_section): New method.
7571 (Sized_relobj::invalidate_section_offset): Remove method.
7572 (Sized_relobj::do_invalidate_section_offset): Remove method.
7573 (Sized_relobj::do_set_section_offset): Handle offset value -1.
7574
7575 2010-01-25 Doug Kwan <dougkwan@google.com>
7576
7577 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7578 Fix warning due to signed and unsigned comparison on a 32-bit host.
7579
7580 2010-01-22 Doug Kwan <dougkwan@google.com>
7581
7582 * arm.cc (Target_arm::do_relax): Record an output section for section
7583 offset adjustment it contains any stub table that has changed.
7584 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7585 offsets in an output section if necessary.
7586 * output.cc (Output_section::Output_section): Initialize
7587 section_offsets_need_adjustments_.
7588 (Output_section::add_input_section_for_script): Renamed to
7589 Output_section::add_simple_input_section.
7590 (Output_section::save_states): Add a comment.
7591 (Output_section::discard_states): New method defintion.
7592 (Output_section::adjust_section_offsets): Same.
7593 * output.h (Output_section::add_input_section_for_script): Renamed to
7594 Output_section::add_simple_input_section.
7595 (Output_section::discard_states): New method declaration.
7596 (Output_section::adjust_section_offsets): Same.
7597 (Output_section::section_offsets_need_adjustment,
7598 Output_section::set_section_offsets_need_adjustment): New method
7599 definitions.
7600 (Output_section::section_offsets_need_adjustment_): New data member.
7601 * script-sections.cc
7602 (Output_section_element_input::set_section_address): Adjust code for
7603 renaming of Output_section::add_input_section_for_script.
7604 (Orphan_output_section::set_section_address): Same.
7605
7606 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7607
7608 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7609 Fix_v4bx enum values .
7610 * gold/options.h (General_options): New option definitions.
7611 (General_options::fix_v4bx): New method.
7612 (General_options::Fix_v4bx): New enum.
7613 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7614 (General_options::parse_fix_v4bx_interworking): New method.
7615
7616 2010-01-22 Doug Kwan <dougkwan@google.com>
7617
7618 * arm.cc (Arm_exidx_fixup): New class.
7619
7620 2010-01-21 Doug Kwan <dougkwan@google.com>
7621
7622 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7623 classes.
7624 (Arm_exidx_section_offset_map): New type.
7625
7626 2010-01-21 Doug Kwan <dougkwan@google.com>
7627
7628 * arm.cc (Arm_exidx_input_section): New class.
7629 (Arm_relobj::exidx_input_section_by_link,
7630 Arm_relobj::exidx_input_section_by_shndx,
7631 Arm_relobj::make_exidx_input_section): New methods.
7632 (read_arm_attributes_section): Remove.
7633 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7634 information about them.
7635 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7636 to here.
7637
7638 2010-01-20 Doug Kwan <dougkwan@google.com>
7639
7640 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7641 Input_section_specifier to Section_id.
7642 (Target_arm::new_arm_input_section: Adjust code for change of key
7643 type.
7644 (Target_arm::find_arm_input_section): Ditto.
7645 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7646 (Section_id): Remove.
7647 (Garbage_collection::Section_id_hash): Remove.
7648 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7649 (Section_id): Remove.
7650 (Icf::Section_id_hash): Remove.
7651 * object.h (Section_id, Const_section_id, Section_id_hash,
7652 Const_section_id_hash): New type definitions.
7653 * output.cc (Output_section::add_relaxed_input_section): Change to
7654 use Const_section_id instead of Input_section_specifier as key type.
7655 (Output_section::add_merge_input_section): Ditto.
7656 (Output_section::build_relaxation_map): Change to use Section_id
7657 instead of Input_section_specifier as key type.
7658 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7659 Ditto.
7660 (Output_section::convert_input_sections_to_relaxed_sections): Change
7661 to use Const_section_id instead of Input_section_specifier as key type.
7662 (Output_section::find_merge_section): Ditto.
7663 (Output_section::find_relaxed_input_section): Ditto.
7664 * output.h (Input_section_specifier): Remove class.
7665 (Output_section::Output_section_data_by_input_section_map): Change
7666 key type to Const_section_id.
7667 (Output_section::Output_relaxed_input_section_by_input_section_map):
7668 Ditto.
7669 (Output_section::Relaxation_map): Change key type to Section_id.
7670
7671 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7672
7673 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7674 (class Arm_v4bx_stub): New class.
7675 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7676 (Stub_factory::make_arm_v4bx_stub): New method.
7677 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7678 (Stub_table::empty): Handle v4bx stubs.
7679 (Stub_table::add_arm_v4bx_stub): New method.
7680 (Stub_table::find_arm_v4bx_stub): New method.
7681 (Arm_relocate_functions::v4bx): New method.
7682 (Target_arm::fix_v4bx): New method.
7683 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7684 (Stub_table::relocate_stubs): Likewise.
7685 (Stub_table::do_write): Likewise.
7686 (Stub_table::update_data_size_and_addralign): Likewise.
7687 (Stub_table::finalize_stubs): Likewise.
7688 (Target_arm::Scan::local): Likewise.
7689 (Target_arm::Scan::global): Likewise.
7690 (Target_arm::do_finalize_sections): Likewise.
7691 (Target_arm::Relocate::relocate): Likewise.
7692 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7693 Likewise.
7694 (Target_arm::scan_reloc_for_stub): Likewise.
7695 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7696
7697 2010-01-19 Ian Lance Taylor <iant@google.com>
7698
7699 * output.cc (Output_section_headers::do_sized_write): Write large
7700 segment count to sh_info field.
7701 (Output_file_header::do_sized_write): For large segment count,
7702 write PN_XNUM to e_phnum field.
7703
7704 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7705
7706 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7707 (Arm_relocate_functions::thm_jump8): New function.
7708 (Arm_relocate_functions::thm_jump11): New function.
7709 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7710 R_ARM_THM_JUMP11.
7711 (Target_arm::Scan::global): Likewise.
7712 (Target_arm::Relocate::relocate): Likewise.
7713 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7714 Likewise.
7715
7716 2010-01-14 Doug Kwan <dougkwan@google.com>
7717
7718 * arm.cc (map, utility): Include headers.
7719 (Target_arm::apply_cortex_a8_workaround): New method.
7720 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7721 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7722 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7723 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7724 the --[no-]fix-cortex-a8 command line options.
7725 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7726 (Target_arm::relocate_stub): Use addend in instruction template.
7727 * options.h (DEFINE_bool): Set the user-set flag.
7728 (General_options): Add --[no-]-fix-cortex options.
7729 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7730 : Update fast look-up map after conversion.
7731
7732 2010-01-14 Sriraman Tallam <tmsriram@google.com>
7733
7734 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7735 in the first pass of do_layout.
7736
7737 2010-01-13 Doug Kwan <dougkwan@google.com>
7738
7739 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7740 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7741 apparent compiler problem of not folding static constant integral
7742 data members of elfcpp::Elf_sizes<32>.
7743
7744 2010-01-13 Doug Kwan <dougkwan@google.com>
7745
7746 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7747 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7748 Arm_relobj::scan_section_for_cortex_a8_erratum,
7749 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7750 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7751 sections to scan for relocation stubs into a new method
7752 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7753 relocation and Cortex-A8 stub scanning.
7754 (Target_arm::do_relax): Force stubs to be after stubbed sections
7755 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
7756 the beginning of a new relaxation pass. Update a comment.
7757 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7758
7759 2010-01-12 Ian Lance Taylor <iant@google.com>
7760
7761 * target-reloc.h (visibility_error): New inline function.
7762 (relocate_section): Call visibility_error.
7763 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7764 (MOSTLYCLEANFILES): Likewise.
7765 (protected_4_pic.o, protected_3.err): New targets.
7766 * testsuite/protected_4.cc: New file.
7767
7768 2010-01-12 Doug Kwan <dougkwan@google.com>
7769
7770 * arm.cc (Cortex_a8_reloc): New class.
7771 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7772 and cortex_a8_relocs_info_.
7773 (Target_arm::fix_cortex_a8): New method definition.
7774 (Target_arm::Cortex_a8_relocs_info): New type.
7775 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7776 New data member declarations.
7777 (Target_arm::scan_reloc_for_stub): Record information about
7778 relocations for THUMB branches that might be exempted from the
7779 Cortex-A8 workaround.
7780 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7781 at the beginning of a relaxation pass.
7782
7783 2010-01-12 Doug Kwan <dougkwan@google.com>
7784
7785 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7786 (Arm_relobj::Mapping_symbol_position,
7787 Arm_reloj::Mapping_symbol_position_less,
7788 Arm_relobj::Mapping_symbols_info): New types.
7789 (Target_arm::is_mapping_symbol_name): New method definition.
7790 (Arm_relobj::do_count_local_symbols): Save information about mapping
7791 symbols.
7792
7793 2010-01-11 Doug Kwan <dougkwan@google.com>
7794
7795 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7796 Arm_relocate_functions::thumb32_branch_upper,
7797 Arm_relocate_functions::thumb32_branch_lower,
7798 Arm_relocate_functions::thumb32_cond_branch_offset,
7799 Arm_relocate_functions::thumb32_cond_branch_upper,
7800 Arm_relocate_functions::thumb32_cond_branch_lower,
7801 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7802 branch offset encoding.
7803 (Arm_relocate_functions::thumb_branch_common): Use new branch
7804 offset encoding methods to avoid code duplication.
7805 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7806 (Stub_addend_reader::operator()): Use new branch encoding method
7807 to avoid code duplication.
7808
7809 2010-01-11 Doug Kwan <dougkwan@google.com>
7810
7811 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7812 (Target_arm::do_finalize_sections): Define special EXIDX section
7813 symbols only if referenced.
7814 * gc.h (Garbage_collection::add_reference): New method.
7815 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7816 code duplication.
7817
7818 2010-01-11 Ian Lance Taylor <iant@google.com>
7819
7820 * script.cc (Version_script_info::build_expression_list_lookup):
7821 Change complaing about duplicate wildcard match from error to
7822 warning.
7823
7824 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7825 of 2009-12-30.
7826 (Version_script_info::Version_script_info): Initialize globs_,
7827 default_version_, default_is_global_, and exact_. Don't
7828 initialize globals_ or locals_.
7829 (Version_script_info::build_lookup_tables): Build local symbols
7830 first.
7831 (Version_script_info::unquote): New function.
7832 (Version_script_info::add_exact_match): New function.
7833 (Version_script_info::build_expression_list_lookup): Remove lookup
7834 parameter. Add is_global parameter. Change all callers. Handle
7835 wildcard pattern specially. Unquote pattern. Call
7836 add_exact_match.
7837 (Version_script_info::get_name_to_match): New function.
7838 (Version_script_info::get_symbol_version): New function.
7839 (Version_script_info::get_symbol_version_helper): Remove.
7840 (Version_script_info::check_unmatched_names): Call unquote.
7841 * script.h (class Version_script_info): Change get_symbol_version
7842 to be non-inline and add is_global parameter; change all callers.
7843 Rewrite symbol_is_local. Update declarations. Define struct
7844 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7845 Remove globals_ and locals_ members. Add exact_, globs_,
7846 default_version_, is_global_.
7847 (Version_script_info::Glob): Remove pattern, add expression and
7848 is_global. Update constructor. Change all callers.
7849 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7850 default version.
7851 (Versions::symbol_section_contents): If a symbol is undefined, or
7852 defined in a dynamic object, set the version index to
7853 VER_NDX_LOCAL.
7854 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7855 symbol_is_local.
7856 (Symbol_table::add_from_pluginobj): Likewise.
7857 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7858
7859 2010-01-11 Doug Kwan <dougkwan@google.com>
7860
7861 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7862 (incremental_dump_LDADD): Add linking option for libintl.
7863 * Makefile.in: Regenerate.
7864
7865 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7866
7867 PR gold/11144
7868 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7869 instead of -Ds.
7870 * testsuite/Makefile.in: Regenerated.
7871
7872 2010-01-10 Doug Kwan <dougkwan@google.com>
7873
7874 * options.h (DEFINE_var): Use parentheses around argument varname__
7875 in macro body to avoid any unintended subsequent substitutions.
7876
7877 2010-01-10 Ian Lance Taylor <iant@google.com>
7878
7879 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7880 candidates before doing symbol resolution.
7881
7882 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7883 ODR candidates if only one is weak.
7884
7885 2010-01-08 Ian Lance Taylor <iant@google.com>
7886
7887 * script.cc (Version_script_info::build_expression_list_lookup):
7888 Don't warn about ambiguous version, just record the ambiguity.
7889 (Version_script_info::get_symbol_version_helper): Give error if
7890 version is ambiguous.
7891
7892 2010-01-08 Doug Kwan <dougkwan@google.com>
7893
7894 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7895 prev_data_size_ and prev_addralign_. Remove initializer for
7896 deleted data member has_been_changed_.
7897 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7898 to determine if the table is empty.
7899 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7900 Remove.
7901 (Stub_table::add_reloc_stub): Define method in class definition
7902 instead of just declaring it there.
7903 (Stub_table::add_cortex_a8_stub): New method definition.
7904 (Stub_table::update_data_size_and_addralign): Ditto.
7905 (Stub_table::finalize_stubs): Ditto.
7906 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7907 (Stub_table::do_addralign_): Return address alignment in the
7908 (Stub_table::do_reset_address_and_file_offset): Define method in
7909 class definition instead of declaring it there. Set current data
7910 size to be the data size of the previous pass.
7911 (Stub_table::set_final_data_size): Use current data size as the
7912 final data size.
7913 (Stub_table::relocate_stub): Change parameter type of stub from
7914 Reloc_stub pointer to Stub pointer.
7915 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7916 (Stub_table::Cortex_a8_stub_list): New typedef.
7917 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7918 Stub_table::prev_addralign_): New data member.
7919 (Arm_relobj::Arm_relobj): Initialize data member
7920 section_has_cortex_a8_workaround_.
7921 (Arm_relobj::section_has_cortex_a8_workaround,
7922 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7923 definitions.
7924 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7925 declarations.
7926 (Target_arm::relocate_stub): Change parameter type of stub from
7927 Reloc_stub pointer to Stub pointer.
7928 (Insn_template::size, Insn_template::alignment): Handle
7929 THUMB16_SPECIAL_TYPE.
7930 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7931 Stub_table::update_data_size_and_addralign,
7932 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7933 definitions.
7934 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7935 (Stub_table::do_write): Ditto.
7936 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7937
7938 2010-01-08 Ian Lance Taylor <iant@google.com>
7939
7940 PR 11108
7941 * symtab.h (class Symbol): Remove fields is_target_special_ and
7942 has_plt_offset_. Add field is_defined_in_discarded_section_.
7943 (Symbol::is_defined_in_discarded_section): New function.
7944 (Symbol::set_is_defined_in_discarded_section): New function.
7945 (Symbol::has_plt_offset): Rewrite.
7946 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7947 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7948 Don't initialize is_target_special_ or has_plt_offset_.
7949 Initialize is_defined_in_discarded_section_.
7950 (Symbol_table::add_from_relobj): If appropriate, set
7951 is_defined_in_discarded_section.
7952 * resolve.cc (Symbol::override_base_with_special): Don't test
7953 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7954 * target-reloc.h (relocate_section): Do special handling for
7955 symbols defined in discarded sections for global symbols as well
7956 as local symbols.
7957
7958 2010-01-08 Ian Lance Taylor <iant@google.com>
7959
7960 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7961 the SHT_SYMTAB case.
7962
7963 2010-01-08 Ian Lance Taylor <iant@google.com>
7964
7965 * object.cc (Sized_relobj::do_layout): Don't get confused if
7966 layout_eh_frame returns NULL.
7967
7968 2010-01-08 Ian Lance Taylor <iant@google.com>
7969
7970 PR 11084
7971 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7972 dynamic symbol table, use the normal symbol table.
7973 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7974 symbol table.
7975
7976 2010-01-08 Ian Lance Taylor <iant@google.com>
7977
7978 PR 11072
7979 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7980 sections.
7981
7982 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7983
7984 * version.cc (print_version): Change to "Copyright 2010".
7985
7986 2010-01-08 Ian Lance Taylor <iant@google.com>
7987
7988 PR 10287
7989 PR 11063
7990 * i386.cc (class Target_i386): Change return type of plt_section
7991 to be non-const.
7992 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7993 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7994 tls_desc_rel_ field.
7995 (Output_data_plt_i386::rel_tls_desc): New function.
7996 (Target_i386::rel_tls_desc_section): New function.
7997 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7998 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7999 R_386_TLS_DESC reloc in rel_tls_desc_section.
8000 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8001 Define struct Tlsdesc_info.
8002 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8003 (Target_x86_64::do_reloc_symbol_index): New function.
8004 (Target_x86_64::add_tlsdesc_info): New function.
8005 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8006 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8007 tlsdesc_rel_ field.
8008 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
8009 all callers.
8010 (Output_data_plt_x86_64::rela_tlsdesc): New function.
8011 (Target_x86_64::rela_tlsdesc_section): New function.
8012 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8013 handling.
8014 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8015 (Target_x86_64::do_reloc_addend): New function.
8016 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8017 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8018 declarations. Define TARGET_CODE. Add arg field to u1_ union.
8019 (Output_reloc::type): New function.
8020 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8021 (Output_reloc::is_target_specific): New function.
8022 (Output_reloc::target_arg): New function.
8023 (class Output_reloc) [SHT_RELA]: Add four new constructors for
8024 absolute relocs and target specific relocs.
8025 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8026 add_target_specific.
8027 (class Output_data_reloc) [SHT_RELA]: Likewise.
8028 * output.cc (Output_reloc::Output_reloc): Add four new versions
8029 for absolute relocs and target specific relocs.
8030 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8031 (Output_reloc::get_symbol_index): Likewise.
8032 (Output_reloc::local_section_offset): Check that local_sym_index_
8033 is not TARGET_CODE or 0.
8034 (Output_reloc::symbol_value): Likewise.
8035 (Output_reloc::write) [SHT_RELA]: Call target for target specific
8036 reloc.
8037 * target.h (class Target): Add reloc_symbol_index and reloc_addend
8038 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
8039 functions.
8040 * layout.cc (add_target_dynamic_tags): Use output section for
8041 DT_PLTRELSZ and DT_JMPREL.
8042
8043 2010-01-07 Ian Lance Taylor <iant@google.com>
8044
8045 PR 11061
8046 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8047 function.
8048 (class Output_data_reloc_generic): Define.
8049 (class Output_data_reloc_base): Change base class to
8050 Output_data_reloc_generic. Change add() method to call
8051 bump_relative_reloc_count for a relative reloc. Remove
8052 sort_relocs_ field.
8053 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8054 to sort_relocs().
8055 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8056 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
8057 appropriate.
8058 * layout.h (class Layout): Update declaration.
8059
8060 2010-01-07 Ian Lance Taylor <iant@google.com>
8061
8062 * output.h (class Output_data): Add const version of
8063 output_section and do_output_section.
8064 (class Output_section_data): Add const version of
8065 do_output_section.
8066 (class Output_section): Likewise.
8067 * layout.cc (Layout::add_target_dynamic_tags): New function.
8068 * layout.h (class Layout): Update declarations.
8069 * arm.cc (Target_arm::do_finalize_sections): Use
8070 add_target_dynamic_tags.
8071 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8072 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8073 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8074 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8075
8076 2010-01-07 Ian Lance Taylor <iant@google.com>
8077
8078 PR 11042
8079 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8080 object as needed.
8081
8082 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
8083 Ian Lance Taylor <iant@google.com>
8084
8085 PR 11019
8086 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8087 Xindex::read_symtab_xindex.
8088
8089 2010-01-07 Doug Kwan <dougkwan@google.com>
8090
8091 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8092 (Insn_template::thumb16_bcond_insn): New method declaration.
8093 (Insn_template): Fix spelling.
8094 (Stub::thumb16_special): New method declaration.
8095 (Stub::do_write): Define virtual method which was previously pure
8096 virtual.
8097 (Stub::do_thumb16_special): New method declaration.
8098 (Stub::do_fixed_endian_write): New template member.
8099 (Reloc_stub::do_write): Remove.
8100 (Reloc_stub::do_fixed_endian_write): Remove.
8101 (Cortex_a8_stub): New class definition.
8102 (Stub_factory::make_cortex_a8_stub): New method definition.
8103 (Stub_factory::Stub_factory): Add missing static storage class
8104 qualifier for elf32_arm_stub_a8_veneer_blx.
8105
8106 2010-01-07 Ian Lance Taylor <iant@google.com>
8107
8108 PR 10980
8109 * options.h (class General_options): Add --warn-unresolved-symbols
8110 and --error-unresolved-symbols.
8111 * errors.cc (Errors::undefined_symbol): Implement
8112 --warn-unresolved-symbols.
8113
8114 * options.h (class General_options): Add -z text and -z textoff.
8115 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8116
8117 2010-01-06 Sriraman Tallam <tmsriram@google.com>
8118
8119 * gc.h (Garbage_collection::Cident_section_map): New typedef.
8120 (Garbage_collection::cident_sections): New function.
8121 (Garbage_collection::add_cident_section): New function.
8122 (Garbage_collection::cident_sections_): New member.
8123 (gc_process_relocs): Add references to sections whose names are C
8124 identifiers.
8125 * gold.h (cident_section_start_prefix): New constant.
8126 (cident_section_stop_prefix): New constant.
8127 (is_cident): New function.
8128 * layout.cc (Layout::define_section_symbols): Replace string constants
8129 with the newly defined constants.
8130 * object.cc (Sized_relobj::do_layout): Track sections whose names are
8131 C identifiers.
8132 * testsuite/Makefile.am: Add gc_orphan_section_test.
8133 * testsuite/Makefile.in: Regenerate.
8134 * testsuite/gc_orphan_section_test.cc: New file.
8135 * testsuite/gc_orphan_section_test.sh: New file.
8136
8137 2010-01-06 Ian Lance Taylor <iant@google.com>
8138
8139 PR 10980
8140 * options.h (class General_options): Add --warn-shared-textrel.
8141 * layout.cc (Layout::finish_dynamic_section): Implement
8142 --warn-shared-textrel.
8143
8144 PR 10980
8145 * options.h (class General_options): Add --warn-multiple-gp.
8146
8147 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8148
8149 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8150 $(THREADSLIB) and $(LIBDL).
8151 * Makefile.in: Rebuild.
8152
8153 2010-01-06 Ian Lance Taylor <iant@google.com>
8154
8155 PR 10980
8156 * options.cc (General_options::parse_section_start): New function.
8157 (General_options::section_start): New function.
8158 (General_options::General_options): Initialize all members.
8159 * options.h: Include <map>
8160 (class General_options): Add --section-start. Add section_starts_
8161 member.
8162 * layout.cc (Layout::attach_allocated_section_to_segment): If
8163 --section-start was used, set the address of the segment. Remove
8164 local sort_sections.
8165 (Layout::relaxation_loop_body): If the address of the load segment
8166 has been set by --section-start, don't use it.
8167 * output.h (Output_segment::update_flags_for_output_section): New
8168 function.
8169 * output.cc (Output_segment::add_output_section): Call
8170 update_flags_for_output_section.
8171
8172 2010-01-05 Ian Lance Taylor <iant@google.com>
8173
8174 PR 10980
8175 * options.h (class General_options): Add --undefined-version.
8176 * script.cc (struct Version_expression): Add was_matched_by_symbol
8177 field.
8178 (Version_script_info::matched_symbol): New function.
8179 (Version_script_info::get_symbol_version_helper): Call
8180 matched_symbol.
8181 (Version_script_info::check_unmatched_names): New function.
8182 * script.h (class Version_script_info): Update declarations.
8183 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8184
8185 * options.h (class General_options): Use DEFINE_bool_alias for
8186 allow_multiple_definition.
8187 * resolve.cc (Symbol_table::should_override): Don't test
8188 allow_multiple_definition.
8189
8190 PR 10980
8191 * options.h (class General_options): Add --cref.
8192 * main.cc (main): Print cref table if --cref. Don't close mapfile
8193 until after printing cref table.
8194 * cref.cc: Include "symtab.h".
8195 (class Cref_inputs): Define Cref_table_compare and Cref_table.
8196 (Cref_table_compare::operator()): New function.
8197 (Cref_inputs::gather_cref): New function.
8198 (filecol): New static const.
8199 (Cref_inputs::print_cref): New function.
8200 (Cref::print_cref): New function.
8201 * cref.h: Include <cstdio>.
8202 (class Cref): Update declarations.
8203 * mapfile.h (Mapfile::file): New function.
8204 * object.h (class Object): Define Symbols. Declare virtual
8205 do_get_global_symbols.
8206 (Object::get_global_symbols): New function.
8207 * object.cc (Input_objects::add_object): Pass object to cref_ if
8208 --cref.
8209 (Input_objects::archive_start): Likewise.
8210 (Input_objects::archive_stop): Likewise.
8211 (Input_objects::print_cref): New function.
8212 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8213 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8214 --cref.
8215 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8216 function.
8217 * plugin.h (class Sized_pluginobj): Update declarations.
8218
8219 2010-01-05 Ian Lance Taylor <iant@google.com>
8220
8221 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8222 to is_default_version. Rename insdef to insdefault.
8223 (Symbol_table::add_from_relobj): Rename def to is_default_version
8224 and local to is_forced_local.
8225 (Symbol_table::add_from_pluginobj): Likewise.
8226 (Symbol_table::add_from_dynobj): Likewise.
8227 (Symbol_table::define_special_symbol): Rename insdef to
8228 insdefault.
8229
8230 2010-01-04 Ian Lance Taylor <iant@google.com>
8231
8232 PR 10980
8233 * options.h (class General_options): Add
8234 --allow-multiple-definition and -z muldefs.
8235 * resolve.cc (Symbol_table::should_override): Don't warn about a
8236 multiple symbol definition if --allow-multiple-definition or -z
8237 muldefs.
8238
8239 PR 10980
8240 * options.h (class General_options): Add --add-needed and
8241 --copy-dt-needed-entries. Tweak --as-needed help entry.
8242 * object.cc (Input_objects::check_dynamic_dependencies): Give an
8243 error if --copy-dt-needed-entries aka --add-needed is used and
8244 would cause a change in behaviour.
8245
8246 PR 10980
8247 * options.h (class General_options): Add -G as a short version of
8248 --shared. Add no-op options -assert, -g, and -i.
8249
8250 2010-01-04 Sriraman Tallam <tmsriram@google.com>
8251
8252 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8253 check for .text or .gnu.linkonce.t sections.
8254 * icf.cc (Icf::find_identical_sections): Ditto.
8255 Change the detection for mangled function name within the section
8256 name.
8257 * icf.h (is_section_foldable_candidate): New function.
8258
8259 2009-12-30 Ian Lance Taylor <iant@google.com>
8260
8261 PR 10980
8262 * options.h (class General_options): Permit two dashes with
8263 --retain-symbols-file.
8264
8265 2009-12-30 Ian Lance Taylor <iant@google.com>
8266
8267 PR 10979
8268 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8269 don't put the file header and segment headers in the text
8270 segment.
8271
8272 PR 10979
8273 * common.cc (Sort_commons::operator()): Stabilize sort when both
8274 entries are NULL.
8275 (Symbol_table::do_allocate_commons_list): When allocating common
8276 symbols, skip a symbol which is no longer common.
8277 * symtab.h (Symbol::is_common): Test whether the symbol comes from
8278 an object before checking its type.
8279 * testsuite/common_test_2.c: New file.
8280 * testsuite/common_test_3.c: New file.
8281 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8282 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8283 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8284 (common_test_2_pic.o, common_test_2.so): New targets.
8285 (common_test_3_pic.o, common_test_3.so): New targets.
8286 * testsuite/Makefile.in: Rebuild.
8287
8288 PR 10979
8289 * script.cc (read_input_script): If we see a new SECTIONS clause,
8290 and we have added an input section, give an error.
8291 * layout.h (class Layout): Add have_added_input_section function.
8292 Add have_added_input_section_ field.
8293 * layout.cc (Layout::Layout): Initialize
8294 have_added_input_section_.
8295 (Layout::layout): Set have_added_input_section_.
8296 (Layout::layout_eh_frame): Likewise.
8297
8298 2009-12-30 Ian Lance Taylor <iant@google.com>
8299
8300 PR 10931
8301 * options.h (class General_options): Add --sort-common option.
8302 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8303 * common.cc (Sort_common): Add sort_order parameter to
8304 constructor. Add sort_order_ field.
8305 (Sort_commons::operator): Check sort_order_.
8306 (Symbol_table::allocate_commons): Determine the sort order.
8307 (Symbol_table::do_allocate_commons): Add sort_order parameter.
8308 Change all callers.
8309 (Symbol_table::do_allocate_commons_list): Likewise.
8310
8311 2009-12-30 Ian Lance Taylor <iant@google.com>
8312
8313 PR 10916
8314 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8315 symbols from this object, don't change the visibility of an
8316 undefined symbol.
8317 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8318
8319 2009-12-30 Ian Lance Taylor <iant@google.com>
8320
8321 PR 10861
8322 * script.h (class Version_script_info): Define Language enum.
8323 Update declarations. Define Glob, Exact, and Lookup types. Add
8324 new fields globals_, locals_, and is_finalized_.
8325 * script.cc: Various formatting fixes.
8326 (class Parser_closure): Change language_stack_ from a vector of
8327 std::string to one of Version_script_info::Language. Adjust all
8328 uses accordingly.
8329 (class Lazy_demangler): Remove.
8330 (struct Version_expression): Change language from std::string to
8331 Version_script_info::Language.
8332 (Version_script_info::Version_script_info): New function.
8333 (Version_script_info::~Version_script_info): Don't call clear.
8334 (Version_script_info::finalize): New function.
8335 (Version_script_info::build_lookup_tables): New function.
8336 (Version_script_info::build_expression_list_lookup): New
8337 function.
8338 (Version_script_info::get_symbol_version_helper): Rewrite to use
8339 lookup tables.
8340 (Version_script_info::print_expression_list): Adjust to use
8341 Version_script_info::Language.
8342 (script_push_lex_into_version_mode): Check that the version script
8343 has not been finalized.
8344 (version_script_push_lang): Change language string to
8345 Version_script_info::Language.
8346 * options.cc (Command_line::version_script): New function.
8347 * options.h (class General_options): Add finalize_dynamic_list
8348 function. Change version_script from declaration to definition.
8349 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8350 * testsuite/version_script.map: Remove duplicate def of foo.
8351 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8352 version_script.map.
8353 * testsuite/Makefile.in: Rebuild.
8354
8355 2009-12-30 Ian Lance Taylor <iant@google.com>
8356
8357 PR 10843
8358 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8359 if the input symbol index is 0, make the output symbol index 0.
8360
8361 2009-12-30 Ian Lance Taylor <iant@google.com>
8362
8363 PR 10670
8364 * options.h (class General_options): Add -x/--discard-all.
8365 * object.cc (Sized_relobj::do_count_local_symbols): Handle
8366 --discard-all. If the local symbol needs a dynamic entry, check
8367 that before handling --discard-locals.
8368
8369 2009-12-30 Ian Lance Taylor <iant@google.com>
8370
8371 PR 10450
8372 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8373 flags to PF_R.
8374 (Output_segment::add_output_section): Don't change the flags if
8375 the type is PT_TLS.
8376
8377 PR 10450
8378 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8379 GNU hash table if they need a dynamic value. Otherwise, don't add
8380 them if they are defined in a dynamic object or are forced local.
8381
8382 2009-12-29 Ian Lance Taylor <iant@google.com>
8383
8384 PR 10450
8385 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8386 .gnu.hash table for a 32-bit target.
8387
8388 PR 10450
8389 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8390 regular and a dynamic object only needs a dynamic symbol table
8391 entry if it is externally visible.
8392
8393 PR 10450
8394 * i386.cc (class Target_i386): Initialize global_offset_table_ in
8395 constructor. Add global_offset_table_ field.
8396 (Target_i386::got_section): Set global_offset_table_.
8397 (Target_i386::do_finalize_sections): Set global_offset_table_
8398 size.
8399 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8400 in constructor. Add global_offset_table_ field.
8401 (Target_x86_64::got_section): Set global_offset_table_.
8402 (Target_x86_64::do_finalize_sections): Set global_offset_table_
8403 size.
8404
8405 * layout.cc (Layout::Layout): Initialize increase_relro_.
8406 (Layout::get_output_section): Add is_relro, is_last_relro, and
8407 is_first_non_relro parameters. Change all callers.
8408 (Layout::choose_output_section): Likewise.
8409 (Layout::add_output_section_data): Likewise.
8410 (Layout::make_output_section): Likewise.
8411 (Layout::set_segment_offsets): Clear increase_relro when using a
8412 linker script.
8413 * layout.h (class Layout): Add increase_relro method. Add
8414 increase_relro_ field. Update declarations.
8415 * output.cc (Output_section::Output_section): Initialize
8416 is_last_relro_ and is_first_non_relro_.
8417 (Output_segment::add_output_section): Group relro sections is
8418 do_sort is true. Handle is_last_relro and is_first_non_relro.
8419 (Output_segment::maximum_alignment): Remove relro handling.
8420 (Output_segment::set_section_addresses): Add increase_relro
8421 parameter. Change all callers. Add initial alignment to align
8422 relro sections on separate page. Remove old relro handling.
8423 (Output_segment::set_section_list_addresses): Remove in_relro
8424 parameter. Change all callers.
8425 (Output_segment::set_offset): Add increase parameter. Change all
8426 callers. Remove old relro handling.
8427 * output.h (class Output_section): Add new methods: is_last_relro,
8428 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8429 Add is_last_relro_ and is_first_non_relro_ fields.
8430 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8431 Create separate .got.plt section. Call increase_relro.
8432 * x86_64.cc (Target_x86_64::got_section): Likewise.
8433 * testsuite/relro_script_test.t: Add .got.plt.
8434
8435 PR 10450
8436 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8437 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8438 (Layout::finalize): Call set_dynamic_symbol_size.
8439 (Layout::set_dynamic_symbol_size): New function.
8440 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
8441 set_dynamic_symbol_size.
8442
8443 PR 10450
8444 * output.h (class Output_section): Add is_entsize_zero_ field.
8445 * output.cc (Output_section::Output_section): Initialize
8446 is_entsize_zero_.
8447 (Output_section::set_entsize): If two different entsizes are
8448 requested, force it to zero.
8449 (Output_section::add_input_section): Set flags for .debug_str
8450 before updating section flags. Set entsize.
8451 (Output_section::update_flags_for_input_section): Set SHF_MERGE
8452 and SHF_STRING if all input sections have those flags.
8453
8454 2009-12-29 Rafael Espindola <espindola@google.com>
8455
8456 * main.cc (main): Fix the sys time reporting.
8457 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8458 reporting.
8459
8460 2009-12-29 Sriraman Tallam <tmsriram@google.com>
8461
8462 * options.cc (General_options::parse_version): Allow -v to exit
8463 without an error if there is nothing to link.
8464
8465 2009-12-29 Ian Lance Taylor <iant@google.com>
8466
8467 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8468 using a version of gcc before 4.1.
8469 * configure: Rebuild.
8470
8471 2009-12-28 Chris Demetriou <cgd@google.com>
8472
8473 * attributes.cc (Output_attributes_section_data::do_write): Use
8474 std::vector::front rather than std::vector::data.
8475
8476 2009-12-28 Ian Lance Taylor <iant@google.com>
8477
8478 * symtab.h (class Symbol_table): Add enum Defined.
8479 * resolve.cc (Symbol_table::should_override): Add defined
8480 parameter. Change all callers. Test whether object is NULL
8481 before calling a method on it.
8482 (Symbol_table::report_resolve_problem): Add defined parameter.
8483 Change all callers.
8484 (Symbol_table::should_override_with_special): Likewise.
8485 * symtab.cc (Symbol_table::define_in_output_data): Add defined
8486 parameter. Change all callers.
8487 (Symbol_table::do_define_in_output_data): Likewise.
8488 (Symbol_table::define_in_output_segment): Likewise.
8489 (Symbol_table::do_define_in_output_segment): Likewise.
8490 (Symbol_table::define_as_constant): Likewise.
8491 (Symbol_table::do_define_as_constant): Likewise.
8492 * script.h (class Symbol_assignment): Add is_defsym parameter to
8493 constructor; change all callers.
8494 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8495 parameter. Change all callers. Add is_defsym_ field.
8496 (class Parser_closure): Add parsing_defsym parameter to
8497 constructor; change all callers. Add parsing_defsym accessor
8498 function. Add parsing_defsym_ field.
8499
8500 2009-12-28 Ian Lance Taylor <iant@google.com>
8501
8502 * gold.cc (queue_middle_tasks): Fix formatting.
8503 * object.cc (Relobj::is_section_name_included): Likewise.
8504
8505 2009-12-23 Ian Lance Taylor <iant@google.com>
8506
8507 * i386.cc (Target_i386::do_calls_non_split): Recognize
8508 -fsplit-stack prologue for a function with a static chain.
8509 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8510 -fsplit-stack prologue when using %r11.
8511
8512 2009-12-21 Sriraman Tallam <tmsriram@google.com>
8513
8514 * options.cc (General_options::parse_version): Make -v continue and do
8515 the link like GNU ld does.
8516
8517 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
8518
8519 * Makefile.am (CCFILES): Add timer.cc.
8520 (HFILES): Add timer.h.
8521 * configure.ac: Check for sysconf and times.
8522 * main.cc: include timer.h.
8523 (main): Use Timer instead of get_run_time.
8524 * timer.cc: New.
8525 * timer.h: New.
8526 * workqueue.cc: include timer.h.
8527 (Workqueue::find_and_run_task):
8528 Report user, sys and wall time.
8529 * Makefile.in: Regenerate.
8530 * config.in: Regenerate.
8531 * configure: Regenerate.
8532
8533 2009-12-16 Doug Kwan <dougkwan@google.com>
8534
8535 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8536 sections.
8537 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8538 relaxed input sections.
8539 * output.cc (Output_section::find_relaxed_input_section): Change
8540 return type to Output_relaxed_input_section pointer. Adjust code
8541 for new type of relaxed_input_section_map_.
8542 * output.h (Output_section::find_relaxed_input_section): Change
8543 return type to Output_relaxed_input_section pointer.
8544 (Output_section::Output_relaxed_input_section_by_input_section_map):
8545 New type.
8546 (Output_section::relaxed_input_section_map_): Change type to
8547 Output_section::Output_relaxed_input_section_by_input_section_map.
8548 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8549 input section.
8550
8551 2009-12-15 Ian Lance Taylor <iant@google.com>
8552
8553 * layout.cc (Layout::create_shstrtab): Only write out after input
8554 sections if we are compressing debug sections.
8555
8556 2009-12-15 Ian Lance Taylor <iant@google.com>
8557
8558 * archive.cc (Archive::add_symbols): Only look up a symbol without
8559 a version if there is, in fact, a version.
8560
8561 2009-12-14 Ian Lance Taylor <iant@google.com>
8562
8563 Revert -Wshadow changes, all changes from:
8564 2009-12-11 Doug Kwan <dougkwan@google.com>
8565 2009-12-11 Nick Clifton <nickc@redhat.com>
8566 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8567
8568 2009-12-11 Doug Kwan <dougkwan@google.com>
8569
8570 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8571 due to -Wshadow.
8572 * attributes.cc (Object_attribute::size): Ditto.
8573 (Attributes_section_data::size): Ditto.
8574 (Attributes_section_data::Attributes_section_data): Ditto.
8575 (Output_attributes_section_data::do_write): Ditto.
8576 * attributes.h (Object_attribute::set_type): Ditto.
8577 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8578
8579 2009-12-11 Nick Clifton <nickc@redhat.com>
8580
8581 * archive.cc: Fix shadowed variable warnings.
8582 * arm.cc: Likewise.
8583 * compressed_output.cc: Likewise.
8584 * compressed_output.h: Likewise.
8585 * configure: Likewise.
8586 * dwarf_reader.cc: Likewise.
8587 * dynobj.cc: Likewise.
8588 * dynobj.h: Likewise.
8589 * ehframe.cc: Likewise.
8590 * ehframe.h: Likewise.
8591 * errors.cc: Likewise.
8592 * expression.cc: Likewise.
8593 * fileread.cc: Likewise.
8594 * fileread.h: Likewise.
8595 * freebsd.h: Likewise.
8596 * i386.cc: Likewise.
8597 * icf.cc: Likewise.
8598 * incremental.h: Likewise.
8599 * layout.cc: Likewise.
8600 * layout.h: Likewise.
8601 * mapfile.cc: Likewise.
8602 * merge.cc: Likewise.
8603 * merge.h: Likewise.
8604 * object.cc: Likewise.
8605 * object.h: Likewise.
8606 * options.h: Likewise.
8607 * output.cc: Likewise.
8608 * output.h: Likewise.
8609 * parameters.cc: Likewise.
8610 * plugin.cc: Likewise.
8611 * powerpc.cc: Likewise.
8612 * reduced_debug_output.cc: Likewise.
8613 * reduced_debug_output.h: Likewise.
8614 * reloc.cc: Likewise.
8615 * reloc.h: Likewise.
8616 * resolve.cc: Likewise.
8617 * script-sections.cc: Likewise.
8618 * script.cc: Likewise.
8619 * script.h: Likewise.
8620 * sparc.cc: Likewise.
8621 * symtab.cc: Likewise.
8622 * symtab.h: Likewise.
8623 * target-select.cc: Likewise.
8624 * target-select.h: Likewise.
8625 * token.h: Likewise.
8626 * workqueue.cc: Likewise.
8627 * workqueue.h: Likewise.
8628 * x86_64.cc: Likewise.
8629
8630 2009-12-10 Doug Kwan <dougkwan@google.com>
8631
8632 * arm.cc (attributes.h): New include.
8633 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8634 (Arm_relobj::~Arm_relobj): Delete object pointed by
8635 attributes_section_data_.
8636 (Arm_relobj::attributes_section_data): New method definition.
8637 (Arm_relobj::attributes_section_data_): New data member declaration.
8638 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8639 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8640 attributes_section_data_.
8641 (Arm_dynobj::attributes_section_data): New method definition.
8642 (Arm_dynobj::attributes_section_data_): New data member declaration.
8643 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8644 initialization value of may_use_blx_ to false.
8645 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8646 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8647 object attributes to compute results instead of hard-coding.
8648 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8649 Target_arm::get_secondary_compatible_arch,
8650 Target_arm::set_secondary_compatible_arch
8651 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8652 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8653 New method declarations.
8654 (Target_arm::get_aeabi_object_attribute): New method definition.
8655 (Target_arm::attributes_section_data_): New data member declaration.
8656 (read_arm_attributes_section): New template definition.
8657 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8658 (Arm_dynobj::do_read_symbols): Ditto.
8659 (Target_arm::do_finalize_sections): Merge attributes sections from
8660 input. Check for BLX use after attributes section merging.
8661 Fix __exidx_start and __exidx_end visibility. Create an
8662 .ARM.attributes section if necessary.
8663 (Target_arm::get_secondary_compatible_arch,
8664 Target_arm::set_secondary_compatible_arch,
8665 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8666 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8667 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8668 New method definitions.
8669
8670 2009-12-09 Ian Lance Taylor <iant@google.com>
8671
8672 * plugin.cc (Plugin::load): Don't cast from void* to a function
8673 pointer.
8674
8675 2009-12-09 Ian Lance Taylor <iant@google.com>
8676
8677 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8678 information fields.
8679
8680 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8681
8682 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8683 Replace two_file_shared_1.so with two_file_shared_2.so.
8684 * testsuite/Makefile.in: Regenerated.
8685
8686 2009-12-08 Doug Kwan <dougkwan@google.com>
8687
8688 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8689 (HFILES): Add attributes.h and int_encoding.h.
8690 * Makefile.in: Regenerate.
8691 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8692 function definitions to int_encoding.cc
8693 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8694 prototypes to int_encoding.h
8695 * reduced_debug_output.cc (int_encoding.h): New include.
8696 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8697 function definitions to int_encoding.cc
8698 (insert_into_vector, read_from_pointer): Move template definitions to
8699 int_encoding.h
8700 * attributes.cc: New file.
8701 * attributes.h: New file.
8702 * int_encoding.cc: New file.
8703 * int_encoding.h: New file.
8704
8705 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
8706
8707 PR gold/11055
8708 * incremental-dump.cc (dump_incremental_inputs): New.
8709 (main): Use dump_incremental_inputs.
8710
8711 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8712
8713 PR gold/10893
8714 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8715 checking elfcpp::STT_FUNC.
8716 (Target_i386::Relocate::relocate): Likewise.
8717 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8718
8719 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8720 symbols from shared libraries into normal FUNC symbols.
8721
8722 * symtab.h (Symbol): Add is_func and use it.
8723
8724 2009-12-05 Doug Kwan <dougkwan@google.com>
8725
8726 * arm.cc (Target_arm::arm_info): Initialize new fields
8727 attributes_section and attributes_vendor.
8728 * i386.cc (Target_i386::i386_info): Same.
8729 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8730 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8731 fields attributes_section and attributes_vendor.
8732 * sparc.cc (Target_sparc::sparc_info): Same.
8733 * target.h (Target::attributes_section, Target::attributes_vendor,
8734 Target::is_attributes_section, Target::attribute_arg_type,
8735 Target::attributes_order): New method definitions.
8736 (Target::Target_info::attributes_section,
8737 Target::Target_info::attributes_vendor): New fields.
8738 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8739 virtual method definitions.
8740 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8741 attributes_section and attributes_vendor.
8742 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8743
8744 2009-12-05 Doug Kwan <dougkwan@google.com>
8745
8746 * arm.cc: Update comments about interworking and stub generation.
8747 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8748 considered as non-PIC.
8749 (Arm_relocate_functions::base_abs): Fix formatting.
8750 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8751 of function to use GOT entry address instead of offset.
8752 (Target_arm::Scan::global): Issue an error if a symbol would need a
8753 PLT does not get one because it is untyped. Remove code to create
8754 dynamic symbols for relative branches.
8755 (Target_arm::Relocate::relocate: Use 0 instead of false since function
8756 takes unsigned integer instead of boolean.
8757
8758 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
8759
8760 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8761 (two_file_test_LDADD): Likewise.
8762 (common_test_1_LDADD): Likewise.
8763 (exception_test_LDADD) Likewise.
8764 (weak_test_LDADD): Likewise.
8765 (many_sections_test_LDADD): Likewise.
8766 (initpri1_LDADD): Likewise.
8767 (script_test_1_LDADD): Likewise.
8768 (script_test_2_LDADD): Likewise.
8769 (justsyms_LDADD): Likewise.
8770 (binary_test_LDADD): Likewise.
8771 (large_LDADD): Likewise.
8772 * testsuite/Makefile.in: Regenerated.
8773
8774 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
8775
8776 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8777 (Symbol_table::override_with_special): Likewise.
8778 (Symbol_table::add_from_object): Likewise.
8779
8780 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8781
8782 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8783 Don't set the data_offset twice.
8784
8785 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8786
8787 * testsuite/Makefile.in: Regenerate.
8788
8789 2009-12-03 Doug Kwan <dougkwan@google.com>
8790
8791 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8792 (Target_arm::do_finalize_sections): Add parameter for symbol table
8793 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8794 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8795 parameter for symbol table pointer.
8796 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8797 an additional parameter for a pointer to symbol table.
8798 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8799 parameter for a symbol table pointer.
8800 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8801 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8802 Ditto.
8803 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8804 parameter for a symbol table pointer.
8805
8806 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
8807
8808 * incremental.cc (Incremental_inputs_header)
8809 (Incremental_inputs_header_write, Incremental_inputs_entry)
8810 (Incremental_inputs_entry_write): Move ...
8811 * incremental.h (Incremental_inputs_header)
8812 (Incremental_inputs_header_write, Incremental_inputs_entry)
8813 (Incremental_inputs_entry_write): here.
8814
8815 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8816
8817 * incremental.cc (make_sized_incremental_binary): Set the target.
8818 Error if it is incompatible.
8819 * output.h (Output_file): Add filename method.
8820
8821 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8822
8823 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8824 from the get_* methods.
8825
8826 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8827
8828 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8829 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8830 Write 0 for the data_offset of scripts.
8831
8832 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8833
8834 * testsuite/Makefile.am: Add the incremental_test.sh test.
8835 * testsuite/incremental_test.sh: New.
8836 * testsuite/incremental_test_1.c: New.
8837 * testsuite/incremental_test_2.c: New.
8838
8839 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
8840
8841 * incremental-dump.cc (main): Fix typos.
8842
8843 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
8844
8845 PR gold/11025
8846 * incremental-dump.cc (main): Use llu to print 64 bit values.
8847
8848 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8849 H.J. Lu <hongjiu.lu@intel.com>
8850
8851 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8852 $(LIBDL).
8853 (incremental_dump_LDADD): Likewise.
8854 * Makefile.in: Regenerated.
8855
8856 2009-11-25 Doug Kwan <dougkwan@google.com>
8857
8858 Revert:
8859
8860 2009-11-25 Doug Kwan <dougkwan@google.com>
8861
8862 * arm.cc (Target_arm::Target_arm): Move method definition
8863 outside of class definition. Add code to handle
8864 --target1-rel, --target1-abs and --target2= options.
8865 (Target_arm::get_reloc_reloc_type): Change method to be
8866 non-static and const.
8867 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8868 New data member declaration.
8869 (Target_arm::Scan::local, Target_arm::Scan::global,
8870 Target_arm::Relocate::relocate,
8871 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8872 Adjust call to Target_arm::get_real_reloc_type.
8873 (Target_arm::get_real_reloc_type): Use command line options
8874 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8875 * options.h (--target1-rel, --target1-abs, --target2): New
8876 ARM-only options.
8877
8878 2009-11-25 Doug Kwan <dougkwan@google.com>
8879
8880 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8881 class definition. Add code to handle --target1-rel, --target1-abs
8882 and --target2= options.
8883 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8884 and const.
8885 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8886 member declaration.
8887 (Target_arm::Scan::local, Target_arm::Scan::global,
8888 Target_arm::Relocate::relocate,
8889 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8890 call to Target_arm::get_real_reloc_type.
8891 (Target_arm::get_real_reloc_type): Use command line options to
8892 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8893 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8894 options.
8895
8896 2009-11-25 Doug Kwan <dougkwan@google.com>
8897
8898 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8899 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8900 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8901 formatting.
8902 (Arm_relocate_functions::thm_call): Replace body with a call to
8903 Arm_relocate_functions::thumb_branch_common.
8904 (Arm_relocate_functions::thm_jump24,
8905 Arm_relocate_functions::thm_xpc22): New method definitions.
8906 (Arm_relocate_functions::thumb_branch_common): New method definition.
8907 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8908 operator.
8909 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8910 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8911
8912 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8913
8914 * Makefile.am: Build incremental-dump
8915 * Makefile.in: Regenerate.
8916 * incremental-dump.cc: New.
8917 * incremental.cc (Incremental_inputs_header_data,
8918 Incremental_inputs_entry_data): Move to incremental.h
8919 * incremental.h: (Incremental_inputs_header_data,
8920 Incremental_inputs_entry_data): Move from incremental.cc
8921
8922 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8923
8924 * incremental.cc (Incremental_inputs_header,
8925 Incremental_inputs_header_write, Incremental_inputs_entry,
8926 Incremental_inputs_entry_write): Add a typedef with the data type.
8927
8928 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8929
8930 * incremental.cc (Incremental_inputs_header,
8931 Incremental_inputs_header_write, Incremental_inputs_entry,
8932 Incremental_inputs_entry_write): Update comment about which
8933 type has the filed descriptions.
8934
8935 2009-11-15 Doug Kwan <dougkwan@google.com>
8936
8937 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8938 (Arm_relocate_functions::arm_branch_common): Change method defintion
8939 in class definition to a method declaration and update list of formal
8940 parameters.
8941 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8942 Arm_relocation_functions::jump24): Adjust call to
8943 Arm_relocate_functions::arm_branch_common. Update list of formal
8944 parameters.
8945 (Arm_relocate_functions::xpc25): New method definition.
8946 (Arm_relocate_functions::arm_branch_common): Move method defintion
8947 out from class definition. Use stubs for mode-switching and extending
8948 branch ranges.
8949 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8950 specially. Change code to enable use of stubs in ARM branches.
8951
8952 2009-11-10 Doug Kwan <dougkwan@google.com>
8953
8954 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8955 in method declaration.
8956 (Target_arm::relocate_stub): New method declaration.
8957 (Target_arm::default_target): Change to return a pointer instead of
8958 a const reference.
8959 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8960 Target_arm::default_target.
8961 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8962 method definition.
8963 (Target_arm::relocate_section): Adjust view.
8964 (Target_arm::relocate_stub): New method definition.
8965
8966 2009-11-10 Doug Kwan <dougkwan@google.com>
8967
8968 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8969 a format warning.
8970 * incremental.cc (open_incremental_binary): Initialized local
8971 variables to avoid warnings.
8972 * object.cc (make_elf_object): Ditto.
8973 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8974 a format warning.
8975
8976 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8977
8978 PR gold/10930
8979 * testsuite/plugin_test.c: Include "config.h".
8980
8981 2009-11-09 Doug Kwan <dougkwan@google.com>
8982
8983 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8984 (arm_symbol_value): Remove.
8985 (Arm_relocate_functions::arm_branch_common,
8986 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8987 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8988 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8989 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8990 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8991 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8992 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8993 Arm_relocate_functions::thm_mobw_abs_nc,
8994 Arm_relocate_functions::thm_mov_abs,
8995 Arm_relocate_functions::movw_prel_nc,
8996 Arm_relocate_functions::thm_movt_abs,
8997 Arm_relocate_functions::movt_prel,
8998 Arm_relocate_functions::thm_movw_prel_nc,
8999 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9000 (Target_arm::Relocate::relocate): Only decompose address into two
9001 parts if relocation type uses the thumb-bit and pass the actual
9002 bit instead of a flag indicating that the thumb-bit is used. Adjust
9003 calls to methods in Arm_relocate_functions for this change.
9004
9005 2009-11-08 Ian Lance Taylor <iant@google.com>
9006
9007 PR 10925
9008 * reloc.cc: Instantiate
9009 Sized_relobj::initialize_input_to_output_maps and
9010 Sized_relobj:free_input_to_output_maps.
9011
9012 2009-11-06 Ian Lance Taylor <iant@google.com>
9013
9014 PR 10876
9015 * defstd.cc (in_segment): Set only_if_ref true for "end".
9016
9017 2009-11-06 Doug Kwan <dougkwan@google.com>
9018
9019 * arm.cc (class Reloc_stub): Correct a comment.
9020 (Target_arm::Target_arm): Initialize arm_input_section_map_.
9021 (Target_arm::scan_section_for_stubs): New method declaration.
9022 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9023 Change methods from private to protected.
9024 (Target_arm::do_may_relax): New method definition.
9025 (Target_arm::do_relax, Target_arm::group_sections,
9026 Target_arm::scan_reloc_for_stub,
9027 Target_arm::scan_reloc_section_for_stubs): New method declarations.
9028 (Target_arm::arm_input_section_map_): New data member declaration.
9029 (Target_arm::scan_reloc_for_stub,
9030 Target_arm::scan_reloc_section_for_stubs,
9031 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9032 Target_arm::do_relax): New method definitions.
9033
9034 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
9035
9036 * configure.ac: Check for (struct stat)::st_mtim
9037 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9038 * config.in: Regenerate.
9039 * configure: Regenerate.
9040
9041 2009-11-05 Ian Lance Taylor <iant@google.com>
9042
9043 PR 10910
9044 * output.cc (Output_segment::add_output_section): Add missing
9045 return statement.
9046
9047 2009-11-04 Ian Lance Taylor <iant@google.com>
9048
9049 PR 10880
9050 * object.h (class Object): Add is_needed and set_is_needed
9051 methods. Add is_needed_ field. Make bool fields into bitfields.
9052 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9053 defined in a dynamic object and referenced by a regular object,
9054 set is_needed for the dynamic object.
9055 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9056 if the file is marked with as_needed and it is not needed.
9057
9058 2009-11-04 Ian Lance Taylor <iant@google.com>
9059
9060 PR 10887
9061 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9062 tags if data is discarded by linker script.
9063 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9064 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9065 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9066 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9067
9068 2009-11-04 Ian Lance Taylor <iant@google.com>
9069
9070 * layout.cc (Layout::get_output_section): Add is_interp and
9071 is_dynamic_linker_section parameters. Change all callers.
9072 (Layout::choose_output_section): Likewise.
9073 (Layout::make_output_section): Likewise.
9074 (Layout::add_output_section_data): Add is_dynamic_linker_section
9075 parameter. Change all callers.
9076 * layout.h (class Layout): Update declarations.
9077 * output.h (class Output_section): Add is_interp, set_is_interp,
9078 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9079 Add is_interp_, is_dynamic_linker_section_ fields. Change
9080 generate_code_fills_at_write_ to a bitfield.
9081 * output.cc (Output_section::Output_sections): Initialize new
9082 fields.
9083 (Output_segment::add_output_section): Add do_sort parameter.
9084 Change all callers.
9085
9086 2009-11-03 Ian Lance Taylor <iant@google.com>
9087
9088 PR 10860
9089 * options.h (class General_options): Add --warn-common.
9090 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9091 merging two common symbols.
9092 (Symbol_table::should_override): Handle --warn-common when merging
9093 a common symbol with a defined symbol. Use report_resolve_problem
9094 for multiple definitions.
9095 (Symbol_table::report_resolve_problem): New function.
9096 * symtab.h (class Symbol_table): Declare report_resolve_problem.
9097
9098 2009-11-03 Doug Kwan <dougkwan@google.com>
9099
9100 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9101 stub_factory_.
9102 (Target_arm::stub_factory): New method definition.
9103 (Target_arm::new_arm_input_section,
9104 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9105 Target_arm::reloc_uses_thumb_bit): New method declarations.
9106 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9107 New type definitions.
9108 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9109 member declarations.
9110 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9111 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9112 New method definitions.
9113
9114 2009-11-03 Ian Lance Taylor <iant@google.com>
9115
9116 * options.h (class General_options): Add --warn_constructors.
9117
9118 2009-11-03 Ian Lance Taylor <iant@google.com>
9119
9120 PR 10893
9121 * defstd.cc (in_section): Add entries for __rel_iplt_start,
9122 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9123
9124 2009-11-03 Ian Lance Taylor <iant@google.com>
9125
9126 PR 10895
9127 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9128 --msgid-bugs-address.
9129 (install-pdf): New target.
9130 (install-data_yes): Look up one directory to find mkinstalldirs.
9131
9132 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
9133
9134 * po/Make-in (.po.gmo): Don't generate .gmo files in source
9135 tree.
9136
9137 2009-10-30 Doug Kwan <dougkwan@google.com>
9138
9139 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9140
9141 2009-10-30 Doug Kwan <dougkwan@google.com>
9142
9143 * arm.cc (Stub_addend_reader): New struct template definition
9144 and partial specializations.
9145 (Stub_addend_reader::operator()): New method definition for a
9146 partially specialized template.
9147
9148 2009-10-30 Doug Kwan <dougkwan@google.com>
9149
9150 * arm.cc (Arm_relobj::processor_specific_flags): New method
9151 definition.
9152 (Arm_relobj::do_read_symbols): New method declaration.
9153 (Arm_relobj::processor_specific_flags_): New data member declaration.
9154 (Arm_dynobj): New class definition.
9155 (Target_arm::do_finalize_sections): Add input_objects parameter.
9156 (Target_arm::do_adjust_elf_header): New method declaration.
9157 (Target_arm::are_eabi_versions_compatible,
9158 (Target_arm::merge_processor_specific_flags): New method declaration.
9159 (Target_arm::do_make_elf_object): New overloaded method definitions
9160 and declaration.
9161 (Arm_relobj::do_read_symbols): New method definition.
9162 (Arm_dynobj::do_read_symbols): Ditto.
9163 (Target_arm::do_finalize_sections): Add input_objects parameters.
9164 Merge processor-specific flags from all input objects.
9165 (Target_arm::are_eabi_versions_compatible,
9166 Target_arm::merge_processor_specific_flags,
9167 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9168 New method definitions.
9169 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9170 Input_objects pointer type parameter.
9171 * layout.cc (Layout::finalize): Pass input objects to target's.
9172 finalize_sections function.
9173 * output.cc (Output_file_header::do_sized_write): Set ELF file
9174 header's processor-specific flags.
9175 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9176 Input_objects pointer type parameter.
9177 * sparc.cc (Target_sparc::do_finalize_sections): Same.
9178 * target.h (Input_objects): New forward class declaration.
9179 (Target::processor_specific_flags,
9180 Target::are_processor_specific_flags_sect): New method definitions.
9181 (Target::finalize_sections): Add input_objects parameter.
9182 (Target::Target): Initialize processor_specific_flags_ and
9183 are_processor_specific_flags_set_.
9184 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9185 parameter.
9186 (Target::set_processor_specific_flags): New method definition.
9187 (Target::processor_specific_flags_,
9188 Target::are_processor_specific_flags_set_): New data member
9189 declarations.
9190 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9191 Input_objects pointer type parameter.
9192
9193 2009-10-30 Doug Kwan <dougkwan@google.com>
9194
9195 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9196
9197 2009-10-28 Ian Lance Taylor <iant@google.com>
9198
9199 * object.h (class Relobj): Drop options parameter from
9200 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9201 do_scan_relocs, do_relocate. Change all callers.
9202 (class Sized_relobj): Drop options parameters from
9203 do_gc_process_relocs, do_scan_relocs, do_relocate,
9204 do_relocate_sections, relocate_sections, emit_relocs_scan,
9205 emit_relocs_scan_reltype. Change all callers.
9206 (struct Relocate_info): Remove options field and all references to
9207 it.
9208 * reloc.h (class Read_relocs): Remove options constructor
9209 parameter and options_ field. Change all callers.
9210 (class Gc_process_relocs, class Scan_relocs): Likewise.
9211 (class Relocate_task): Likewise.
9212 * target-reloc.h (scan_relocs): Remove options parameter. Change
9213 all callers.
9214 (scan_relocatable_relocs): Likewise.
9215 * target.h (class Sized_target): Remove options parameter from
9216 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
9217 all callers.
9218 * gc.h (gc_process_relocs): Remove options parameter. Change all
9219 callers.
9220 * arm.cc: Update functions to remove options parameters.
9221 * i386.cc: Likewise.
9222 * powerpc.cc: Likewise.
9223 * sparc.cc: Likewise.
9224 * x86_64.cc: Likewise.
9225 * testsuite/testfile.cc: Likewise.
9226
9227 2009-10-28 Doug Kwan <dougkwan@google.com>
9228
9229 * arm.cc (Arm_relobj): New class definition.
9230 (Arm_relobj::scan_sections_for_stubs,
9231 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9232 New method definitions.
9233
9234 2009-10-28 Cary Coutant <ccoutant@google.com>
9235
9236 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9237 (Plugin::cleanup_done_): New member.
9238 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9239 (Plugin_manager::cleanup_done_): Remove.
9240 (Plugin_manager::add_input_file): Edit error message.
9241 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9242 (Plugin_manager::cleanup): Remove use of cleanup_done_.
9243
9244 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
9245
9246 * fileread.cc: (File_read::View::~View): Use the new
9247 data_ownership_ filed.
9248 (File_read::~File_read): Dispose the new whole_file_view_.
9249 (File_read::open): Mmap the whole file if needed.
9250 (File_read::open): Use whole_file_view_ instead of contents_.
9251 (File_read::find_view): Use whole_file_view_ if applicable.
9252 (File_read::do_read): Use whole_file_view_ instead of contents_.
9253 (File_read::make_view): Use whole_file_view_ instead of contents_,
9254 update File_read::View::View call.
9255 (File_read::find_or_make_view): Update File_read::View::View
9256 call.
9257 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9258 remove contents_
9259 (File_read::View::Data_ownership): New enum.
9260 (File_read::View::View): Replace bool mapped_ with Data_ownership
9261 argument.
9262 (File_read::View::mapped_): Remove (replaced by data_ownership_).
9263 (File_read::View::data_ownership_): New field.
9264 (File_read::contents_): Remove (replaced by whole_file_view_).
9265 (File_read::whole_file_view_): New field.
9266 * options.h (class General_options): Add --keep-files-mapped.
9267
9268 2009-10-27 Cary Coutant <ccoutant@google.com>
9269
9270 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9271 * testsuite/Makefile.am (plugin_test_5): New test case.
9272 * testsuite/Makefile.in: Regenerate.
9273
9274 2009-10-25 Doug Kwan <dougkwan@google.com>
9275
9276 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9277 from private to protected to allow access by child class.
9278 (Sized_relobj::do_relocate_sections): New method declaration.
9279 (Sized_relobj::relocate_sections): Virtualize.
9280 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9281 Sized_relobj::relocate_sections. Instantiate template explicitly
9282 for different target sizes and endianity.
9283
9284 2009-10-24 Doug Kwan <dougkwan@google.com>
9285
9286 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9287 (Arm_input_section::as_arm_input_section): New method.
9288 (Arm_output_section): New class definition.
9289 (Arm_output_section::create_stub_group,
9290 Arm_output_section::group_sections): New method definitions.
9291
9292 2009-10-22 Doug Kwan <dougkwan@google.com>
9293
9294 * arm.cc (Arm_input_section): New class definition.
9295 (Arm_input_section::init, Arm_input_section:do_write,
9296 Arm_input_section::set_final_data_size,
9297 Arm_input_section::do_reset_address_and_file_offset): New method
9298 definitions.
9299
9300 2009-10-21 Doug Kwan <dougkwan@google.com>
9301
9302 * arm.cc (Stub_table, Arm_input_section): New forward class
9303 declarations.
9304 (Stub_table): New class defintion.
9305 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9306 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9307 New method definition.
9308
9309 2009-10-21 Doug Kwan <dougkwan@google.com>
9310
9311 * arm.cc: Update copyright comments.
9312 (Target_arm): New forward class template declaration.
9313 (Arm_address): New type.
9314 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9315 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9316 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9317 constants.
9318 (Insn_template): Same.
9319 (DEF_STUBS): New macro.
9320 (Stub_type): New enum type.
9321 (Stub_template): New class definition.
9322 (Stub): Same.
9323 (Reloc_stub): Same.
9324 (Stub_factory): Same.
9325 (Target_arm::Target_arm): Initialize may_use_blx_ and
9326 should_force_pic_veneer_.
9327 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9328 Target_arm::should_force_pic_veneer,
9329 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9330 Target_arm::using_thumb_only, Target_arm:;default_target): New
9331 method defintions.
9332 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9333 New data member declarations.
9334 (Insn_template::size, Insn_template::alignment): New method defintions.
9335 (Stub_template::Stub_template): New method definition.
9336 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9337 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9338 (Stub_factory::Stub_factory): New method definition.
9339 * gold.h (string_hash): New template.
9340 * output.h (Input_section_specifier::hash_value): Use
9341 gold::string_hash.
9342 (Input_section_specifier::string_hash): Remove.
9343 * stringpool.cc (Stringpool_template::string_hash): Use
9344 gold::string_hash.
9345
9346 2009-10-20 Doug Kwan <dougkwan@google.com>
9347
9348 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9349 symbols of relaxed input sections.
9350 * output.h (Output_section::find_relaxed_input_section): Make
9351 method public.
9352
9353 2009-10-16 Doug Kwan <dougkwan@google.com>
9354
9355 * dynobj.cc (Versions::Versions): Initialize version_script_.
9356 Only insert base version symbol definition for a shared object
9357 if version script defines any version versions.
9358 (Versions::define_base_version): New method definition.
9359 (Versions::add_def): Check that base version is not needed.
9360 (Versions::add_need): Define base version lazily.
9361 * dynobj.h (Versions::define_base_version): New method declaration.
9362 (Versions::needs_base_version_): New data member declaration.
9363 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9364 (check_DATA): Add no_version_test.stdout.
9365 (libno_version_test.so, no_version_test.o no_version_test.stdout):
9366 New make rules.
9367 * testsuite/Makefile.in: Regenerate.
9368 * testsuite/no_version_test.c: New file.
9369 * testsuite/no_version_test.sh: Ditto.
9370
9371 2009-10-16 Doug Kwan <dougkwan@google.com>
9372
9373 * expression.cc (class Segment_start_expression): New class definition.
9374 (Segment_start_expression::value): New method definition.
9375 (script_exp_function_segment_start): Return a new
9376 Segment_start_expression.
9377 * gold/script-c.h (script_saw_segment_start_expression): New function
9378 prototype.
9379 * script-sections.cc (Script_sections::Script_sections): Initialize
9380 SAW_SEGMENT_START_EXPRESSION_ to false.
9381 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9382 and -Tbbs options to specify section addresses if given in
9383 command line and no SEGMENT_START expression is seen in a script.
9384 * script-sections.h (Script_sections::saw_segment_start_expression,
9385 Script_sections::set_saw_segment_start_expression): New method
9386 definition.
9387 (Script_sections::saw_segment_start_expression_): New data member
9388 declaration.
9389 * script.cc (script_saw_segment_start_expression): New function.
9390 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9391 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9392 script_test_7.sh and script_test_8.sh.
9393 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9394 script_test_8.stdout.
9395 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9396 (script_test_6, script_test_6.stdout, script_test_7,
9397 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9398 * Makefile.in: Regenerate.
9399 * testsuite/script_test_6.sh: New file.
9400 * testsuite/script_test_6.t: Same.
9401 * testsuite/script_test_7.sh: Same.
9402 * testsuite/script_test_7.t: Same.
9403 * testsuite/script_test_8.sh: Same.
9404
9405 2009-10-16 Doug Kwan <dougkwan@google.com>
9406
9407 * output.cc (Output_segment::set_section_list_address): Cast
9408 expressions to unsigned long long type to avoid format warnings.
9409
9410 2009-10-15 Ian Lance Taylor <iant@google.com>
9411
9412 * script.cc (Script_options::add_symbol_assignment): Always add a
9413 dot assignment to script_sections_.
9414 * script-sections.cc (Script_sections::add_dot_assignment):
9415 Initialize if necessary.
9416
9417 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9418 program headers with no load segment if there is a linker script.
9419
9420 * layout.cc (Layout::set_segment_offsets): Align the file offset
9421 to the segment aligment for -N or -n with no load segment.
9422 * output.cc (Output_segment::add_output_section): Don't crash if
9423 the first section is a TLS section.
9424 (Output_segment::set_section_list_addresses): Print an error
9425 message if the address moves backward in a linker script.
9426 * script-sections.cc
9427 (Output_section_element_input::set_section_addresses): Don't
9428 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9429 (Orphan_output_section::set_section_addresses): Likewise.
9430
9431 2009-10-15 Doug Kwan <dougkwan@google.com>
9432
9433 * layout.cc (Layout::finish_dynamic_section): Generate tags
9434 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9435 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9436 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9437
9438 2009-10-14 Ian Lance Taylor <iant@google.com>
9439
9440 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9441 fields.
9442 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9443 data_shdr fields of relinfo.
9444 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9445 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
9446 R_386_TLS_LDO_32, adjust based on section flags.
9447 (Target_i386::Relocate::fix_up_ldo): Remove.
9448
9449 2009-10-13 Ian Lance Taylor <iant@google.com>
9450
9451 Add support for -pie.
9452 * options.h (class General_options): Add -pie and
9453 --pic-executable.
9454 (General_options::output_is_position_independent): Test -pie.
9455 (General_options::output_is_executable): Return true if not shared
9456 and not relocatable.
9457 (General_options::output_is_pie): Remove.
9458 * options.cc (General_options::finalize): Reject incompatible uses
9459 of -pie.
9460 * gold.cc (queue_middle_tasks): A -pie link is not static.
9461 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9462 * symtab.cc (Symbol::final_value_is_known): Return false if
9463 output_is_position_independent.
9464 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9465 output_is_position_independent.
9466 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9467 output_is_position_independent.
9468 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9469 output_is_position_independent.
9470 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9471 two_file_pie_test.
9472 (basic_pie_test.o, basic_pie_test): New targets.
9473 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9474 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9475 (two_file_pie_test): New target.
9476 * testsuite/Makefile.in: Rebuild.
9477 * README: Remove note saying that -pie is not supported.
9478
9479 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
9480
9481 * options.h (class General_options): Add -init and -fini.
9482 * layout.cc (Layout::finish_dynamic_section): Emit
9483 given init and fini functions.
9484
9485 2009-10-13 Sriraman Tallam <tmsriram@google.com>
9486
9487 * gc.h (gc_process_relocs): Check if icf is enabled using new
9488 function.
9489 * gold.cc (queue_initial_tasks): Likewise.
9490 (queue_middle_tasks): Likewise.
9491 * object.cc (do_layout): Likewise.
9492 * symtab.cc (is_section_folded): Likewise.
9493 * main.cc (main): Likewise.
9494 * reloc.cc (Read_relocs::run): Likewise.
9495 (Sized_relobj::do_scan_relocs): Likewise.
9496 * icf.cc (is_function_ctor_or_dtor): New function.
9497 (Icf::find_identical_sections): Check if function is ctor or dtor when
9498 safe icf is chosen.
9499 * options.h (General_options::icf): Change option to be an enum.
9500 (Icf_status): New enum.
9501 (icf_enabled): New method.
9502 (icf_safe_folding): New method.
9503 (set_icf_status): New method.
9504 (icf_status_): New variable.
9505 * (options.cc) (General_options::finalize): Set icf_status_.
9506 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9507 icf_test and icf_keep_unique_test to use the --icf enum flag.
9508 * testsuite/icf_safe_test.sh: New file.
9509 * testsuite/icf_safe_test.cc: New file.
9510
9511 2009-10-12 Sriraman Tallam <tmsriram@google.com>
9512
9513 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9514 includes to gc.h and icf.h.
9515 * arm.cc: Include gc.h.
9516 * gold.cc: Likewise.
9517 * i386.cc: Likewise.
9518 * powerpc.cc: Likewise.
9519 * sparc.cc: Likewise.
9520 * x86_64.cc: Likewise.
9521 * gc.h: Include icf.h.
9522
9523 2009-10-11 Ian Lance Taylor <iant@google.com>
9524
9525 * plugin.cc: Include "gold.h" before other header files.
9526
9527 2009-10-10 Chris Demetriou <cgd@google.com>
9528
9529 * options.h (Input_file_argument::Input_file_type): New enum.
9530 (Input_file_argument::is_lib_): Replace with...
9531 (Input_file_argument::type_): New member.
9532 (Input_file_argument::Input_file_argument): Take Input_file_type
9533 'type' rather than boolean 'is_lib' as second argument.
9534 (Input_file_argument::is_lib): Use type_.
9535 (Input_file_argument::is_searched_file): New function.
9536 (Input_file_argument::may_need_search): Handle is_searched_file.
9537 * options.cc (General_options::parse_library): Support -l:filename.
9538 (General_options::parse_just_symbols): Update for Input_file_argument
9539 changes.
9540 (Command_line::process): Likewise.
9541 * archive.cc (Archive::get_file_and_offset): Likewise.
9542 * plugin.cc (Plugin_manager::release_input_file): Likewise.
9543 * script.cc (read_script_file, script_add_file): Likewise.
9544 * fileread.cc (Input_file::Input_file): Likewise.
9545 (Input_file::will_search_for): Handle is_searched_file.
9546 (Input_file::open): Likewise.
9547 * readsyms.cc (Read_symbols::get_name): Likewise.
9548 * testsuite/Makefile.am (searched_file_test): New test.
9549 * testsuite/Makefile.in: Regenerate.
9550 * testsuite/searched_file_test.cc: New file.
9551 * testsuite/searched_file_test_lib.cc: New file.
9552
9553 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9554 Ian Lance Taylor <iant@google.com>
9555
9556 * descriptor.cc: Include <cstdio> and "binary-io.h".
9557 (Descriptors::open): Open the files in binary mode always.
9558 * script.cc (Lex::get_token): Treat \r as whitespace.
9559
9560 2009-10-09 Ian Lance Taylor <iant@google.com>
9561
9562 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9563
9564 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9565 Ian Lance Taylor <iant@google.com>
9566
9567 * configure.ac: Check for readv function also.
9568 * fileread.cc (readv): Define if not HAVE_READV.
9569 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9570 does not exist.
9571 * config.in: Regenerate.
9572 * configure: Regenerate.
9573
9574 2009-10-09 Doug Kwan <dougkwan@google.com>
9575
9576 * layout.cc (Layout::make_output_section): Call target hook to make
9577 ordinary output section.
9578 (Layout::finalize): Adjust parameter list of call the
9579 Target::may_relax().
9580 * layout.h (class Layout::section_list): New method.
9581 * merge.h (Output_merge_base::entsize): Change visibility to public.
9582 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9583 New methods.
9584 (Output_merge_string::do_is_string): New method.
9585 * object.cc (Sized_relobj::do_setup): renamed from
9586 Sized_relobj::set_up.
9587 * object.h (Sized_relobj::adjust_shndx,
9588 Sized_relobj::initializ_input_to_output_maps,
9589 Sized_relobj::free_input_to_output_maps): Change visibilities to
9590 protected.
9591 (Sized_relobj::setup): Virtualize.
9592 (Sized_relobj::do_setup): New method declaration.
9593 (Sized_relobj::invalidate_section_offset,
9594 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9595 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9596 * options.cc (parse_int): New function.
9597 * options.h (parse_int): New declaration.
9598 (DEFINE_int): New macro.
9599 (stub_group_size): New option.
9600 * output.cc (Output_section::Output_section): Initialize memebers
9601 merge_section_map_, merge_section_by_properties_map_,
9602 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9603 (Output_section::add_input_section): Handled deferred code-fill
9604 generation and remove an old comment.
9605 (Output_section::add_relaxed_input_section): New method definition.
9606 (Output_section::add_merge_input_section): Use merge section by
9607 properties map to speed to search. Update merge section maps
9608 as appropriate.
9609 (Output_section::build_relaxation_map): New method definition.
9610 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9611 Same.
9612 (Output_section::relax_input_section): Renamed to
9613 Output_section::convert_input_sections_to_relaxed_sections and change
9614 interface to take a vector of pointers to relaxed sections.
9615 (Output_section::find_merge_section,
9616 Output_section::find_relaxed_input_section): New method definitions.
9617 (Output_section::is_input_address_mapped,
9618 Output_section::output_offset, Output_section::output_address):
9619 Use output section data maps to speed up searching.
9620 (Output_section::find_starting_output_address): Add comments.
9621 (Output_section::do_write,
9622 Output_section::write_to_postprocessing_buffer): Do code-fill
9623 generation as appropriate.
9624 (Output_section::get_input_sections): Invalidate relaxed input section
9625 map.
9626 (Output_section::restore_states): Adjust type of checkpoint .
9627 Invalidate relaxed input section map.
9628 * output.h (Output_merge_base): New class declaration.
9629 (Input_section_specifier): New class defintion.
9630 (class Output_relaxed_input_section) Change base class to
9631 Output_section_data_build.
9632 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9633 base class initializer.
9634 (Output_section::add_relaxed_input_section): New method declaration.
9635 (Output_section::Input_section): Change visibility to protected.
9636 (Output_section::Input_section::relobj,
9637 Output_section::Input_section::shndx): Handle relaxed input sections.
9638 Output_section::input_sections) Change visibility to protected. Also
9639 define overload to return a non-const pointer.
9640 (Output_section::Merge_section_properties): New class defintion.
9641 (Output_section::Merge_section_by_properties_map,
9642 Output_section::Output_section_data_by_input_section_map,
9643 Output_section::Relaxation_map): New types.
9644 (Output_section::relax_input_section): Rename method to
9645 Output_section::convert_input_sections_to_relaxed_sections and change
9646 interface to take a vector of relaxed section pointers.
9647 (Output_section::find_merge_section,
9648 Output_section::find_relaxed_input_section,
9649 Output_section::build_relaxation_map,
9650 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9651 New method declarations.
9652 (Output_section::merge_section_map_
9653 Output_section::merge_section_by_properties_map_,
9654 Output_section::relaxed_input_section_map_,
9655 Output_section::is_relaxed_input_section_map_valid_,
9656 Output_section::generate_code_fills_at_write_): New data members.
9657 * script-sections.cc
9658 (Output_section_element_input::set_section_addresses): Call
9659 current_data_size and addralign methods of relaxed input sections.
9660 (Orphan_output_section::set_section_addresses): Call current_data_size
9661 and addralign methods of relaxed input sections.
9662 * symtab.cc (Symbol_table::compute_final_value): Extract template
9663 from the body of Symbol_table::sized_finalize_symbol.
9664 (Symbol_table::sized_finalized_symbol): Call
9665 Symbol_table::compute_final_value.
9666 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9667 (Symbol_table::compute_final_value): New templated method declaration.
9668 * target.cc (Target::do_make_output_section): New method defintion.
9669 * target.h (Target::make_output_section): New method declaration.
9670 (Target::relax): Add more parameters for input objects, symbol table
9671 and layout. Adjust call to do_relax.
9672 (Target::do_make_output_section): New method declaration.
9673 (Target::do_relax): Add parameters for input objects, symbol table
9674 and layout.
9675
9676 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9677
9678 * pread.c: Include stdio.h.
9679
9680 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9681
9682 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9683 defined.
9684
9685 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9686
9687 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9688 Change read_shndx type to unsigned int.
9689 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9690 int.
9691 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9692 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9693 Change read_shndx type to unsigned int.
9694 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9695 int.
9696 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9697 * layout.cc (Layout::create_symtab_sections): Cast the result of
9698 local_symcount * symsize to off_t in the gold_assert.
9699
9700 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9701
9702 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9703 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9704 R_ARM_BASE_ABS.
9705 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9706 (Arm_relocate_functions::thm_abs5): New function.
9707 (Arm_relocate_functions::abs12): New function.
9708 (Arm_relocate_functions::abs16): New function.
9709 (Arm_relocate_functions::base_abs): New function.
9710 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9711 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9712 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9713 R_ARM_BASE_ABS.
9714 (Scan::global): Likewise.
9715 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9716 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9717 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9718 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9719 R_ARM_BASE_ABS.
9720
9721 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9722
9723 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9724 (Arm_relocate_functions::movt_prel): New function.
9725 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9726 (Arm_relocate_functions::thm_movt_prel): New function.
9727 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9728 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9729 (Scan::global, Relocate::relocate): Likewise.
9730 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9731
9732 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9733
9734 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9735 Incremental_checker.
9736 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9737 unsigned int.
9738 (class Incremental_inputs_header): New class.
9739 (Incremental_inputs_header_writer): Edit comment.
9740 (Incremental_inputs_entry): New class.
9741 (Incremental_inputs_entry_writer): Edit comment.
9742 (Sized_incremental_binary::do_find_incremental_inputs_section):
9743 Add *strtab_shndx parameter, fill it.
9744 (Sized_incremental_binary::do_check_inputs): New method.
9745 (Incremental_checker::can_incrementally_link_output_file): Use
9746 Sized_incremental_binary::check_inputs.
9747 (Incremental_inputs::report_command_line): Save command line in
9748 command_line_.
9749 * incremental.h:
9750 (Incremental_binary::find_incremental_inputs_section): New
9751 method.
9752 (Incremental_binary::do_find_incremental_inputs_section): Add
9753 strtab_shndx parameter.
9754 (Incremental_binary::do_check_inputs): New pure virtual method.
9755 (Sized_incremental_binary::do_check_inputs): Declare.
9756 (Incremental_checker::Incremental_checker): Add incremental_inputs
9757 parameter, use it to initialize incremental_inputs_.
9758 (Incremental_checker::incremental_inputs_): New field.
9759 (Incremental_checker::command_line): New method.
9760 (Incremental_checker::inputs): New method.
9761 (Incremental_checker::command_line_): New field.
9762
9763 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9764
9765 * incremental.cc: Include <cstdarg> and "target-select.h".
9766 (vexplain_no_incremental): New function.
9767 (explain_no_incremental): New function.
9768 (Incremental_binary::error): New method.
9769 (Sized_incremental_binary::do_find_incremental_inputs_section): New
9770 method.
9771 (make_sized_incremental_binary): New function.
9772 (open_incremental_binary): New function.
9773 (can_incrementally_link_file): Add checks if output is ELF and has
9774 inputs section.
9775 * incremental.h: Include "elfcpp_file.h" and "output.h".
9776 (Incremental_binary): New class.
9777 (Sized_incremental_binary): New class.
9778 (open_incremental_binary): Declare.
9779 * object.cc (is_elf_object): Use
9780 elfcpp::Elf_recognizer::is_elf_file.
9781 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9782 * output.h (Output_file::filesize): New method.
9783
9784 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9785
9786 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9787 New function.
9788 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9789 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9790 function.
9791 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9792 function.
9793 (Arm_relocate_functions::movw_abs_nc): New function.
9794 (Arm_relocate_functions::movt_abs): New function.
9795 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9796 (Arm_relocate_functions::thm_movt_abs): New function.
9797 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9798 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9799 (Scan::global): Likewise.
9800 (Relocate::relocate): Likewise.
9801 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9802
9803 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9804
9805 * arm.cc (Arm_relocate_functions::got_prel) New function.
9806 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9807 (Relocate::relocate): Likewise.
9808 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9809
9810 2009-10-06 Ian Lance Taylor <iant@google.com>
9811
9812 * options.h (class General_options): Define
9813 split_stack_adjust_size parameter.
9814 * object.h (class Object): Add uses_split_stack_ and
9815 has_no_split_stack_ fields. Add uses_split_stack and
9816 has_no_split_stack accessor functions. Declare
9817 handle_split_stack_section.
9818 (class Reloc_symbol_changes): Define.
9819 (class Sized_relobj): Define Function_offsets. Declare
9820 split_stack_adjust, split_stack_adjust_reltype, and
9821 find_functions.
9822 * object.cc (Object::handle_split_stack_section): New function.
9823 (Sized_relobj::do_layout): Call handle_split_stack_section.
9824 * dynobj.cc (Sized_dynobj::do_layout): Call
9825 handle_split_stack_section.
9826 * reloc.cc (Sized_relobj::relocate_sections): Call
9827 split_stack_adjust for executable sections in split_stack
9828 objects. Pass reloc_map to relocate_section.
9829 (Sized_relobj::split_stack_adjust): New function.
9830 (Sized_relobj::split_stack_adjust_reltype): New function.
9831 (Sized_relobj::find_functions): New function.
9832 * target-reloc.h: Include "object.h".
9833 (relocate_section): Add reloc_symbol_changes parameter. Change
9834 all callers.
9835 * target.h (class Target): Add calls_non_split method. Declare
9836 do_calls_non_split virtual method. Declare match_view and
9837 set_view_to_nop.
9838 * target.cc: Include "elfcpp.h".
9839 (Target::do_calls_non_split): New function.
9840 (Target::match_view): New function.
9841 (Target::set_view_to_nop): New function.
9842 * gold.cc (queue_middle_tasks): Give an error if mixing
9843 split-stack and non-split-stack objects with -r.
9844 * i386.cc (Target_i386::relocate_section): Add
9845 reloc_symbol_changes parameter.
9846 (Target_i386::do_calls_non_split): New function.
9847 * x86_64.cc (Target_x86_64::relocate_section): Add
9848 reloc_symbol_changes parameter.
9849 (Target_x86_64::do_calls_non_split): New function.
9850 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9851 parameter.
9852 * powerpc.cc (Target_powerpc::relocate_section): Add
9853 reloc_symbol_changes parameter.
9854 * sparc.cc (Target_sparc::relocate_section): Add
9855 reloc_symbol_changes parameter.
9856 * configure.ac: Call AM_CONDITIONAL for the default target.
9857 * configure: Rebuild.
9858 * testsuite/Makefile.am (TEST_AS): New variable.
9859 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9860 (check_DATA): Add split_i386 and split_x86_64 files.
9861 (SPLIT_DEFSYMS): Define.
9862 (split_i386_[1234n].o): New targets.
9863 (split_i386_[124]): New targets.
9864 (split_i386_[1234r].stdout): New targets.
9865 (split_x86_64_[1234n].o): New targets.
9866 (split_x86_64_[124]): New targets.
9867 (split_x86_64_[1234r].stdout): New targets.
9868 (MOSTLYCLEANFILES): Add new executables.
9869 * testsuite/split_i386.sh: New file.
9870 * testsuite/split_x86_64.sh: New file.
9871 * testsuite/split_i386_1.s: New file.
9872 * testsuite/split_i386_2.s: New file.
9873 * testsuite/split_i386_3.s: New file.
9874 * testsuite/split_i386_4.s: New file.
9875 * testsuite/split_i386_n.s: New file.
9876 * testsuite/split_x86_64_1.s: New file.
9877 * testsuite/split_x86_64_2.s: New file.
9878 * testsuite/split_x86_64_3.s: New file.
9879 * testsuite/split_x86_64_4.s: New file.
9880 * testsuite/split_x86_64_n.s: New file.
9881 * testsuite/testfile.cc (Target_test): Update relocation_section
9882 function.
9883 * testsuite/Makefile.in: Rebuild.
9884
9885 2009-10-06 Ian Lance Taylor <iant@google.com>
9886
9887 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9888 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9889 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9890 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9891 the address on ldo_addrs_.
9892 (Target_i386::Relocate::fix_up_ldo): New function.
9893
9894 2009-10-06 Rafael Espindola <espindola@google.com>
9895
9896 * plugin.cc (add_input_library): New.
9897 (Plugin::load): Add add_input_library to tv.
9898 (Plugin_manager::add_input_file): Add the is_lib argument.
9899 (add_input_file): Update call to Plugin_manager::add_input_file.
9900 (add_input_library): New.
9901 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9902
9903 2009-09-30 Doug Kwan <dougkwan@google.com>
9904
9905 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9906 symbol and call Symbol::may_need_copy_reloc to determine if
9907 a copy reloc is needed.
9908 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9909 nocopyreloc is given in command line.
9910 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9911 given in command line.
9912 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9913 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9914 of the removed Target_i386::may_need_copy_reloc.
9915 * options.h (copyreloc): New option with default value false.
9916 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9917 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9918 instead of the removed Target_powerpc::may_need_copy_reloc.
9919 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9920 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9921 instead of the removed Target_sparc::may_need_copy_reloc.
9922 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9923 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9924 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9925 instead of the removed Target_x86_64::may_need_copy_reloc.
9926
9927 2009-09-30 Ian Lance Taylor <iant@google.com>
9928
9929 * object.h (class Object): Remove target_ field, and target,
9930 sized_target, and set_target methods.
9931 (Object::sized_target): Remove.
9932 (class Sized_relobj): Update declarations. Remove sized_target.
9933 * object.cc (Sized_relobj::setup): Remove target parameter.
9934 Change all callers.
9935 (Input_objects::add_object): Don't do anything with the target.
9936 (make_elf_sized_object): Add punconfigured parameter. Change all
9937 callers. Set or test parameter target.
9938 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9939 Change all callers.
9940 * parameters.cc (Parameters::set_target): Change parameter type to
9941 be non-const.
9942 (Parameters::default_target): Remove.
9943 (set_parameters_target): Change parameter type to be non-const.
9944 (parameters_force_valid_target): New function.
9945 (parameters_clear_target): New function.
9946 * parameters.h (class Parameters): Update declarations. Remove
9947 default_target method. Add sized_target and clear_target
9948 methods. Change target_ to be non-const.
9949 (set_parameters_target): Update declaration.
9950 (parameters_force_valid_target): Declare.
9951 (parameters_clear_target): Declare.
9952 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9953 as NULL if we aren't searching.
9954 (Add_symbols::run): Don't check for compatible target.
9955 * fileread.cc (Input_file::open_binary): Call
9956 parameters_force_valid_target.
9957 * gold.cc (queue_middle_tasks): Likewise.
9958 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9959 set_target on object.
9960 * dynobj.h (class Sized_dynobj): Update declarations.
9961 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9962 make_elf_object returns NULL.
9963 (Archive::include_member): Don't check whether object target is
9964 compatible.
9965 * output.cc (Output_section::add_input_section): Get target from
9966 parameters.
9967 (Output_section::relax_input_section): Likewise.
9968 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9969 parameters.
9970 (Sized_relobj::do_scan_relocs): Likewise.
9971 (Sized_relobj::relocate_sections): Likewise.
9972 * resolve.cc (Symbol_table::resolve): Likewise.
9973 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9974 parameter. Change all callers.
9975 (Symbol_table::add_from_object): Get target from parameters.
9976 (Symbol_table::add_from_relobj): Don't check object target.
9977 (Symbol_table::add_from_dynobj): Likewise.
9978 (Symbol_table::define_special_symbol): Get target from
9979 parameters.
9980 * symtab.h (class Symbol_table): Update declaration.
9981 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9982 parameter. Change all callers. Clear parameter target.
9983 (Binary_test): Test target here.
9984 * testsuite/object_unittest.cc (gold_testsuite): Remove
9985 target_test_pointer parameter. Change all callers.
9986 (Object_test): Test target here.
9987
9988 2009-09-26 Ian Lance Taylor <iant@google.com>
9989
9990 * testsuite/initpri1.c: Don't try to use constructor priorities if
9991 compiling with gcc before 4.3.
9992
9993 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9994
9995 * testsuite/retain_symbols_file_test.sh (check_present): Change
9996 output file name to retain_symbols_file_test.stdout.
9997 (check_absent): Likewise.
9998
9999 2009-09-18 Craig Silverstein <csilvers@google.com>
10000
10001 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10002 * options.cc: Include <cerrno> and <fstream>.
10003 (General_options::finalize): Parse -retain-symbols-file tag.
10004 * options.h: New flag.
10005 (General_options): New method should_retain_symbol, new
10006 variable symbols_to_retain.
10007 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10008 should_retain_symbol map.
10009 * testsuite/Makefile.am (retain_symbols_file_test): New test.
10010 * testsuite/Makefile.in: Regenerate.
10011 * testsuite/retain_symbols_file_test.sh: New file.
10012
10013 2009-09-18 Nick Clifton <nickc@redhat.com>
10014
10015 * po/es.po: Updated Spanish translation.
10016
10017 2009-09-17 Doug Kwan <dougkwan@google.com>
10018
10019 * debug.h (DEBUG_RELAXATION): New constant.
10020 (DEBUG_ALL): Add DEBUG_RELAXATION.
10021 (debug_string_to_enum): Add relaxation debug option.
10022 * layout.cc
10023 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10024 Layout::Relaxation_debug_check::read_sections,
10025 Layout::Relaxation_debug_check::read_sections): New method definitions.
10026 (Layout::Layout): Initialize data members
10027 record_output_section_data_from_scrips_,
10028 script_output_section_data_list_ and relaxation_debug_check_.
10029 (Layout::save_segments, Layout::restore_segments,
10030 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10031 Layout::relaxation_loop_body): New method definitions.
10032 (Layout::finalize): Support relaxation. Move section layout code to
10033 Layout::relaxation_loop_body.
10034 (Layout::set_asection_address_from_script): Move code for orphan
10035 section placement out.
10036 (Layout::place_orphan_sections_in_script): New method definition.
10037 * layout.h (Output_segment_headers, Output_file_header):
10038 New forward class declarations.
10039 (Layout::~Layout): Define.
10040 (Layout::new_output_section_data_from_script): New method definition.
10041 (Layout::place_orphan_sections_in_script): New method declaration.
10042 (Layout::Segment_states): New type declaration.
10043 (Layout::save_segments, Layout::restore_segments,
10044 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10045 Layout::relaxation_loop_body): New method declarations.
10046 (Layout::Output_section_data_list): New type declaration.
10047 (Layout::Relaxation_debug_check): New class definition.
10048 (Layout::record_output_section_data_from_script_,
10049 Layout::script_output_section_data_list_, Layout::segment_states_,
10050 Layout::relaxation_debug_check_): New data members.
10051 * output.cc: (Output_section_headers::do_size): New method definition.
10052 (Output_section_headers::Output_section_headers): Move size
10053 computation to Output_section_headers::do_size.
10054 (Output_segment_headers::do_size): New method definition.
10055 (Output_file_header::Output_file_header): Move size computation to
10056 Output_file_header::do_size and call it.
10057 (Output_file_header::do_size): New method definition.
10058 (Output_data_group::Output_data_group): Adjust call to
10059 Output_section_data.
10060 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10061 (Output_symtab_xindex::do_write): Add array bound check.
10062 (Output_section::Input_section::print_to_mapfile): Handle
10063 RELAXED_INPUT_SECTION_CODE.
10064 (Output_section::Output_section): Initialize data member checkpoint_.
10065 (Output_section::~Output_section): Delete checkpoint object pointed
10066 by checkpoint_.
10067 (Output_section::add_input_section): Always add an Input_section if
10068 relaxing.
10069 (Output_section::add_merge_input_section): Add assert.
10070 (Output_section::relax_input_section): New method definition.
10071 (Output_section::set_final_data_size): Set load address to zero for
10072 an unallocated section.
10073 (Output_section::do_address_and_file_offset_have_reset_values):
10074 New method definition.
10075 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10076 Handle relaxed input section.
10077 (Output_section::sort_attached_input_sections): Checkpoint input
10078 section list lazily.
10079 (Output_section::get_input_sections): Change type of input_sections to
10080 list of Simple_input_section pointers. Checkpoint input section list
10081 lazily. Also handle relaxed input sections.
10082 (Output_section::add_input_section_for_script): Take a reference to
10083 a Simple_input_section object instead of Relobj pointer and section
10084 index as parameter. Handle relaxed input sections.
10085 (Output_section::save_states, Output_section::restore_states): New
10086 method definitions.
10087 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10088 (Output_data::is_data_size_fixed): New method definition.
10089 (Output_data::reset_addresss_and_file_offset): Do not reset data size
10090 if it is fixed.
10091 (Output_data::address_and_file_offset_have_reset_values): New method
10092 definition.
10093 (Output_data::do_address_and_file_offset_have_reset_values): New method
10094 definition.
10095 (Output_data::set_data_size): Check that data size is not fixed.
10096 (Output_data::fix_data_size): New method definition.
10097 (Output_data::is_data_size_fixed_): New data member.
10098 (Output_section_headers::set_final_data_size): New method definition.
10099 (Output_section_headers::do_size): New method declaration.
10100 (Output_segment_headers::set_final_data_size): New method definition.
10101 (Output_segment_headers::do_size): New method declaration.
10102 (Output_file_header::set_final_data_size)::New method definition.
10103 (Output_file_header::do_size)::New method declaration.
10104 (Output_section_data::Output_section_data): Add new parameter
10105 is_data_size_fixed and use it to fix data size.
10106 (Output_data_const::Output_data_const): Adjust call to base class
10107 constructor and fix data size.
10108 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10109 base class constructor and fix data size.
10110 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10111 base class constructor and fix data size.
10112 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10113 class constructor and fix data size.
10114 (Output_data_group::set_final_data_size): New method definition.
10115 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10116 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10117 class constructor and fix data size.
10118 (Output_relaxed_input_section): New class definition.
10119 (Output_section::Simple_input_section): New class definition.
10120 (Output_section::get_input_sections): Adjust parameter list.
10121 (Output_section::add_input_section_for_script): Same.
10122 (Output_section::save_states, Output_section::restore_states,
10123 Output_section::do_address_and_file_offset_have_reset_values,
10124 (Output_section::Input_section::Input_section): Handle
10125 RELAXED_INPUT_SECTION_CODE. Add new overload for
10126 Output_relaxed_input_section.
10127 (Output_section::Input_section::is_input_section,
10128 Output_section::Input_section::set_output_section): Handle relaxed
10129 input section.
10130 (Output_section::Input_section::is_relaxed_input_section,
10131 Output_section::Input_section::output_section_data,
10132 Output_section::Input_section::relaxed_input_section): New method
10133 definitions.
10134 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10135 value.
10136 (Output_section::Input_section::u1_): Update comments.
10137 (Output_section::Input_section::u2_): Add new union member poris.
10138 (Output_section::Checkpoint_output_section): New classs definition.
10139 (Output_section::relax_input_section): New method declaration.
10140 (Output_section::checkpoint_): New data member.
10141 (Output_segment): Update comments.
10142 (Output_segment::Output_segment): Un-privatize copy constructor.
10143 (Output_segment::operator=): Un-privatize.
10144 * script-sections.cc (Output_section_element::Input_section_list):
10145 Change element type to Output_section::Simple_input_section.
10146 (Output_section_element_dot_assignment::set_section_addresses):
10147 Register output section data for relaxation clean up.
10148 (Output_data_exression::Output_data_expression): Adjust call to base
10149 constructor to fix data size.
10150 (Output_section_element_data::set_section_addresses): Register
10151 Output_data_expression object for relaxation clean up.
10152 (struct Input_section_info): Replace Relobj pointer and section index
10153 pair with Output_section::Simple_input_section and Convert struct to a
10154 class.
10155 (Input_section_sorter::operator()): Adjust access to
10156 Input_section_info data member to use accessors.
10157 (Output_section_element_input::set_section_addresses): Use layout
10158 parameter. Adjust code to use Output_section::Simple_input_section
10159 and Input_secction_info classes. Register filler for relaxation
10160 clean up.
10161 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10162 and section index pair with Output_section::Simple_input_section
10163 class. Adjust code accordingly.
10164 (Phdrs_element::release_segment): New method definition.
10165 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10166 segment list.
10167 (Script_sections::release_segments): New method definition.
10168 * gold/script-sections.h (Script_sections::release_segments): New
10169 method declaration.
10170 * gold/target.h (Target::may_relax, Target::relax,
10171 Target::do_may_relax, Target::do_relax): New method definitions.
10172
10173 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10174
10175 * arm.cc (has_signed_unsigned_overflow): New function.
10176 (Arm_relocate_functions::abs8): New function.
10177 (Target_arm::Scan::local): Handle R_ARM_ABS8.
10178 (Target_arm::Scan::global): Likewise.
10179 (Target_arm::relocate::relocate): Likewise.
10180 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10181 Likewise.
10182
10183 2009-09-16 Cary Coutant <ccoutant@google.com>
10184
10185 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10186 * testsuite/Makefile.in: Regenerate.
10187
10188 2009-09-11 Nick Clifton <nickc@redhat.com>
10189
10190 * po/gold.pot: Updated by the Translation project.
10191
10192 2009-09-08 Cary Coutant <ccoutant@google.com>
10193
10194 * output.cc (Output_file::open): Add execute permission to empty file.
10195 * testsuite/Makefile.am (permission_test): New test.
10196 * testsuite/Makefile.in: Regenerate.
10197
10198 2009-09-02 Ian Lance Taylor <iant@google.com>
10199
10200 * output.cc (Output_file::resize): Call map_no_anonymous rather
10201 than map.
10202
10203 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
10204
10205 * gold.cc: Include "incremental.h".
10206 (queue_initial_tasks): Call Incremental_checker methods.
10207 * incremental.cc: Include "output.h".
10208 (Incremental_checker::can_incrementally_link_output_file): New
10209 method.
10210 * incremental.h (Incremental_checker): New class.
10211
10212 * output.cc (Output_file::open_for_modification): New method.
10213 (Output_file::map_anonymous): Changed return type to bool. Record
10214 map in base_ field.
10215 (Output_file::map_no_anonymous): New method, broken out of map.
10216 (Output_file::map): Use map_no_anonymous and map_anonymous.
10217 * output.h (class Output_file): Update declarations.
10218
10219 2009-08-24 Cary Coutant <ccoutant@google.com>
10220
10221 * options.h (Command_line::Pre_options): New class.
10222 (Command_line::pre_options): New member.
10223 * options.cc (gold::options::ready_to_register): New variable.
10224 (One_option::register_option): Do nothing if not registering options.
10225 Assert if same short option registered twice.
10226 (General_options::General_options): Turn off option registration when
10227 done constructing.
10228 (Command_line::Pre_options::Pre_options): New constructor.
10229
10230 2009-08-24 Cary Coutant <ccoutant@google.com>
10231
10232 * options.h (General_options::no_keep_memory): Remove incorrect
10233 short option.
10234
10235 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10236
10237 * Makefile.am (am__skiplex, am__skipyacc): New.
10238 * Makefile.in: Regenerate.
10239
10240 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10241
10242 * Makefile.am (AM_CPPFLAGS): Renamed from ...
10243 (INCLUDES): ... this.
10244 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10245 (AM_CPPFLAGS): Renamed from ...
10246 (INCLUDE): ... this.
10247 * Makefile.in, testsuite/Makefile.in: Regenerate.
10248
10249 * Makefile.in: Regenerate.
10250 * aclocal.m4: Likewise.
10251 * config.in: Likewise.
10252 * configure: Likewise.
10253 * testsuite/Makefile.in: Likewise.
10254
10255 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10256 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10257 * Makefile.in: Regenerate.
10258 * testsuite/Makefile.in: Regenerate.
10259
10260 2009-08-19 Cary Coutant <ccoutant@google.com>
10261
10262 * resolve.cc (Symbol_table::resolve): Don't complain about defined
10263 symbols in shared libraries overridden by hidden or internal symbols
10264 in the main program.
10265
10266 2009-08-19 Chris Demetriou <cgd@google.com>
10267
10268 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10269 checking source file names in error messages.
10270
10271 2009-08-18 Doug Kwan <dougkwan@google.com>
10272
10273 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10274 an elcpp::Ehdr as parameter. Adjust call to set_target.
10275 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10276 an elfcpp::Ehdr as parameter.
10277 * object.cc (Object::set_target): Remove the version that looks up
10278 a target and sets it.
10279 (Sized_relobj::setup): Take a Target object instead of
10280 an elfcpp::Ehdr as parameter. Adjust call to set_target.
10281 (make_elf_sized_object): Find target and ask target to
10282 make an ELF object.
10283 * object.h: (Object::set_target): Remove the version that looks up
10284 a target and sets it.
10285 (Sized_relobj::setup): Take a Target object instead of
10286 an elfcpp:Ehdr as parameter.
10287 * target.cc: Include dynobj.h.
10288 (Target::do_make_elf_object_implementation): New.
10289 (Target::do_make_elf_object): New.
10290 * target.h (Target::make_elf_object): New template declaration.
10291 (Target::do_make_elf_object): New method declarations.
10292 (Target::do_make_elf_object_implementation): New template declaration.
10293
10294 2009-08-14 Ian Lance Taylor <iant@google.com>
10295
10296 * gold.h (FUNCTION_NAME): Define.
10297 (gold_unreachable): Use FUNCTION_NAME.
10298
10299 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10300
10301 * icf.cc (Icf::find_identical_sections): Issue a warning when a
10302 symbol in the --keep-unique list is not found.
10303
10304 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10305
10306 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10307 been maked as --keep-unique.
10308 (Icf::unfold_section): New function.
10309 * icf.h (Icf::unfold_section): New function.
10310 * options.h (General_options::keep_unique): New option.
10311 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10312 * testsuite/Makefile.in: Regenerate.
10313 * testsuite/icf_keep_unique_test.sh: New file.
10314 * testsuite/icf_keep_unique_test.cc: New file.
10315
10316 2009-08-12 Cary Coutant <ccoutant@google.com>
10317
10318 PR 10471
10319 * resolve.cc (Symbol_table::resolve): Check for references from
10320 dynamic objects to hidden and internal symbols.
10321 * testsuite/Makefile.am (hidden_test.sh): New test.
10322 * testsuite/Makefile.in: Regenerate.
10323 * testsuite/hidden_test.sh: New script.
10324 * testsuite/hidden_test_1.c: New test source.
10325 * testsuite/hidden_test_main.c: New test source.
10326
10327 2009-08-11 Doug Kwan <dougkwan@google.com>
10328
10329 * arm.cc: Update comments.
10330 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10331 segment to locate the .ARM.exidx section if present.
10332
10333 2009-08-09 Doug Kwan <dougkwan@google.com>
10334
10335 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10336 patch.
10337
10338 2009-08-07 Sriraman Tallam <tmsriram@google.com>
10339 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10340 compiler warnings.
10341
10342 2009-08-06 Sriraman Tallam <tmsriram@google.com>
10343
10344 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10345 valid tls_segment only for non-debug-section relocations.
10346 * testsuite/Makefile.am: Add gc_tls_test.
10347 * testsuite/Makefile.in: Regenerate.
10348 * testsuite/gc_tls_test.cc: New file.
10349 * testsuite/gc_tls_test.sh: New file.
10350
10351 2009-08-05 Sriraman Tallam <tmsriram@google.com>
10352
10353 * icf.cc: New file.
10354 * icf.h: New file.
10355 * Makefile.am (CCFILES): Add icf.cc.
10356 (HFILES): Add icf.h
10357 * Makefile.in: Regenerate.
10358 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10359 * gc.h (gc_process_relocs): Populate lists used by icf to contain
10360 section, symbol and addend information for the relocs.
10361 * gold.cc (queue_middle_tasks): Call identical code folding.
10362 * gold.h: Add defines for multimap.
10363 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10364 to the call of finalize_local_symbols.
10365 * main.cc (main): Create object of class Icf.
10366 * object.cc (Sized_relobj::do_layout): Allow this function to be
10367 called twice during icf.
10368 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10369 to sections marked as identical by icf.
10370 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10371 when available.
10372 (Sized_relobj::do_section_entsize): New function.
10373 * object.h (Object::section_entsize): New function.
10374 (Object::do_section_entsize): New pure virtual function.
10375 (Relobj::finalize_local_symbols): Add new parameter.
10376 (Relobj::do_section_entsize): New function.
10377 * options.h (General_options::icf): New option.
10378 (General_options::icf_iterations): New option.
10379 (General_options::print_icf_sections): New option.
10380 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10381 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10382 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10383 icf.
10384 * symtab.cc (Symbol_table::is_section_folded): New function.
10385 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
10386 to sections marked as identical by icf.
10387 * symtab.h (Symbol_table::set_icf): New function.
10388 (Symbol_table::icf): New function.
10389 (Symbol_table::is_section_folded): New function.
10390 (Symbol_table::icf_): New data member.
10391 * target-reloc.h (relocate_section): Ignore sections folded by icf.
10392 * testsuite/Makefile.am: Add commands to build icf_test.
10393 * testsuite/Makefile.in: Regenerate.
10394 * testsuite/icf_test.sh: New file.
10395 * testsuite/icf_test.cc: New file.
10396
10397 2009-07-24 Chris Demetriou <cgd@google.com>
10398
10399 * layout.cc (is_compressible_debug_section): Fix incorrect
10400 comment about compressed section names.
10401
10402 2009-07-20 Ian Lance Taylor <ian@airs.com>
10403
10404 PR 10419
10405 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10406
10407 2009-07-16 Ian Lance Taylor <iant@google.com>
10408
10409 PR 10400
10410 * layout.h: #include <map>.
10411 (class Kept_section): Change from struct to class. Add accessors
10412 and setters. Add section size to Comdat_group mapping. Change
10413 Comdat_group to std::map. Add is_comdat_ field. Add
10414 linkonce_size field in union.
10415 (class Layout): Update declaration of find_or_add_kept_section.
10416 Don't declare find_kept_object.
10417 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10418 parameter. Add object, shndx, is_comdat, and is_group_name
10419 parameters. Change all callers. Adjust for new Kept_section.
10420 (Layout::find_kept_object): Remove.
10421 * object.cc (Sized_relobj::include_section_group): Update use of
10422 Kept_section. Rename secnum to shndx. Only record
10423 Kept_comdat_section if sections are the same size.
10424 (Sized_relobj::include_linkonce_section): Update use of
10425 Kept_section. Only record Kept_comdat_section if sections are the
10426 same size. Set size of linkonce section.
10427 (Sized_relobj::map_to_kept_section): Update call to
10428 get_kept_comdat_section.
10429 * object.h (class Sized_relobj): Rename fields in
10430 Kept_comdat_section to drop trailing underscores; change object
10431 field to Relobj*. Change Kept_comdat_section_table to store
10432 struct rather than pointer.
10433 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10434 Add kept_object and kept_shndx parameters. Change all callers.
10435 (Sized_relobj::get_kept_comdat_section): Change return type to
10436 bool. Add kept_object and kept_shndx parameters. Change all
10437 callers.
10438 * plugin.cc (Pluginobj::include_comdat_group): Update call to
10439 Layout::find_or_add_kept_section.
10440
10441 2009-07-09 Ian Lance Taylor <iant@google.com>
10442
10443 * merge.cc (Object_merge_map::initialize_input_to_output_map):
10444 Reserve space in the hash table.
10445
10446 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
10447
10448 * fileread.cc (File_read::get_mtime): New method.
10449 * fileread.h (Timespec): New structure.
10450 (File_read::get_mtime): New method.
10451 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10452 Renamed from timestamp_nsec.
10453 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10454 Elf_Xword.
10455 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10456 timestamp_nsec.
10457 (Incremental_inputs::report_archive): Save mtime; style fix.
10458 (Incremental_inputs::report_obejct): Save mtime; style fix.
10459 (Incremental_inputs::report_script): Save mtime; style fix.
10460 (Incremental_inputs::finalize_inputs): Style fix.
10461 (Incremental_inputs::finalize): Style fix.
10462 (Incremental_inputs::create_input_section_data): Store inputs
10463 mtime.
10464 * incremental.h (Incremental_inputs::report_script): Add mtime
10465 argument.
10466 (Incremental_inputs::Input_info::Input_info): Intialize only one
10467 union member.
10468 (Incremental_inputs::Input_info::archive): Move to nameless
10469 union.
10470 (Incremental_inputs::Input_info::obejct): Move to nameless union.
10471 (Incremental_inputs::Input_info::script): Move to nameless union.
10472 (Incremental_inputs::mtime): New field.
10473 * script.cc (read_input_script): Pass file mtime to
10474 Incremental_input.
10475 * script.h (Script_info::inputs): Style fix.
10476
10477 2009-07-01 Ian Lance Taylor <ian@airs.com>
10478
10479 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10480 instead of 32.
10481
10482 2009-06-24 Ian Lance Taylor <iant@google.com>
10483
10484 PR 10156
10485 * layout.cc (Layout::choose_output_section): If we find an
10486 existing section, update the flags.
10487 (Layout::create_notes): New function, broken out of
10488 Layout::finalize.
10489 (Layout::finalize): Don't create note sections.
10490 (Layout::create_note): Don't crash if linker script discards
10491 section.
10492 (Layout::create_gold_note): Likewise.
10493 (Layout::create_build_id): Likewise. Don't set
10494 after_input_sections on the section.
10495 (Layout::create_executable_stack_info): Remove target parameter.
10496 Change caller.
10497 * layout.h (class Layout): Declare create_notes. Update
10498 declaration of create_executable_stack_info.
10499 * gold.cc (queue_middle_tasks): Call create_notes.
10500 * output.cc (Output_section::update_flags_for_input_section): Move
10501 here from output.h. If SHF_ALLOC flag is newly set, mark address
10502 invalid.
10503 * output.h (Output_data::mark_address_invalid): New function.
10504 (class Output_section): Only declare, not define,
10505 update_flags_for_input_section. Remove set_flags.
10506
10507 2009-06-24 Ian Lance Taylor <iant@google.com>
10508
10509 * script-sections.cc (Output_section_definition::
10510 set_section_addresses): Rename shadowing local load_address to
10511 laddr.
10512
10513 2009-06-24 Ian Lance Taylor <iant@google.com>
10514
10515 PR 10244
10516 * reloc.cc (relocate_sections): Skip empty relocation sections.
10517
10518 2009-06-23 Ian Lance Taylor <iant@google.com>
10519
10520 PR 10156
10521 * layout.cc (Layout::create_note): Use choose_output_section
10522 rather than make_output_section.
10523
10524 2009-06-23 Ian Lance Taylor <iant@google.com>
10525
10526 PR 10237
10527 * options.cc (General_options::parse_V): Set printed_version_.
10528 (General_options::General_options): Initialize printed_version_.
10529 * options.h (class General_options): Add printed_version_ field.
10530 * gold.cc (queue_initial_tasks): If there are no input files,
10531 don't give a fatal error if we printed the version information.
10532 (queue_middle_tasks): If using -r with a shared object, give a
10533 fatal error rather than an ordinary error.
10534
10535 2009-06-23 Ian Lance Taylor <iant@google.com>
10536
10537 PR 10219
10538 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10539 (Layout::make_output_section): Set have_stabstr_section_ if we see
10540 a .stab*str section.
10541 (Layout::finalize): Call link_stabs_sections.
10542 (Layout::link_stabs_sections): New file.
10543 * layout.h (class Layout): Add have_stabstr_section_ field.
10544 Declare link_stabs_sections.
10545
10546 2009-06-23 Doug Kwan <dougkwan@google.com>
10547
10548 * Makefile.am (libgold_a_LIBADD): New.
10549 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10550 * Makefile.in: Regenerate.
10551 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10552 * configure: Regenerate.
10553 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10554 * fileread.cc: Include sys/state.h
10555 * gold.h: Declare memmem and strndup if found missing.
10556 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10557
10558 2009-06-23 Ian Lance Taylor <iant@google.com>
10559
10560 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10561 * configure: Rebuild.
10562
10563 2009-06-23 Ian Lance Taylor <iant@google.com>
10564
10565 PR 10147
10566 * object.cc (Object::section_contents): Don't try to get a view if
10567 the section has length zero.
10568 (Object::handle_gnu_warning_section): If the section is empty, use
10569 the name of the section as the warning.
10570
10571 2009-06-23 Ian Lance Taylor <iant@google.com>
10572
10573 PR 10133
10574 * stringpool.h (class Stringpool_template): Add optimize_ field.
10575 (Stringpool_template::set_optimize): New function.
10576 * stringpool.cc (Stringpool_template::Stringpool_template):
10577 Initialize optimize_ field.
10578 (Stringpool_template::set_string_offsets): Test local optimize
10579 fild rather than parameter.
10580 * layout.cc (Layout::Layout): Call set_optimize on the section
10581 name stringpool.
10582
10583 2009-06-22 Ian Lance Taylor <iant@google.com>
10584
10585 PR 10030
10586 * yyscript.y: Parse TARGET.
10587 * script.cc (script_set_target): New function.
10588 * script-c.h (script_set_target): Declare.
10589 * options.cc (General_options::string_to_object_format): Rename
10590 from string_to_object_format in anonymous namespace. Change
10591 callers.
10592 * options.h (class General_options): Declare
10593 string_to_object_format.
10594
10595 2009-06-22 Ian Lance Taylor <iant@google.com>
10596
10597 * script-sections.cc (Script_sections::create_segments): Don't put
10598 program headers in a PT_LOAD segment if -n or -N.
10599
10600 2009-06-22 Ian Lance Taylor <iant@google.com>
10601
10602 PR 10141
10603 * options.h (class General_options): Add -z lazy and -z now. Sort
10604 -z options into alphabetical order.
10605 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10606
10607 2009-06-21 Ian Lance Taylor <iant@google.com>
10608
10609 * layout.cc (Layout::make_output_section): Call
10610 Target::new_output_section.
10611 (Layout::attach_allocated_section_to_segment): Put large section
10612 sections in a separate load segment with the large segment flag
10613 set.
10614 (Layout::segment_precedes): Sort large data segments after other
10615 load segments.
10616 (align_file_offset): New static function.
10617 (Layout::set_segment_offsets): Use align_file_offset.
10618 * output.h (class Output_section): Add is_small_section_ and
10619 is_large_section_ fields.
10620 (Output_section::is_small_section): New function.
10621 (Output_section::set_is_small_section): New function.
10622 (Output_section::is_large_section): New function.
10623 (Output_section::set_is_large_section): New function.
10624 (Output_section::is_large_data_section): New function.
10625 (class Output_segment): Add is_large_data_segment_ field.
10626 (Output_segment::is_large_data_segment): New function.
10627 (Output_segment::set_is_large_data_segment): New function.
10628 * output.cc (Output_section::Output_section): Initialize new
10629 fields.
10630 (Output_segment::Output_segment): Likewise.
10631 (Output_segment::add_output_section): Add assertion that large
10632 data sections always go in large data segments. Force small data
10633 sections to the end of the list of data sections. Force small BSS
10634 sections to the start of the list of BSS sections. For large BSS
10635 sections to the end of the list of BSS sections.
10636 * symtab.h (class Symbol): Declare is_common_shndx.
10637 (Symbol::is_defined): Check Symbol::is_common_shndx.
10638 (Symbol::is_common): Likewise.
10639 (class Symbol_table): Define enum Commons_section_type. Update
10640 declarations. Add small_commons_ and large_commons_ fields.
10641 * symtab.cc (Symbol::is_common_shndx): New function.
10642 (Symbol_table::Symbol_table): Initialize new fields.
10643 (Symbol_table::add_from_object): Put small and large common
10644 symbols in the right list.
10645 (Symbol_table::sized_finalized_symbol): Check
10646 Symbol::is_common_shndx.
10647 (Symbol_table::sized_write_globals): Likewise.
10648 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10649 common symbol lists. Don't call do_allocate_commons_list if the
10650 list is empty.
10651 (Symbol_table::do_allocate_commons_list): Remove is_tls
10652 parameter. Add comons_section_type parameter. Change all
10653 callers. Handle small and large common symbols.
10654 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10655 Symbol::is_common_shndx.
10656 * resolve.cc (symbol_to_bits): Likewise.
10657 * target.h (Target::small_common_shndx): New function.
10658 (Target::small_common_section_flags): New function.
10659 (Target::large_common_shndx): New function.
10660 (Target::large_common_section_flags): New function.
10661 (Target::new_output_section): New function.
10662 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10663 small_common_section_flags, and large_common_section_flags
10664 fields.
10665 (Target::do_new_output_section): New virtual function.
10666 * arm.cc (Target_arm::arm_info): Initialize new fields.
10667 * i386.cc (Target_i386::i386_info): Likewise.
10668 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10669 Likewise.
10670 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10671 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10672 (Target_x86_64::do_new_output_section): New function.
10673 * configure.ac: Define conditional MCMODEL_MEDIUM.
10674 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10675 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10676 (large_LDFLAGS): Define.
10677 * testsuite/large.c: New file.
10678 * testsuite/testfile.cc (Target_test::test_target_info):
10679 Initialize new fields.
10680 * configure, testsuite/Makefile.in: Rebuild.
10681
10682 2009-06-05 Doug Kwan <dougkwan@google.com>
10683
10684 * Makefile.am (CCFILES): Add target.cc.
10685 * Makefile.in: Regenerate.
10686 * i386.cc (class Target_i386): Define new virtual method to
10687 override do_is_local_label_name in parent.
10688 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10689 local symbols if --discard-locals or -X is given.
10690 * options.h (class General_options): Declare new options
10691 '--discard-locals' and '-X' for discarding locals.
10692 * target.h (class Target): Define new methods is_local_label_name.
10693 Declare new virtual method do_is_local_label_name.
10694 * target.cc: New file.
10695 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10696 (check_SCRIPTS): Add discard_locals_test.sh.
10697 (check_DATA): Add discard_local_tests.syms.
10698 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10699 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10700 * testsuite/Makefile.in: Regenerate.
10701 * testsuite/discard_locals_test.c: New file.
10702 * testsuite/discard_locals_test.sh: Same.
10703
10704 2009-06-05 Doug Kwan <dougkwan@google.com>
10705
10706 * object.cc (Sized_relobj::Sized_relobj): Initialize
10707 discarded_eh_frame_shndx_ to -1U.
10708 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10709 section.
10710 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10711 a discarded .eh_frame section.
10712 (Sized_relobj::do_finalize_local_symbols): Ditto.
10713 * object.h (class Sized_relobj): Declare new member
10714 discarded_eh_frame_shndx_.
10715 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10716 (local_labels_test.o, local_labels_test): New rules.
10717 * testsuite/Makefile.in: Regenerate.
10718
10719 2009-06-04 Doug Kwan <dougkwan@google.com>
10720
10721 * layout.cc (Layout::section_name_mapping): Add mapping for
10722 special ARM sections.
10723
10724 2009-06-03 Doug Kwan <dougkwan@google.com>
10725
10726 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10727 (utils::has_overflow): Same.
10728
10729 2009-06-03 Ian Lance Taylor <iant@google.com>
10730
10731 * layout.cc (Layout::section_name_mapping): New array, replacing
10732 Layout::linkonce_mapping.
10733 (Layout::section_name_mapping_count): New variable, replacing
10734 Layout::linkonce_mapping_count.
10735 (Layout::linkonce_output_name): Remove.
10736 (Layout::output_section_name): Rewrite.
10737 * layout.h (class Layout): Rename Linkonce_mapping to
10738 Section_name_mapping, linkonce_mapping to section_name_mapping,
10739 linkonce_mapping_count to section_name_mapping_count. Don't
10740 declare linkonce_output_name.
10741
10742 2009-06-03 Doug Kwan <dougkwan@google.com>
10743
10744 * gold/arm.cc (namespace utils): New.
10745 (Target_arm::reloc_is_non_pic): Define new method.
10746 (class Arm_relocate_functions): New.
10747 (Target_arm::Relocate::relocate): Handle relocation types used by
10748 Android.
10749
10750 2009-06-03 Ian Lance Taylor <iant@google.com>
10751
10752 * arm.cc (Target_arm::scan::global): Use || instead of |.
10753
10754 2009-06-02 Doug Kwan <dougkwan@google.com>
10755
10756 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
10757 issued_non_pic_error_.
10758 (class Target_arm::Scan): Declare new method check_non_pic.
10759 Define new method symbol_needs_plt_entry.
10760 Declare new data member issued_non_pic_error_.
10761 (class Target_arm::Relocate): Declare new method
10762 should_apply_static_reloc.
10763 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10764 (Target_arm::Scan::check_non_pic): Define new method.
10765 (Target_arm::Scan::local): Handle a small subset of reloc types used
10766 by Android.
10767 (Target_arm::Scan::local): Same.
10768 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10769
10770 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
10771
10772 * incremental.cc (Incremental_inputs::report_command_line): Filter
10773 out --incremental-* options.
10774
10775 2009-05-29 Doug Kwan <dougkwan@google.com>
10776
10777 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10778 template class.
10779 (class Target_arm): Update comment.
10780 (Target_arm::Target_arm): Initialize new data members GOT_,
10781 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10782 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10783 and Target_arm::rel_dyn_section.
10784 Declare new_enum Target_arm::Got_type.
10785 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10786 and DYNBSS_.
10787 Update commments for member do_dynsym_value.
10788 (Target_arm::got_size, Target_arm::plt_section,
10789 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10790 new methods inside class defintion.
10791 (Target_arm::got_section): Define new method.
10792 (Target_arm::rel_dyn_section): Same.
10793 (Output_data_plt_arm): New template class.
10794 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10795 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10796 (Output_data_plt_arm::add_entry): Same.
10797 (Output_data_plt_arm::first_plt_entry): Define new
10798 static data member for PLT instruction template.
10799 (Output_data_plt_arm::plt_entry): Same.
10800 (Output_data_plt_arm::do_write): Define new method.
10801 (Target_arm::make_plt_entry): Same.
10802 (Target_arm::do_finalize_sections): Same.
10803 (Target_arm::do_dynsym_value): Same.
10804
10805 2009-05-28 Doug Kwan <dougkwan@google.com>
10806
10807 * Makefile.am (TARGETSOURCES): Add arm.cc.
10808 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10809 * Makefile.in: Regenerate.
10810 * arm.cc: New file.
10811 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10812
10813 2009-05-26 Doug Kwan <dougkwan@google.com>
10814
10815 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10816 (General_options::check_excluded_libs): Strip off directories in
10817 archive name before matching like GNU ld does.
10818 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10819 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10820 (exclude_libs_test_LDFLAGS): Add linker option
10821 -Wl,--exclude-libs,libexclude_libs_test_3
10822 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10823 an explicit archive without using -l.
10824 (alt/libexclude_libs_test_3.a): New make rule.
10825 * testsuite/Makefile.in: Regenerate.
10826 * testsuite/exclude_libs_test.c : Declare lib3_default().
10827 (main): Call it.
10828 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10829 * exclude_libs_test_3.c: New file.
10830
10831 2009-05-26 Nick Clifton <nickc@redhat.com>
10832
10833 * po/id.po: New Indonesian translation.
10834 * po/gold.pot: Updated template file.
10835
10836 2009-05-22 Sriraman Tallam <tmsriram@google.com>
10837
10838 * testsuite/Makefile.am: Add -ffunction-sections to compile
10839 gc_comdat_test files. Add -Wl,--gc-sections to build
10840 gc_comdat_test.
10841 * testsuite/Makefile.in: Regenerate.
10842 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10843
10844 2009-05-21 Sriraman Tallam <tmsriram@google.com>
10845
10846 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10847 kept comdat section was garbage collected.
10848 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10849 * testsuite/Makefile.in: Regenerate.
10850 * testsuite/gc_comdat_test.sh: New file.
10851 * testsuite/gc_comdat_test_1.cc: New file.
10852 * testsuite/gc_comdat_test_2.cc: New file.
10853
10854 2009-05-19 Doug Kwan <dougkwan@google.com>
10855
10856 * archive.cc (Archive::Archive): Move constructor from archive.h
10857 to here. Initialize no_export_.
10858 (Archive::get_elf_object_for_member): Set no_export flag of object.
10859 * archive.h (Archive::Archive): Move constructor body to
10860 archive.cc.
10861 (Archive::no_export): New method.
10862 (Archive::no_export_): New field.
10863 * object.h (Object::Object): Initialize no_export_ to false.
10864 (Object::no_export, Object::set_no_export): New methods.
10865 (Object::no_export_): New field.
10866 * options.cc (General_options::parse_exclude_libs): New method.
10867 (General_options::check_excluded_libs) Same.
10868 * options.h (exclude_libs): New option.
10869 (General_options::check_excluded_libs): New method declaration.
10870 (General_options::excluded_libs_): New field.
10871 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10872 default or protected visibility if an object has no-export flag set.
10873 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10874 (check_SCRIPTS): Add exclude_libs_test.sh.
10875 (check_DATA): Add exclude_libs_test.syms.
10876 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10877 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10878 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10879 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10880 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10881 libexclude_libs_test_2.a): New rules.
10882 * testsuite/Makefile.in: Regenerate.
10883 * testsuite/exclude_libs_test.c: New file.
10884 * testsuite/exclude_libs_test.sh: Ditto.
10885 * testsuite/exclude_libs_test_1.c: Ditto.
10886 * testsuite/exclude_libs_test_2.c: Ditto.
10887
10888 2009-05-15 Ian Lance Taylor <iant@google.com>
10889
10890 * configure.ac: Check for declarations for cases where libiberty.h
10891 checks HAVE_DECL_xxx.
10892 * configure, config.in: Rebuild.
10893
10894 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10895
10896 * gold.h (Incremental_argument_list): Remove (invalid) forward
10897 declaration.
10898 * incremental.cc (Incremental_inputs::report_achive): New method.
10899 (Incremental_inputs::report_object): New method.
10900 (Incremental_inputs::report_script): New method.
10901 (Incremental_inputs::finalize_inputs): New method.
10902 (Incremental_inputs::finalize): Call finalize_inputs().
10903 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10904 Create inputs entries.
10905 * incremental.h (Incremental_input_type): New enum.
10906 (Incremental_inputs::Incremental_input): Initialize new fields.
10907 (Incremental_inputs::report_inputs): New method.
10908 (Incremental_inputs::report_achive): New method.
10909 (Incremental_inputs::report_object): New method.
10910 (Incremental_inputs::report_script): New method.
10911 (Incremental_inputs::finalize_inputs): New method.
10912 (Incremental_inputs::Input_info): New struct.
10913 (Incremental_inputs::Input_info_map): New typedef.
10914 (Incremental_inputs::lock_): New field.
10915 (Incremental_inputs::Inputs_): New field.
10916 (Incremental_inputs::Inputs_map): New field.
10917 * main.cc (main): Call Incremental_input::report_inputs.
10918 * options.h (Input_argument_list): Typedef moved from
10919 Input_arguments.
10920 (Input_file_group::Files): Remove, use ::Input_argument_list.
10921 (Input_file_group::Input_argument_list): Remove, use
10922 ::Input_argument_list.
10923 * plugin.cc (Plugin_manager::add_input_file): Add error in
10924 incremental build.
10925 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10926 functions.
10927 * script.cc (read_input_script): Call
10928 Incremental_input::report_script.
10929 * script.h (Script_info): New class.
10930
10931 2009-04-27 Ian Lance Taylor <iant@google.com>
10932
10933 * x86_64.cc (do_adjust_output_section): Set entsize to
10934 plt_entry_size.
10935
10936 2009-04-23 Elliott Hughes <enh@google.com>
10937
10938 * output.cc (Output_file::close): After short writes, continue
10939 writing from the correct offset in the buffer being written.
10940
10941 2009-04-23 Chris Demetriou <cgd@google.com>
10942
10943 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10944 * configure: Regenerate.
10945 * config.in: Regenerate.
10946 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10947 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10948
10949 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10950
10951 * incremental.cc (Incremental_inputs_header_data): Renamed from
10952 Incremental_input_header_data.
10953 (Incremental_inputs_header_data::data_size): New field.
10954 (Incremental_inputs_header_data::put_input_file_count): Renamed
10955 from input_file_count.
10956 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10957 from command_line_offset.
10958 (Incremental_inputs_header_data::put_reserved): Renamed from
10959 put_reserved.
10960 (Incremental_inputs_entry_data): Renamed from
10961 Incremental_input_entry_data.
10962 (Incremental_inputs_entry_data::data_size): New field.
10963 (Incremental_inputs::report_command_line): New method.
10964 (Incremental_inputs::finalize): New method.
10965 (Incremental_inputs::create_incremental_inputs_data): New method.
10966 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10967 * incremental.h: New file.
10968 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10969 (Layout::finalize): Create incremental inputs section in
10970 incremental builds.
10971 (Layout::create_incremental_info_sections): New method.
10972 * layout.h (Layout::incremental_inputs): New method.
10973 (Layout::create_incremental_info_sections): New method.
10974 (Layout::incremental_inputs_): New field.
10975 * main.cc (main): Notify Incremental_input of the command line.
10976
10977 2009-04-01 Ian Lance Taylor <iant@google.com>
10978 Mikolaj Zalewski <mikolajz@google.com>
10979
10980 * gold.h (reserve_unordered_map): Define, three versions, one for
10981 each version of Unordered_map.
10982 * layout.cc (Layout::Layout): Remove options parameter. Add
10983 number_of_input_files parameter. Don't initialize options_.
10984 Initialize number_of_input_files_ and resized_signatures_. Move
10985 sections_are_attached_.
10986 (Layout::layout_group): Reserve space for group_signatures_.
10987 (Layout::find_or_add_kept_section): Change name parameter to be a
10988 reference. Resize signatures_ map when it gets large enough.
10989 (Layout::layout_eh_frame): Use parameters->options() instead of
10990 this->options_.
10991 (Layout::make_output_section): Likewise.
10992 (Layout::attach_allocated_section_to_segment): Likewise.
10993 (Layout::finalize, Layout::create_executable_stack): Likewise.
10994 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10995 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10996 * layout.h (class Layout): Update declarations. Remove options_
10997 field. Add number_of_input_files_ and resized_signatures_
10998 fields. Move sections_are_attached_ field.
10999 * main.cc (main): Pass number of input files to Layout
11000 constructor. Don't pass options.
11001
11002 2009-03-30 Ian Lance Taylor <iant@google.com>
11003
11004 * ffsll.c (ffsll): Correct implementation.
11005
11006 2009-03-27 Ian Lance Taylor <iant@google.com>
11007
11008 * ffsll.c: New file.
11009 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11010 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11011 * ftruncate.c (ftruncate): Declare before definition.
11012 * mremap.c (mremap): Likewise.
11013 * pread.c (pread): Likewise.
11014 * configure, Makefile.in, config.in: Rebuild.
11015
11016 * mremap.c: New file.
11017 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11018 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11019 (mremap): Declare if HAVE_MREMAP is not defined.
11020 * configure, Makefile.in, config.in: Rebuild.
11021
11022 2009-03-27 Cary Coutant <ccoutant@google.com>
11023
11024 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11025 position independent.
11026 * sparc.cc (Target_sparc::check_non_pic): Likewise.
11027 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11028
11029 2009-03-24 Cary Coutant <ccoutant@google.com>
11030
11031 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11032 an executable.
11033 (needs_dynamic_reloc): Likewise.
11034
11035 2009-03-24 Ian Lance Taylor <iant@google.com>
11036
11037 * yyscript.y (file_cmd): Recognize EXTERN.
11038 (extern_name_list, extern_name_list_body): New nonterminals.
11039 * script.cc (script_add_extern): Define.
11040 * script-c.h (script_add_extern): Declare.
11041
11042 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
11043
11044 * object.cc (is_elf_object): Define.
11045 * object.h (is_elf_object): Declare.
11046 * archive.cc (Archive::get_elf_object_for_member): Call
11047 is_elf_object.
11048 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11049
11050 2009-03-24 Elliott Hughes <enh@google.com>
11051
11052 * output.cc (Output_file::map_anonymous): Define.
11053 (Output_file::map): Use map_anonymous. If the regular mmap fails,
11054 try an anonymous one. Report the size if the mmap fails.
11055 * output.h (class Output_file): Declare map_anonymous.
11056
11057 2009-03-24 Ian Lance Taylor <iant@google.com>
11058
11059 * target-select.cc (instantiate_target): Don't acquire the lock if
11060 the instantiated_target_ field has already been set.
11061
11062 2009-03-23 Ian Lance Taylor <iant@google.com>
11063
11064 * gold-threads.h (class Initialize_lock): Define.
11065 * gold-threads.cc (class Initialize_lock_once): Define.
11066 (initialize_lock_control): New static variable.
11067 (initialize_lock_pointer): New static variable.
11068 (initialize_lock_once): New static function.
11069 (Initialize_lock::Initialize_lock): Define.
11070 (Initialize_lock::initialize): Define.
11071 * target-select.h: Include "gold-threads.h".
11072 (class Target_selector): Add lock_ and initialize_lock_ fields.
11073 Don't define instantiate_target, just declare it.
11074 * target-select.cc (Target_selector::Target_selector): Initialize
11075 new fields.
11076 (Target_selector::instantiate_target): Define.
11077 * descriptors.h: Include "gold-threads.h".
11078 (class Descriptors): Add initialize_lock_ field.
11079 * descriptors.cc (Descriptors::Descriptors): Initialize new
11080 field.
11081 (Descriptors::open): Use initialize_lock_ field
11082 * errors.h (class Errors): Add initialize_lock_ field.
11083 * errors.cc (Errors::Errors): Initialize new field.
11084 (Errors::initialize_lock): Use initialize_lock_ field.
11085 * powerpc.cc (class Target_selector_powerpc): Remove
11086 instantiated_target_ field. In do_recognize call
11087 instantiate_target rather than do_instantiate_target. In
11088 do_instantiate_target just allocate a new target.
11089 * sparc.cc (class Target_selector_sparc): Likewise.
11090
11091 * freebsd.h: New file.
11092 * i386.cc: Include "freebsd.h".
11093 (Target_i386): Derive from Target_freebsd rather than
11094 Sized_target.
11095 (Target_selector_i386): Derive from Target_selector_freebsd rather
11096 than Target_selector.
11097 * x86_64.cc: Include "freebsd.h".
11098 (Target_x86_64): Derive from Target_freebsd rather than
11099 Sized_target.
11100 (Target_selector_x86_64): Derive from Target_selector_freebsd
11101 rather than Target_selector.
11102 * target.h (class Target): Add adjust_elf_header and
11103 do_adjust_elf_header.
11104 * output.cc (Output_file_header:: do_sized_write): Call target
11105 adjust_elf_header routine.
11106 * configure.tgt: Set targ_osabi.
11107 * configure.ac: Define GOLD_DEFAULT_OSABI.
11108 * parameters.cc (Parameters::default_target): Pass
11109 GOLD_DEFAULT_OSABI to select_target.
11110 * target-select.h (class Target_selector): Make instantiate_target
11111 protected rather than private.
11112 * Makefile.am (HFILES): Add freebsd.h.
11113 * configure, Makefile.in, config.in: Rebuild.
11114
11115 * merge.cc (do_add_input_section): Correct pend value. Change
11116 message about last entry not being null terminated from error to
11117 warning.
11118
11119 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
11120
11121 * incremental.cc: New file.
11122 * Makefile.am (CCFILES): Add incremental.cc.
11123 * Makefile.in: Rebuild.
11124
11125 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
11126
11127 * layout.cc (Layout::output_section_name): Preserve names
11128 of '.note.' sections.
11129
11130 2009-03-19 Ian Lance Taylor <iant@google.com>
11131
11132 * descriptors.cc (Descriptors::open): Check that the options are
11133 valid before using them.
11134
11135 2009-03-18 Ian Lance Taylor <iant@google.com>
11136
11137 * script-sections.h: Include <list>.
11138 (class Script_sections): Change Sections_elements from std::vector
11139 to std::list. Typedef public Elements_iterator. Add
11140 orphan_section_placement_, data_segment_align_start_, and
11141 saw_data_segment_align_ fields. Remove data_segment_align_index_
11142 field.
11143 * script-sections.cc (class Orphan_section_placement): New class.
11144 (class Sections_element): Add virtual functions is_relro and
11145 orphan_section_init. Remove virtual function place_orphan_here.
11146 (class Output_section_definition): Add is_relro and
11147 orphan_section_init. Remove place_orphan_here.
11148 (class Orphan_output_section): Likewise.
11149 (Script_sections::Script_sections): Update for field changes.
11150 (Script_sections::data_segment_align): Set saw_data_segment_align_
11151 and data_segment_align_start_, not data_segment_align_index.
11152 (Script_sections::data_segment_relro_end): Check
11153 saw_data_segment_align_. Use data_segment_align_start_ rather
11154 than data_segment_align_index_.
11155 (Script_sections::place_orphan): Rewrite to use
11156 Orphan_section_placement.
11157
11158 2009-03-17 Ian Lance Taylor <iant@google.com>
11159
11160 * archive.cc (Archive::add_symbols): Check for a version attached
11161 to the symbol name in the archive map.
11162 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11163 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11164 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11165 (ver_test_11.a): New target.
11166 * testsuite/Makefile.in: Rebuild.
11167
11168 * configure.ac: Check for chsize and posix_fallocate. Replace
11169 ftruncate.
11170 * ftruncate.c: New file, from gnulib.
11171 * output.cc (posix_fallocate): Define dummy version if not
11172 HAVE_POSIX_FALLOCATE.
11173 (Output_file::map): Call posix_fallocate rather than lseek and
11174 write.
11175 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11176 * configure, Makefile.in, config.in: Rebuild.
11177
11178 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
11179
11180 * layout.h (Layout::create_note): Add section_name parameter.
11181 * layout.cc (Layout::create_note): Likewise.
11182 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11183
11184 2009-03-17 Ian Lance Taylor <iant@google.com>
11185
11186 * descriptors.cc: Include "options.h".
11187 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11188 (Descriptors::open): Always use O_CLOEXEC when opening a new
11189 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
11190 then set FD_CLOEXEC.
11191
11192 * sparc.cc (class Target_sparc): Add has_got_section.
11193 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11194 make sure we have a GOT section.
11195
11196 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11197 (Target_sparc::Scan::local): Likewise.
11198 (Target_sparc::Scan::global): Likewise.
11199 (Target_sparc::Relocate::relocate): Likewise.
11200 (Target_sparc::Relocate::relocate_tls): Likewise.
11201
11202 * symtab.cc (Symbol_table::define_default_version): New function,
11203 broken out of add_from_object.
11204 (Symbol_table::add_from_object): Call define_default_version.
11205 (Symbol_table::define_special_symbol): Add resolve_oldsym
11206 parameter. Change all callers. If the version for a symbol comes
11207 from a version script, resolve it with the symbol with the same
11208 name with no version. Also add the symbol without a version if
11209 appropriate.
11210 (do_define_in_output_data): If resolving with oldsym, don't delete
11211 sym.
11212 (do_define_in_output_segment): Likewise.
11213 (do_define_as_constant): Likewise.
11214 * symtab.h (class Symbol_table): Update declarations.
11215
11216 2009-03-13 Ian Lance Taylor <iant@google.com>
11217
11218 * readsyms.cc (Read_symbols::incompatible_warning): New function.
11219 (Read_symbols::requeue): New function.
11220 (Read_symbols::do_read_symbols): If make_elf_object fails because
11221 the target type is not configured, and the file was searched for,
11222 issue a warning and retry with the next directory.
11223 (Add_symbols::run): If the file has an incompatible format, and
11224 it was searched for, requeue the Read_symbols task. On error,
11225 release the object.
11226 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
11227 dirindex parameter to constructor. Change all callers. Declare
11228 incompatible_warning and requeue.
11229 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11230 input_argument_ and input_group_ fields. Add them to
11231 constructor. Change all callers.
11232 (class Read_script): Add dirindex_ field. Add it to constructor.
11233 Change all callers.
11234 * archive.cc (Archive::setup): Remove input_objects parameter.
11235 Change all callers.
11236 (Archive::get_file_and_offset): Likewise.
11237 (Archive::read_all_symbols): Likewise.
11238 (Archive::read_symbols): Likewise.
11239 (Archive::get_elf_object_for_member): Remove input_objects
11240 parameter. Add punconfigured parameter. Change all callers.
11241 (Archive::add_symbols): Change return type to bool. Check return
11242 value of include_member.
11243 (Archive::include_all_members): Likewise.
11244 (Archive::include_member): Change return type to bool. Return
11245 false if first included object has incompatible target. Set
11246 included_member_ field.
11247 (Add_archive_symbols::run): If add_symbols returns false, requeue
11248 Read_symbols task.
11249 * archive.h (class Archive): Add included_member_ field.
11250 Initialize it in constructor. Add input_file and searched_for
11251 methods. Update declarations.
11252 (class Add_archive_symbols): Add dirpath_, dirindex_, and
11253 input_argument_ fields. Add them to constructor. Change all
11254 callers.
11255 * script.cc: Include "target-select.h".
11256 (class Parser_closure): Add skip_on_incompatible_target_ and
11257 found_incompatible_target_ fields. Add
11258 skip_on_incompatible_target parameter to constructor. Change all
11259 callers. Add methods skip_on_incompatible_target,
11260 clear_skip_on_incompatible_target, found_incompatible_target, and
11261 set_found_incompatible_target.
11262 (read_input_script): Add dirindex parameter. Change all callers.
11263 If parser finds an incompatible target, requeue Read_symbols
11264 task.
11265 (script_set_symbol): Clear skip_on_incompatible_target in
11266 closure.
11267 (script_add_assertion, script_parse_option): Likewise.
11268 (script_start_sections, script_add_phdr): Likewise.
11269 (script_check_output_format): New function.
11270 * script.h (read_input_script): Update declaration.
11271 * script-c.h (script_check_output_format): Declare.
11272 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11273 (ignore_cmd): Remove OUTPUT_FORMAT.
11274 * fileread.cc (Input_file::Input_file): Add explicit this.
11275 (Input_file::will_search_for): New function.
11276 (Input_file::open): Add pindex parameter. Change all callers.
11277 * fileread.h (class Input_file): Add input_file_argument method.
11278 Declare will_search_for. Update declarations.
11279 * object.cc (make_elf_object): Add punconfigured parameter.
11280 Change all callers.
11281 * object.h (class Object): Make input_file public. Add
11282 searched_for method.
11283 (make_elf_object): Update declaration.
11284 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
11285 restart search.
11286 * dirsearch.h (class Dirsearch): Update declaration.
11287 * options.h (class General_options): Add --warn-search-mismatch.
11288 * parameters.cc (Parameters::is_compatible_target): New function.
11289 * parameters.h (class Parameters): Declare is_compatible_target.
11290 * workqueue.cc (Workqueue::add_blocker): New function.
11291 * workqueue.h (class Workqueue): Declare add_blocker.
11292
11293 * fileread.cc (Input_file::open): Remove options parameter.
11294 Change all callers.
11295 (Input_file::open_binary): Likewise.
11296 * script.cc (read_input_script): Likewise.
11297 * readsyms.h (class Read_symbols): Remove options_ field. Remove
11298 options parameter from constructor. Change all callers.
11299 (class Read_script): Likewise.
11300 * fileread.h (class Input_file): Update declarations.
11301 * script.h (read_input_script): Update declaration.
11302
11303 2009-03-10 Nick Clifton <nickc@redhat.com>
11304
11305 * po/es.po: New Spanish translation.
11306
11307 2009-03-06 Cary Coutant <ccoutant@google.com>
11308
11309 * options.cc (parse_short_option): Keep dash_z from registering itself.
11310
11311 2009-03-03 Ian Lance Taylor <iant@google.com>
11312
11313 PR 9918
11314 * target-reloc.h (relocate_section): Pass output_section to
11315 relocate.
11316 * i386.cc (Target_i386::should_apply_static_reloc): Add
11317 output_section parameter. Change all callers.
11318 (Target_i386::Relocate::relocate): Add output_section parameter.
11319 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11320 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11321 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11322 * testsuite/two_file_shared.sh: New script.
11323 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11324 (check_DATA): Add two_file_shared.dbg.
11325 (two_file_shared.dbg): New target.
11326 * testsuite/Makefile.in: Rebuild.
11327
11328 2009-03-01 Ian Lance Taylor <iant@google.com>
11329
11330 * configure.ac: Check for byteswap.h.
11331 * configure: Rebuild.
11332 * config.in: Rebuild.
11333
11334 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
11335
11336 * layout.cc (Layout::find_or_add_kept_section): New function.
11337 (Layout::add_comdat): Removed.
11338 * layout.h (struct Kept_section): Move out of class Layout.
11339 Remove trailing underscores from field names. Add group_sections
11340 field. Rename group_ field to is_group. Change all uses.
11341 (class Layout): Declare find_or_add_kept_section, not add_comdat.
11342 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11343 comdat_groups_ field.
11344 (Sized_relobj::include_section_group): Use
11345 find_or_add_kept_section and Kept_section::group_sections.
11346 (Sized_relobj::include_linkonce_section): Likewise.
11347 * object.cc (class Sized_relobj): Don't define Comdat_group or
11348 Comdat_group_table. Remove find_comdat_group and
11349 add_comdat_group. Remove comdat_groups_ field.
11350 * plugin.cc (include_comdat_group): Use
11351 Layout::find_or_add_kept_section.
11352
11353 2009-02-28 Ian Lance Taylor <iant@google.com>
11354
11355 * README: --gc-sections and map files are now supported. Document
11356 some build requirements.
11357
11358 PR 6992
11359 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11360 relocatable link set the value of the section symbol to zero.
11361 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11362 relocatable link don't include the section address in the local
11363 symbol value.
11364
11365 2009-02-27 Ian Lance Taylor <iant@google.com>
11366
11367 PR 6811
11368 * options.h (class Search_directory): Add is_system_directory.
11369 (class General_options): Declare is_in_system_directory.
11370 * options.cc (get_relative_sysroot): Make static.
11371 (get_default_sysroot): Make static.
11372 (General_optoins::is_in_system_directory): New function.
11373 * fileread.cc (Input_file::is_in_system_directory): New function.
11374 * fileread.h (class Input_file): Declare is_in_system_directory.
11375 * object.h (class Object): Add is_in_system_directory.
11376 (class Input_objects): Remove system_library_directory_ field.
11377 * object.cc (Input_objects::add_object): Don't set
11378 system_library_directory_.
11379 (input_objects::found_in_system_library_directory): Remove.
11380 * symtab.cc (Symbol_table::write_globals): Remove input_objects
11381 parameter. Change all callers.
11382 (Symbol_table::sized_write_globals): Likewise.
11383 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11384 Call Object::is_in_system_directory.
11385 * symtab.h (class Symbol_table): Update declarations.
11386
11387 PR 5990
11388 * descriptors.h (Open_descriptor): Add is_on_stack field.
11389 * descriptors.cc (Descriptors::open): If the descriptor is on the
11390 top of the stack, remove it. Initialize is_on_stack field.
11391 (Descriptors::release): Only add pod to stack if it is not on the
11392 stack already.
11393 (Descriptors::close_some_descriptor): Clear stack_next and
11394 is_on_stack fields.
11395
11396 PR 7091
11397 * output.cc (Output_section::find_starting_output_address): Rename
11398 from starting_output_address; add PADDR parameter; change return
11399 type.
11400 * output.h (class Output_section): Declare
11401 find_starting_output_address instead of starting_output_address.
11402 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11403 section symbol for which we can't find a merge section.
11404
11405 PR 9836
11406 * symtab.cc (Symbol_table::add_from_object): If the visibility is
11407 hidden or internal, force the symbol to be local.
11408 * resolve.cc (Symbol::override_visibility): Define.
11409 (Symbol::override_base): Use override_visibility.
11410 (Symbol_table::resolve): Likewise.
11411 (Symbol::override_base_with_special): Likewise.
11412 (Symbol_table::override_with_special): If the visibility is hidden
11413 or internal, force the symbol to be local.
11414 * symtab.h (class Symbol): Add set_visibility and
11415 override_visibility.
11416 * testsuite/ver_test_1.sh: New file.
11417 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11418 (check_DATA): Add ver_test_1.syms.
11419 (ver_test_1.syms): New target.
11420 * testsuite/Makefile.in: Rebuild.
11421
11422 2009-02-25 Cary Coutant <ccoutant@google.com>
11423
11424 * layout.cc (Layout::choose_output_section): Don't rename sections
11425 when using a linker script that has a SECTIONS clause.
11426 * Makefile.in: Regenerate.
11427
11428 * testsuite/Makefile.am (script_test_5.sh): New test case.
11429 * testsuite/Makefile.in: Regenerate.
11430 * testsuite/script_test_5.cc: New file.
11431 * testsuite/script_test_5.sh: New file.
11432 * testsuite/script_test_5.t: New file.
11433
11434 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
11435
11436 * archive.cc (Archive::include_member): Update calls to add_symbols.
11437 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11438 the Layout argument.
11439 * dynobj.h (do_add_symbols): Add the Layout argument.
11440 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11441 Layout argument.
11442 * object.h (Object::add_symbols): Add the Layout argument.
11443 (Object::do_add_symbols): Add the Layout argument.
11444 (Sized_relobj::do_add_symbols): Add the Layout argument.
11445 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11446 Unify the two versions.
11447 (Add_plugin_symbols): Remove.
11448 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11449 (Sized_pluginobj::do_add_symbols): Unify the two versions.
11450 (Add_plugin_symbols): Remove.
11451 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11452 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11453 (Add_symbols::run): Make it work with Pulginobj.
11454
11455 2009-02-06 Ian Lance Taylor <iant@google.com>
11456
11457 * object.cc (Sized_relobj::do_layout): Make info message start
11458 with lower case letter.
11459
11460 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
11461
11462 * binary.cc: Fix file comment.
11463
11464 * options.h (enum Incremental_disposition): Define.
11465 (class General_options): Add new options: --incremental,
11466 --incremental_changed, --incremental_unchanged,
11467 --incremental_unknown. Add incremental_disposition_ and
11468 implicit_incremental_ fields.
11469 (General_options::incremental_disposition): New function.
11470 (class Position_dependent_options): Add incremental_disposition
11471 option.
11472 (Position_dependent_options::copy_from_options): Set incremental
11473 dispositions.
11474 * options.cc (General_options::parse_incremental_changed): New
11475 function.
11476 (General_options::parse_incremental_unchanged): New function.
11477 (General_options::parse_incremental_unknown): New function.
11478 (General_options::General_options): Initialize new fields
11479 incremental_disposition_ and implicit_incremental_.
11480 (General_options::finalize): Check for uasge of --incremental-*
11481 without --incremental.
11482
11483 2009-02-06 Chris Demetriou <cgd@google.com>
11484
11485 * gold.h (gold_undefined_symbol): Change to take only a Symbol
11486 pointer and to report location as the file name associated with
11487 the symbol.
11488 (gold_undefined_symbol_at_location): New function to replace the
11489 old gold_undefined_symbol functionality.
11490 * target-reloc.h (relocate_section): Update to use
11491 gold_undefined_symbol_at_location.
11492 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11493 Call gold_undefined_symbol function rather than gold_error.
11494 * errors.h (Errors::undefined_symbol): Take location as a
11495 string, rather than calculating it from a relocation.
11496 * errors.cc (Errors::fatal): Print "fatal error:" before the
11497 formatted message.
11498 (Errors::error, Errors::error_at_location): Print "error: "
11499 before the formatted message.
11500 (Errors::undefined_symbol): Take location as a string, rather
11501 than calculating it from a relocation.
11502 (gold_undefined_symbol_at_location): New function akin to
11503 old gold_undefined_symbol, calculates location from relocation.
11504 (gold_undefined_symbol): Change to take only a Symbol pointer
11505 and to report location as the file name associated with the symbol.
11506 * testsuite/debug_msg.sh: Update for changed error messages.
11507 * testsuite/undef_symbol.sh: Likewise.
11508
11509 2009-02-04 Duncan Sands <baldrick@free.fr>
11510
11511 PR 9812
11512 * reduced_debug_output.h
11513 (Output_reduced_debug_abbrev_section::failed): Use format for
11514 gold_warning.
11515 (Output_reduced_debug_info_section::faild): Likewise.
11516
11517 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
11518
11519 * script.cc (Lazy_demangler): New class.
11520 (Version_script_info::get_symbol_version_helper): Demangle a
11521 symbol only once.
11522
11523 2009-01-29 Cary Coutant <ccoutant@google.com>
11524
11525 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11526 to __tls_get_addr.
11527 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11528
11529 2009-01-28 Ian Lance Taylor <iant@google.com>
11530
11531 * version.cc (version_string): Bump to 1.9.
11532
11533 * gold.h: Include <cstring> and <stdint.h>.
11534 * version.cc: Include <cstdio>.
11535 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11536 warning.
11537 * reduced_debug_output.cc (insert_into_vector): Rename from
11538 Insert_into_vector; change all callers. Use Swap_unaligned to
11539 avoid aliasing issue; remove union since it is unnecessary.
11540
11541 2009-01-27 Sriraman Tallam <tmsriram@google.com>
11542
11543 * Makefile.am (CCFILES): Add gc.cc.
11544 (HFILES): Add gc.h.
11545 * Makefile.in: Regenerate.
11546 * gold.cc (Gc_runner): New class.
11547 (queue_initial_tasks): Call garbage collection related tasks
11548 when corresponding options are invoked.
11549 (queue_middle_gc_tasks): New function.
11550 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11551 processed early before laying out sections during garbage collection.
11552 * gold.h (queue_middle_gc_tasks): New function.
11553 (is_prefix_of): Move from "layout.cc".
11554 * i386.cc (Target_i386::gc_process_relocs): New function.
11555 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11556 * main.cc (main): Create object of class "Garbage_collection".
11557 * object.cc (Relobj::copy_symbols_data): New function.
11558 (Relobj::is_section_name_included): New function.
11559 (Sized_relobj::do_layout): Allow this function to be called twice
11560 during garbage collection and defer layout of section during the
11561 first call.
11562 * object.h (Relobj::get_symbols_data): New function.
11563 (Relobj::is_section_name_included): New function.
11564 (Relobj::copy_symbols_data): New function.
11565 (Relobj::set_symbols_data): New function.
11566 (Relobj::get_relocs_data): New function.
11567 (Relobj::set_relocs_data): New function.
11568 (Relobj::is_output_section_offset_invalid): New pure virtual function.
11569 (Relobj::gc_process_relocs): New function.
11570 (Relobj::do_gc_process_relocs): New pure virtual function.
11571 (Relobj::sd_): New data member.
11572 (Sized_relobj::is_output_section_offset_invalid): New function.
11573 (Sized_relobj::do_gc_process_relocs): New function.
11574 * options.h (General_options::gc_sections): Modify to not be a no-op.
11575 (General_options::print_gc_sections): New option.
11576 * plugin.cc (Plugin_finish::run): Remove function call to
11577 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11578 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11579 * reloc.cc (Read_relocs::run): Add task to process relocs and
11580 determine unreferenced sections when doing garbage collection.
11581 (Gc_process_relocs): New class.
11582 (Sized_relobj::do_gc_process_relocs): New function.
11583 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11584 sections that are garbage collected.
11585 * reloc.h (Gc_process_relocs): New class.
11586 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11587 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11588 symbols whose corresponding sections are garbage collected.
11589 (Symbol_table::Symbol_table): Add new parameter for the garbage
11590 collection object.
11591 (Symbol_table::gc_mark_undef_symbols): New function.
11592 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11593 (Symbol_table::gc_mark_dyn_syms): New function.
11594 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11595 as garbage.
11596 (Symbol_table::add_from_object): Likewise.
11597 (Symbol_table::add_from_relobj): When building shared objects, do not
11598 treat externally visible symbols as garbage.
11599 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11600 table information for static and relocatable links.
11601 * symtab.h (Symbol_table::set_gc): New function.
11602 (Symbol_table::gc): New function.
11603 (Symbol_table::gc_mark_undef_symbols): New function.
11604 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11605 (Symbol_table::gc_mark_dyn_syms): New function.
11606 (Symbol_table::gc_): New data member.
11607 * target.h (Sized_target::gc_process_relocs): New pure virtual
11608 function.
11609 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11610 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11611
11612 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11613
11614 * options.h (General_options::gc_sections): Define as a no-op for now.
11615 (General_options::no_keep_memory): Ditto.
11616 (General_options::Bshareable): Define.
11617 * options.cc (General_options::finalize): Honor -Bshareable.
11618
11619 2009-01-20 Andreas Schwab <schwab@suse.de>
11620
11621 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11622 read the value in the contents, since we don't use it. Use the
11623 template endianness when writing.
11624 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11625
11626 2009-01-19 Andreas Schwab <schwab@suse.de>
11627
11628 * configure.tgt (powerpc64-*): Fix targ_obj.
11629
11630 2009-01-15 Ian Lance Taylor <iant@google.com>
11631
11632 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11633 local symbols when stripping all symbols.
11634
11635 2009-01-14 Cary Coutant <ccoutant@google.com>
11636
11637 * output.cc (Output_reloc): Add explicit instantiations.
11638
11639 2009-01-14 Cary Coutant <ccoutant@google.com>
11640
11641 * archive.cc (Archive::get_elf_object_for_member): Remove call
11642 to File_read::claim_for_plugin.
11643 * descriptors.cc (Descriptors::open): Remove reference to
11644 is_claimed.
11645 (Descriptors::claim_for_plugin): Remove.
11646 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11647 (Descriptors::is_claimed): Remove.
11648 (claim_descriptor_for_plugin): Remove.
11649 * fileread.cc (File_read::claim_for_plugin): Remove.
11650 * fileread.h (File_read::claim_for_plugin): Remove.
11651 (File_read::descriptor): Reopen descriptor if necessary.
11652 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11653 (Plugin_manager::all_symbols_read): Add task parameter. Change
11654 all callers.
11655 (Plugin_manager::get_input_file): New function.
11656 (Plugin_manager::release_input_file): New function.
11657 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11658 corresponding data member.
11659 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11660 and pass to base constructor. Change all callers.
11661 (get_input_file, release_input_file): New functions.
11662 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11663 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11664 (Plugin_manager::all_symbols_read): Add task parameter.
11665 (Plugin_manager::get_input_file): New function.
11666 (Plugin_manager::release_input_file): New function.
11667 (Plugin_manager::task_): New data member.
11668 (Pluginobj::Pluginobj): Add filesize parameter.
11669 (Pluginobj::filename): New function.
11670 (Pluginobj::descriptor): New function.
11671 (Pluginobj::filesize): New function.
11672 (Pluginobj::filesize_): New data member.
11673 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11674 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11675 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11676
11677 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11678 with archive libraries.
11679 * testsuite/Makefile.in: Regenerate.
11680 * testsuite/plugin_test.c (struct sym_info): New type.
11681 (get_input_file, release_input_file): New static variables.
11682 (onload): Capture new transfer vector entries.
11683 (claim_file_hook): Stop reading at end of file according to filesize.
11684 Factor out parsing of readelf output into separate function.
11685 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11686 APIs and get the source file name from the symbol table. Convert
11687 source file name to corresponding object file name. Print info
11688 message when adding new input files.
11689 (parse_readelf_line): New function.
11690 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11691 * testsuite/plugin_test_2.sh: Likewise.
11692 * testsuite/plugin_test_3.sh: Likewise.
11693 * testsuite/plugin_test_4.sh: New test case.
11694
11695 2009-01-07 Ian Lance Taylor <iant@google.com>
11696
11697 * version.cc (version_string): Bump to 1.8.
11698
11699 2008-12-23 Cary Coutant <ccoutant@google.com>
11700
11701 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11702 * plugin.cc (Plugin_manager::finish): Rename as
11703 layout_deferred_objects. Move cleanup to separate function.
11704 (Plugin_manager::cleanup): New function.
11705 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11706 separately.
11707 * plugin.h (Plugin_manager::finish): Rename as
11708 layout_deferred_objects.
11709 (Plugin_manager::cleanup): New function.
11710 (Plugin_manager::cleanup_done): New field.
11711
11712 2008-12-23 Cary Coutant <ccoutant@google.com>
11713
11714 * plugin.cc (is_visible_from_outside): New function.
11715 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11716 so we don't return "IR only" status for exported symbols or -r links.
11717
11718 * testsuite/Makefile.am (plugin_test_3): New test case.
11719 * testsuite/Makefile.in: Regenerate.
11720 * testsuite/plugin_test_3.sh: New file.
11721
11722 2008-12-22 Cary Coutant <ccoutant@google.com>
11723
11724 * object.cc (Sized_relobj::layout_section): New function.
11725 (Sized_relobj::do_layout): Defer layout of input sections until after
11726 plugin has provided replacement files.
11727 (Sized_relobj::do_layout_deferred_sections): New function.
11728 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11729 (Relobj::layout_deferred_sections): New function.
11730 (Relobj::do_layout_deferred_sections): New function.
11731 (Sized_relobj::do_layout_deferred_sections): New function.
11732 (Sized_relobj::layout_section): New function.
11733 (Sized_relobj::Deferred_layout): New structure.
11734 (Sized_relobj::deferred_layout_): New field.
11735 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11736 Change all callers. Layout deferred sections.
11737 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11738 references.
11739 (Plugin_hook::run): Move code from do_plugin_hook inline.
11740 (Plugin_hook::do_plugin_hook): Remove.
11741 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11742 (Plugin_manager::finish): Renamed, was cleanup.
11743 (Plugin_manager::should_defer_layout): New function.
11744 (Plugin_manager::add_deferred_layout_object): New function.
11745 (Plugin_manager::Deferred_layout_list): New type.
11746 (Plugin_manager::deferred_layout_objects_): New field.
11747 (Plugin_hook::do_plugin_hook): Remove.
11748
11749 2008-12-17 Ian Lance Taylor <iant@google.com>
11750
11751 * options.h (class General_options): Add --no case for
11752 --export-dynamic.
11753
11754 2008-12-16 Cary Coutant <ccoutant@google.com>
11755
11756 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11757 vector.
11758 (Plugin_manager::claim_file): Create plugin object even if
11759 plugin did not call the add_symbols callback.
11760 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11761 asking for more symbols than were added.
11762 * testsuite/Makefile.am (plugin_test_1): Add test case with
11763 no global symbols.
11764 (empty.syms): New target.
11765 * testsuite/Makefile.in: Regenerate.
11766 * testsuite/plugin_test.c (claim_file_hook): Add new debug
11767 message. Don't call add_symbols if no globals.
11768 (all_symbols_read_hook): Don't provide replacement for empty
11769 claimed file.
11770
11771 2008-12-12 Ian Lance Taylor <iant@google.com>
11772
11773 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11774 r_type == 0 for a local symbol with r_sym == 0.
11775 (scan_relocatable_relocs): Pass r_sym to
11776 local_non_section_strategy.
11777 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11778 r_sym parameter.
11779
11780 * configure.ac: Update test for TLS descriptors: they are
11781 supported as of glibc 2.9.
11782 * configure: Rebuild.
11783
11784 2008-12-11 Ian Lance Taylor <iant@google.com>
11785
11786 PR 7091
11787 * target-reloc.h (Default_scan_relocatable_relocs): For each
11788 function, map r_type == 0 to RELOC_DISCARD.
11789
11790 2008-12-10 Cary Coutant <ccoutant@google.com>
11791
11792 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11793 object to override a kept COMDAT group from a plugin object.
11794
11795 2008-12-09 Ian Lance Taylor <iant@google.com>
11796
11797 PR 7088
11798 * yyscript.y (file_cmd): Handle INPUT.
11799
11800 * testsuite/initpri1.c: Change all declarations to be full
11801 prototypes by adding void, to avoid compiler warnings.
11802
11803 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
11804
11805 * options.cc (General_options::parse_plugin_opt): New.
11806 (General_options::add_plugin): The argument now is just the filename.
11807 (General_options::add_plugin_option): New.
11808 * options.h (plugin_opt): New.
11809 (add_plugin): Change argument name.
11810 (add_plugin_option): New.
11811 * plugin.cc (Plugin::load): Don't parse the plugin option.
11812 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11813 (Plugin::add_option): New.
11814 (Plugin::args_): Change type.
11815 (Plugin::filename_): New.
11816 (Plugin_manager::add_plugin_option): New.
11817 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11818 * testsuite/Makefile.in: Regenerate.
11819
11820 2008-12-05 Cary Coutant <ccoutant@google.com>
11821
11822 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11823 Handle --strip-lto-sections option.
11824 * options.h (strip_lto_sections): New option.
11825
11826 2008-12-01 Cary Coutant <ccoutant@google.com>
11827
11828 * plugin.cc (ld_plugin_message): Change format parameter to const.
11829 Fix mismatch between new[] and delete.
11830
11831 2008-11-14 Cary Coutant <ccoutant@google.com>
11832
11833 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11834 instead of -1U.
11835
11836 2008-11-05 Craig Silverstein <csilvers@google.com>
11837
11838 * options.cc (General_options::parse_dynamic_list): New function.
11839 * options.h (General_options): New flags dynamic_list,
11840 dynamic_list_data, dynamic_list_cpp_new, and
11841 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11842 (General_options::in_dynamic_list): New function.
11843 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11844 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11845 (Lex::can_continue_name): Likewise.
11846 (yylex): Likewise.
11847 (read_script_file): New parameter script_options.
11848 (read_dynamic_list): New function.
11849 (Script_options::define_dynamic_list): New function.
11850 (dynamic_list_keyword_parsecodes): New variable.
11851 (dynamic_list_keywords): New variable.
11852 * script.h (Script_options::define_dynamic_list): New function
11853 prototype.
11854 (read_dynamic_list): New function prototype.
11855 * symtab.cc (strprefix): New macro.
11856 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11857 dynamic_list_data, dynamic_list_cpp_new, and
11858 dynamic_list_cpp_typeinfo.
11859 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11860 (dynamic_list_expr): New rule.
11861 (dynamic_list_nodes): Likewise.
11862 (dynamic_list_node): Likewise.
11863 * testsuite/Makefile.am (dynamic_list): New test.
11864 * testsuite/Makefile.in: Regenerated.
11865 * testsuite/dynamic_list.t: New file.
11866 * testsuite/dynamic_list.sh: New file.
11867
11868 2008-11-05 Craig Silverstein <csilvers@google.com>
11869
11870 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11871 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11872 (t11_last): Likewise.
11873 * testsuite/ver_test_6.c (main): Likewise.
11874
11875 2008-10-07 Cary Coutant <ccoutant@google.com>
11876
11877 * options.c (General_options::finalize): Add check for -static and
11878 -shared.
11879 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11880 is not empty.
11881
11882 2008-10-02 Cary Coutant <ccoutant@google.com>
11883
11884 * plugin.cc (make_sized_plugin_object): Fix conditional
11885 compilation to work when not all targets are enabled.
11886
11887 2008-09-29 Cary Coutant <ccoutant@google.com>
11888
11889 * archive.cc (Archive::get_file_and_offset): Use filename instead
11890 of name to get library path.
11891 (Archive::include_member): Unlock external member of a thin archive.
11892
11893 * testsuite/Makefile.am (TEST_AR): New variable.
11894 (thin_archive_test_1): New test.
11895 (thin_archive_test_2): New test.
11896 * testsuite/Makefile.in: Regenerate.
11897 * testsuite/thin_archive_main.cc: New file.
11898 * testsuite/thin_archive_test_1.cc: New file.
11899 * testsuite/thin_archive_test_2.cc: New file.
11900 * testsuite/thin_archive_test_3.cc: New file.
11901 * testsuite/thin_archive_test_4.cc: New file.
11902
11903 2008-09-29 Cary Coutant <ccoutant@google.com>
11904
11905 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11906 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11907 instead of -1U.
11908 (Sized_relobj::do_finalize_local_symbols): Likewise.
11909 (Sized_relobj::map_to_kept_section): Likewise.
11910 * object.h (Sized_relobj::invalid_address): New constant.
11911 (Sized_relobj::do_output_section_offset): Check for invalid_address
11912 and return -1ULL.
11913 * output.cc (Output_reloc::local_section_offset): Use constant
11914 invalid_address instead of -1U.
11915 (Output_reloc::get_address): Likewise.
11916 (Output_section::output_address): Change -1U to -1ULL.
11917 * output.h (Output_reloc::invalid_address): New constant.
11918 * reloc.cc (Sized_relobj::write_sections): Use constant
11919 invalid_address instead of -1U.
11920 (Sized_relobj::relocate_sections): Likewise.
11921 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11922 values for merge sections.
11923 * target-reloc.h (relocate_for_relocatable): Use constant
11924 invalid_address instead of -1U.
11925
11926 2008-09-19 Cary Coutant <ccoutant@google.com>
11927
11928 Add plugin functionality for link-time optimization (LTO).
11929 * configure.ac (plugins): Add --enable-plugins option.
11930 * configure: Regenerate.
11931 * config.in: Regenerate.
11932 * Makefile.am (LIBDL): New variable.
11933 (CCFILES): Add plugin.cc.
11934 (HFILES): Add plugin.h.
11935 (ldadd_var): Add LIBDL.
11936 * Makefile.in: Regenerate.
11937
11938 * archive.cc: Include "plugin.h".
11939 (Archive::setup): Don't preread archive symbols when using a plugin.
11940 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11941 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11942 files.
11943 (Archive::include_member): Add symbols from plugin objects.
11944 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11945 * descriptors.cc (Descriptors::open): Check for file descriptors
11946 abandoned by plugins.
11947 (Descriptors::claim_for_plugin): New function.
11948 * descriptors.h (Descriptors::claim_for_plugin): New function.
11949 (Open_descriptor::is_claimed): New field.
11950 (claim_descriptor_for_plugin): New function.
11951 * fileread.cc (File_read::claim_for_plugin): New function.
11952 * fileread.h (File_read::claim_for_plugin): New function.
11953 (File_read::descriptor): New function.
11954 * gold.cc: Include "plugin.h".
11955 (queue_initial_tasks): Add task to call plugin hooks for generating
11956 new object files.
11957 * main.cc: Include "plugin.h".
11958 (main): Load plugin libraries.
11959 * object.h (Pluginobj): Declare.
11960 (Object::pluginobj): New function.
11961 (Object::do_pluginobj): New function.
11962 (Object::set_target): New function.
11963 * options.cc: Include "plugin.h".
11964 (General_options::parse_plugin): New function.
11965 (General_options::General_options): Initialize plugins_ field.
11966 (General_options::add_plugin): New function.
11967 * options.h (Plugin_manager): Declare.
11968 (General_options): Add --plugin option.
11969 (General_options::has_plugins): New function.
11970 (General_options::plugins): New function.
11971 (General_options::add_plugin): New function.
11972 (General_options::plugins_): New field.
11973 * plugin.cc: New file.
11974 * plugin.h: New file.
11975 * readsyms.cc: Include "plugin.h".
11976 (Read_symbols::do_read_symbols): Check for archive before checking
11977 for ELF file. Call plugin hooks to claim files.
11978 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11979 from a real object file; force override when processing replacement
11980 files.
11981 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11982 (Symbol::init_base_object): Likewise.
11983 (Symbol::init_base_output_data): Likewise.
11984 (Symbol::init_base_output_segment): Likewise.
11985 (Symbol::init_base_constant): Likewise.
11986 (Symbol::init_base_undefined): Likewise.
11987 (Symbol::output_section): Assert that object is not a plugin.
11988 (Symbol_table::add_from_pluginobj): New function.
11989 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11990 undefined.
11991 (Symbol_table::sized_write_globals): Likewise.
11992 (Symbol_table::add_from_pluginobj): Instantiate template.
11993 * symtab.h (Sized_pluginobj): Declare.
11994 (Symbol::in_real_elf): New function.
11995 (Symbol::set_in_real_elf): New function.
11996 (Symbol::in_real_elf_): New field.
11997 (Symbol_table::add_from_pluginobj): New function.
11998
11999 * testsuite/Makefile.am (AM_CFLAGS): New variable.
12000 (LIBDL): New variable.
12001 (LDADD): Add LIBDL.
12002 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12003 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12004 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12005 (MOSTLYCLEANFILES): Likewise.
12006 * testsuite/Makefile.in: Regenerate.
12007 * testsuite/plugin_test.c: New file.
12008 * testsuite/plugin_test_1.sh: New file.
12009 * testsuite/plugin_test_2.sh: New file.
12010
12011 2008-09-16 Ian Lance Taylor <iant@google.com>
12012
12013 * target-reloc.h (relocate_section): Check whether a symbol is
12014 defined by the ABI before reporting an undefined symbol error.
12015 * target.h (Target::is_defined_by_abi): Make parameter const.
12016 (Target::do_is_defined_by_abi): Likewise.
12017 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12018 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12019 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12020 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12021 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12022 * testsuite/Makefile.in: Rebuild.
12023
12024 * fileread.cc (make_view): Add casts to avoid warning.
12025
12026 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12027
12028 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12029 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12030
12031 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12032
12033 * options.h (General_options::output_is_executable): New.
12034 (General_options::output_is_pie): New.
12035 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12036 for shared libraries.
12037 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12038
12039 2008-09-11 Chris Demetriou <cgd@google.com>
12040
12041 * options.h (origin): New -z option.
12042 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12043 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12044 in DT_FLAGS_1.
12045
12046 2008-09-05 Cary Coutant <ccoutant@google.com>
12047
12048 * fileread.cc (File_read::make_view): Add check for attempt to map
12049 beyond end of file.
12050
12051 2008-09-05 Cary Coutant <ccoutant@google.com>
12052
12053 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12054 explicit instantiations.
12055
12056 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
12057
12058 PR gold/6858
12059 * options.cc (General_options::finalize): Allow undefined symbols
12060 in shlibs if linking -shared.
12061
12062 PR gold/6859
12063 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12064 symbols as not needing a dynsym entry.
12065
12066 2008-08-20 Craig Silverstein <csilvers@google.com>
12067
12068 * fileread.cc (File_read::open): Do not lock the file unless it
12069 was successfully opened.
12070
12071 2008-08-14 Cary Coutant <ccoutant@google.com>
12072
12073 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12074 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12075 * testsuite/tls_test.cc (struct int128): 128-bit struct
12076 for testing TLS relocs with non-zero addend.
12077 (v12): New TLS variable.
12078 (t12): New test.
12079 (t_last): Add check for v12.
12080 * testsuite/tls_test.h (t12): New function.
12081 * testsuite/tls_test_main.cc (thread_routine): Call new test.
12082
12083 2008-08-13 Ian Lance Taylor <iant@google.com>
12084
12085 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12086 set tls_segment_ or relro_segment_.
12087 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12088 when appropriate.
12089 * output.h (Output_section::clear_is_relro): New function.
12090 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12091 sections specially even when output_data_ is empty.
12092 (Output_segment::maximum_alignment): When first section is relro,
12093 only force alignment for PT_LOAD segments.
12094 * script.cc (script_data_segment_align): New function.
12095 (script_data_segment_relro_end): New function.
12096 * script-c.h (script_data_segment_align): Declare.
12097 (script_data_segment_relro_end): Declare.
12098 * script-sections.h (class Script_sections): Declare
12099 data_segment_align and data_segment_relro_end. Add fields
12100 segment_align_index_ and saw_relro_end_.
12101 * script-sections.cc (class Sections_element): Add set_is_relro
12102 virtual function. Add new bool* parameter to place_orphan_here.
12103 Add get_output_section virtual function.
12104 (class Output_section_definition): Add set_is_relro. Add new
12105 bool* parameter to place_orphan_here. Add get_output_section.
12106 Add is_relro_ field.
12107 (Output_section_definition::Output_section_definition): Initialize
12108 evaluated_address_, evaluated_load_address, evaluated_addralign_,
12109 and is_relro_ fields.
12110 (Output_section_definition::place_orphan_here): Add is_relro
12111 parameter.
12112 (Output_section_definition::set_section_addresses): Set relro for
12113 output section.
12114 (Output_section_definition::alternate_constraint): Likewise.
12115 (class Orphan_output_section): Add new bool* parameter to
12116 place_orphan_here. Add get_output_section.
12117 (Orphan_output_section::place_orphan_here): Add is_relro
12118 parameter.
12119 (Script_sections::Script_sections): Initialize
12120 data_segment_align_index_ and saw_relro_end_.
12121 (Script_sections::data_segment_align): New function.
12122 (Script_sections::data_segment_relro_end): New function.
12123 (Script_sections::place_orphan): Set or clear is_relro.
12124 (Script_sections::set_section_addresses): Force alignment of first
12125 TLS section.
12126 * yyscript.y (exp): Call script_data_segment_align and
12127 script_data_segment_relro_end.
12128 * testsuite/relro_script_test.t: New file.
12129 * testsuite/relro_test.cc (using_script): Declare.
12130 (t1, t2): Test using_script.
12131 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12132 (relro_script_test_SOURCES): Define.
12133 (relro_script_test_DEPENDENCIES): Define.
12134 (relro_script_test_LDFLAGS): Define.
12135 (relro_script_test_LDADD): Define.
12136 (relro_script_test.so): New target.
12137 * testsuite/Makefile.in: Rebuild.
12138
12139 2008-08-06 Cary Coutant <ccoutant@google.com>
12140
12141 * archive.cc (Archive::total_archives, Archive::total_members)
12142 (Archive::total_members_loaded): New variables.
12143 (Archive::setup): Add parameter. Add option to preread
12144 archive symbols.
12145 (Archive::read_armap): Add counter.
12146 (Archive::get_file_and_offset): New function.
12147 (Archive::get_elf_object_for_member): New function.
12148 (Archive::read_all_symbols): New function.
12149 (Archive::read_symbols): New function.
12150 (Archive::add_symbols): Add counters.
12151 (Archive::include_all_members): Use armap to find members if it's
12152 already built.
12153 (Archive::include_member): Skip reading symbols if already read.
12154 Factored code into Archive::get_file_and_offset and
12155 Archive::get_elf_object_for_member. Changed call to
12156 Mapfile::report_include_archive_member.
12157 (Archive::print_stats): New function.
12158 * archive.h: Declare Object and Read_symbols_data classes.
12159 (Archive::Archive): Add initializers for new members.
12160 (Archive::setup): Add parameter.
12161 (Archive::print_stats): New function.
12162 (Archive::total_archives, Archive::total_members)
12163 (Archive::total_members_loaded): New variables.
12164 (Archive::get_file_and_offset): New function.
12165 (Archive::get_elf_object_for_member): New function.
12166 (Archive::read_all_symbols): New function.
12167 (Archive::read_symbols): New function.
12168 (Archive::Archive_member): New class.
12169 (Archive::members_): New member.
12170 (Archive::num_members_): New member.
12171 * main.cc: Include archive.h.
12172 (main): Call Archive::print_stats.
12173 * mapfile.cc (Mapfile::report_include_archive_member): Delete
12174 archive parameter; member_name is now the fully-decorated name.
12175 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12176 * options.h: (General_options): Add --preread-archive-symbols option.
12177 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12178 Archive::setup.
12179
12180 2008-08-04 Ian Lance Taylor <iant@google.com>
12181
12182 * symtab.h (Symbol::use_plt_offset): New function.
12183 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12184 * powerpc.cc (Relocate::relocate): Likewise.
12185 * sparc.cc (Relocate::relocate): Likewise.
12186 * x86_64.cc (Relocate::relocate): Likewise.
12187 * testsuite/weak_plt.sh: New test.
12188 * testsuite/weak_plt_main.cc: New test.
12189 * testsuite/weak_plt_shared.cc: New test.
12190 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12191 (check_PROGRAMS): Add weak_plt.
12192 (check_DATA): Add weak_plt_shared.so.
12193 (weak_plt_main_pic.o, weak_plt): New targets.
12194 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12195 * testsuite/Makefile.in: Rebuild.
12196
12197 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12198 gcctestdir/ld.
12199 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12200 * testsuite/Makefile.in: Rebuild.
12201
12202 2008-08-04 Alan Modra <amodra@bigpond.net.au>
12203
12204 * Makefile.am (POTFILES.in): Set LC_ALL=C.
12205 * Makefile.in: Regenerate.
12206 * po/POTFILES.in: Regenerate.
12207
12208 2008-07-29 Ian Lance Taylor <iant@google.com>
12209
12210 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12211 symbols before other symbols.
12212 * testsuite/script_test_2.cc (test_addr): Declare.
12213 (test_addr_alias): Declare.
12214 (main): Check that test_addr and test_addr_alias have the right
12215 values.
12216 * testsuite/script_test_2.t: Define test_addr_alias and
12217 test_addr.
12218
12219 2008-07-24 Ian Lance Taylor <iant@google.com>
12220
12221 PR 5990
12222 * descriptors.cc: New file.
12223 * descriptors.h: New file.
12224 * gold-threads.h (class Hold_optional_lock): New class.
12225 * fileread.cc: Include "descriptors.h".
12226 (File_read::~File_read): Release descriptor rather than closing
12227 it.
12228 (File_read::open) [file]: Call open_descriptor rather than open.
12229 Set is_descriptor_opened_.
12230 (File_read::open) [memory]: Assert that descriptor is not open.
12231 (File_read::reopen_descriptor): New function.
12232 (File_read::release): Release descriptor.
12233 (File_read::do_read): Make non-const. Reopen descriptor.
12234 (File_read::read): Make non-const.
12235 (File_read::make_view): Reopen descriptor.
12236 (File_read::do_readv): Likewise.
12237 * fileread.h (class File_read): Add is_descriptor_opened_ field.
12238 Update declarations.
12239 * layout.cc: Include "descriptors.h".
12240 (Layout::create_build_id): Use open_descriptor rather than open.
12241 * output.cc: Include "descriptors.h".
12242 (Output_file::open): Use open_descriptor rather than open.
12243 * archive.cc (Archive::const_iterator): Change Archive to be
12244 non-const.
12245 (Archive::begin, Archive::end): Make non-const.
12246 (Archive::count_members): Likewise.
12247 * archive.h (class Archive): Update declarations.
12248 * object.h (Object::read): Make non-const.
12249 * Makefile.am (CCFILES): Add descriptors.cc.
12250 (HFILES): Add descriptors.h.
12251 * Makefile.in: Rebuild.
12252
12253 PR 6716
12254 * gold.h: Always include <clocale>. Add Solaris workarounds
12255 following code in binutils/sysdep.h.
12256
12257 PR 6048
12258 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12259 this->eh_frame_hdr_ is NULL before using it.
12260
12261 * dynobj.cc (Versions::Versions): Update comment.
12262
12263 * dynobj.cc (Versions::Versions): If there is an soname, use it as
12264 the base version name.
12265
12266 * stringpool.cc (Stringpool_template::add_with_length): Set key to
12267 array size plus one.
12268 (Stringpool_template::set_string_offsets): Subtract one from key
12269 before using it as an array index.
12270 (Stringpool_template::get_offset_with_length): Likewise.
12271 (Stringpool_template::write_to_buffer): Likewise.
12272 * stringpool.h (Stringpool_template::get_offset_from_key):
12273 Likewise.
12274
12275 2008-07-23 Ian Lance Taylor <iant@google.com>
12276
12277 PR 6658
12278 * object.h (Merged_symbol_value::value): Do our best to handle a
12279 negative addend.
12280
12281 PR 6647
12282 * script.cc (Version_script_info::get_versions): Don't add empty
12283 version tag to return value.
12284 (Version_script_info::get_symbol_version_helper): Change return
12285 type to bool. Add pversion parameter. Change all callers.
12286 (script_register_vers_node): Don't require a non-NULL tag.
12287 * script.h (class Version_script_info): Update declarations.
12288 (Version_script_info::get_symbol_version): Change return type to
12289 bool. Add version parameter. Change all callers.
12290 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12291 handling. Handle an empty version from a version script.
12292 (Symbol_table::define_special_symbol): Likewise.
12293 * testsuite/ver_test_10.script: New file.
12294 * testsuite/ver_test_10.sh: New file.
12295 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12296 (check_DATA): Add ver_test_10.syms.
12297 (ver_test_10.syms, ver_test_10.so): New target.
12298 * testsuite/Makefile.in: Rebuild.
12299
12300 2008-07-23 Simon Baldwin <simonb@google.com>
12301
12302 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12303 to zero for undefined symbols from dynamic libraries.
12304
12305 2008-07-23 Ian Lance Taylor <iant@google.com>
12306
12307 * symtab.cc (Symbol_table::resolve): Remove version parameter.
12308 Change all callers.
12309 * symtab.h (class Symbol_table): Update declaration.
12310 * testsuite/ver_test_9.cc: New file.
12311 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12312 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12313 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12314 (ver_test_9.so, ver_test_9.o): New targets.
12315 * testsuite/Makefile.in: Rebuild.
12316
12317 2008-07-22 Ian Lance Taylor <iant@google.com>
12318
12319 * options.h (class General_options): Define --check-sections.
12320 * layout.cc (Layout::set_segment_offsets): Handle
12321 --check-sections.
12322
12323 * options.h (class General_options): Define -n/--nmagic and
12324 -N/--omagic.
12325 * options.cc (General_options::finalize): For -n/--nmagic or
12326 -N/--omagic, set -static.
12327 * layout.cc (Layout::attach_allocated_section_to_segment): If
12328 -N/--omagic, don't put read-only and read-write sections in
12329 different segments.
12330 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12331 finding a read-only segment.
12332 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12333 don't set the minimum segment alignment to the common page size,
12334 and don't set the file offset to the address modulo the page size.
12335 * script-sections.cc (Script_sections::create_segments): If
12336 -n/--omagic, don't put read-only and read-write sections in
12337 different segments.
12338
12339 * cref.cc: New file.
12340 * cref.h: New file.
12341 * options.h (class General_options): Add --print-symbol-counts.
12342 * main.cc (main): Issue defined symbol report if requested.
12343 * archive.cc (Archive::interpret_header): Make into a const member
12344 function.
12345 (Archive::add_symbols): Call Input_objects::archive_start and
12346 archive_stop.
12347 (Archive::const_iterator): Define new class.
12348 (Archive::begin, Archive::end): New functions.
12349 (Archive::include_all_members): Rewrite to use iterator.
12350 (Archive::count_members): New function.
12351 * archive.h (class Archive): Update declarations.
12352 (Archive::filename): New function.
12353 * object.cc: Include "cref.h".
12354 (Sized_relobj::Sized_relobj): Initialize defined_count_.
12355 (Sized_relobj::do_get_global_symbol_counts): New function.
12356 (Input_objects::add_object): Add object to cross-referencer.
12357 (Input_objects::archive_start): New function.
12358 (Input_objects::archive_stop): New function.
12359 (Input_objects::print_symbol_counts): New function.
12360 * object.h: Declare Cref and Archive.
12361 (Object::get_global_symbol_counts): New function.
12362 (Object::do_get_global_symbol_counts): New pure virtual function.
12363 (class Sized_relobj): Add defined_count_ field. Update
12364 declarations.
12365 (class Input_objects): Add cref_ field. Update constructor.
12366 Update declarations.
12367 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12368 defined_count_.
12369 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12370 symbol counts.
12371 (Sized_dynobj::do_get_global_symbol_counts): New function.
12372 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12373 defined_count_. Update declarations. Define Symbols typedef.
12374 * symtab.cc (Symbol_table::add_from_relobj): Add defined
12375 parameter. Change all callers.
12376 (Symbol_table::add_from_dynobj): Add sympointers and defined
12377 parameters. Change all callers.
12378 * symtab.h (class Symbol_table): Update declarations.
12379 * Makefile.am (CCFILES): Add cref.cc.
12380 (HFILES): Add cref.h.
12381 * Makefile.in: Rebuild.
12382
12383 2008-07-22 Simon Baldwin <simonb@google.com>
12384
12385 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12386 to zero when writing undefined symbols.
12387
12388 2008-07-22 Ian Lance Taylor <iant@google.com>
12389
12390 * output.cc (Output_section::add_input_section): Don't try to
12391 merge empty merge sections.
12392
12393 2008-07-21 Craig Silverstein <csilvers@google.com>
12394
12395 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12396 Include symbol version in error message.
12397
12398 2008-07-20 Chris Demetriou <cgd@google.com>
12399
12400 * configure.ac (gold_cv_c_random_seed): New configured variable.
12401 (RANDOM_SEED_CFLAGS): New substituted variable.
12402 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12403 * configure: Rebuild.
12404 * Makefile.in: Likewise.
12405 * testsuite/Makefile.in: Likewise.
12406
12407 2008-07-18 Ian Lance Taylor <iant@google.com>
12408
12409 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12410 where we see NAME/NULL and NAME/VERSION as separate symbols.
12411 * testsuite/ver_test_main.cc (main): Call t4.
12412 (t4, t4_2a): Define.
12413 * testsuite/ver_test_2.cc (t4_2): Define.
12414 * testsuite/ver_test_2.script: Put t4_2a in VER2.
12415 * testsuite/ver_test_4.cc (t4_2a): Define.
12416 * testsuite/ver_test_4.script: Put t4_2a in VER2.
12417 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12418
12419 2008-07-17 Ian Lance Taylor <iant@google.com>
12420
12421 * dynobj.cc (Versions::add_def): If we give an error about a
12422 missing version, go ahead and create the version anyhow.
12423
12424 2008-07-10 Ian Lance Taylor <iant@google.com>
12425
12426 Handle output sections with more than 0x7fffffff bytes.
12427 * object.h (class Relobj): Change map_to_output_ to
12428 output_sections_, and just keep a section pointer. Change all
12429 uses. Move comdat group support to Sized_relobj.
12430 (Relobj::is_section_specially_mapped): Remove.
12431 (Relobj::output_section): Remove poff parameter. Change all
12432 callers.
12433 (Relobj::output_section_offset): New function.
12434 (Relobj::set_section_offset): Rewrite.
12435 (Relobj::map_to_output): Remove.
12436 (Relobj::output_sections): New function.
12437 (Relobj::do_output_section_offset): New pure virtual function.
12438 (Relobj::do_set_section_offset): Likewise.
12439 (class Sized_relobj): Add section_offsets_ field. Add comdat
12440 group support from Relobj. Update declarations.
12441 (Sized_relobj::get_output_section_offset): New function.
12442 (Sized_relobj::do_output_section_offset): New function.
12443 (Sized_relobj::do_set_section_offset): New function.
12444 * object.cc (Relobj::output_section_address): Remove.
12445 (Sized_relobj::Sized_relobj): Initialize new fields.
12446 (Sized_relobj::include_section_group): Cast find_kept_object to
12447 Sized_relobj.
12448 (Sized_relobj::include_linkonce_section): Likewise.
12449 (Sized_relobj::do_layout): Use separate arrays for output section
12450 and output offset.
12451 (Sized_relobj::do_count_local_symbols): Change map_to_output to
12452 output_sections.
12453 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12454 output_sections and section_offsets.
12455 (Sized_relobj::write_local_symbols): Likewise.
12456 (map_to_kept_section): Compute output address directly.
12457 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12458 output_sections and section_offsets.
12459 (Sized_relobj::write_sections): Likewise.
12460 (Sized_relobj::relocate_sections): Likewise.
12461 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12462 * output.h (class Output_reloc): Update declarations. Change
12463 u2_.relobj to Sized_relobj*.
12464 (class Output_data_reloc): Change add functions to use
12465 Sized_relobj*.
12466 * output.cc (Output_reloc::Output_reloc): Change relobj to
12467 Sized_relobj*.
12468 (Output_reloc::local_section_offset): Change return type to
12469 Elf_Addr. Use get_output_section_offset.
12470 (Output_reloc::get_address): Likewise.
12471 (Output_section::is_input_address_mapped): Don't call
12472 is_section_specially_mapped.
12473 (Output_section::output_offset): Likewise.
12474 (Output_section::output_address): Likewise.
12475 (Output_section::starting_output_address): Likewise.
12476 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12477 parameter to Sized_relobj*.
12478 (Copy_relocs::need_copy_reloc): Likewise.
12479 (Copy_relocs::save): Likewise.
12480 * copy-relocs.h (class Copy_relocs): Update declarations.
12481 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12482 Sized_relobj*. Change relobj_ field to Sized_relobj*.
12483 * target-reloc.h (relocate_for_relocatable): Change
12484 offset_in_output_section type to Elf_Addr. Change code that uses
12485 it as well.
12486 * layout.cc (Layout::layout): Always set *off.
12487 * mapfile.cc (Mapfile::print_input_section): Use
12488 output_section_offset.
12489 * i386.cc (Target_i386::copy_reloc): Change object parameter to
12490 Sized_relobj*.
12491 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12492 * sparc.cc (Target_sparc::copy_reloc): Likewise.
12493 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12494
12495 2008-07-03 Ian Lance Taylor <iant@google.com>
12496
12497 * layout.cc (Layout::include_section): Do not discard unrecognized
12498 SHT_STRTAB sections.
12499
12500 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
12501
12502 * script.cc (Lex::can_continue_name): Make '?' allowable in
12503 version-script names.
12504 * testsuite/version_script.map: Change glob pattern to use '?'
12505
12506 2008-06-30 Manish Singh <yosh@gimp.org>
12507
12508 PR 6585
12509 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12510 Correct typo.
12511
12512 2008-06-30 Ian Lance Taylor <iant@google.com>
12513
12514 PR 6660
12515 PR 6682
12516 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12517 versions]: Don't try to read the value in the contents, since we
12518 don't use it. Use the template endianness when writing.
12519
12520 2008-06-25 Cary Coutant <ccoutant@google.com>
12521
12522 * fileread.cc (File_read::make_view): Assert on zero-length view.
12523 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12524 symbol table when there are no symbols to read.
12525
12526 2008-06-23 Craig Silverstein <csilvers@google.com>
12527
12528 * version.cc (version_string): Bump to 1.7
12529
12530 2008-06-18 Craig Silverstein <csilvers@google.com>
12531
12532 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12533 constant 0xFFFF to type Valtype.
12534 (Powerpc_relocate_functions::rel16_ha): Likewise.
12535
12536 2008-06-17 Ian Lance Taylor <iant@google.com>
12537
12538 * output.h (Output_section::Input_section): Initialize p2align_ to
12539 zero for Output_section_data constructors.
12540 (Output_section::Input_section::addralign): If not an input
12541 section, return the alignment of the Output_section_data.
12542 * testsuite/copy_test.cc: New file.
12543 * testsuite/copy_test_1.cc: New file.
12544 * testsuite/copy_test_2.cc: New file.
12545 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12546 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12547 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12548 (copy_test_1_pic.o, copy_test_1.so): New targets.
12549 (copy_test_2_pic.o, copy_test_2.so): New targets.
12550 * testsuite/Makefile.in: Rebuild.
12551
12552 * script-sections.cc (Script_sections::place_orphan): Initialize
12553 local variable exact.
12554
12555 2008-06-13 David Edelsohn <edelsohn@gnu.org>
12556
12557 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12558
12559 2008-06-12 David Edelsohn <edelsohn@gnu.org>
12560 David S. Miller <davem@davemloft.net>
12561
12562 * powerpc.cc: New file.
12563 * Makefile.am (TARGETSOURCES): Add powerpc.cc
12564 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12565 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12566 * Makefile.in: Rebuild.
12567
12568 2008-06-09 Ian Lance Taylor <iant@google.com>
12569
12570 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12571 <exception>.
12572 (throwing, orig_terminate): New static variables.
12573 (terminate_handler): New static function.
12574 (t2): Set terminate handler.
12575
12576 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12577
12578 PR 6584
12579 * binary.cc (Binary_to_elf::sized_convert): Fix .data
12580 alignment.
12581
12582 2008-05-30 Cary Coutant <ccoutant@google.com>
12583
12584 * archive.cc (Archive::include_all_members) Correct to step
12585 over symbol table and extended name table in thin archives.
12586
12587 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12588
12589 PR 6407
12590 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12591 calculation.
12592
12593 2008-05-28 Caleb Howe <cshowe@google.com>
12594
12595 * reduced_debug_output.cc: New file.
12596 * reduced_debug_output.h: New file.
12597 * options.h (class General_options): Add --strip-debug-non-line.
12598 * options.cc (General_options::finalize): Add strip_debug_non_line
12599 to the strip heirarchy.
12600 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12601 fields.
12602 * layout.cc: Include "reduced_debug_output.h".
12603 (Layout::Layout): Initialize new fields.
12604 (line_only_debug_sections): New static array.
12605 (is_lines_only_debug_sections): New static inline function.
12606 (Layout::include_section): Handle --strip-debug-non-line.
12607 (Layout::make_output_section): If --strip-debug-non-line, build
12608 new output sections for .debug_abbrev and .debug_info.
12609 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12610 gold. Warn about possible overflow.
12611 (read_signed_LEB_128): Likewise.
12612 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12613 (read_signed_LEB_128): Declare.
12614 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12615 (HFILES): Add reduced_debug_output.h.
12616 * Makefile.in: Rebuild.
12617
12618 2008-05-21 Ian Lance Taylor <iant@google.com>
12619
12620 * mapfile.cc: New file.
12621 * mapfile.h: New file.
12622 * options.h (class General_options): Add -M/--print-map and -Map.
12623 * options.cc (General_options::finalize): Make -M equivalent to
12624 -Map -.
12625 * main.cc: Include <cstdio> and "mapfile.h".
12626 (main): Open mapfile if requested.
12627 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12628 constructor. Change caller.
12629 (queue_initial_tasks): Add mapfile parameter. Change caller.
12630 (queue_middle_tasks): Likewise.
12631 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12632 declarations.
12633 * archive.cc: Include "mapfile.h".
12634 (Archive::add_symbols): Add mapfile parameter. Change all
12635 callers. Pass mapfile, symbol, and reason to include_member.
12636 (Archive::include_all_members): Add mapfile parameter. Change all
12637 callers.
12638 (Archive::include_member): Add mapfile, sym, and why parameters.
12639 Change all callers. Report inclusion to map file.
12640 * archive.h: Include "fileread.h".
12641 (class Archive): Update declarations.
12642 (Archive::file): New const method.
12643 (class Add_archive_symbols): Add mapfile_ field. Update
12644 constructor. Change all callers.
12645 * readsyms.h (class Read_symbols): Likewise.
12646 (class Finish_group): Likewise.
12647 (class Read_script): Likewise.
12648 * common.cc: Include "mapfile.h".
12649 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12650 all callers.
12651 (Symbol_table::do_allocate_commons): Likewise.
12652 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12653 symbol allocation to mapfile.
12654 * common.h (class Allocate_commons_task): Add mapfile_ field.
12655 Update constructor. Change all callers.
12656 * symtab.h (class Symbol_table): Update declarations.
12657 * layout.cc: Include "mapfile.h".
12658 (Layout_task_runner::run): Print information to mapfile.
12659 (Layout::create_gold_note): Change Output_data_fixed_space to
12660 Output_data_zero_fill.
12661 (Layout::create_build_id): Likewise.
12662 (Layout::print_to_mapfile): New function.
12663 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12664 constructor. Change caller.
12665 (class Layout): Declare print_to_mapfile.
12666 * output.cc (Output_section::Input_section::print_to_mapfile): New
12667 function.
12668 (Output_section::add_input_section): If producing a map, always
12669 add to input_sections_ list.
12670 (Output_section::do_print_to_mapfile): New function.
12671 (Output_segment::print_sections_to_mapfile): New function.
12672 (Output_segment::print_section_list_to_mapfile): New function.
12673 * output.h: Include "mapfile.h".
12674 (Output_data::print_to_mapfile): New function.
12675 (Output_data::do_print_to_mapfile): New virtual function.
12676 (Output_segment_headers::do_print_to_mapfile): New function.
12677 (Output_file_header::do_print_to_mapfile): New function.
12678 (Output_data_const::do_print_to_mapfile): New function.
12679 (class Output_data_const_buffer): Add map_name_ field. Update
12680 constructor. Change all callers. Add do_print_to_mapfile
12681 function.
12682 (class Output_data_fixed_space): Likewise.
12683 (class Output_data_space): Likewise.
12684 (class Output_data_zero_fill): New class.
12685 (Output_data_strtab::do_print_to_mapfile): New function.
12686 (Output_data_reloc_base::do_print_to_mapfile): New function.
12687 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12688 (Output_data_group::do_print_to_mapfile): New function.
12689 (Output_data_got::do_print_to_mapfile): New function.
12690 (Output_data_dynamic::do_print_to_mapfile): New function.
12691 (Output_symtab_xindex::do_print_to_mapfile): New function.
12692 (class Output_section): Declare do_print_to_mapflie. Declare
12693 print_to_mapfile in Input_section.
12694 (class Output_segment): Declare new functions.
12695 * object.h (Sized_relobj::symbol_count): New function.
12696 * script-sections.cc
12697 (Output_section_element_dot_assignment::set_section_addresses):
12698 Change Output_data_fixed_space to Output_data_zero_fill.
12699 (Output_data_expression::do_print_to_mapfile): New function.
12700 * script.cc (read_input_script): Add mapfile parameter. Change
12701 all callers.
12702 * script.h (read_input_script): Update declaration.
12703 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12704 (Eh_frame::do_print_to_mapfile): New function.
12705 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12706 (Output_merge_string::do_print_to_mapfile): New function.
12707 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12708 function.
12709 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12710 function.
12711 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12712 function.
12713 * Makefile.am (CCFILES): Add mapfile.cc.
12714 (HFILES): Add mapfile.h.
12715 * Makefile.in: Rebuild.
12716
12717 2008-05-19 Ian Lance Taylor <iant@google.com>
12718
12719 * options.h (class General_options): Add -z relro.
12720 * layout.cc (Layout::Layout): Initialize relro_segment_.
12721 (Layout::add_output_section_data): Return the output section.
12722 (Layout::make_output_section): Rcognize relro sections and mark
12723 them appropriately.
12724 (Layout::attach_allocated_section_to_segment): Put relro sections
12725 in a PT_GNU_RELRO segment.
12726 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12727 section as relro.
12728 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12729 PT_TLS segments.
12730 (Layout::linkonce_mapping): Map d.rel.ro.local to
12731 .data.rel.ro.local.
12732 (Layout::output_section_name): Us .data.rel.ro.local for any
12733 section which begins with that.
12734 * layout.h (class Layout): Update add_output_section_data
12735 declaration. Add relro_segment_ field.
12736 * output.cc (Output_section::Output_section): Initialize is_relro_
12737 and is_relro_local_ fields.
12738 (Output_segment::add_output_section): Group relro sections.
12739 (Output_segment::is_first_section_relro): New function.
12740 (Output_segment::maximum_alignment): If there is a relro section,
12741 align the segment to the common page size.
12742 (Output_segment::set_section_addresses): Track whether we are
12743 looking at relro sections. If the last section is a relro
12744 section, align to the common page size.
12745 (Output_segment::set_section_list_addresses): Add in_relro
12746 parameter. Change all callers. Align to the page size when
12747 moving from relro to non-relro section.
12748 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12749 segment.
12750 * output.h (class Output_section): Add is_relro_ and
12751 is_relro_local_ fields.
12752 (Output_section::is_relro): New function.
12753 (Output_section::set_is_relro): New function.
12754 (Output_section::is_relro_local): New function.
12755 (Output_section::set_is_relro_local): New function.
12756 (class Output_segment): Update declarations.
12757 * i386.cc (Target_i386::got_section): Mark .got section as relro.
12758 * sparc.cc (Target_sparc::got_section): Likewise.
12759 * x86_64.cc (Target_x86_64::got_section): Likewise.
12760 * testsuite/relro_test_main.cc: New file.
12761 * testsuite/relro_test.cc: New file.
12762 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12763 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12764 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12765 (relro_test.so, relro_test_pic.o): New targets.
12766 * testsuite/Makefile.in: Rebuild.
12767
12768 2008-05-16 Ian Lance Taylor <iant@google.com>
12769
12770 * output.cc (Output_segment::add_output_section): Remove front
12771 parameter.
12772 * output.h (class Output_segment): Remove
12773 add_initial_output_section and overloaded add_output_section.
12774 Update declaration of remaining add_output_section.
12775 * layout.cc (Layout::create_interp): Call add_output_section
12776 rather than add_initial_output_section.
12777 (Layout::finish_dynamic_section): Likewise.
12778
12779 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12780 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
12781 know the dynamic type.
12782 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12783 field. Initialize it in constructor.
12784 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12785 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12786 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12787 reloc.
12788
12789 * output.cc (Output_reloc::get_address): Change return type to
12790 Elf_Addr.
12791 * output.h (class Output_reloc): Update get_address declaration.
12792 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12793 for section addresses.
12794
12795 2008-05-09 Ian Lance Taylor <iant@google.com>
12796
12797 PR 6493
12798 * gold.cc (gold_nomem): Use return value of write.
12799
12800 2008-05-08 Ian Lance Taylor <iant@google.com>
12801
12802 * symtab.c (Symbol::init_base_output_data): Add version
12803 parameter. Change all callers.
12804 (Symbol::init_base_output_segment): Likewise.
12805 (Symbol::init_base_constant): Likewise.
12806 (Symbol::init_base_undefined): Likewise.
12807 (Sized_symbol::init_output_data): Likewise.
12808 (Sized_symbol::init_output_segment): Likewise.
12809 (Sized_symbol::init_constant): Likewise.
12810 (Sized_symbol::init_undefined): Likewise.
12811 (Symbol_table::do_define_in_output_data): If the new symbol has a
12812 version, mark it as the default.
12813 (Symbol_table::do_define_in_output_segment): Likewise.
12814 (Symbol_table::do_define_as_constant): Likewise.
12815 * symtab.h (class Symbol): Update declarations.
12816 (class Sized_symbol): Likewise.
12817 * resolve.cc (Symbol::override_version): New function.
12818 (Symbol::override_base): Call override_version.
12819 (Symbol::override_base_with_special): Likewise.
12820 * testsuite/ver_script_8.script: New file.
12821 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12822 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12823 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12824 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12825
12826 2008-05-06 Ian Lance Taylor <iant@google.com>
12827
12828 PR 6049
12829 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12830 functions.
12831 (class General_options): Remove existing --undefined, and add
12832 --no-undefined instead. Add new --undefined as synonym for -u.
12833 * archive.cc (Archive::add_symbols): Check whether symbol was
12834 named with -u.
12835 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12836 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12837 all uses. Add IS_UNDEFINED. Update declarations to split
12838 different versions of init_base. Declare init_base_undefined.
12839 (Symbol::is_defined): Handle IS_UNDEFINED.
12840 (Symbol::is_undefined): Likewise.
12841 (Symbol::is_weak_undefined): Call is_undefined.
12842 (Symbol::is_absolute): Handle IS_CONSTANT.
12843 (class Sized_symbol): Update declarations to split different
12844 versions of init. Declare init_undefined.
12845 (class Symbol_table): Declare new functions.
12846 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12847 Change all callers.
12848 (Symbol::init_base_output_data): Likewise.
12849 (Symbol::init_base_output_segment): Likewise.
12850 (Symbol::init_base_constant): Likewise.
12851 (Symbol::init_base_undefined): New function.
12852 (Sized_symbol::init_object): Rename from init. Change all
12853 callers.
12854 (Sized_symbol::init_output_data): Likewise.
12855 (Sized_symbol::init_output_segment): Likewise.
12856 (Sized_symbol::init_constant): Likewise.
12857 (Sized_symbol::init_undefined): New function.
12858 (Symbol_table::add_undefined_symbols_from_command_line): New
12859 function.
12860 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12861 function.
12862 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12863 (Symbol::output_section): Likewise.
12864 (Symbol::set_output_section): Likewise.
12865 (Symbol_table::sized_finalize_symbol): Likewise.
12866 (Symbol_table::sized_write_globals): Likewise.
12867 * resolve.cc (Symbol_table::should_override): Likewise.
12868 (Symbol::override_base_with_special): Likewise.
12869
12870 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12871 symbol, change it to have default visibility.
12872 * testsuite/protected_1.cc: New file.
12873 * testsuite/protected_2.cc: New file.
12874 * testsuite/protected_3.cc: New file.
12875 * testsuite/protected_main_1.cc: New file.
12876 * testsuite/protected_main_2.cc: New file.
12877 * testsuite/protected_main_3.cc: New file.
12878 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12879 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12880 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12881 (protected_1.so): New target.
12882 (protected_1_pic.o, protected_2_pic.o): New targets.
12883 (protected_3_pic.o): New target.
12884 (check_PROGRAMS): Add protected_2.
12885 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12886 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12887 * testsuite/Makefile.in: Rebuild.
12888
12889 * options.h (DEFINE_var): Add set_user_set_##varname__.
12890 (DEFINE_bool_alias): New macro.
12891 (class General_options): Define -Bstatic using DEFINE_bool_alias
12892 rather than DEFINE_special. Add --undefined as an alias for -z
12893 defs.
12894 * options.cc (General_options::parse_Bstatic): Remove.
12895
12896 * options.h (class General_options): Add --fatal-warnings.
12897 * main.cc (main): Implement --fatal-warnings.
12898 * errors.h (Errors::warning_count): New function.
12899
12900 * options.h (class General_options): Add -Bsymbolic-functions.
12901 * symtab.h (Symbol::is_preemptible): Check for
12902 -Bsymbolic-functions.
12903
12904 2008-05-05 Ian Lance Taylor <iant@google.com>
12905
12906 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12907 as noVARNAME rather than no-VARNAME.
12908 (class General_options): Add option -z combreloc.
12909 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12910 get_address.
12911 (Output_reloc::sort_before) [SHT_REL]: New function.
12912 (Output_reloc::sort_before) [SHT_RELA]: New function.
12913 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12914 Sort_relocs_comparison.
12915 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12916 parameter. Change all callers.
12917 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12918 sort_relocs parameter. Change all callers.
12919 * output.cc (Output_reloc::get_address): New function, broken out
12920 of write_rel.
12921 (Output_reloc::write_rel): Call it.
12922 (Output_reloc::compare): New function.
12923 (Output_data_reloc_base::do_write): Optionally sort relocs.
12924
12925 * configure.ac: If targ_extra_obj is set, link it in.
12926 * configure.tgt: Initialize all variables.
12927 (x86_64*): Set targ_extra_obj and targ_extra_size.
12928 * configure: Rebuild.
12929
12930 * object.cc (Sized_relobj::include_section_group): Adjust section
12931 indexes read from group data. Build vector to pass to
12932 layout_group.
12933 * layout.cc (Layout::layout_group): Add flags and shndxes
12934 parameters. Remove contents parameter. Change caller. Update
12935 explicit instantiations.
12936 * layout.h (class Layout): Update layout_group declaration.
12937 * output.cc (Output_data_group::Output_data_group): Add flags and
12938 input_shndxes parameters. Remove contents parameter. Change
12939 caller.
12940 (Output_data_group::do_write): Change input_sections_ to
12941 input_shndxes_.
12942 * output.h (class Output_data_group): Update constructor
12943 declaration. Rename input_sections_ to input_shndxes_.
12944 * testsuite/many_sections_test.cc: Add template.
12945
12946 2008-04-30 Cary Coutant <ccoutant@google.com>
12947
12948 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12949
12950 * layout.cc (Layout::include_section): Refactored check for debug
12951 info section.
12952 (Layout::add_comdat): Add new parameters. Change type
12953 of signature parameter. Add object and shndx to signatures table.
12954 (Layout::find_kept_object): New function.
12955 * layout.h: Include <cstring>.
12956 (Layout::is_debug_info_section): New function.
12957 (Layout::add_comdat): Add new parameters.
12958 (Layout::find_kept_object): New function.
12959 (Layout::Kept_section): New struct.
12960 (Layout::Signatures): Change type of map range.
12961 * object.cc (Relobj::output_section_address): New function.
12962 (Sized_relobj::include_section_group): Add new parameters. Change
12963 calls to Layout::add_comdat. Change to build table of kept comdat
12964 groups and table mapping discarded sections to kept sections.
12965 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12966 (Sized_relobj::do_layout): Change calls to include_section_group and
12967 include_linkonce_section.
12968 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12969 value to zero when section is discarded.
12970 (Sized_relobj::map_to_kept_section): New function.
12971 * object.h (Relobj::output_section_address): New function.
12972 (Relobj::Comdat_group): New type.
12973 (Relobj::find_comdat_group): New function.
12974 (Relobj::Comdat_group_table): New type.
12975 (Relobj::Kept_comdat_section): New type.
12976 (Relobj::Kept_comdat_section_table): New type.
12977 (Relobj::add_comdat_group): New function.
12978 (Relobj::set_kept_comdat_section): New function.
12979 (Relobj::get_kept_comdat_section): New function.
12980 (Relobj::comdat_groups_): New field.
12981 (Relobj::kept_comdat_sections_): New field.
12982 (Symbol_value::input_value): Update comment.
12983 (Sized_relobj::map_to_kept_section) New function.
12984 (Sized_relobj::include_linkonce_section): Add new parameter.
12985 * target-reloc.h (Comdat_behavior): New type.
12986 (get_comdat_behavior): New function.
12987 (relocate_section): Add code to map a discarded section to the
12988 corresponding kept section when applying a relocation.
12989
12990 2008-04-30 Craig Silverstein <csilvers@google.com>
12991
12992 * dwarf_reader.cc (next_generation_count): New static var.
12993 (Addr2line_cache_entry): New struct.
12994 (addr2line_cache): New static var.
12995 (Dwarf_line_info::one_addr2line): Added caching.
12996 (Dwarf_line_info::clear_addr2line_cache): New function.
12997 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12998 cache-size parameter.
12999 (Dwarf_line_info::one_addr2line_cache): New function.
13000 * symtab.cc (Symbol_table::detect_odr_violations): Pass
13001 new cache-size argument to one_addr2line(), and clear cache.
13002
13003 2008-04-28 Cary Coutant <ccoutant@google.com>
13004
13005 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13006 R_386_PC8 relocations.
13007
13008 2008-04-23 Ian Lance Taylor <iant@google.com>
13009
13010 * object.cc (Sized_relobj::include_section_group): Check for
13011 invalid section group.
13012
13013 * object.cc (make_elf_object): Correct test for 64-bit ELF file
13014 header size.
13015
13016 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13017 than read for file header.
13018 * archive.cc (Archive::include_member): Likewise.
13019
13020 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
13021
13022 * aclocal.m4: Regenerate.
13023 * configure: Regenerate.
13024
13025 2008-04-19 Ian Lance Taylor <iant@google.com>
13026
13027 * version.cc (version_string): Bump to 1.6.
13028
13029 * testsuite/Makefile.am (many_sections_r_test): New target.
13030 (many_sections_r_test_SOURCES): Remove.
13031 (many_sections_r_test_DEPENDENCIES): Remove.
13032 (many_sections_r_test_LDFLAGS): Remove.
13033 (many_sections_r_test_LDADD): Remove.
13034
13035 * object.cc (Sized_relobj::do_add_symbols): Always pass
13036 local_symbol_count_ to add_from_relobj.
13037
13038 * testsuite/Makefile.am (many_sections_check.h): Only check one in
13039 every thousand variables.
13040 * testsuite/Makefile.in: Rebuild.
13041
13042 * object.cc (Xindex::initialize_symtab_xindex): New function.
13043 (Xindex::read_symtab_xindex): New function.
13044 (Xindex::sym_xindex_to_shndx): New function.
13045 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13046 available.
13047 (Sized_relobj::do_initialize_xindex): New function.
13048 (Sized_relobj::do_read_symbols): Adjust section links.
13049 (Sized_relobj::symbol_section_and_value): Add is_ordinary
13050 parameter. Change all callers.
13051 (Sized_relobj::include_section_group): Adjust section links and
13052 symbol section indexes.
13053 (Sized_relobj::do_layout): Adjust section links.
13054 (Sized_relobj::do_count_local_symbols): Adjust section links and
13055 symbol section indexes.
13056 (Sized_relobj::do_finalize_local_symbols): Distinguish between
13057 ordinary and special symbols.
13058 (Sized_relobj::write_local_symbols): Add symtab_xindex and
13059 dynsym_xindex parameters. Change all callers. Adjust section
13060 links. Use SHN_XINDEX when needed.
13061 (Sized_relobj::get_symbol_location_info): Adjust section links.
13062 Don't get fooled by special symbols.
13063 * object.h (class Xindex): Define.
13064 (class Object): Add xindex_ parameter. Declare virtual functoin
13065 do_initialize_xindex.
13066 (Object::adjust_sym_shndx): New function.
13067 (Object::set_xindex): New protected function.
13068 (class Symbol_value): Add is_ordinary_shndx_ field.
13069 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13070 (Symbol_value::value): Assert ordinary section.
13071 (Symbol_value::initialize_input_to_output_map): Likewise.
13072 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13073 Change all callers.
13074 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
13075 all callers.
13076 (class Sized_relobj): Update declarations.
13077 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13078 parameter. Change all callers.
13079 (Sized_relobj::adjust_shndx): New function.
13080 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13081 field.
13082 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13083 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
13084 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
13085 (Sized_dynobj::read_dynsym_section): Adjust section links.
13086 (Sized_dynobj::read_dynamic): Likewise.
13087 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
13088 section links.
13089 (Sized_dynobj::do_initialize_xindex): New function.
13090 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
13091 do_initialize_xindex.
13092 (Sized_dynobj::adjust_shndx): New function.
13093 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13094 dynsym_xindex_ fields.
13095 (Layout::finalize): Add a call to set_section_indexes before
13096 creating the symtab sections.
13097 (Layout::set_section_indexes): Don't do anything if the section
13098 already has a section index.
13099 (Layout::create_symtab_sections): Add shnum parameter. Change
13100 caller. Create .symtab_shndx section if needed.
13101 (Layout::create_shdrs): Add shstrtab_section parameter. Change
13102 caller.
13103 (Layout::allocated_output_section_count): New function.
13104 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13105 needed.
13106 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13107 fields. Update declarations.
13108 (Layout::symtab_xindex): New function.
13109 (Layout::dynsym_xindex): New function.
13110 (class Write_symbols_task): Add layout_ field.
13111 (Write_symbols_task::Write_symbols_task): Add layout parameter.
13112 Change caller.
13113 * output.cc (Output_section_headers::Output_section_headers): Add
13114 shstrtab_section parameter. Change all callers.
13115 (Output_section_headers::do_sized_write): Store overflow values
13116 for section count and section string table section index in
13117 section header zero.
13118 (Output_file_header::do_sized_write): Check for overflow of
13119 section count and section string table section index.
13120 (Output_symtab_xindex::do_write): New function.
13121 (Output_symtab_xindex::endian_do_write): New function.
13122 * output.h (class Output_section_headers): Add shstrtab_section_.
13123 Update declarations.
13124 (class Output_symtab_xindex): Define.
13125 (Output_section::has_out_shndx): New function.
13126 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13127 field.
13128 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13129 Change all callers.
13130 (Sized_symbol::init): Likewise.
13131 (Symbol::output_section): Check for ordinary symbol.
13132 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
13133 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
13134 callers.
13135 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13136 Change all callers. Simplify handling of symbols from sections
13137 not included in the link.
13138 (Symbol_table::add_from_dynobj): Handle ordinary symbol
13139 distinction.
13140 (Weak_alias_sorter::operator()): Assert that symbols are
13141 ordinary.
13142 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13143 distinction.
13144 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13145 parameters. Change all callers.
13146 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
13147 symbol distinction. Use SHN_XINDEX when needed.
13148 (Symbol_table::write_section_symbol): Add symtab_xindex
13149 parameter. Change all callers.
13150 (Symbol_table::sized_write_section_symbol): Likewise. Use
13151 SHN_XINDEX when needed.
13152 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
13153 declarations.
13154 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
13155 (Symbol::is_defined): Check is_ordinary.
13156 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13157 (Symbol::is_absolute, Symbol::is_common): Likewise.
13158 (class Sized_symbol): Update declarations.
13159 (class Symbol_table): Update declarations.
13160 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13161 parameters. Change all callers.
13162 (Sized_symbol::override): Likewise.
13163 (Symbol_table::override): Likewise.
13164 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
13165 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
13166 is_ordinary, and orig_st_shndx parameters. Change all callers.
13167 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13168 to be in an ordinary section.
13169 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13170 object and is_ordinary parameters. Change all callers.
13171 (Sized_dwarf_line_info::read_relocs): Add object parameter.
13172 Change all callers. Don't add undefined or non-ordinary symbols
13173 to reloc_map_.
13174 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13175 Change all callers.
13176 * dwarf_reader.h (class Sized_dwarf_line_info): Update
13177 declarations.
13178 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13179 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13180 (Sized_relobj::relocate_sections): Likewise.
13181 * target-reloc.h (scan_relocs): Adjust section symbol index.
13182 (scan_relocatable_relocs): Likewise.
13183 * i386.cc (Scan::local): Check for ordinary symbols.
13184 * sparc.cc (Scan::local): Likewise.
13185 * x86_64.cc (Scan::local): Likewise.
13186 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13187 to symbol_section_and_value.
13188 * testsuite/many_sections_test.cc: New file.
13189 * testsuite/Makefile.am (BUILT_SOURCES): Define.
13190 (check_PROGRAMS): Add many_sections_test.
13191 (many_sections_test_SOURCES): Define.
13192 (many_sections_test_DEPENDENCIES): Define.
13193 (many_sections_test_LDFLAGS): Define.
13194 (BUILT_SOURCES): Add many_sections_define.h.
13195 (many_sections_define.h): New target.
13196 (BUILT_SOURCES): Add many_sections_check.h.
13197 (many_sections_check.h): New target.
13198 (check_PROGRAMS): Add many_sections_r_test.
13199 (many_sections_r_test_SOURCES): Define.
13200 (many_sections_r_test_DEPENDENCIES): Define.
13201 (many_sections_r_test_LDFLAGS): Define.
13202 (many_sections_r_test_LDADD): Define.
13203 (many_sections_r_test.o): New target.
13204 * testsuite/Makefile.in: Rebuild.
13205
13206 2008-04-17 Cary Coutant <ccoutant@google.com>
13207
13208 * errors.cc (Errors::info): New function.
13209 (gold_info): New function.
13210 * errors.h (Errors::info): New function.
13211 * gold.h (gold_info): New function.
13212 * object.cc (Input_objects::add_object): Print trace output.
13213 * options.cc (options::parse_set): New function.
13214 (General_options::parse_wrap): Deleted.
13215 (General_options::General_options): Deleted initializer.
13216 * options.h (options::String_set): New typedef.
13217 (options::parse_set): New function.
13218 (DEFINE_set): New macro.
13219 (General_options::wrap): Changed to use DEFINE_set. Changed
13220 callers of any_wrap_symbols and is_wrap_symbol.
13221 (General_options::trace, General_options::trace_symbol):
13222 New options.
13223 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13224 (General_options::wrap_symbols_): Deleted.
13225 * symtab.cc (Symbol_table::add_from_object): Print trace output.
13226
13227 2008-04-17 David S. Miller <davem@davemloft.net>
13228
13229 * options.cc (General_options::parse_V): New function.
13230 * options.h: Add entries for -V and -Qy.
13231
13232 2008-04-17 Ian Lance Taylor <iant@google.com>
13233
13234 * common.cc (Symbol_table::allocate_commons): Remove options
13235 parameter. Change caller.
13236 (Symbol_table::do_allocate_commons): Remove options parameter.
13237 Change caller. Just call do_allocate_commons_list twice.
13238 (Symbol_table::do_allocate_commons_list): New function, broken out
13239 of do_allocate_commons.
13240 * common.h (class Allocate_commons_task): Remove options_ field.
13241 Update constructor.
13242 * symtab.cc (Symbol_table::Symbol_table): Initialize
13243 tls_commons_.
13244 (Symbol_table::add_from_object): Put TLS common symbols on
13245 tls_commons_ list.
13246 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13247 which are IN_OUTPUT_DATA.
13248 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
13249 allocate_commons and do_allocate_commons declarations. Declare
13250 do_allocate_commons_list.
13251 * gold.cc (queue_middle_tasks): Update creation of
13252 Allocate_commons_task to not pass options.
13253 * testsuite/Makefile.am (INCLUDES): Add -I.. .
13254 (TLS_TEST_C_FLAGS): New variable.
13255 (tls_test_c_pic.o): New target.
13256 (tls_test_shared.so): Link in tls_test_c_pic.o.
13257 (tls_test_c_pic_ie.o): New target.
13258 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13259 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13260 (tls_test_c.o): New target.
13261 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13262 (tls_pic_test_LDADD): Likewise.
13263 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13264 (tls_shared_gd_to_ie_test_LDADD): Likewise.
13265 (tls_test_c_gnu2.o): New target.
13266 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13267 tls_test_c_gnu2.o.
13268 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13269 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13270 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13271 * testsuite/tls_test.cc: Include "config.h".
13272 (t_last): Call t11_last.
13273 * testsuite/tls_test.h (t11, t11_last): Declare.
13274 * testsuite/tls_test_c.c: New file.
13275 * testsuite/tls_test_main.cc (thread_routine): Call t11.
13276 * configure.ac: Check for OpenMP support.
13277 * configure, config.in, Makefile.in: Rebuild.
13278 * testsuite/Makefile.in: Rebuild.
13279
13280 2008-04-16 Cary Coutant <ccoutant@google.com>
13281
13282 * i386.cc (Target_i386::define_tls_base_symbol): New function.
13283 (Target_i386::tls_base_symbol_defined_): New field.
13284 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13285 (Target_i386::Scan::global): Likewise.
13286 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13287 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13288 (Target_x86_64::tls_base_symbol_defined_): New field.
13289 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13290 (Target_x86_64::Scan::global): Likewise.
13291
13292 2008-04-16 Cary Coutant <ccoutant@google.com>
13293
13294 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13295 (Symbol::needs_plt_entry): Allow weak undefined symbols.
13296 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13297 building shared libraries.
13298 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13299 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13300 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13301 * testsuite/Makefile.in: Rebuild.
13302 * testsuite/weak_undef.h: New file.
13303 * testsuite/weak_undef_file1.cc: Add extra test cases.
13304 * testsuite/weak_undef_file2.cc: Likewise.
13305 * testsuite/weak_undef_test.cc: Likewise.
13306
13307 2008-04-16 David S. Miller <davem@davemloft.net>
13308
13309 * sparc.cc (Target_sparc::Scan): Change from struct to class.
13310 Add issued_non_pic_error_ field. Declare check_non_pic.
13311 (Target_sparc::Scan::check_non_pic): New function.
13312 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13313 (Target_sparc::Scan::global): Likewise.
13314
13315 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13316 * configure: Rebuild.
13317
13318 * options.h (DEFINE_enable): New macro.
13319 (new_dtags): New enable option.
13320 (initfirst, interpose, loadfltr, nodefaultlib,
13321 nodelete, nodlopen, nodump): New -z options.
13322 * layout.cc (Layout:finish_dynamic_section): If new
13323 dtags enabled, emit DT_RUNPATH. Also, emit a
13324 DT_FLAGS_1 containing any specified -z flags.
13325
13326 2008-04-16 Ian Lance Taylor <iant@google.com>
13327
13328 * copy-relocs.cc: New file.
13329 * copy-relocs.h: New file.
13330 * reloc.cc: Remove Copy_relocs code.
13331 * reloc.h: Likewise.
13332 * reloc-types.h (struct Reloc_types) [both versions]: Add
13333 get_reloc_addend_noerror.
13334 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13335 variants of add_global which take an addend which must be zero.
13336 * i386.cc: Include "copy-relocs.h".
13337 (class Target_i386): Change type of copy_relocs_ to variable,
13338 update initializer.
13339 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13340 Change all callers.
13341 (Target_i386::do_finalize_sections): Change handling of
13342 copy_relocs_.
13343 * sparc.cc: Include "copy-relocs.h".
13344 (class Target_sparc): Change type of copy_relocs_ to variable,
13345 update initializer.
13346 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13347 Change all callers.
13348 (Target_sparc::do_finalize_sections): Change handling of
13349 copy_relocs_.
13350 * x86_64.cc: Include "copy-relocs.h".
13351 (class Target_x86_64): Change type of copy_relocs_ to variable,
13352 update initializer.
13353 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13354 class. Change all callers.
13355 (Target_x86_64::do_finalize_sections): Change handling of
13356 copy_relocs_.
13357 * Makefile.am (CCFILES): Add copy-relocs.cc.
13358 (HFILES): Add copy-relocs.h.
13359
13360 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13361
13362 * testsuite/script_test_4.sh: Permit leading zeroes.
13363
13364 2008-04-15 Ian Lance Taylor <iant@google.com>
13365
13366 * script-sections.cc (Script_sections::create_segments): Use
13367 header_size_adjustment even when there is enough room for the
13368 headers.
13369 * testsuite/script_test_4.sh: New file.
13370 * testsuite/script_test_4.t: New file.
13371 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13372 (check_DATA): Add script_test_4.stdout.
13373 (MOSTLYCLEANFILES): Likewise.
13374 (script_test_4): New target.
13375 (script_test_4.stdout): New target.
13376 * testsuite/Makefile.in: Rebuild.
13377
13378 * sparc.cc: Add definitions for Output_data_plt_sparc class
13379 constants.
13380
13381 2008-04-14 David S. Miller <davem@davemloft.net>
13382
13383 * sparc.cc: New file.
13384 * Makefile.am (TARGETSOURCES): Add sparc.cc
13385 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13386 * configure.tgt: Document targ_extra_size and
13387 targ_extra_big_endian. Add entries for sparc-* and
13388 sparc64-*.
13389 * configure.ac: Handle targ_extra_size and
13390 targ_extra_big_endian.
13391 * Makefile.in: Rebuild.
13392 * configure: Likewise.
13393 * po/POTFILES.in: Likewise.
13394 * po/gold.pot: Likewise.
13395
13396 2008-04-14 Ian Lance Taylor <iant@google.com>
13397
13398 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13399 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13400 in the name/type/flags to section mapping. Don't call
13401 allocate_output_section.
13402 (Layout::choose_output_section): Change parameter from adjust_name
13403 to is_input_section. Don't permit input sections after sections
13404 are attached to segments. Don't call allocate_output_section.
13405 (Layout::layout_eh_frame): Call update_flags_for_input_section,
13406 not write_enable_output_section.
13407 (Layout::make_output_section): Don't push to
13408 unattached_section_list_ nor call attach_to_segment. Call
13409 attach_section_to_segment if sections are attached.
13410 (Layout::attach_sections_to_segments): New function.
13411 (Layout::attach_section_to_segment): New function.
13412 (Layout::attach_allocated_section_to_segment): Rename from
13413 attach_to_segment. Remove flags parameter.
13414 (Layout::allocate_output_section): Remove function.
13415 (Layout::write_enable_output_section): Remove function.
13416 * layout.h (class Layout): Update for above changes. Add new
13417 field sections_are_attached_.
13418 * output.h (Output_section::update_flags_for_input_section): New
13419 function.
13420 * output.cc (Output_section::add_input_section): Call
13421 update_flags_for_input_section.
13422 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13423
13424 2008-04-11 Cary Coutant <ccoutant@google.com>
13425
13426 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13427 thought unnecessary.
13428 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13429
13430 2008-04-11 Ian Lance Taylor <iant@google.com>
13431
13432 * output.h (class Output_section_data): Remove inline definition
13433 of set_addralign.
13434 * output.cc (Output_section_data::set_addralign): New function.
13435
13436 2008-04-11 Cary Coutant <ccoutant@google.com>
13437
13438 Add support for TLS descriptors for i386 and x86_64.
13439 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13440 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13441 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13442 GOT_TYPE_TLS_DESC.
13443 (Target_i386::got_mod_index_entry): Remove unnecessary code.
13444 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13445 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
13446 relocations.
13447 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13448 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13449 Fix problem with initial-exec relocations.
13450 (Target_i386::Relocate::relocate_tls): Likewise.
13451 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13452 relaxation.
13453 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13454 support for section-plus-offset dynamic table entries.
13455 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13456 (Output_data_dynamic::Dynamic_entry): Add support for
13457 section-plus-offset dynamic table entries.
13458 (Output_data_dynamic::Classification): Likewise.
13459 (Output_data_dynamic::classification_): Renamed offset_.
13460 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13461 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13462 (Target_x86_64::make_plt_section): New function.
13463 (Target_x86_64::reserve_tlsdesc_entries): New function.
13464 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13465 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13466 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13467 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13468 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13469 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13470 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13471 add extra PLT entry for TLS descriptors.
13472 (Output_data_plt_x86_64::got_): New field.
13473 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13474 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13475 fields.
13476 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13477 descriptors.
13478 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13479 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13480 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13481 R_386_TLS_DESC_CALL relocations.
13482 (Target_x86_64::Scan::global): Likewise.
13483 (Target_x86_64::do_finalize_sections): Add dynamic table entries
13484 for TLS descriptors.
13485 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13486 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13487 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13488 GD-to-IE relaxation.
13489 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13490 and TLS_DESCRIPTORS.
13491 * Makefile.in: Rebuild.
13492 * configure: Rebuild.
13493 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13494 (tls_test_shared2.so): New target.
13495 (tls_shared_gd_to_ie_test_SOURCES): New variable.
13496 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13497 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13498 (tls_shared_gd_to_ie_test_LDADD): New variable.
13499 (tls_shared_gnu2_gd_to_ie_test): New target.
13500 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13501 New targets.
13502 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13503 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13504 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13505 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13506 (tls_shared_gnu2_test): New target.
13507 (tls_test_gnu2_shared.so): New target.
13508 (tls_shared_gnu2_test_SOURCES): New variable.
13509 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13510 (tls_shared_gnu2_test_LDFLAGS): New variable.
13511 (tls_shared_gnu2_test_LDADD): New variable.
13512 * testsuite/Makefile.in: Rebuild.
13513 * testsuite/Makefile.
13514
13515 2008-04-11 Ian Lance Taylor <iant@google.com>
13516
13517 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13518 justsyms.t.
13519 * testsuite/Makefile.in: Rebuild.
13520
13521 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13522 long.
13523 * testsuite/script_test_2.cc (main): Adjust test.
13524
13525 2008-04-11 David S. Miller <davem@davemloft.net>
13526 Ian Lance Taylor <iant@google.com>
13527
13528 * options.h (General_options): Add entries for '-Y' and
13529 '-relax'.
13530 * options.cc (General_options:finalize): If -Y was used, add those
13531 entries to the library path instead of the default "/lib" and
13532 "/usr/lib".
13533
13534 2008-04-11 David S. Miller <davem@davemloft.net>
13535
13536 * testsuite/justsyms.t: Start at 0x100.
13537 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13538 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13539 long.
13540 * testsuite/script_test_2.cc: Adjust string and section length
13541 checks.
13542
13543 2008-04-09 Ian Lance Taylor <iant@google.com>
13544
13545 PR gold/5996
13546 * script-sections.cc (Sections_element::allocate_to_segment): Add
13547 orphan parameter.
13548 (Output_section_definition::allocate_to_segment): Likewise.
13549 (Orphan_output_section::allocate_to_segment): Likewise.
13550 (Script_sections::attach_sections_using_phdrs_clause): Don't
13551 propagate non-PT_LOAD segments to orphan sections.
13552 * testsuite/Makefile.am (script_test_3.stdout): Generate using
13553 readelf rather than objdump.
13554 * testsuite/script_test_3.sh: Adjust accordingly. Test that
13555 .interp section and PT_INTERP segment are the same size.
13556 * testsuite/Makefile.in: Rebuild.
13557
13558 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13559 aliases for symbols defined in the same object.
13560 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13561 (weak_alias_test_SOURCES): New variable.
13562 (weak_alias_test_DEPENDENCIES): New variable.
13563 (weak_alias_test_LDFLAGS): New variable.
13564 (weak_alias_test_LDADD): New variable.
13565 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13566 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13567 (weak_alias_test_3.o): New target.
13568 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13569 * testsuite/weak_alias_test_main.cc: New file.
13570 * testsuite/weak_alias_test_1.cc: New file.
13571 * testsuite/weak_alias_test_2.cc: New file.
13572 * testsuite/weak_alias_test_3.cc: New file.
13573
13574 2008-04-08 Ian Lance Taylor <iant@google.com>
13575
13576 * options.h (class General_options): Add --noinhibit-exec option.
13577 * main.cc (main): Check --noinhibit-exec.
13578
13579 * options.h (class General_options): Define --wrap as a special
13580 option. Add wrap_symbols_ field.
13581 (General_options::any_wrap_symbols): New function.
13582 (General_options::is_wrap_symbol): New function.
13583 * options.cc (General_options::parse_wrap): New function.
13584 (General_options::General_options): Initialize wrap_symbols_.
13585 * symtab.cc (Symbol_table::wrap_symbol): New function.
13586 (Symbol_table::add_from_object): Handle --wrap.
13587 * symtab.h (class Symbol_table): Declare wrap_symbol.
13588 * target.h (Target::wrap_char): New function.
13589 (Target::Target_info): Add wrap_char field.
13590 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13591 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13592 * testsuite/testfile.cc (Target_test::test_target_info):
13593 Likewise.
13594
13595 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13596 there is one.
13597
13598 * layout.h (class Layout): Add added_eh_frame_data_ field.
13599 * layout.cc (Layout::Layout): Initialize new field.
13600 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13601 output section until we find a section we merged successfully.
13602 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13603 that the size be non-zero.
13604
13605 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13606 qualifier.
13607
13608 2008-04-08 Craig Silverstein <csilvers@google.com>
13609
13610 * configure.ac: Export new conditional variable HAVE_ZLIB.
13611 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13612 on HAVE_ZLIB.
13613 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13614 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13615
13616 2008-04-07 Ian Lance Taylor <iant@google.com>
13617
13618 * version.cc (version_string): Set to "1.5".
13619
13620 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13621 Add issued_non_pic_error_ field. Declare check_non_pic.
13622 (Target_x86_64::Scan::check_non_pic): New function.
13623 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13624 (Target_x86_64::Scan::global): Likewise.
13625
13626 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13627 addend parameter. Change caller. Handle merge sections.
13628 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13629 Address to Addend. Don't add in the result of
13630 local_section_offset, pass down the addend and use the returned
13631 value.
13632 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13633 Update declarations of local_section_offset and symbol_value.
13634 * testsuite/two_file_test_1.cc (t18): New function.
13635 * testsuite/two_file_test_2.cc (f18): New function.
13636 * testsuite/two_file_test_main.cc (main): Call t18.
13637 * testsuite/two_file_test.h (t18, f18): Declare.
13638
13639 * configure.ac: Don't test for objdump, c++filt, or readelf.
13640 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13641 conditionals.
13642 (TEST_READELF): New variable.
13643 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13644 (check_PROGRAMS): Add two_file_strip_test.
13645 (two_file_strip_test): New target.
13646 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13647 (two_file_same_shared_strip_test_SOURCES): New variable.
13648 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13649 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13650 (two_file_same_shared_strip_test_LDADD): New variable.
13651 (two_file_shared_strip.so): New target.
13652 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13653 (ver_test_5.syms, ver_test_7.syms): Likewise.
13654 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13655 (strip_test_3.stdout): Use TEST_OBJDUMP.
13656 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13657
13658 2008-04-04 Cary Coutant <ccoutant@google.com>
13659
13660 * symtab.h (Symbol::is_weak_undefined): New function.
13661 (Symbol::is_strong_undefined): New function.
13662 (Symbol::is_absolute): New function.
13663 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13664 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13665 absolute symbols.
13666 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13667 (weak_undef_test): New target.
13668 * testsuite/Makefile.in: Rebuild.
13669 * testsuite/weak_undef_file1.cc: New file.
13670 * testsuite/weak_undef_file2.cc: New file.
13671 * testsuite/weak_undef_test.cc: New file.
13672
13673 2008-04-03 Craig Silverstein <csilvers@google.com>
13674
13675 * compressed_output.h (class Output_compressed_section): Use
13676 unsigned buffer.
13677 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13678 add zlib header.
13679 (zlib_compressed_suffix): Removed.
13680 (Output_compressed_section::set_final_data_size): Use unsigned
13681 buffers.
13682 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13683 Fix linker invocation.
13684 (flagstest_o_specialfile_and_compress_debug_sections):
13685 Likewise.
13686 * testsuite/Makefile.in: Regenerated.
13687
13688 2008-04-02 David S. Miller <davem@davemloft.net>
13689
13690 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13691 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13692
13693 2008-04-02 Craig Silverstein <csilvers@google.com>
13694
13695 * TODO: New file.
13696
13697 2008-04-02 Ian Lance Taylor <iant@google.com>
13698
13699 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13700 parameters. Update for new key type to views_. Change all
13701 callers.
13702 (File_read::read): Adjust for byteshift in returned view.
13703 (File_read::add_view): New function, broken out of
13704 find_and_make_view.
13705 (File_read::make_view): New function, broken out of
13706 find_and_make_view.
13707 (File_read::find_or_make_view): Add offset and aligned
13708 parameters. Rewrite accordingly. Change all callers.
13709 (File_read::get_view): Add offset and aligned parameters. Adjust
13710 for byteshift in return value.
13711 (File_read::get_lasting_view): Likewise.
13712 * fileread.h (class File_read): Update declarations.
13713 (class File_read::View): Add byteshift_ field. Add byteshift to
13714 constructor. Add byteshift method.
13715 * archive.h (Archive::clear_uncached_views): New function.
13716 (Archive::get_view): Add aligned parameter. Change all callers.
13717 * object.h (Object::get_view): Add aligned parameter. Change all
13718 callers.
13719 (Object::get_lasting_view): Likewise.
13720
13721 * fileread.cc (File_read::release): Don't call clear_views if
13722 there are multiple objects.
13723 * fileread.h (File_read::clear_uncached_views): New function.
13724 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13725 on the archive.
13726
13727 2008-03-31 Cary Coutant <ccoutant@google.com>
13728
13729 Add thin archive support.
13730 * archive.cc (Archive::armagt): New const.
13731 (Archive::setup): Remove task parameter and calls to unlock.
13732 (Archive::unlock_nested_archives): New function.
13733 (Archive::read_header): Add nested_off parameter. Change
13734 all callers.
13735 (Archive::interpret_header): Likewise.
13736 (Archive::include_all_members): Change to handle thin
13737 archives.
13738 (Archive::include_member): Likewise.
13739 * archive.h (Archive::Archive): Add new parameters and
13740 initializers.
13741 (Archive::armagt): New const.
13742 (Archive::setup): Remove task parameter.
13743 (Archive::unlock_nested_archives): New function.
13744 (Archive::read_header): Add nested_off parameter.
13745 (Archive::interpret_header): Likewise.
13746 (Archive::Nested_archive_table): New typedef.
13747 (Archive::is_thin_archive_): New field.
13748 (Archive::nested_archives_): New field.
13749 (Archive::options_): New field.
13750 (Archive::dirpath_): New field.
13751 (Archive::task_): New field.
13752 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13753 for thin archives. Pass additional parameters to
13754 Archive::Archive. Unlock the archive file after calling
13755 Archive::setup.
13756
13757 2008-03-29 Ian Lance Taylor <iant@google.com>
13758
13759 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13760 version symbol to be local.
13761 * testsuite/ver_test_4.sh: New file.
13762 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13763 (check_DATA): Add ver_test_4.syms.
13764 (ver_test_4.syms): New target.
13765 * testsuite/Makefile.in: Rebuild.
13766
13767 * output.cc
13768 (Output_section::Input_section_sort_entry::has_priority): New
13769 function.
13770 (Output_section::Input_section_sort_entry::match_file_name): New
13771 function.
13772 (Output_section::Input_section_sort_entry::match_section_name):
13773 Remove.
13774 (Output_section::Input_section_sort_entry::match_section_name_prefix):
13775 Remove.
13776 (Output_section::Input_section_sort_entry::match_section_file):
13777 Remove.
13778 (Output_section::Input_section_sort_compare::operator()): Rewrite
13779 using new Input_section_sort_entry functions. Sort crtbegin and
13780 crtend first. Sort sections with no priority before sections with
13781 a priority.
13782 * testsuite/initpri1.c (d3): Check j != 4.
13783 (cd5): New constructor/destructor function.
13784 (main): Check j != 2.
13785
13786 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13787 new symbol when resolving, don't call set_is_default.
13788 * testsuite/ver_test_7.cc: New file.
13789 * testsuite/ver_test_7.sh: New file.
13790 * testsuite/Makefile.am (ver_test_7.so): New target.
13791 (ver_test_7.o): New target.
13792 (check_SCRIPTS): Add ver_test_7.sh.
13793 (check_DATA): Add ver_test_7.syms.
13794 (ver_test_7.syms): New target.
13795
13796 2008-03-28 Ian Lance Taylor <iant@google.com>
13797
13798 * layout.cc (Layout::layout): If we see an input section with a
13799 name that needs sorting, set the must_sort flag for the output
13800 section.
13801 (Layout::make_output_section): If the name of the output section
13802 indicates that it might require sorting, set the may_sort flag.
13803 * output.h (Output_section::may_sort_attached_input_sections): New
13804 function.
13805 (Output_section::set_may_sort_attached_input_sections): New
13806 function.
13807 (Output_section::must_sort_attached_input_sections): New
13808 function.
13809 (Output_section::set_must_sort_attached_input_sections): New
13810 function.
13811 (class Output_section): Declare Input_section_sort_entry. Define
13812 Input_section_sort_compare. Declare
13813 sort_attached_input_sections. Add new fields:
13814 may_sort_attached_input_sections_,
13815 must_sort_attached_input_sections_,
13816 attached_input_sections_are_sorted_.
13817 * output.cc (Output_section::Output_section): Initialize new
13818 fields.
13819 (Output_section::add_input_section): Add an entry to
13820 input_sections_ if may_sort or must_sort are true.
13821 (Output_section::set_final_data_size): Call
13822 sort_attached_input_sections if necessary.
13823 (Output_section::Input_section_sort_entry): Define new class.
13824 (Output_section::Input_section_sort_compare::operator()): New
13825 function.
13826 (Output_section::sort_attached_input_sections): New function.
13827 * configure.ac: Check whether the compiler supports constructor
13828 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13829 * testsuite/initpri1.c: New file.
13830 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13831 CONSTRUCTOR_PRIORITY.
13832 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13833 (initpri1_LDFLAGS): New variable.
13834 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13835
13836 2008-03-27 Ian Lance Taylor <iant@google.com>
13837
13838 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13839 * testsuite/common_test_1.c: New file.
13840 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13841 (common_test_1_SOURCES): New variable.
13842 (common_test_1_DEPENDENCIES): New variable.
13843 (common_test_1_LDFLAGS): New variable.
13844
13845 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13846 and commons_ correctly when NAME/VERSION does not override
13847 NAME/NULL.
13848 * testsuite/ver_test_6.c: New file.
13849 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13850 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13851 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13852
13853 2008-03-26 Ian Lance Taylor <iant@google.com>
13854
13855 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13856 of an undefined symbol from a version script.
13857 * testsuite/Makefile.am (ver_test_5.so): New target.
13858 (ver_test_5.o): New target.
13859 (check_SCRIPTS): Add ver_test_5.sh.
13860 (check_DATA): Add ver_test_5.syms.
13861 (ver_test_5.syms): New target.
13862 * testsuite/ver_test_5.cc: New file.
13863 * testsuite/ver_test_5.script: New file.
13864 * testsuite/ver_test_5.sh: New file.
13865 * Makefile.in, testsuite/Makefile.in: Rebuild.
13866
13867 PR gold/5986
13868 Fix problems building gold with gcc 4.3.0.
13869 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13870 (gold_error_at_location, gold_warning_at_location): Use it.
13871 * configure.ac: Check whether we can compile and use a template
13872 function with a printf attribute.
13873 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13874 when jumping over bytes.
13875 * object.cc: Instantiate Object::read_section_data.
13876 * debug.h: Include <cstring>
13877 * dwarf_reader.cc: Include <algorithm>
13878 * main.cc: Include <cstring>.
13879 * options.cc: Include <cstring>.
13880 * output.cc: Include <cstring>.
13881 * script.cc: Include <cstring>.
13882 * script.h: Include <string>.
13883 * symtab.cc: Include <cstring> and <algorithm>.
13884 * target-select.cc: Include <cstring>.
13885 * version.cc: Include <string>.
13886 * testsuite/testmain.cc: Include <cstdlib>.
13887 * configure, config.in: Rebuild.
13888
13889 2008-03-25 Ian Lance Taylor <iant@google.com>
13890
13891 * options.cc: Include "../bfd/bfdver.h".
13892 (options::help): Print bug reporting address.
13893
13894 * version.cc (print_version): Adjust output for current value of
13895 BFD_VERSION_STRING.
13896
13897 * NEWS: New file.
13898
13899 * options.cc (options::help): Print list of supported targets.
13900 * target-select.h: Include <vector>.
13901 (class Target_selector): Make machine_, size_, and is_big_endian_
13902 fields const. Add bfd_name_ and instantiated_target_ fields.
13903 (Target_selector::Target_selector): Add bfd_name parameter.
13904 (Target_selector::recognize): Make non-virtual, call
13905 do_recognize.
13906 (Target_selector::recognize_by_name): Make non-virtual, call
13907 do_recognize_by_name.
13908 (Target_selector::supported_names): New function.
13909 (Target_selector::bfd_name): New function.
13910 (Target_selector::do_instantiate_target): New pure virtual
13911 function.
13912 (Target_selector::do_recognize): New virtual function.
13913 (Target_selector::do_recognize_by_name): New virtual function.
13914 (Target_selector::instantiate_target): New private function.
13915 (supported_target_names): Declare.
13916 * target-select.cc (Target_selector::Target_selector): Update for
13917 new parameter and fields.
13918 (select_target_by_name): Check that the name matches before
13919 calling recognize_by_name.
13920 (supported_target_names): New function.
13921 * i386.cc (class Target_selector_i386): Update Target_selector
13922 constructor call. Remove recognize and recognize_by_name. Add
13923 do_instantiate_target.
13924 * x86_64.cc (class Target_selector_x86_64): Likewise.
13925 * testsuite/testfile.cc (class Target_selector_test): Update for
13926 changes to Target_selector.
13927
13928 * README: Rewrite, with some notes on unsupported features.
13929
13930 2008-03-24 Cary Coutant <ccoutant@google.com>
13931
13932 * i386.cc (Target_i386::Got_type): New enum declaration.
13933 (Target_i386::Scan::local): Updated callers of Output_data_got
13934 member functions.
13935 (Target_i386::Scan::global): Likewise.
13936 (Target_i386::Relocate::relocate): Likewise.
13937 (Target_i386::Relocate::relocate_tls): Likewise.
13938 * object.h (Got_offset_list): New class.
13939 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13940 (Sized_relobj::local_got_offset): Likewise.
13941 (Sized_relobj::set_local_got_offset): Likewise.
13942 (Sized_relobj::local_has_tls_got_offset): Removed.
13943 (Sized_relobj::local_tls_got_offset): Removed.
13944 (Sized_relobj::set_local_tls_got_offset): Removed.
13945 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13946 * output.cc (Output_data_got::add_global): Added got_type parameter.
13947 (Output_data_got::add_global_with_rel): Likewise.
13948 (Output_data_got::add_global_with_rela): Likewise.
13949 (Output_data_got::add_global_pair_with_rel): New function.
13950 (Output_data_got::add_global_pair_with_rela): New function.
13951 (Output_data_got::add_local): Added got_type parameter.
13952 (Output_data_got::add_local_with_rel): Likewise.
13953 (Output_data_got::add_local_with_rela): Likewise.
13954 (Output_data_got::add_local_pair_with_rel): New function.
13955 (Output_data_got::add_local_pair_with_rela): New function.
13956 (Output_data_got::add_global_tls): Removed.
13957 (Output_data_got::add_global_tls_with_rel): Removed.
13958 (Output_data_got::add_global_tls_with_rela): Removed.
13959 (Output_data_got::add_local_tls): Removed.
13960 (Output_data_got::add_local_tls_with_rel): Removed.
13961 (Output_data_got::add_local_tls_with_rela): Removed.
13962 * output.h (Output_data_got::add_global): Added got_type parameter.
13963 (Output_data_got::add_global_with_rel): Likewise.
13964 (Output_data_got::add_global_with_rela): Likewise.
13965 (Output_data_got::add_global_pair_with_rel): New function.
13966 (Output_data_got::add_global_pair_with_rela): New function.
13967 (Output_data_got::add_local): Added got_type parameter.
13968 (Output_data_got::add_local_with_rel): Likewise.
13969 (Output_data_got::add_local_with_rela): Likewise.
13970 (Output_data_got::add_local_pair_with_rel): New function.
13971 (Output_data_got::add_local_pair_with_rela): New function.
13972 (Output_data_got::add_global_tls): Removed.
13973 (Output_data_got::add_global_tls_with_rel): Removed.
13974 (Output_data_got::add_global_tls_with_rela): Removed.
13975 (Output_data_got::add_local_tls): Removed.
13976 (Output_data_got::add_local_tls_with_rel): Removed.
13977 (Output_data_got::add_local_tls_with_rela): Removed.
13978 * resolve.cc (Symbol::override_base_with_special): Removed
13979 reference to has_got_offset_ field.
13980 * symtab.cc (Symbol::init_fields): Replaced initialization
13981 of got_offset_ with got_offsets_. Removed initialization
13982 of has_got_offset_
13983 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13984 (Symbol::got_offset): Likewise.
13985 (Symbol::set_got_offset): Likewise.
13986 (Symbol::has_tls_got_offset): Removed.
13987 (Symbol::tls_got_offset): Removed.
13988 (Symbol::set_tls_got_offset): Removed.
13989 (Symbol::got_offset_): Removed.
13990 (Symbol::tls_mod_got_offset_): Removed.
13991 (Symbol::tls_pair_got_offset_): Removed.
13992 (Symbol::got_offsets_): New field.
13993 (Symbol::has_got_offset): Removed.
13994 (Symbol::has_tls_mod_got_offset): Removed.
13995 (Symbol::has_tls_pair_got_offset): Removed.
13996 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13997 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13998 member functions.
13999 (Target_x86_64::Scan::global): Likewise.
14000 (Target_x86_64::Relocate::relocate): Likewise.
14001 (Target_x86_64::Relocate::relocate_tls): Likewise.
14002
14003 2008-03-25 Ben Elliston <bje@au.ibm.com>
14004
14005 * yyscript.y: Fix spelling error in comment.
14006
14007 2008-03-24 Ian Lance Taylor <iant@google.com>
14008
14009 * options.h (class General_options): Define build_id option.
14010 * layout.h (class Layout): Declare write_build_id, create_note,
14011 create_build_id. Add build_id_note_ member.
14012 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14013 "libiberty.h", "md5.h", "sha1.h".
14014 (Layout::Layout): Initialize eh_frame_data_,
14015 eh_frame_hdr_section_, and build_id_note_.
14016 (Layout::finalize): Call create_build_id.
14017 (Layout::create_note): New function, broken out of
14018 Layout::create_gold_note.
14019 (Layout::create_gold_note): Call create_note.
14020 (Layout::create_build_id): New function.
14021 (Layout::write_build_id): New function.
14022 (Close_task_runner::run): Call write_build_id.
14023
14024 * x86_64.cc: Correct license to GPLv3.
14025
14026 2008-03-23 Ian Lance Taylor <iant@google.com>
14027
14028 * options.cc: Include "demangle.h".
14029 (parse_optional_string): New function.
14030 (parse_long_option): Handle takes_optional_argument.
14031 (parse_short_option): Update dash_z initializer. Handle
14032 takes_optional_argument.
14033 (General_options::General_options): Initialize do_demangle_.
14034 (General_options::finalize): Set do_demangle_. Handle demangling
14035 style.
14036 * options.h (parse_optional_string): Declare.
14037 (struct One_option): Add optional_arg field. Update constructor.
14038 Update call constructor calls. Add takes_optional_argument
14039 function.
14040 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
14041 (DEFINE_optional_string): Define.
14042 (General_options::demangle): Change from DEFINE_bool to
14043 DEFINE_optional_string.
14044 (General_options::no_demangle): New function.
14045 (General_options::do_demangle): New function.
14046 (General_options::set_do_demangle): New function.
14047 (General_options::execstack_status_): Move definition to end of
14048 class definition.
14049 (General_options::static_): Likewise.
14050 (General_options::do_demangle_): New field.
14051 * object.cc (big_endian>::get_symbol_location_info): Call
14052 Options::do_demangle, not Options::demangle.
14053 * symtab.cc (demangle): Likewise.
14054
14055 2008-03-22 Ian Lance Taylor <iant@google.com>
14056
14057 * gold.h: Include <cstddef> and <sys/types.h>
14058 * options.h: Include <cstring>.
14059
14060 2008-03-21 Ian Lance Taylor <iant@google.com>
14061
14062 * Added source code to GNU binutils.