Sync libiberty with upstream GCC.
[binutils-gdb.git] / gold / ChangeLog
1 2014-09-30 Cary Coutant <ccoutant@google.com>
2
3 PR gold/17432
4 * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
5
6 2014-09-30 Kito Cheng <kito@0xlab.org>
7
8 PR gold/13597
9 * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
10 hash table before sysv-style hash table.
11
12 2014-09-29 Sriraman Tallam <tmsriram@google.com>
13
14 * options.h (--pic-executable): Add negative to alias to -no-pie.
15
16 2014-09-26 Cary Coutant <ccoutant@google.com>
17
18 PR gold/16773
19 * object.cc (Sized_relobj_file): Compute value of section symbols
20 for TLS sections the same as TLS symbols.
21
22 2014-09-25 Cary Coutant <ccoutant@google.com>
23
24 PR gold/17432
25 * resolve.cc (Symbol_table::resolve): Override common placeholder
26 symbols, but adjust sizes.
27 * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
28 symbols to common lists.
29
30 2014-09-24 Alan Modra <amodra@gmail.com>
31
32 * po/POTFILES.in: Regenerate.
33
34 2014-09-23 Taiju Tsuiki <tzik@google.com>
35 Cary Coutant <ccoutant@google.com>
36
37 PR gold/14860
38 * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
39 on input_sections_blocker.
40 * layout.cc (Write_sections_task::locks): Unblock
41 input_sections_blocker_.
42 * layout.h (Write_sections_task::Write_sections_task): Add
43 input_sections_blocker.
44 * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
45 to DEPENDENCIES.
46 * testsuite/Makefile.in: Regenerate.
47
48 2014-09-18 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
49
50 * testsuite/Makefile.am (plugin_test_10): New test.
51 * testsuite/Makefile.in: Regenerate
52 * testsuite/plugin_common_test_2.c (c1): Align to 8.
53 * testsuite/plugin_test_10.sh: New file.
54
55 2014-09-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
56
57 * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
58 * resolve.cc (Symbol_table::resolve): Don't override common symbols
59 during the replacement phase.
60
61 2014-09-17 Han Shen <shenhan@google.com>
62 Jing Yu <jingyu@google.com>
63
64 * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
65 TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
66 * aarch64.cc (Target_aarch64): Add data members
67 got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
68 tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
69 constructor.
70 (Target_aarch64::do_reloc_symbol_index): New method.
71 (Target_aarch64::do_reloc_addend): New method.
72 (Target_aarch64::add_tlsdesc_info): New method.
73 (Target_aarch64::do_dynsym_value): New method.
74 (Target_aarch64::do_make_data_plt): Add new parameters: got,
75 got_irelative. Pass them to Output_data_plt_aarch64_standard.
76 (Target_aarch64::make_data_plt): Add new parameters: got,
77 got_irelative. Pass them to do_make_data_plt.
78 (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
79 (Target_aarch64::Relocate:tls_gd_to_le): New method.
80 (Target_aarch64::Relocate:tls_ie_to_le): New method.
81 (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
82 (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
83 (Target_aarch64::got_tlsdesc_section): New method.
84 (Target_aarch64::make_local_ifunc_plt_entry): New method.
85 (Target_aarch64::define_tls_base_symbol): New method.
86 (Target_aarch64::reserve_tlsdesc_entries): New method.
87 (Target_aarch64::got_mod_index_entry): New method.
88 (Target_aarch64::rela_tlsdesc_section): New method.
89 (Target_aarch64::rela_irelative_section): New method.
90 (Target_aarch64::Tlsdesc_info): New struct.
91 (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
92 relocations and tlsdesc relocations.
93 (Target_aarch64::optimize_tls_reloc): Implement method.
94 (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
95 got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
96 in constructor.
97 (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
98 (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
99 (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
100 (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
101 (Output_data_plt_aarch64::rela_tlsdesc): New method.
102 (Output_data_plt_aarch64::rela_irelative): New method.
103 (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
104 (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
105 (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
106 (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
107 (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
108 (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
109 (Output_data_plt_aarch64_standard): New member variables:
110 plt_tlsdesc_entry_size, tlsdesc_plt_entry.
111 (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
112 New parameter: got, got_irelative.
113 (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
114 (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
115 (Output_data_plt_aarch64::do_write): Replace got_address with
116 gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
117 (AArch64_relocate_functions::update_movnz): New method.
118 (AArch64_relocate_functions): Correct format.
119 (AArch64_relocate_functions::movnz): New method.
120 (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
121 before the switch. Add new cases to switch.
122 Check ie_to_le relaxation on tlsie relocations. Add code handling
123 tlsgd tlsdesc cases.
124 (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
125 needed. Add new cases to switch. Insert dynamic RELATIVE relocation
126 when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
127 Call reloc_name_in_error_message to print unsupported reloc.
128 (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
129 make_data_plt.
130 (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
131 relocs. Fill in some more dynamic tags.
132 (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
133 Skip call tls_get_addr when tlsgd is relaxed.
134 (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
135 handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
136 tlsdesc->ie relaxation.
137
138 2014-09-03 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
139
140 * mips.cc (Target_mips_nacl): New class.
141 (Target_selector_mips_nacl): New class.
142 (target_selector_mips32): Rename from target_selector_mips32be and use
143 Target_selector_mips_nacl instead of Target_selector_mips.
144 (target_selector_mips32el): Rename from target_selector_mips32 and use
145 Target_selector_mips_nacl instead of Target_selector_mips.
146 (target_selector_mips64): Rename from target_selector_mips64be and use
147 Target_selector_mips_nacl instead of Target_selector_mips.
148 (target_selector_mips64el): Rename from target_selector_mips64 and use
149 Target_selector_mips_nacl instead of Target_selector_mips.
150 (Target_mips::mips_info): Add const attribute.
151
152 2014-09-02 Cary Coutant <ccoutant@google.com>
153
154 * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
155 * dynobj.h (Sized_dynobj::do_section_name): Likewise.
156 * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
157 (Sized_incr_dynobj::do_section_name): Likewise.
158 * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
159 (Sized_incr_dynobj::do_section_name): Likewise.
160 * object.h (Object::section_name): Likewise.
161 (Object::do_section_name): Likewise.
162 (Sized_relobj_file::do_section_name): Likewise.
163 * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
164 * plugin.h (Sized_pluginobj::do_section_name): Likewise.
165
166 2014-09-02 Cary Coutant <ccoutant@google.com>
167
168 PR gold/17005
169 * ehframe.cc (Fde::write): Add output_offset parameter.
170 (Cie::write): Likewise.
171 (Eh_frame::set_final_data_size): Account for offset within output
172 section.
173 (Eh_frame::do_sized_write): Likewise.
174 * ehframe.h (Fde::write): Add output_offset parameter.
175 (Cie::write): Likewise.
176 * output.cc (Output_section::Input_section_sort_entry): Remove
177 section_has_name_; add output_section_name parameter. Use
178 output section name for non-input sections.
179 (Output_section::Input_section_sort_entry::section_has_name): Remove.
180 (Output_section::Input_section_sort_entry::section_has_name_): Remove.
181 (Output_section::Input_section_sort_compare): Remove logic for
182 sections without names.
183 (Output_section::Input_section_sort_init_fini_compare): Likewise.
184 (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
185 Likewise.
186 (Output_section::Input_section_sort_section_name_compare): Likewise.
187
188 2014-08-29 Han Shen <shenhan@google.com>
189 Jing Yu <jingyu@google.com>
190
191 * aarch64-reloc-property.cc
192 (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
193 reference reloc property in the table.
194 * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
195 3 other entries.
196 * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
197 2 new overloaded methods.
198 (Output_data_got_aarch64::do_write): Add code to write out
199 static relocs.
200 (class Output_data_got_aarch64::Static_reloc): New class to wrap
201 static relocs.
202 (Output_data_got_aarch64::static_relocs): New vector to
203 hold static relocs.
204 (Target_aarch64::TCB_SIZE): New const static memeber.
205 (Target_aarch64::tcb_size): New method.
206 (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
207 (Target_aarch64::Relocate::relocate_tls): New method.
208 (Target_aarch64::Scan::local): Add code handling new reloc types.
209 (Target_aarch64::Scan::global): Add code handling new reloc types.
210
211 2014-08-13 Sriraman Tallam <tmsriram@google.com>
212
213 * options.h (-no-pie): Add option.
214
215 2014-08-08 Jing Yu <jingyu@google.com>
216 Han Shen <shenhan@google.com>
217
218 * Makefile.am (HFILES): Add aarch64-reloc-property.h.
219 (DEFFILES): add aarch64-reloc.def.
220 (TARGETSOURCES): Add aarch64-reloc-property.cc.
221 (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
222 * Makefile.in: Regenerate.
223 * aarch64-reloc-property.cc: New file.
224 * aarch64-reloc-property.h: New file.
225 * aarch64-reloc.def: New file.
226 * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
227 with tab to make the format consistent.
228 (Output_data_got_aarch64::symbol_table_): New method.
229 (Target_aarch64::do_plt_address_for_global): New method.
230 (Target_aarch64::do_plt_address_for_local): New method.
231 (Target_aarch64::do_select_as_default_target): New method.
232 (Target_aarch64::do_make_data_plt): New method.
233 (Target_aarch64::make_data_plt): New method.
234 (Output_data_plt_aarch64::has_irelative_section): New method.
235 (Output_data_plt_aarch64::address_for_global): New method.
236 (Output_data_plt_aarch64::address_for_local): New method.
237 (Output_data_plt_aarch64::irelative_rel_): New parameter.
238 (Output_data_plt_aarch64::add_entry): Implement contents.
239 (Output_data_plt_aarch64::set_final_data_size): Fix typo.
240 (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
241 the got_pov entry to plt0.
242 (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
243 Implement contents.
244 (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
245 (AArch64_howto): New struct.
246 (aarch64_howto[]): New static const array.
247 (AArch64_relocate_functions): New class.
248 (Target_aarch64::Scan::get_reference_flags): Remove method.
249 (Target_aarch64::Scan::local): Implement to support a few relocations.
250 (Target_aarch64::Scan::global): Implement to support a few relocations.
251 (Target_aarch64::make_plt_section): Implement contents.
252 (Target_aarch64::make_plt_entry): Implement contents.
253 (Target_aarch64::do_finalize_sections): Implement contents.
254 (Target_aarch64::Relocate::relocate): Implement a few relocations.
255 (Target_aarch64::relocate_section): Implement contents.
256
257 2014-08-06 Alan Modra <amodra@gmail.com>
258
259 * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
260
261 2014-08-06 Alan Modra <amodra@gmail.com>
262
263 PR 13227
264 * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
265
266 2014-07-21 Sriraman Tallam <tmsriram@google.com>
267
268 * object.cc (Relobj::is_section_name_included): Add
269 ".rodata.nptl_version" to not garbage collect this section.
270
271 2014-07-08 Cary Coutant <ccoutant@google.com>
272
273 * expression.cc (struct Expression::Expression_eval_info): Add
274 new fields type_pointer, vis_pointer, and nonvis_pointer.
275 (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
276 nonvis_pointer parameters. Adjust all calls.
277 (Symbol_expression::value): Update type, visibility, and nonvis bits
278 in caller.
279 * script.cc (Symbol_assignment::sized_finalize): Update type,
280 visibility, and remaining st_other bits for new symbol.
281 * script.h: (Expression::eval_maybe_dot): Add type_pointer,
282 vis_pointer, and nonvis_pointer parameters.
283 * symtab.h (Symbol::set_type): New method.
284
285 * testsuite/Makefile.am (defsym_test): New test.
286 * testsuite/Makefile.in: Regenerate.
287 * testsuite/defsym_test.c: New file.
288 * testsuite/defsym_test.sh: New file.
289
290 2014-07-08 Cary Coutant <ccoutant@google.com>
291
292 PR gold/15639
293 * dynobj.h (Sized_dynobj::base_read_symbols): New method.
294 * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
295 (Sized_dynobj::base_read_symbols): ...new method.
296 * object.h (Sized_relobj_file::base_read_symbols): New method.
297 * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
298 (Sized_relobj_file::base_read_symbols): ...new method.
299 * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
300 * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
301 * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
302
303 2014-07-04 Alan Modra <amodra@gmail.com>
304
305 * po/POTFILES.in: Regenerate.
306
307 2014-07-02 Jing Yu <jingyu@google.com>
308
309 * aarch64.cc: New file
310 * Makefile.am (TARGETSOURCES): Add aarch64.cc
311 (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
312 * Makefile.in: Regenerate.
313 * configure.tgt: Add entries for aarch64*.
314 * configure.ac: Likewise.
315 * configure: Likewise.
316
317 2014-06-27 Alan Modra <amodra@gmail.com>
318
319 * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
320
321 2014-06-24 Cary Coutant <ccoutant@google.com>
322
323 * dwp.cc (Dwo_file::read): Allow files with no .debug_types
324 sections.
325 (Dwo_file::sized_read_unit_index): Likewise.
326
327 2014-06-23 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
328
329 * mips.cc: New file.
330 * Makefile.am (TARGETSOURCES): Add mips.cc
331 (ALL_TARGETOBJS): Add mips.$(OBJEXT)
332 * configure.tgt: Add entries for mips*.
333 * configure.ac: Likewise.
334 * Makefile.in: Regenerate.
335 * configure: Likewise.
336
337 2014-06-09 Cary Coutant <ccoutant@google.com>
338
339 * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
340 unit_length is within section bounds.
341
342 2014-06-09 Cary Coutant <ccoutant@google.com>
343
344 PR gold/16980
345 * layout.cc (Layout::print_to_mapfile): Print unattached sections in
346 map.
347
348 2014-06-07 Alan Modra <amodra@gmail.com>
349
350 * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
351
352 2014-06-06 Cary Coutant <ccoutant@google.com>
353
354 * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
355 * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
356 (Dwarf_pubnames_table::read_header): Likewise.
357 * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
358 .debug_gnu_pubtypes.
359
360 2014-06-05 Joel Brobecker <brobecker@adacore.com>
361
362 * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
363 * Makefile.in, configure: Regenerate.
364
365 2014-06-03 Alan Modra <amodra@gmail.com>
366
367 * powerpc.cc (addis_12_2): Define.
368 (Stub_table::do_write): Support fusion on ELFv2 stubs.
369
370 2014-06-03 Alan Modra <amodra@gmail.com>
371
372 * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
373 st_other output.
374
375 2014-06-02 Alan Modra <amodra@gmail.com>
376
377 * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
378 Only ignore relocs on ELFv1.
379 (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
380
381 2014-05-30 Cary Coutant <ccoutant@google.com>
382
383 * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
384 * testsuite/Makefile.in: Regenerate.
385 * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
386
387 2014-05-27 H.J. Lu <hongjiu.lu@intel.com>
388
389 PR gold/16945
390 * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
391 for got_offset. Properly get GOT address for R_X86_64_PLTOFF64.
392
393 2014-05-15 Alan Modra <amodra@gmail.com>
394
395 * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
396 Compare FDE contents with DW_CFA_nop rather than 0.
397
398 2014-05-13 Sriraman Tallam <tmsriram@google.com>
399
400 * symtab.h (may_need_copy_reloc): Remove check for position independent
401 code.
402 * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
403 position independence before pc absolute may_need_copy_reloc call.
404 Add check for executable output befor pc relative may_need_copy_reloc
405 call.
406 * i386.cc: Ditto.
407 * arm.cc: Ditto.
408 * sparc.cc: Ditto.
409 * tilegx.cc: Ditto.
410 * powerpc.cc: Add check for no position independence before
411 may_need_copy_reloc calls.
412 * testsuite/pie_copyrelocs_test.cc: New file.
413 * testsuite/pie_copyrelocs_shared_test.cc: New file.
414 * Makefile.am (pie_copyrelocs_test): New test.
415 * Makefile.in: Regenerate.
416
417 2014-05-08 Martin Liška <mliska@suse.cz>
418
419 * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
420
421 2014-05-06 Cary Coutant <ccoutant@google.com>
422
423 PR gold/16900
424 * i386.cc (Output_data_got_plt_i386): New class.
425 (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
426 parameter. Change all callers.
427 (Output_data_plt_i386::layout_): Remove.
428 (Output_data_plt_i386::got_plt_): Change type.
429 (Target_i386::got_plt_): Change type. Change all references.
430 (Target_i386::got_section): Create instance of new class.
431 (Output_data_got_plt_i386::do_write): New function.
432 * x86_64.cc (Output_data_got_plt_x86_64): New class.
433 (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
434 parameter. Change all callers.
435 (Output_data_plt_x86_64::layout_): Remove.
436 (Output_data_plt_x86_64::got_plt_): Change type.
437 (Target_x86_64::got_plt_): Change type. Change all references.
438 (Target_x86_64::got_section): Create instance of new class.
439 (Output_data_got_plt_x86_64::do_write): New function.
440 (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
441 (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
442 class.
443
444 2014-05-05 Cary Coutant <ccoutant@google.com>
445
446 * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
447 if we have pubnames/pubtypes.
448
449 2014-05-02 Cary Coutant <ccoutant@google.com>
450
451 * defstd.cc (in_segment): Define __ehdr_start here...
452 * layout.cc (Layout::finalize): ...Instead of here. Set the
453 output segment when known.
454 * resolve.cc (Symbol::override_base_with_special): Remember
455 the original binding.
456 * symtab.cc (Symbol::set_output_segment): New function.
457 (Symbol::set_undefined): New function.
458 * symtab.h (Symbol::is_weak_undefined): Check original undef
459 binding.
460 (Symbol::is_strong_undefined): New function.
461 (Symbol::set_output_segment): New function.
462 (Symbol::set_undefined): New function.
463 * target-reloc.h (is_strong_undefined): Remove.
464 (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
465 Check for hidden undefs.
466 (relocate_section): Call Symbol::is_strong_undefined.
467
468 * testsuite/Makefile.am (ehdr_start_test_1)
469 (ehdr_start_test_2, ehdr_start_test_3)
470 (ehdr_start_test_4, ehdr_start_test_5): New test cases.
471 * testsuite/Makefile.in: Regenerate.
472 * testsuite/ehdr_start_def.cc: New source file.
473 * testsuite/ehdr_start_test.cc: New source file.
474 * testsuite/ehdr_start_test.t: New linker script.
475 * testsuite/ehdr_start_test_4.sh: New shell script.
476
477 2014-04-23 Cary Coutant <ccoutant@google.com>
478
479 PR gold/16870
480 * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
481
482 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
483
484 * layout.cc (Layout::include_section): Allow a target to decide
485 whether to include a section.
486 * target.h (Target::should_include_section): New function.
487 (Target::do_should_include_section): New function.
488
489 2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
490
491 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
492 inline into ...
493 (Copy_relocs::emit): ... here.
494 * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
495 (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
496 (Copy_reloc_entry::entries_): Change from private to protected.
497
498 2014-04-02 Sriraman Tallam <tmsriram@google.com>
499
500 * icf.cc (get_section_contents): Replace copies of reloc
501 vectors with const references.
502
503 2014-04-02 Cary Coutant <ccoutant@google.com>
504
505 * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
506 (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
507 * configure: Regenerate.
508 * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
509 -fno-use-linker-plugin.
510 (LINK1, CXXLINK1): Add it to the link command.
511 * testsuite/Makefile.in: Regenerate.
512
513 2014-03-12 Alan Modra <amodra@gmail.com>
514
515 * Makefile.in: Regenerate.
516
517 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
518
519 * symtab.h (Symbol::set_nonvis): New function.
520
521 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
522
523 * symtab.cc (Sized_symbol<32>::init_output_data):
524 Instantiate the template.
525 (Sized_symbol<64>::init_output_data): Likewise.
526
527 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
528
529 * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
530 adjust dynamic symbol value.
531 * target.h (Target::adjust_dyn_symbol): New function.
532 (Target::do_adjust_dyn_symbol): New function.
533
534 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
535
536 * output.cc (Output_data_dynamic::Dynamic_entry::write):
537 Get the value of DYNAMIC_CUSTOM dynamic entry.
538 * output.h (Output_data_dynamic::add_custom): New function.
539 (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
540 dynamic entry.
541 (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
542 * target.h (Target::dynamic_tag_custom_value): New function.
543 (Target::do_dynamic_tag_custom_value): New function.
544
545 2014-03-10 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
546
547 * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
548 dynsym indexes.
549 * target.h (Target::has_custom_set_dynsym_indexes): New function.
550 (Target::do_has_custom_set_dynsym_indexes): New function.
551 (Target::set_dynsym_indexes): New function.
552 (Target::do_set_dynsym_indexes): New function.
553
554 2014-03-07 Alan Modra <amodra@gmail.com>
555
556 * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
557 CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
558 (Powerpc_relocate_functions::has_overflow_unsigned): New function.
559 (Powerpc_relocate_functions::has_overflow_bitfield,
560 overflowed): Use the above.
561 (Target_powerpc::Relocate::relocate): Correct overflow checking
562 for a number of relocations. Modify overflow test for 16-bit
563 fields in instructions to signed/unsigned according to whether
564 the field takes a signed or unsigned value.
565
566 2014-03-05 Alan Modra <amodra@gmail.com>
567
568 Update copyright years.
569
570 2014-03-05 Alan Modra <amodra@gmail.com>
571
572 * powerpc.cc (Target_powerpc::Scan::local, global): Support
573 R_PPC64_ADDR64_LOCAL.
574 (Target_powerpc::Relocate::relocate): Likewise.
575
576 2014-03-03 Alan Modra <amodra@gmail.com>
577
578 * dwp.cc (print_version): Update copyright year to current.
579
580 2014-02-10 Alan Modra <amodra@gmail.com>
581
582 * po/gold.pot: Regenerate.
583
584 2014-02-06 Cary Coutant <ccoutant@google.com>
585
586 Fix problem where -u is ignored when a weak undef is seen.
587
588 * archive.cc (Library_base::should_include_member): Reorder
589 code to check for -u option if a weak undef has already been seen.
590 * testsuite/Makefile.am (weak_undef_test_2): New test case.
591 * testsuite/Makefile.in: Regenerate.
592 * testsuite/weak_undef_file3.cc: New file.
593 * testsuite/weak_undef_file4.cc: New file.
594 * testsuite/weak_undef_test_2.cc: New file.
595
596 2014-02-05 Cary Coutant <ccoutant@google.com>
597
598 Fix issues with gold undefined symbol diagnostics.
599
600 PR binutils/15435
601 * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
602 check to here.
603 * target-reloc.h (is_strong_undefined): New function.
604 (relocate_section): Move undef vtable symbol check from here.
605 Check for is_strong_undefined.
606
607 2014-02-05 Cary Coutant <ccoutant@google.com>
608
609 Fix problems with the --dynamic-list option.
610
611 PR gold/13577
612 * options.cc (General_options::parse_dynamic_list):
613 Set have_dynamic_list_.
614 (General_options::General_options): Initialize have_dynamic_list_.
615 (General_options::finalize): Turn off -Bsymbolic and
616 -Bsymbolic-functions if --dynamic-list provided.
617 * options.h (General_options::have_dynamic_list): New function.
618 (General_options::have_dynamic_list_): New data member.
619 * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
620 correctly.
621
622 PR gold/16530
623 * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
624 in --dynamic-list, mark it.
625
626 * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
627 (dynamic_list_2): New test case.
628 * testsuite/Makefile.in: Regenerate.
629 * testsuite/dynamic_list_2.cc: New file.
630 * testsuite/dynamic_list_2.t: New file.
631 * testsuite/dynamic_list_lib1.cc: New file.
632 * testsuite/dynamic_list_lib2.cc: New file.
633 * testsuite/gc_dynamic_list_test.c: New file.
634 * testsuite/gc_dynamic_list_test.sh: New file.
635 * testsuite/gc_dynamic_list_test.t: New file.
636
637 2014-01-28 Cary Coutant <ccoutant@google.com>
638
639 Add .gdb_index version 7 support.
640
641 * gold/dwarf_reader.cc: include <utility> (for make_pair).
642 (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
643 debug sections.
644 (Dwarf_ranges_table::read_ranges_table): Likewise.
645 (Dwarf_pubnames_table::read_section): Check for GNU-style
646 sections, and for compressed debug sections.
647 (Dwarf_pubnames_table::read_header): Compute end address of table.
648 (Dwarf_pubnames_table::next_name): Return flag_byte. Check
649 for end of list by offset, not by offset == 0.
650 (Dwarf_info_reader::do_read_string_table): Check for compressed
651 debug sections.
652 * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
653 Initialize new data members.
654 (Dwarf_pubnames_table::next_name): return flag_byte.
655 (Dwarf_pubnames_table::end_of_table_): New data member.
656 (Dwarf_pubnames_table::is_gnu_style_): New data member.
657 * gold/gdb-index.cc (gdb_index_version): Update to version 7.
658 (Gdb_index_info_reader::read_pubtable): Read flag_byte.
659 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
660 read skeleton type unit DIEs.
661 (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
662 (Gdb_index::do_write): Write flag_byte.
663 * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
664 (Gdb_index::Cu_vector): Store flags along with cu indexes.
665 * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
666 * gold/testsuite/gdb_index_test_comm.sh: Likewise.
667
668 2014-01-08 H.J. Lu <hongjiu.lu@intel.com>
669
670 * version.cc (print_version): Update copyright year to 2014.
671
672 2013-12-19 Dimitry Andric <dimitry@andric.com>
673
674 * stringpool.cc (Stringpool_template::reserve): Add
675 HAVE_UNORDERED_MAP case.
676 * stringpool.cc (Stringpool_template::print_stats): Likewise.
677
678 2013-12-18 Cary Coutant <ccoutant@google.com>
679
680 * configure.ac: Check for <unordered_set> and <unordered_map>.
681 * config.in: Regenerate.
682 * configure: Regenerate.
683 * system.h: Use <unordered_set> and <unordered_map> if available.
684
685 2013-12-10 Roland McGrath <mcgrathr@google.com>
686
687 * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
688 with $(INSTALL_PROGRAM_ENV).
689 * Makefile.in: Regenerate.
690
691 2013-11-22 Cary Coutant <ccoutant@google.com>
692
693 * configure.ac: Add check for which library is needed for
694 dlopen.
695 * configure: Regenerate.
696
697 2013-11-22 Cary Coutant <ccoutant@google.com>
698
699 * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
700 assembler.
701 * testsuite/Makefile.in: Regenerate.
702
703 2013-11-17 H.J. Lu <hongjiu.lu@intel.com>
704
705 * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
706 Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
707 R_X86_64_PC32 and R_X86_64_PLT32, respectively.
708 (Target_x86_64<size>::Scan::local): Likewise.
709 (Target_x86_64<size>::Scan::global): Likewise.
710 (Target_x86_64<size>::Relocate::relocate): Likewise.
711 (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
712 Likewise.
713 (Target_x86_64<size>::Scan::check_non_pic(): Handle
714 R_X86_64_PC32_BND.
715
716 * testsuite/Makefile.am (check_PROGRAMS): Add
717 exception_x86_64_bnd_test.
718 (exception_x86_64_bnd_test_SOURCES): New macro.
719 (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
720 (exception_x86_64_bnd_test_LDFLAGS): Likewise.
721 (exception_x86_64_bnd_test_LDADD): Likewise.
722 (exception_x86_64_bnd_1.o): New rule.
723 (exception_x86_64_bnd_2.o): Likewise.
724 * testsuite/Makefile.in: Regenerated.
725
726 2013-11-15 Alan Modra <amodra@gmail.com>
727
728 * powerpc.cc (Target_powerpc::glink_section): Provide non-const
729 accessor.
730 (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
731 Only call ppc64_local_entry_offset for 64-bit. Restrict
732 symval_for_branch lookup to ELFv1.
733 (Stub_table::add_plt_call_entry): Use unsigned int off.
734 (Output_data_glink::Address, invalid_address): New.
735 (Output_data_glink::add_eh_frame): Move out of line. Add
736 support for ELFv2.
737 (Output_data_glink::add_global_entry, find_global_entry,
738 global_entry_address): New functions.
739 (Output_data_glink::global_entry_stubs_, end_branch_table_,
740 ge_size): New variables.
741 (Output_data_glink::set_final_data_size): Add global entry
742 stub sizing.
743 (Output_data_glink::do_write): Write global entry stubs.
744 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
745 parameter. Return true for ELFv2. Adjust callers.
746 (Target_powerpc::Scan::local, global): Restrict opd lookup to
747 ELFv1. Similarly for ifunc and dynamic relocation processing
748 specific to ELFv1. Recognize that symbols are defined on
749 their plt entries for ELFv2.
750 (Target_powerpc::symval_for_branch): Assert if called for
751 ELFv2 or ppc32.
752 (Target_powerpc::Relocate::relocate): Use global entry plt
753 stub for symbol value if such exists on ELFv2.
754 (Target_powerpc::Relocate::relocate): Don't call
755 symval_for_branch when ELFv2. Do adjust for local entry
756 offset when ELFv2.
757 (Target_powerpc::do_dynsym_value): Set symbols to global entry
758 plt stub for ELFv2.
759 (Target_powerpc::do_plt_address_for_global): Similarly.
760
761 2013-11-14 Cary Coutant <ccoutant@google.com>
762
763 Revert patch -- this did not fix the problem, and there is
764 no race there.
765
766 2013-11-14 Cary Coutant <ccoutant@google.com>
767
768 PR gold/14860
769 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
770 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
771 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
772 updating fde_offsets_.
773 (Eh_frame_hdr::lock_): New data member.
774
775 2013-11-14 Cary Coutant <ccoutant@google.com>
776
777 * dwp.cc (Dwo_file_entry): New type.
778 (File_list): Use Dwo_file_entry.
779 (Dwo_file::verify): New function.
780 (Dwo_file::verify_dwo_list): New function.
781 (Dwo_file::sized_verify_dwo_list): New function.
782 (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
783 list.
784 (Dwp_options): New enum type.
785 (dwp_options): Add --verify-only.
786 (usage): Likewise.
787 (main): Likewise.
788 * dwp.h (gold_info): Add declaration.
789
790 2013-11-14 Cary Coutant <ccoutant@google.com>
791
792 PR gold/14860
793 * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
794 (Ehframe_hdr::set_final_data_size): Allocate a Lock.
795 * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
796 updating fde_offsets_.
797 (Eh_frame_hdr::lock_): New data member.
798
799 2013-11-06 Cary Coutant <ccoutant@google.com>
800
801 PR gold/15758
802 * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
803 before reloc sections.
804
805 2013-11-04 Alan Modra <amodra@gmail.com>
806
807 * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
808 (Symbol::needs_dynamic_reloc): Test new flag.
809 * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
810 (Target_powerpc::Scan::get_reference_flags): Add target param.
811 Return FUNC_DESC_ABI for 64-bit ELFv1.
812 (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
813 call.
814 (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
815 (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
816
817 2013-10-31 Cary Coutant <ccoutant@google.com>
818
819 Restore support for dwp v2 DWARF package file format.
820
821 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
822 tu_length parameter. Adjust all callers.
823 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
824 * dwp.cc: Include dwarf.h.
825 (Section_bounds): New struct type.
826 (Unit_set): New struct type.
827 (Dwo_file::Dwo_file): Initialize new data member.
828 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
829 Combine and rename to...
830 (Dwo_file::read_unit_index): ...this.
831 (Dwo_file::sized_read_compunit_index)
832 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
833 (Dwo_file::sized_read_unit_index): ...this.
834 (Dwo_file::copy_section): Remove section_name, is_str_offsets
835 parameters; add section_id parameter.
836 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
837 (Dwo_file::add_unit_set): ...this.
838 (Dwo_file::shndx_map_): Remove.
839 (Dwo_file::sect_offsets_): New data member.
840 (Dwp_output_file::Dwp_output_file): Initialize new data members.
841 (Dwp_output_file::add_section): Rename to...
842 (Dwp_output_file::add_contribution): ...this.
843 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
844 (Dwp_output_file::add_tu_set): Likewise.
845 (Dwp_output_file::Contribution): New type.
846 (Dwp_output_file::Section::contributions): New data member.
847 (Dwp_output_file::Cu_or_tu_set): Remove.
848 (Dwp_output_file::Section::Section): New ctor.
849 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
850 (Dwp_output_file::Dwp_index::Section_table): New type.
851 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
852 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
853 parameter.
854 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
855 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
856 (Dwp_output_file::Dwp_index::section_table): New member function.
857 (Dwp_output_file::Dwp_index::section_table_end): New member function.
858 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
859 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
860 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
861 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
862 (Dwp_output_file::Dwp_index::section_table_): New data member.
863 (Dwp_output_file::Dwp_index::section_mask_): New data member.
864 (Dwp_output_file::add_output_section): New member function.
865 (Dwp_output_file::write_new_section): New member function.
866 (Dwp_output_file::write_contributions): New member function.
867 (Dwp_output_file::section_id_map_): New data member.
868 (class Dwo_id_info_reader): Remove.
869 (class Unit_reader): New class.
870 (get_dwarf_section_name): New function.
871 (Dwo_file::read_executable): Adjust initializations of class data.
872 (Dwo_file::read): Add support for v2 package file format.
873 (Dwo_file::read_unit_index): Likewise.
874 (Dwo_file::sized_read_unit_index): Likewise.
875 (Dwo_file::copy_section): Likewise.
876 (Dwo_file::add_unit_set): Likewise.
877 (Dwp_output_file::add_output_section): Likewise.
878 (Dwp_output_file::add_contribution): Likewise.
879 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
880 for empty slot.
881 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
882 file format.
883 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
884 slot.
885 (Dwp_output_file::initialize): Remove unused function.
886 (Dwp_output_file::finalize): Add support for v2 package file format.
887 (Dwp_output_file::write_index): Likewise.
888 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
889 function prototype.
890
891 2013-10-31 Cary Coutant <ccoutant@google.com>
892
893 * configure.ac: Fix check for -fmerge-constants.
894 * configure.ac: Regenerate.
895
896 2013-10-30 Roland McGrath <mcgrathr@google.com>
897
898 * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
899 Correct 9-byte nop sequence to match what the assembler generates.
900
901 2013-10-30 Alan Modra <amodra@gmail.com>
902
903 * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
904 ppc64_local_entry_offset, ppc64_local_entry_offset,
905 do_read_symbols): New functions.
906 (Powerpc_relobj::e_flags_, st_other_): New vars.
907 (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
908 (Powerpc_dynobj::abiversion, set_abiversion): New functions.
909 (Powerpc_relobj::e_flags_): New var.
910 (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
911 and adjust for ELFv2.
912 (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
913 (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
914 (Powerpc_dynobj::do_find_special_sections): Likewise.
915 (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
916 (Target_powerpc::Branch_info::make_stub): Adjust stub destination
917 to ELFv2 local entry.
918 (Target_powerpc::do_relax): No thread safe barriers needed for
919 ELFv2.
920 (Output_data_plt_powerpc::initial_plt_entry_size_,
921 plt_entry_size): Delete. Replace all uses with
922 first_plt_entry_offset() and plt_entry_size().
923 (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
924 reserved_size parm. Update callers.
925 (Output_data_plt_powerpc::entry_count): Update.
926 (Output_data_plt_powerpc::first_plt_entry_offset): Make private
927 and use Target_powerpc::first_plt_entry_offset().
928 (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
929 rename to plt_entry_size.
930 (Output_data_plt_powerpc::add_ifunc_entry,
931 add_local_ifunc_entry): Adjust reloc for ELFv2.
932 (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
933 (glink_eh_frame_fde_64v2): New.
934 (Stub_table::plt_call_size): Support ELFv2 sizing.
935 (Output_data_glink::add_eh_frame): Use the new FDE.
936 (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
937 (Stub_table::do_write): Write ELFv2 stubs and glink.
938 (Target_powerpc::Relocate::relocate): Replaces nop after call
939 with ld 2,24(1) and adjust local offset destination for ELFv2.
940
941 2013-10-30 Alan Modra <amodra@gmail.com>
942
943 * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
944 (Target_powerpc::Scan::global, local): Likewise.
945 (Target_powerpc::Relocate::relocate): Likewise. Check for overflow
946 on all ppc64 @h and @ha relocs.
947
948 2013-10-14 Alan Modra <amodra@gmail.com>
949
950 * output.h (Output_data_got::add_constant): Tidy.
951 (Output_data_got::add_constant_pair): New function.
952 * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
953 methods used so as to first call reserve_ent().
954
955 2013-10-11 Roland McGrath <mcgrathr@google.com>
956
957 * powerpc.cc (Output_data_got_powerpc): Remove unused methods
958 add_got_entry and add_got_entry_pair.
959
960 * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
961 (HAVE_PUBNAMES): Likewise.
962 * configure: Regenerate.
963
964 * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
965 * testsuite/Makefile.in: Regenerate.
966
967 * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
968 Remove const from declaration.
969 * target.cc (Sized_target::do_adjust_elf_header): Update definition.
970 * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
971 * output.h (Output_file_header): Remove const from member target_
972 and corresponding constructor argument.
973 * output.cc (Output_file_header::Output_file_header): Update prototype.
974 (Output_file_header::do_sized_write): Use this->target_ in place
975 of parameters()->target().
976
977 * testsuite/undef_symbol.cc (Foo::get_a): New method.
978
979 * configure.ac (MERGE_CONSTANTS_FLAG): New check.
980 * configure: Regenerate.
981 * Makefile.in: Regenerate.
982 * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
983 * testsuite/merge_string_literals_2.c: Likewise.
984 * testsuite/Makefile.am
985 (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
986 (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
987 literal -fmerge-constants.
988 * testsuite/Makefile.in: Regenerate.
989
990 * i386.cc (Target_i386): Remove unused member dynbss_.
991 * arm.cc (Target_arm): Likewise.
992 * powerpc.cc (Target_powerpc): Likewise.
993 * sparc.cc (Target_sparc): Likewise.
994 * tilegx.cc (Target_tilegx): Likewise.
995 * x86_64.cc (Target_x86_64): Likewise.
996 * dwarf_reader.h (Dwarf_info_reader): Remove unused members
997 type_signature_, type_offset_.
998 * plugin.h (Plugin_hook): Remove unused member layout_.
999 * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1000 mapfile_.
1001 (Read_member): Remove unused members input_objects_, symtab_,
1002 mapfile_, layout_.
1003 (Check_library): Remove unused member symtab_.
1004 * archive.h (Lib_group): Remove unused member lib_.
1005 * archive.cc (Lib_group::Lib_group): Update initializer.
1006 * incremental.h (Incremental_binary): Remove unused member target_.
1007 (Incremental_script_entry): Removed unused member script_.
1008 * layout.h (Write_symbols_task): Remove unused member input_objects_.
1009 * icf.h (Icf): Remove unused member num_tracked_relocs.
1010
1011 * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1012 [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1013 its only use.
1014 * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1015
1016 * archive.h: Use struct rather than class for forward declaration
1017 of Read_symbols_data.
1018
1019 2013-10-07 Cary Coutant <ccoutant@google.com>
1020
1021 PR gold/16010
1022 * testsuite/Makefile.am (icf_test): Fix dependencies.
1023 (icf_safe_test): Likewise.
1024 (icf_safe_so_test): Likewise.
1025 (large_symbol_alignment): Add empty _LDADD rule.
1026 * testsuite/Makefile.in: Regenerate.
1027
1028 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
1029
1030 PR gold/15927
1031 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1032 relocation for R_X86_64_32 on x32.
1033
1034 2013-08-27 Roland McGrath <mcgrathr@google.com>
1035
1036 * output.cc (Output_segment::set_section_addresses): Take new
1037 Target* argument. If target->isolate_execinstr() and the segment
1038 is executable and starts at a target->abi_pagesize() boundary,
1039 pad its end out to a target->abi_pagesize() boundary with code fill.
1040 * output.h (Output_segment::set_section_addresses): Update decl.
1041 * layout.h (Layout::check_output_data_for_reset_values): Take new
1042 argument RELAX_OUTPUTS.
1043 (Layout): New member relax_output_list_.
1044 (Layout::add_relax_output): New method.
1045 * layout.cc (Layout::Layout): Update constructor.
1046 (Layout::reset_relax_output): New method.
1047 (Layout::clean_up_after_relaxation): Call it.
1048 (Layout::prepare_for_relaxation): Update caller.
1049 (Layout::set_segment_offsets): Update callers of set_section_addresses.
1050 Call reset_relax_output before re-processing segments for
1051 isolate_execinstr case.
1052 (Layout::write_data): Handle relax_output_list_.
1053 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1054 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
1055
1056 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
1057
1058 PR binutils/15834
1059 * object.h: Fix typos.
1060
1061 2013-08-16 Roland McGrath <mcgrathr@google.com>
1062
1063 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1064 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1065
1066 2013-08-07 Cary Coutant <ccoutant@google.com>
1067
1068 Revert support for v2 DWP files:
1069
1070 2013-03-01 Cary Coutant <ccoutant@google.com>
1071
1072 Add dwp support for v2 DWARF package file format.
1073 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1074 tu_length parameter. Adjust all callers.
1075 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1076 * dwp.cc: Include dwarf.h.
1077 (Section_bounds): New struct type.
1078 (Unit_set): New struct type.
1079 (Dwo_file::Dwo_file): Initialize new data member.
1080 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1081 Combine and rename to...
1082 (Dwo_file::read_unit_index): ...this.
1083 (Dwo_file::sized_read_compunit_index)
1084 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1085 (Dwo_file::sized_read_unit_index): ...this.
1086 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1087 parameters; add section_id parameter.
1088 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1089 (Dwo_file::add_unit_set): ...this.
1090 (Dwo_file::shndx_map_): Remove.
1091 (Dwo_file::sect_offsets_): New data member.
1092 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1093 (Dwp_output_file::add_section): Rename to...
1094 (Dwp_output_file::add_contribution): ...this.
1095 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1096 (Dwp_output_file::add_tu_set): Likewise.
1097 (Dwp_output_file::Contribution): New type.
1098 (Dwp_output_file::Section::contributions): New data member.
1099 (Dwp_output_file::Cu_or_tu_set): Remove.
1100 (Dwp_output_file::Section::Section): New ctor.
1101 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1102 (Dwp_output_file::Dwp_index::Section_table): New type.
1103 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1104 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1105 parameter.
1106 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1107 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1108 (Dwp_output_file::Dwp_index::section_table): New member function.
1109 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1110 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1111 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1112 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1113 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1114 (Dwp_output_file::Dwp_index::section_table_): New data member.
1115 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1116 (Dwp_output_file::add_output_section): New member function.
1117 (Dwp_output_file::write_new_section): New member function.
1118 (Dwp_output_file::write_contributions): New member function.
1119 (Dwp_output_file::section_id_map_): New data member.
1120 (class Dwo_id_info_reader): Remove.
1121 (class Unit_reader): New class.
1122 (get_dwarf_section_name): New function.
1123 (Dwo_file::read_executable): Adjust initializations of class data.
1124 (Dwo_file::read): Add support for v2 package file format.
1125 (Dwo_file::read_unit_index): Likewise.
1126 (Dwo_file::sized_read_unit_index): Likewise.
1127 (Dwo_file::copy_section): Likewise.
1128 (Dwo_file::add_unit_set): Likewise.
1129 (Dwp_output_file::add_output_section): Likewise.
1130 (Dwp_output_file::add_contribution): Likewise.
1131 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1132 for empty slot.
1133 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1134 file format.
1135 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1136 slot.
1137 (Dwp_output_file::initialize): Remove unused function.
1138 (Dwp_output_file::finalize): Add support for v2 package file format.
1139 (Dwp_output_file::write_index): Likewise.
1140 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1141 function prototype.
1142
1143 2013-07-31 Cary Coutant <ccoutant@google.com>
1144
1145 * object.cc (Sized_relobj::do_output_section_address): New function.
1146 (Sized_relobj): Instantiate explicitly.
1147 * object.h (Object::output_section_address): New function.
1148 (Object::do_output_section_address): New function.
1149 (Sized_relobj::do_output_section_address): New function.
1150 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1151
1152 2013-07-30 Cary Coutant <ccoutant@google.com>
1153 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
1154
1155 * parameters.cc (Parameters::entry): Return target-specific entry
1156 symbol name.
1157 * target.h (Target::entry_symbol_name): New function.
1158 (Target_info::entry_symbol_name): New data member.
1159
1160 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1161 * i386.cc (Target_i386::i386_info): Likewise.
1162 (Target_i386_nacl::i386_nacl_info): Likewise.
1163 * sparc.cc (Target_sparc::sparc_info): Likewise.
1164 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1165 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1166 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1167 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1168
1169 2013-07-22 Sterling Augustine <saugustine@google.com>
1170
1171 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1172 Convert parameter shndx to local variable. Add parameters symtab
1173 and symtab_size. Scan over section names. Find relocation
1174 section corresponding to current section. Create and initialize
1175 reloc_mapper_ and reloc_type_.
1176 (Dwarf_pubnames_table::read_header): Add assertion. Change
1177 unit_length to off_t. Initialize member unit_length_. Fill in field
1178 cu_offset_.
1179 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1180 Initialize new fields unit_length_ and cu_offset_.
1181 (Dwarf_pubnames_table::read_section): Update prototype.
1182 (Dwarf_pubnames_table::cu_offset): New member function.
1183 (Dwarf_pubnames_table::subsection_size): Likewise.
1184 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1185 New fields.
1186 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1187 member functions public.
1188 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1189 Update comment. Rework logic. Move repeated parts to...
1190 (Gdb_index_info_reader::read_pubtable): ...here. New function.
1191 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1192 pubtypes_table_, and stmt_list_offset.
1193 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1194 Gdb_index::find_pubtype_offset,
1195 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1196 (Gdb_index::pubnames_read): Update prototype and rework logic.
1197 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1198 Forward declare.
1199 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1200 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1201 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1202 Gdb_index::map_pubtable_to_dies):
1203 Declare functions.
1204 (Gdb_index::pubnames_read): Update declaration.
1205 (Gdb_index::Pubname_offset_map): New type.
1206 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1207 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1208 Gdb_index::stmt_list_offset): Declare.
1209 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1210 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1211 Gdb_index::pubtypes_offset_): Remove.
1212
1213 2013-07-19 Roland McGrath <mcgrathr@google.com>
1214
1215 * options.h (General_options): Add -Trodata-segment option.
1216 * parameters.cc (Parameters::check_rodata_segment): New function.
1217 (Parameters::set_target_once): Call it.
1218 * parameters.h (Parameters): Declare it (private member function).
1219 * layout.cc (load_seg_unusable_for_headers): New function, broken
1220 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
1221 then validate rodata segment rather than text segment.
1222 (relaxation_loop_body): Call that.
1223 (is_text_segment): New function. Don't admit a non-executable
1224 segment if TARGET->isolate_execinstr().
1225 (set_segment_offsets): Call it. Honor -Trodata-segment option.
1226
1227 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
1228
1229 PR gold/15070
1230 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1231 * nacl.h (Sniff_file::View::View): Request aligned view.
1232
1233 2013-07-11 Cary Coutant <ccoutant@google.com>
1234
1235 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1236 correct BRLT entry size.
1237
1238 2013-07-03 Alan Modra <amodra@gmail.com>
1239
1240 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1241 comment.
1242
1243 2013-07-01 Cary Coutant <ccoutant@google.com>
1244
1245 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1246 reloc_type_.
1247 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1248 (Dwarf_ranges_table::lookup_reloc): New function.
1249 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1250 reloc_type_.
1251 (Dwarf_ranges_table::lookup_reloc): New function.
1252 (Dwarf_ranges_table::reloc_type_): New data member.
1253
1254 2013-06-27 Jing Yu <jingyu@google.com>
1255
1256 PR gold/15662
1257 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1258 function.
1259 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1260 (Target_powerpc::do_relax): Call the above.
1261
1262 2013-06-27 Cary Coutant <ccoutant@google.com>
1263
1264 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1265 on garbage collected .opd section.
1266
1267 2013-06-27 Alan Modra <amodra@gmail.com>
1268
1269 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1270 is non-zero.
1271 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1272 (Target_powerpc::do_function_location): Likewise for loc->shndx.
1273
1274 2013-06-14 Cary Coutant <ccoutant@google.com>
1275
1276 * resolve.cc (Symbol::override_base): Don't override st_type
1277 from plugin placeholder symbols.
1278 (Symbol_table::resolve): Likewise.
1279 (Symbol_table::should_override): Don't complain about TLS mismatch
1280 if the TO symbol is a plugin placeholder.
1281 * testsuite/Makefile.am (plugin_test_tls): New test.
1282 * testsuite/Makefile.in: Regenerate.
1283 * testsuite/plugin_test_tls.sh: New test script.
1284 * testsuite/two_file_test_2_tls.cc: New test source.
1285 * testsuite/two_file_test_tls.cc: New test source.
1286
1287 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
1288
1289 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1290 the maximum segment alignment is larger than the page size.
1291 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1292 correctly aligns the symbols with large alignemnt.
1293 * testsuite/Makefile.in: Regenerate.
1294 * testsuite/large_symbol_alignment.cc: New file.
1295
1296 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
1297 Sriraman Tallam <tmsriram@google.com>
1298
1299 * options.h (sort_section): New option.
1300 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1301 Rename from Input_section_sort_section_name_special_ordering_compare.
1302 (Input_section_sort_section_name_compare): New struct.
1303 * output.cc (Output_section::Input_section_sort_section_name_compare::
1304 operator()): New function.
1305 (Output_section::sort_attached_input_sections): Use new sort function
1306 for .text if --sort-section=name is specified.
1307 * layout.cc (Layout::make_output_section):
1308 Add sorting by name when --sort-section=name is specified.
1309 * testsuite/Makefile.am (text_section_grouping): Test option
1310 --sort-section=name.
1311 * testsuite/Makefile.in: Regenerate.
1312 * testsuite/section_sorting_name.cc: New file.
1313 * testsuite/section_sorting_name.sh: New file.
1314
1315 2013-05-21 Cary Coutant <ccoutant@google.com>
1316
1317 * symtab.h (Symbol::is_cxx_vtable): New function.
1318 * target-reloc.h (relocate_section): Check for vtable symbol.
1319 * testsuite/Makefile.am (missing_key_func.sh): New test case.
1320 * testsuite/Makefile.in: Regenerate.
1321 * testsuite/missing_key_func.cc: New test source.
1322 * testsuite/missing_key_func.sh: New test script.
1323
1324 2013-05-21 Cary Coutant <ccoutant@google.com>
1325
1326 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1327 type of enclosing symbol.
1328 (Relocate_info::location): Check symbol type when describing symbol.
1329 * object.h (Symbol_location_info): Remove unused line_number;
1330 add enclosing_symbol_type.
1331 * testsuite/debug_msg.sh: Adjust expected output.
1332
1333 2013-05-13 Cary Coutant <ccoutant@google.com>
1334
1335 * configure.ac: Export DEFAULT_TARGET.
1336 * configure: Regenerate.
1337 * Makefile.in: Regenerate.
1338 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1339 * testsuite/Makefile.in: Regenerate.
1340 * testsuite/debug_msg.sh: Delete duplicate tests.
1341 Don't check undef_int error message match for powerpc where the
1342 source file and line number aren't available.
1343
1344 2013-05-10 Roland McGrath <mcgrathr@google.com>
1345
1346 * options.h (General_options): Add --rosegment-gap option.
1347 * options.cc (finalize): --rosegment-gap implies --rosegment.
1348 * layout.cc (set_segment_offsets): Let user option override
1349 target->rosegment_gap().
1350
1351 2013-05-10 Roland McGrath <mcgrathr@google.com>
1352
1353 * options.h (General_options): Remove leading space from help
1354 messages for -nostdlib and --rosegment.
1355
1356 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
1357
1358 PR ld/15365
1359 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1360
1361 2013-05-03 Alan Modra <amodra@gmail.com>
1362
1363 * merge.cc (Output_merge_string::do_add_input_section): Correct
1364 scan for number of strings. Rename vars to avoid shadowing.
1365 Include missing terminator in input_size_.
1366
1367 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
1368
1369 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1370 Restore empty string handling.
1371
1372 2013-05-01 Cary Coutant <ccoutant@google.com>
1373
1374 * stringpool.cc (Stringpool_template::new_key_offset): Fix
1375 uninitialized warning.
1376
1377 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
1378
1379 * output.cc (Output_section::add_merge_input_section): Allow
1380 to merge sections if the alignment is more than character size.
1381 * merge.h (Output_merge_string::Output_merge_string): Remove
1382 assert.
1383 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1384 only not-null strings. Check the alignment of strings.
1385 * stringpool.h
1386 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1387 alignment as the argument.
1388 (Stringpool_template<Stringpool_char>::addralign_): New class member.
1389 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1390 Align non-zero length strings according to the addralign_.
1391 (Stringpool_template<Stringpool_char>::set_string_offsets):
1392 Updating offsets according to the given alignment.
1393 * testsuite/Makefile.am (text_section_grouping): Test if string
1394 literals are getting merged.
1395 * testsuite/Makefile.in: Regenerate.
1396 * testsuite/merge_string_literals_1.c: New file.
1397 * testsuite/merge_string_literals_2.c: Ditto.
1398 * testsuite/merge_string_literals.sh: Ditto.
1399
1400 2013-04-26 Ian Lance Taylor <iant@google.com>
1401
1402 * target-reloc.h (relocate_section): If the reloc offset is out of
1403 range, pass VIEW as NULL to relocate.relocate.
1404 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1405 * i386.cc (Target_i386::Relocate::relocate): Likewise.
1406 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1407 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1408 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1409 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1410
1411 2013-04-26 Geoff Pike <gpike@chromium.org>
1412
1413 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1414 * layout.cc (Hash_task): New class.
1415 (Layout::queue_build_id_tasks): New function.
1416 (Layout::write_build_id): Handle single-thread portion of build ID
1417 computation. (In some cases, all of it is single-threaded.) Replace
1418 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1419 functionality in fewer lines of code.
1420 * layout.h (Layout::queue_build_id_tasks): New function declaration.
1421 * options.h (General_options): make "--build-id" default to tree
1422 rather than sha1. Add two new options related to --build-id=tree:
1423 --build-id-chunk-size-for-treehash and
1424 --build-id-min-file-size-for-treehash.
1425 * Makefile.am: add testing of --build-id=tree and related new options
1426 (these tests will be invoked by "make check").
1427 * Makefile.in: Regenerate.
1428
1429 2013-04-25 Alan Modra <amodra@gmail.com>
1430
1431 * configure.tgt: Add powerpcle and powerpc64le.
1432
1433 2013-04-22 Alan Modra <amodra@gmail.com>
1434
1435 PR gold/15355
1436 * layout.cc (Layout::segment_precedes): Allow more than one
1437 segment with the same type and flags.
1438
1439 2013-04-15 Cary Coutant <ccoutant@google.com>
1440
1441 * layout.cc (Layout::set_relocatable_section_offsets): Don't
1442 allocate space in file for BSS sections.
1443
1444 2013-04-15 Cary Coutant <ccoutant@google.com>
1445
1446 * script-sections.cc (Orphan_output_section): Reset address
1447 to zero after each orphaned section for relocatable links.
1448
1449 2013-04-15 Cary Coutant <ccoutant@google.com>
1450
1451 * symtab.cc (Symbol_table::sized_write_globals): Subtract
1452 section starting address for relocatable link.
1453 * testsuite/Makefile.am (script_test_11): New test.
1454 * testsuite/Makefile.in: Regenerate.
1455 * testsuite/script_test_11.c: New source file.
1456 * testsuite/script_test_11.t: New linker script.
1457
1458 2013-04-13 Alan Modra <amodra@gmail.com>
1459
1460 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1461 owner when sections are not adjacent and exceed group size.
1462 (Target_powerpc::group_sections): Handle corner case.
1463 (Target_powerpc::Branch_info::make_stub): Handle case where
1464 stub table doesn't exist due to branches in non-exec sections.
1465 (Target_powerpc::Relocate::relocate): Likewise.
1466
1467 2013-04-11 Alan Modra <amodra@gmail.com>
1468
1469 PR gold/15354
1470 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1471 .branch_lt to match bfd ld. Adjust comments throughout file.
1472
1473 2013-04-04 Ian Lance Taylor <iant@google.com>
1474
1475 GCC PR c++/56840
1476 * object.cc (do_layout_deferred_sections): Handle .eh_frame
1477 sections before checking whether they are included in the link.
1478
1479 2013-03-29 Sriraman Tallam <tmsriram@google.com>
1480
1481 * archive.cc (Archive::get_elf_object_for_member): Create the elf
1482 object before calling the plugin claim_file handler. Pass the elf
1483 object of the archive to the plugin. Delete the elf object if the
1484 plugin claims the file.
1485
1486 2013-03-21 Alan Modra <amodra@gmail.com>
1487
1488 * layout.cc (Layout::set_segment_offsets): Accept writable .text
1489 segment when omagic.
1490
1491 2013-03-21 Alan Modra <amodra@gmail.com>
1492
1493 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1494 comparison warning.
1495 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1496 uninitialized" warning.
1497
1498 2013-03-20 Alan Modra <amodra@gmail.com>
1499
1500 * symtab.h (Symbol::clear_version): New function.
1501 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1502 is_needed by weak references. Clear version for symbols defined
1503 in as-needed objects that are not needed.
1504
1505 2013-03-15 Alan Modra <amodra@gmail.com>
1506
1507 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1508 static and public. Add report_err param. Return false for data refs.
1509 (Target_powerpc::rela_dyn_section): New overloaded function.
1510 (Target_powerpc::plt_, iplt_): Elucidate.
1511 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1512 (Output_data_plt_powerpc::do_write): Don't write .iplt.
1513 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1514 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1515 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
1516 push_branch and make_plt_entry for ifunc syms when
1517 reloc_needs_plt_for_ifunc.
1518 (Target_powerpc::Relocate::relocate): Don't use plt entry value
1519 for ifunc unless reloc_needs_plt_for_ifunc.
1520
1521 2013-03-15 Alan Modra <amodra@gmail.com>
1522
1523 * gc.h (gc_process_relocs): Don't look through function descriptors.
1524 * icf.cc (get_section_contents): Do so here instead.
1525
1526 2013-03-13 Alan Modra <amodra@gmail.com>
1527
1528 * powerpc.cc (is_branch_reloc): Forward declare.
1529 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1530 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1531 false for 64-bit, true for 32-bit non-branch relocs.
1532 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1533 * testsuite/Makefile.am (icf_test): Use linker map file instead of
1534 nm output.
1535 (icf_safe_test): Generate linker map file as well as nm output.
1536 (icf_safe_so_test): Likewise.
1537 * testsuite/Makefile.in: Regenerate.
1538 * testsuite/icf_test.sh: Parse linker map file to determine
1539 section folding.
1540 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
1541 * testsuite/icf_safe_so_test.sh: Likewise.
1542 (X86_32_or_ARM_specific_safe_fold): Merge into..
1543 (arch_specific_safe_fold): ..this.
1544 (X86_64_specific_safe_fold): Delete unused function.
1545
1546 2013-03-12 Alan Modra <amodra@gmail.com>
1547
1548 * gc.h (gc_process_relocs): Look through function descriptors
1549 to determine shndx, symvalue and addend used by ICF. Tidy
1550 variable duplication.
1551
1552 2013-03-11 Alan Modra <amodra@gmail.com>
1553
1554 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1555 * layout.cc (Layout_task_runner::run): ..to here.
1556 * symtab.h (struct Symbol_location): Extract from..
1557 (class Symbol_table): ..here.
1558 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1559 * target.h (class Target): Add function_location and
1560 do_function_location functions.
1561 (class Sized_target): Add do_function_location.
1562 * object.h (class Sized_relobj_file): Move find_shdr..
1563 (class Object): ..to here.
1564 * object.cc: Likewise. Update to suit. Instantiate.
1565 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1566 * powerpc.cc (class Powerpc_dynobj): New.
1567 (Target_powerpc::do_function_location): New function.
1568 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1569 (Powerpc_dynobj::do_read_symbols): New function.
1570 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1571
1572 2013-03-08 Ian Lance Taylor <iant@google.com>
1573
1574 * options.cc (General_options::string_to_object_format): Accept
1575 "default".
1576
1577 2013-03-08 Alan Modra <amodra@gmail.com>
1578
1579 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1580 pointer to Post_fde.
1581 (struct Post_fde): Move definition to here..
1582 * ehframe.cc (struct Post_fde): ..from here.
1583 (Cie::write): Don't alloc Post_fde.
1584 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
1585
1586 2013-03-07 Alan Modra <amodra@gmail.com>
1587
1588 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1589 relocation referencing .LC0.
1590 * testsuite/discard_locals_test.sh: Remove FIXMEs.
1591
1592 2013-03-07 Alan Modra <amodra@gmail.com>
1593
1594 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1595 always_inline. Add assembly for powerpc to avoid GOT.
1596
1597 2013-03-07 Alan Modra <amodra@gmail.com>
1598
1599 * testsuite/script_test_10.sh: Don't test .bss section
1600 header number.
1601
1602 2013-03-06 Alan Modra <amodra@gmail.com>
1603
1604 * powerpc.cc (class Powerpc_relobj): Move some member functions.
1605 (Target_powerpc::symval_for_branch): Add symtab param. Update
1606 all callers. Handle folded sections.
1607 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1608 to Powerpc_relobj.
1609 (Global_symbol_visitor_opd::operator()): Likewise.
1610
1611 2013-03-04 Alan Modra <amodra@gmail.com>
1612
1613 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1614 * testsuite/Makefile.in: Regenerate.
1615
1616 2013-03-01 Cary Coutant <ccoutant@google.com>
1617
1618 Add dwp support for v2 DWARF package file format.
1619 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1620 tu_length parameter. Adjust all callers.
1621 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1622 * dwp.cc: Include dwarf.h.
1623 (Section_bounds): New struct type.
1624 (Unit_set): New struct type.
1625 (Dwo_file::Dwo_file): Initialize new data member.
1626 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1627 Combine and rename to...
1628 (Dwo_file::read_unit_index): ...this.
1629 (Dwo_file::sized_read_compunit_index)
1630 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1631 (Dwo_file::sized_read_unit_index): ...this.
1632 (Dwo_file::copy_section): Remove section_name, is_str_offsets
1633 parameters; add section_id parameter.
1634 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1635 (Dwo_file::add_unit_set): ...this.
1636 (Dwo_file::shndx_map_): Remove.
1637 (Dwo_file::sect_offsets_): New data member.
1638 (Dwp_output_file::Dwp_output_file): Initialize new data members.
1639 (Dwp_output_file::add_section): Rename to...
1640 (Dwp_output_file::add_contribution): ...this.
1641 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1642 (Dwp_output_file::add_tu_set): Likewise.
1643 (Dwp_output_file::Contribution): New type.
1644 (Dwp_output_file::Section::contributions): New data member.
1645 (Dwp_output_file::Cu_or_tu_set): Remove.
1646 (Dwp_output_file::Section::Section): New ctor.
1647 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1648 (Dwp_output_file::Dwp_index::Section_table): New type.
1649 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1650 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1651 parameter.
1652 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1653 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1654 (Dwp_output_file::Dwp_index::section_table): New member function.
1655 (Dwp_output_file::Dwp_index::section_table_end): New member function.
1656 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1657 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1658 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1659 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1660 (Dwp_output_file::Dwp_index::section_table_): New data member.
1661 (Dwp_output_file::Dwp_index::section_mask_): New data member.
1662 (Dwp_output_file::add_output_section): New member function.
1663 (Dwp_output_file::write_new_section): New member function.
1664 (Dwp_output_file::write_contributions): New member function.
1665 (Dwp_output_file::section_id_map_): New data member.
1666 (class Dwo_id_info_reader): Remove.
1667 (class Unit_reader): New class.
1668 (get_dwarf_section_name): New function.
1669 (Dwo_file::read_executable): Adjust initializations of class data.
1670 (Dwo_file::read): Add support for v2 package file format.
1671 (Dwo_file::read_unit_index): Likewise.
1672 (Dwo_file::sized_read_unit_index): Likewise.
1673 (Dwo_file::copy_section): Likewise.
1674 (Dwo_file::add_unit_set): Likewise.
1675 (Dwp_output_file::add_output_section): Likewise.
1676 (Dwp_output_file::add_contribution): Likewise.
1677 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1678 for empty slot.
1679 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1680 file format.
1681 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1682 slot.
1683 (Dwp_output_file::initialize): Remove unused function.
1684 (Dwp_output_file::finalize): Add support for v2 package file format.
1685 (Dwp_output_file::write_index): Likewise.
1686 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1687 function prototype.
1688
1689 2013-03-01 Cary Coutant <ccoutant@google.com>
1690
1691 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1692 function into class definition in header file.
1693 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1694 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1695 New function.
1696 (Dwarf_info_reader::check_buffer): Move here from .cc file.
1697
1698 2013-02-28 Alan Modra <amodra@gmail.com>
1699
1700 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1701 * target.cc (Target::do_plt_fde_location): New function.
1702 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1703 accessor function, and constructor param.
1704 (struct Post_fde, Post_fdes): Declare.
1705 (Cie::write): Add post_fdes param.
1706 * ehframe.cc (Fde::write): Use plt_fde_location.
1707 (struct Post_fde): Define.
1708 (Cie::write): Stash FDEs added post merge mapping.
1709 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1710 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
1711 (Eh_frame::do_sized_write): Arrange to write post map FDES after
1712 other FDEs.
1713 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1714 (Target_powerpc::has_glink): New function.
1715 (Target_powerpc::do_relax): Add eh_frame info for stubs.
1716 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1717 glink_eh_frame_fde_32, default_fde): New data.
1718 (Stub_table::eh_frame_added_): New var.
1719 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1720 Make const.
1721 (Stub_table::add_eh_frame): New function.
1722 (Output_data_glink::add_eh_frame): New function.
1723 (Target_powerpc::make_glink_section): Call add_eh_frame.
1724
1725 2013-02-15 Ian Lance Taylor <iant@google.com>
1726
1727 * options.h (DEFINE_uint64_alias): Define.
1728 (class General_options): Add -Ttext-segment as an alias for
1729 -Ttext.
1730
1731 2013-02-15 Alan Modra <amodra@gmail.com>
1732
1733 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1734 (Stub_table::do_write): ..here, two places.
1735 (Stub_table::plt_call_size): Use it here too.
1736
1737 2013-02-11 Ian Lance Taylor <iant@google.com>
1738
1739 * descriptors.cc (Descriptors::close_all): New function.
1740 * descriptors.h (class Descriptors): Declare close_all.
1741 (close_all_descriptors): New inline function.
1742 * plugin.cc: Include "descriptors.h".
1743 (Plugin_manager::cleanup): Call close_all_descriptors.
1744
1745 2013-02-06 Alan Modra <amodra@gmail.com>
1746
1747 * README: Update coding style link.
1748
1749 2013-01-28 Cary Coutant <ccoutant@google.com>
1750
1751 * dwp.cc (File_list): New typedef.
1752 (Dwo_name_info_reader): New class.
1753 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1754 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1755 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1756 (Dwo_file::read_executable): New function.
1757 (Dwo_file::read): Move common setup code to ...
1758 (Dwo_file::make_object): ... here.
1759 (dwp_options): Add --exec/-e.
1760 (usage): Likewise.
1761 (main): Likewise.
1762
1763 2013-01-24 Sriraman Tallam <tmsriram@google.com>
1764
1765 * layout.cc (Layout::layout): Check for option text_reorder.
1766 (Layout::make_output_section): Ditto.
1767 * options.h (text_reorder): New option.
1768 * output.cc (Input_section_sort_compare): Remove special ordering
1769 of section names.
1770 (Output_section::
1771 Input_section_sort_section_name_special_ordering_compare::
1772 operator()): New function.
1773 (Output_section::sort_attached_input_sections): Use new sort function
1774 for .text.
1775 * output.h (Input_section_sort_section_name_special_ordering_compare):
1776 New struct.
1777 * testsuite/Makefile.am (text_section_grouping): Test option
1778 --no-text-reorder
1779 * testsuite/Makefile.in: Regenerate.
1780 * testsuite/text_section_grouping.sh: Check order of functions without
1781 default text reordering.
1782
1783 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1784
1785 * options.h (General_options): Change default to true for new_dtags.
1786
1787 2013-01-18 Mike Frysinger <vapier@gentoo.org>
1788
1789 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1790 when enable_new_dtags is false. Only add DT_RUNPATH when
1791 enable_new_dtags is true.
1792
1793 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
1794
1795 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1796 used in declaration and definition consistent.
1797 (Target_powerpc::symval_for_branch): Ditto.
1798
1799 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1800
1801 * testsuite/plugin_final_layout.cc: Fix comment.
1802
1803 2013-01-16 Sriraman Tallam <tmsriram@google.com>
1804
1805 * layout.cc (Layout::layout): Do not do default sorting for
1806 text sections when section ordering is specified.
1807 (make_output_section): Ditto.
1808 * testsuite/plugin_final_layout.cc: Name the function sections
1809 to catch reordering issues.
1810
1811 2013-01-15 Alan Modra <amodra@gmail.com>
1812
1813 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1814 plt-thread-safe.
1815
1816 2013-01-15 Alan Modra <amodra@gmail.com>
1817
1818 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1819 * testsuite/Makefile.in: Regenerate.
1820
1821 2013-01-14 Alan Modra <amodra@gmail.com>
1822
1823 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1824 * testsuite/Makefile.in: Regenerate.
1825
1826 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
1827
1828 PR bfd/14430
1829 Fix mingw gold build with plugins enabled
1830 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1831 * configure.ac: Export DLOPEN_LIBS and add headers check.
1832 * plugin.cc: Handle non-dlfcn case.
1833 * Makefile.in: Regenerate.
1834 * config.in: Regenerate.
1835 * configure: Regenerate.
1836 * testsuite/Makefile.in: Regenerate.
1837
1838 2013-01-09 Sriraman Tallam <tmsriram@google.com>
1839
1840 * output.h (sort_attached_input_sections): Change to be public.
1841 * script-sections.cc
1842 (Output_section_definition::set_section_addresses): Sort
1843 attached input sections according to section order before linker
1844 script assigns section addresses.
1845 (Orphan_output_section::set_section_addresses): Sort
1846 attached input sections according to section order before linker
1847 script assigns section addresses.
1848 * Makefile.am (final_layout.sh): Use a simple linker script to
1849 check if section ordering still works.
1850 * Makefile.in: Regenerate.
1851
1852 2013-01-09 Ben Cheng <bccheng@google.com>
1853
1854 * arm.cc (Target_arm::attributes_accept_div): New function.
1855 (Target_arm::attributes_forbid_div): New function.
1856 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1857 attribute using the same new functions as what bfd/elf32_arm.c
1858 does.
1859
1860 2013-01-07 Cary Coutant <ccoutant@google.com>
1861
1862 PR gold/14993
1863 * output.cc (Output_section::add_input_section): For incremental
1864 updates, don't track input sections that are allocated from patch
1865 space.
1866
1867 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1868 Ian Lance Taylor <iant@google.com>
1869
1870 PR gold/14897
1871 * configure.ac (--enable-ld): Removed.
1872 (install_as_default): Set to yes only for --enable-gold=default
1873 or --disable-ld.
1874 * configure: Regenerated.
1875
1876 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
1877
1878 * options.h (General_options): Add -fuse-ld= for GCC linker
1879 option compatibility.
1880
1881 2013-01-04 Cary Coutant <ccoutant@google.com>
1882
1883 * configure.ac: Fix typo restoring CXXFLAGS.
1884 * configure: Regenerate.
1885
1886 2013-01-04 Cary Coutant <ccoutant@google.com>
1887
1888 * testsuite/Makefile.am (CXXLINK_S): New macro.
1889 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1890 * testsuite/Makefile.in: Regenerate.
1891
1892 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
1893
1894 * version.cc (print_version): Update copyright year to 2013.
1895
1896 2012-12-20 Ian Lance Taylor <iant@google.com>
1897
1898 * layout.cc (Layout::special_ordering_of_input_section): New
1899 function.
1900 (Layout::layout): If input section requires special ordering, must
1901 sort input sections.
1902 (Layout::make_output_section): May sort .text input sections.
1903 (Layout::is_section_name_prefix_grouped): Remove.
1904 * layout.h (class Layout): Declare
1905 special_ordering_of_input_section. Don't declare
1906 is_section_name_prefix_grouped.
1907 * output.cc (Output_section::add_input_section): Revert last
1908 change.
1909 (Output_section::Input_section_sort::match_file_name): Don't crash
1910 if called on output section data.
1911 (Output_section::Input_section_sort_compare): Sort based on
1912 special ordering.
1913 (Output_section::Input_section_sort_section_order_index_compare):
1914 Revert last patch.
1915 (Output_section::sort_attached_input_sections): Likewise.
1916
1917 2012-12-18 Sriraman Tallam <tmsriram@google.com>
1918
1919 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1920 * layout.h (Layout::is_section_name_prefix_grouped): New function.
1921 * output.cc (Output_section::add_input_section): Check if section
1922 name contains special prefix. Keep input sections to sort such
1923 sections.
1924 (Output_section::Input_section_sort_section_order_index_compare
1925 ::operator()): Group sections according to prefixes.
1926 (Output_section::sort_attached_input_sections): Add condition to
1927 Input_section_entry constructor call.
1928 * testsuite/Makefile.am (text_section_grouping): New test.
1929 * testsuite/Makefile.in: Regenerate.
1930 * testsuite/text_section_grouping.cc: New file.
1931 * testsuite/text_section_grouping.sh: New file.
1932
1933 2012-12-17 Nick Clifton <nickc@redhat.com>
1934
1935 * Makefile.am: Add copyright notice.
1936 * NEWS: Likewise.
1937 * README: Likewise.
1938 * configure.ac: Likewise.
1939 * ftruncate.c: Likewise.
1940 * Makefile.in: Regenerate.
1941
1942 2012-12-14 Cary Coutant <ccoutant@google.com>
1943
1944 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1945 --no-as-needed flag.
1946 (exception_separate_shared_12_test): Likewise.
1947 (incremental_copy_test): Likewise.
1948 * testsuite/Makefile.in: Regenerate.
1949
1950 2012-12-14 Cary Coutant <ccoutant@google.com>
1951
1952 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1953 (Dwp_output_file::Dwp_index::enter_set): Add assert.
1954
1955 2012-12-12 Alan Modra <amodra@gmail.com>
1956
1957 * powerpc.cc (class Track_tls): New.
1958 (class Relocate, class Scan): Inherit Track_tls.
1959 (Target_powerpc::Scan::local, global): Track tls optimization
1960 and avoid creating plt entry for __tls_get_addr if all uses
1961 are optimized away.
1962 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1963
1964 2012-12-12 Alan Modra <amodra@gmail.com>
1965
1966 * options.h (General_options): Add --toc-sort/--no-toc-sort.
1967 Replace no_toc_optimize with toc_optimize.
1968 * output.h (Output_section::input_sections): Provide non-const variant.
1969 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1970 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1971 accessors.
1972 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1973 (class Sort_toc_sections): New.
1974 (Target_powerpc::do_finalize_sections): Sort toc sections.
1975 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1976
1977 2012-12-10 Roland McGrath <mcgrathr@google.com>
1978
1979 * testsuite/binary_unittest.cc (read_all): New function.
1980 (Sized_binary_test): Use it instead of ::read.
1981 * fileread.cc (do_read): Don't assume pread always reads the whole
1982 amount in a single call.
1983
1984 2012-12-10 Alan Modra <amodra@gmail.com>
1985
1986 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1987 Set EM_PPC64 or EM_PPC here.
1988 (Target_selector_powerpc::do_recognize): Delete.
1989
1990 2012-12-10 Alan Modra <amodra@gmail.com>
1991
1992 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1993 stub_table_.
1994 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1995
1996 2012-12-07 Roland McGrath <mcgrathr@google.com>
1997
1998 * testsuite/binary_unittest.cc (Sized_binary_test):
1999 Use open_descriptor rather than ::open.
2000
2001 2012-12-07 Alan Modra <amodra@gmail.com>
2002
2003 * powerpc.cc (Stub_table::do_write): Delete redundant Address
2004 typedef and invalid_address constant.
2005 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2006 instantiate constants.
2007
2008 2012-12-06 Roland McGrath <mcgrathr@google.com>
2009
2010 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2011 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2012 * aclocal.m4: Regenerate.
2013 * configure: Regenerate.
2014 * Makefile.in: Regenerate.
2015 * testsuite/Makefile.in: Regenerate.
2016
2017 2012-12-07 Alan Modra <amodra@gmail.com>
2018
2019 * options.h (General_options): Add no_toc_optimize.
2020 * powerpc.cc (ok_lo_toc_insn): New function.
2021 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2022
2023 2012-12-06 Alan Modra <amodra@gmail.com>
2024
2025 * options.h (General_options): Add plt_align, plt_static_chain,
2026 plt_thread_safe. Update stub_group_size help text.
2027 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2028 for new plt_thread_safe_ var.
2029 (use_plt_offset): Correct comments.
2030 (Target_powerpc::do_relax): Look for thread creation symbols to
2031 determine default plt_thread_safe value. Clear plt call stubs
2032 as well as branch stubs each iteration.
2033 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2034 insn constants.
2035 (l, hi, ha, write_insn): Move earlier.
2036 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2037 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2038 plt stubs too.
2039 (Stub_table::update_size): Adjust.
2040 (Stub_table::prev_size, set_prev_size): Delete.
2041 (Stub_table::stub_align): Let --plt-align affect result.
2042 (Stub_table::plt_call_size): Calculate sizes for various stubs.
2043 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2044 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2045 (Stub_table::do_write): Support more stub variants.
2046
2047 2012-12-04 Alan Modra <amodra@gmail.com>
2048
2049 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2050 (Target_powerpc::do_define_standard_symbols): New function.
2051
2052 2012-12-03 Alan Modra <amodra@gmail.com>
2053
2054 * output.h: Formatting, whitespace.
2055
2056 2012-12-03 Alan Modra <amodra@gmail.com>
2057
2058 * layout.h (Layout::get_executable_sections): Declare.
2059 * layout.cc (Layout::get_executable_sections): New function.
2060 * arm.cc (Target_arm::group_sections): Use it.
2061 (Arm_output_section::group_sections): Delete now redundant test.
2062 * output.cc (Output_reloc::Output_reloc): Add is_relative.
2063 param to handle relative relocs.
2064 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2065 (Output_data_reloc::add_absolute): Adjust.
2066 (Output_data_reloc::add_relative): New function.
2067 (Output_data::reset_data_size): New function.
2068 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2069 (Output_section::set_addralign): New function.
2070 (Output_section::checkpoint_set_addralign): New function.
2071 (Output_section::clear_section_offsets_need_adjustment): New function.
2072 (Output_section::input_sections): Make public.
2073 * powerpc.cc (class Output_data_brlt_powerpc): New.
2074 (class Stub_table, class Stub_control): New.
2075 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2076 stub_table_, set_stub_table, stub_table): New vectors and accessor
2077 functions.
2078 (Target_powerpc::do_may_relax, do_relax, push_branch,
2079 new_stub_table, stub_tables, brlt_section, group_sections,
2080 add_branch_lookup_table, find_branch_lookup_table,
2081 write_branch_lookup_table, make_brlt_section): New functions.
2082 (Target_powerpc::struct Sort_sections, class Branch_info): New.
2083 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2084 branch_info_): New vars.
2085 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2086 make call stubs here.
2087 (Output_data_glink): Remove all call stub handling from this class.
2088 (Target_powerpc::Scan::local, global): Save interesting branch
2089 relocs and relocs for ifunc. Adjust calls to plt entry functions.
2090 (Target_powerpc::do_finalize_sections): Only make reg save/restore
2091 functions on final link.
2092 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2093 Handle long branch destinations too.
2094 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2095 do_plt_address_for_local): Adjust lookup of plt call stubs.
2096
2097 2012-11-30 Alan Modra <amodra@gmail.com>
2098
2099 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2100 relocs against protected symbols when building 32-bit shared libs.
2101
2102 2012-11-30 Alan Modra <amodra@gmail.com>
2103
2104 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2105 param. Call got_section() to make .got. Update all callers
2106 and their callers and so on.
2107
2108 2012-11-30 Alan Modra <amodra@gmail.com>
2109
2110 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2111 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2112 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2113 value if it already exists.
2114
2115 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
2116
2117 PR gold/14858
2118 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2119
2120 2012-11-14 Roland McGrath <mcgrathr@google.com>
2121
2122 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2123 than bfc instruction for data sandboxing.
2124
2125 2012-11-08 Alan Modra <amodra@gmail.com>
2126
2127 * po/POTFILES.in: Regenerate.
2128
2129 2012-11-05 Alan Modra <amodra@gmail.com>
2130
2131 * configure.ac: Apply 2012-09-10 change to config.in here.
2132 * configure: Regenerate.
2133
2134 2012-11-05 Alan Modra <amodra@gmail.com>
2135
2136 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2137 (struct Opd_ent): Use "Address" rather than "Offset".
2138 (Output_data_got_powerpc::got_base_offset): Return Valtype.
2139 (Target_powerpc::got_section): Make public.
2140 (Target_powerpc::scan_relocs): Move code setting symbols..
2141 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2142 Create _SDA_BASE_ only when referenced.
2143
2144 2012-11-02 Roland McGrath <mcgrathr@google.com>
2145
2146 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2147 from last change.
2148
2149 2012-11-01 Roland McGrath <mcgrathr@google.com>
2150
2151 * target.h (Sized_target::relocate_relocs): Use Elf_Off
2152 for offset_in_output_section parameter.
2153 (Sized_target::relocate_special_relocatable): Likewise.
2154 * arm.cc (Target_arm::relocate_relocs): Likewise.
2155 (Target_arm::relocate_special_relocatable): Likewise.
2156 * i386.cc (Target_i386::relocate_relocs): Likewise.
2157 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2158 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2159 * target-reloc.h (relocate_relocs): Likewise.
2160 * testsuite/testfile.cc (Target_test): Likewise.
2161 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2162 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2163
2164 * system.h: Move inclusion of <clocale> to after <libintl.h> in
2165 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2166
2167 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2168 parameter, which is unused in the [!F_SETFD] case.
2169
2170 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2171 SYMNDX to off_t before comparing it to this->data_size().
2172 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2173 * incremental.cc (Output_section_incremental_inputs::do_write):
2174 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2175
2176 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2177
2178 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
2179
2180 * gold.cc (Target_arm::do_adjust_elf_header): Add the
2181 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2182 in EABI_VER5.
2183
2184 2012-10-29 Cary Coutant <ccoutant@google.com>
2185
2186 * dwp.cc (usage): Add file and exit status parameters;
2187 add --help and --version options.
2188 (print_version): New function.
2189 (main): Add --help and --version options.
2190
2191 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2192
2193 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2194 final_layout_sequence.txt.
2195 * testsuite/Makefile.in: Regenerated.
2196
2197 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2198
2199 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2200 COMPILE generated by automake.
2201 (LINK1): Likewise.
2202 (CXXCOMPILE1): Likewise.
2203 (CXXLINK1): Likewise.
2204 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2205 (LINK): Likewise.
2206 (CXXCOMPILE): Likewise.
2207 (CXXLINK): Likewise.
2208 * testsuite/Makefile.in: Regenerated.
2209
2210 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2211
2212 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2213 on bad fwrite return.
2214
2215 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
2216
2217 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2218 on val.
2219
2220 2012-10-23 Cary Coutant <ccoutant@google.com>
2221
2222 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2223 * testsuite/Makefile.in: Regenerate.
2224 * testsuite/dwp_test.h: New source file.
2225 * testsuite/dwp_test_1.cc: New source file.
2226 * testsuite/dwp_test_1.s: New source file.
2227 * testsuite/dwp_test_1.sh: New source file.
2228 * testsuite/dwp_test_1b.cc: New source file.
2229 * testsuite/dwp_test_1b.s: New source file.
2230 * testsuite/dwp_test_2.cc: New source file.
2231 * testsuite/dwp_test_2.s: New source file.
2232 * testsuite/dwp_test_2.sh: New source file.
2233 * testsuite/dwp_test_main.cc: New source file.
2234 * testsuite/dwp_test_main.s: New source file.
2235
2236 2012-10-23 Cary Coutant <ccoutant@google.com>
2237
2238 * dwp.h: New header file.
2239 * dwp.cc: New source file.
2240 * gold.h: Move shared declarations to system.h.
2241 * system.h: New header file.
2242 * Makefile.am: Add dwp.
2243 * Makefile.in: Regenerate.
2244
2245 2012-10-23 Cary Coutant <ccoutant@google.com>
2246
2247 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2248 Dwarf_info_reader::read_from_pointer.
2249 (Dwarf_pubnames_table::read_header): Likewise.
2250 (Dwarf_pubnames_table::next_name): Likewise.
2251 (Dwarf_die::read_attributes): Likewise.
2252 (Dwarf_die::skip_attributes): Likewise.
2253 (Dwarf_info_reader::read_from_pointer): New function template.
2254 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2255 (Dwarf_pubnames_table): Likewise.
2256 (Dwarf_info_reader::read_from_pointer): New function template.
2257 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2258 Dwarf_pubnames_table ctor.
2259
2260 2012-10-23 Cary Coutant <ccoutant@google.com>
2261
2262 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2263 abbrev_shndx.
2264 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2265 abbrev_shndx_.
2266 (Dwarf_info_reader::set_abbrev_shndx): New method.
2267 (Dwarf_info_reader::abbrev_shndx_): New data member.
2268
2269 2012-10-23 Cary Coutant <ccoutant@google.com>
2270
2271 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2272 from object, not parameters.
2273 (Dwarf_info_reader::parse): Likewise.
2274 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2275 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2276 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2277 methods.
2278
2279 2012-10-23 Cary Coutant <ccoutant@google.com>
2280
2281 * fileread.cc (Input_file::Input_file): New constructor.
2282 * fileread.h (class Input_file): Add new constructor.
2283
2284 2012-10-18 Alan Modra <amodra@gmail.com>
2285
2286 PR gold/14727
2287 * object.cc (Relobj::is_section_name_included): Also match
2288 .sdata personality section.
2289
2290 2012-10-18 Alan Modra <amodra@gmail.com>
2291
2292 * target-reloc.h (class Default_comdat_behavior): New, package up..
2293 (get_comdat_behaviour): ..this.
2294 (relocate_section): Add Relocate_comdat_behavior template arg,
2295 adjust code to suit.
2296 * arm.cc (Target_arm::relocate_section): Adjust to suit.
2297 (Target_arm::scan_reloc_section): Likewise.
2298 * i386.cc (Target_i386::relocate_section): Likewise.
2299 * sparc.cc (Target_sparc::relocate_section): Likewise.
2300 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2301 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2302 * powerpc.cc (class Relocate_comdat_behavior): New.
2303 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
2304 gold::relocate_section with new template arg.
2305
2306 2012-10-18 Alan Modra <amodra@gmail.com>
2307
2308 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2309 dynamic relocs for GOT_TPREL got entries, without symbol if
2310 resolving locally.
2311 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2312 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2313 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2314
2315 2012-10-17 Alan Modra <amodra@gmail.com>
2316
2317 PR gold/14726
2318 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2319
2320 2012-10-16 Sriraman Tallam <tmsriram@google.com>
2321
2322 * layout.cc (Layout::include_section): Keep sections marked
2323 SHF_EXCLUDE when doing relocatable links.
2324
2325 2012-10-16 Alan Modra <amodra@gmail.com>
2326
2327 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2328 (Target_powerpc::do_finalize_sections): Call it.
2329 (Output_data_save_res): New class and supporting functions.
2330 (Target_powerpc::symval_for_branch): Only look up .opd entry for
2331 normal symbols defined in object files.
2332
2333 2012-10-12 Alan Modra <amodra@gmail.com>
2334
2335 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2336 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
2337 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2338 section if scan_opd_relocs not yet called.
2339 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2340
2341 2012-10-12 Alan Modra <amodra@gmail.com>
2342
2343 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2344 add_local_ifunc_entry): Revert last change.
2345 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2346
2347 2012-10-05 Alan Modra <amodra@gmail.com>
2348
2349 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2350 do_plt_address_for_global): New functions.
2351 (Output_data_got_powerpc::do_write): Don't segfault when linking
2352 statically.
2353 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2354 add_local_ifunc_entry): Return true on adding entry..
2355 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2356 glink->add_entry call. Remove unused symtab param. Adjust calls.
2357 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2358 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
2359 set up symbols here.
2360 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2361 syms here. Do so even when no .iplt. Don't segfault when linking
2362 statically.
2363 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
2364 new variants without reloc param.
2365 (Glink_sym_ent::Glink_sym_ent): Likewise.
2366 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2367 reloc when refs will resolve to plt call stub.
2368 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
2369 R_PPC_PLTREL24 to resolve locally.
2370 (Target_powerpc::Scan::global): Correct ifunc handling.
2371 (Target_powerpc::Relocate::relocate): Correct local sym glink
2372 lookup. Don't destroy "value" when we have a plt call stub,
2373 and when checking plt call validity.
2374 (Target_powerpc::do_dynsym_value): Simplify.
2375
2376 2012-10-05 Alan Modra <amodra@gmail.com>
2377
2378 * i386.cc (Output_data_plt_i386::address_for_global,
2379 address_for_local): Add plt offset to returned value. Adjust uses.
2380 * sparc.cc (Output_data_plt_sparc::address_for_global,
2381 address_for_local): Likewise.
2382 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2383 address_for_local): Likewise.
2384 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2385 address_for_local): Likewise.
2386 * target.h (Target::plt_address_for_global, plt_address_for_local):
2387 Update comment.
2388 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2389 (Output_data_got::Got_entry::write): Nor here.
2390 * output.h: Comment fix.
2391
2392 2012-10-02 Jiong Wang <jiwang@tilera.com>
2393
2394 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2395 global_offset_table_ value for larget got.
2396 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2397
2398 2012-09-29 Alan Modra <amodra@gmail.com>
2399
2400 * powerpc.cc (Target_powerpc::iplt_): New output section.
2401 (Target_powerpc::iplt_section, make_iplt_section,
2402 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2403 (Target_powerpc::make_plt_entry): Handle ifunc syms.
2404 Target_powerpc::plt_entry_count): Count iplt entries too.
2405 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2406 reloc section in constructor. New params.
2407 (Target_powerpc::make_plt_section): Create reloc section here instead.
2408 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2409 functions.
2410 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2411 (Output_data_glink::add_entry, find_entry): New functions to
2412 deal with local syms.
2413 (Glink_sym_ent): Add support for local syms.
2414 (Output_data_glink::do_write): Handle ifunc plt entries.
2415 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2416 (Target_powerpc::Scan::local, global): Handle ifunc syms.
2417 (Target_powerpc::Relocate::relocate): Likewise.
2418 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2419
2420 2012-09-25 Alan Modra <amodra@gmail.com>
2421
2422 * object.h (Sized_relobj_file::adjust_local_symbol,
2423 do_adjust_local_symbol): New functions.
2424 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2425 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2426 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2427 and irregular opd entry spacing.
2428 (Powerpc_relobj::do_read_relocs): Add opd size checks.
2429 (Global_symbol_visitor_opd): New functor.
2430 (Target_powerpc::do_finalize_sections): Omit global symbols defined
2431 on deleted opd entries.
2432
2433 2012-09-15 Jiong Wang <jiwang@tilera.com>
2434
2435 * tilegx.cc: New file.
2436 * Makefile.am (TARGETSOURCES): Add tilegx.cc
2437 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2438 * configure.tgt: Add entries for tilegx*.
2439 * configure.ac: Likewise.
2440 * Makefile.in: Rebuild.
2441 * configure: Likewise.
2442 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2443 tilegx.
2444
2445 2012-09-13 Alan Modra <amodra@gmail.com>
2446
2447 * target-reloc.h (scan_relocs): Call scan.local for relocs
2448 against symbols in discarded sections. Pass is_discarded
2449 param.
2450 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2451 Add is_discarded param.
2452 * powerpc (Target_powerpc::Scan::local): Likewise. Use
2453 is_discarded to flag opd entry as discarded. Don't emit dyn
2454 relocs on such entries.
2455 (Target_powerpc::Scan::global): Similarly detect and handle
2456 such opd entries.
2457 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2458 opd_ent_. Update all uses.
2459 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2460 (Target_powerpc::relocate_section): Zero out discarded opd
2461 entry relocs.
2462
2463 2012-09-12 Ian Lance Taylor <iant@google.com>
2464
2465 PR gold/14570
2466 * output.cc: Rename Output_data_got template parameter from size
2467 to got_size for all functions. Compile all variants of
2468 Output_data_got.
2469 (Output_data_got::Got_entry::write): Correct use of size for
2470 symbol value. Use local_is_tls rather than casting to
2471 Sized_relobj_file.
2472 * object.h (class Object): Add local_is_tls and do_local_is_tls.
2473 (class Sized_relobj_file): Add do_local_is_tls.
2474 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2475
2476 2012-09-11 Alan Modra <amodra@gmail.com>
2477
2478 PR gold/14566
2479 * layout.cc (Layout::set_segment_offsets): When using
2480 common-page-size alignment, ensure we are on a new max-page-size
2481 page.
2482 * output.cc (Output_segment::set_section_addresses): Use
2483 abi_pagesize, not common_pagesize for relro boundary.
2484 (Output_segment::set_offset): Likewise.
2485
2486 2012-09-11 Alan Modra <amodra@gmail.com>
2487
2488 * output.h (Output_data_got::add_global_tls, add_local_tls,
2489 add_local_tls_pair): New functions.
2490 (Output_data_got::add_local_pair_with_rel): Remove second
2491 reloc param. Expand comment.
2492 (Output_data_got::Got_entry): Rename use_plt_offset_ to
2493 use_plt_or_tls_offset_, similarly for constructor param.
2494 (Output_data_got::Got_entry::write): Add got_index param.
2495 * output.cc (Output_data_got::add_global_tls, add_local_tls,
2496 add_local_tls_pair): New functions.
2497 (Output_data_got::Got_entry::write): Handle tls symbols
2498 with use_plt_or_tls_offset_ set specially.
2499 (Output_data_got::add_local_pair_with_rel): Only one reloc.
2500 (Output_data_got::do_write): Replace iterator with index, pass
2501 index to entry write function.
2502 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2503 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2504 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2505 call.
2506 * i386.cc (Target_i386::Scan::local): Likewise.
2507 * sparc.cc (Target_sparc::Scan::local): Likewise.
2508 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2509 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2510 do_tls_offset_for_global): New functions.
2511 (Target_powerpc::Scan::local): Correct TLS relocations and got
2512 entry values.
2513 (Target_powerpc::Scan::global): Don't emit unnecessary
2514 dynamic relocations on TLS GOT entries.
2515
2516 2012-09-10 Matthias Klose <doko@ubuntu.com>
2517
2518 * config.in: Disable sanity check for kfreebsd.
2519
2520 2012-09-10 Sterling Augustine <saugustine@google.com>
2521
2522 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2523 (Gdb_index::pubtypes_read): New parameter.
2524 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2525 to calls.
2526 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2527 pubtypes_object_.
2528
2529 2012-09-09 Alan Modra <amodra@gmail.com>
2530
2531 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2532 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2533 * gc.h (gc_process_relocs): Call target gc_add_reference.
2534 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2535 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2536 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2537 unnecessary cast.
2538 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2539 to cater for when we don't need code offset. Update use.
2540 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2541 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2542 set_opd_valid): New functions.
2543 (Target_powerpc::do_gc_add_reference): New function.
2544 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2545 stashed refs.
2546 (Target_powerpc::do_gc_mark_symbol): New function.
2547
2548 2012-09-06 Cary Coutant <ccoutant@google.com>
2549
2550 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2551 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2552 (Dwarf_die::skip_attributes): Likewise.
2553 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2554 * testsuite/gdb_index_test.cc (inline_func_1): New function.
2555 (main): Call it.
2556 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2557
2558 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
2559
2560 * testsuite/script_test_3.t: Add .got.plt output section
2561 statement.
2562 * testsuite/script_test_4.t: Likewise.
2563
2564 2012-09-05 Alan Modra <amodra@gmail.com>
2565
2566 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2567 update all uses and lose "enum" when using type.
2568
2569 2012-09-05 Alan Modra <amodra@gmail.com>
2570
2571 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2572 * configure: Regenerate.
2573 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2574 (plugin_final_layout.stdout): Likewise.
2575 (memory_test): Set page sizes to 0x1000.
2576 * testsuite/Makefile.in: Regenerate.
2577 * testsuite/discard_locals_test.sh: Add FIXME comment.
2578 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2579 * testsuite/pr14265.t: Add .got output section statement.
2580 * testsuite/script_test_2.t: Likewise.
2581 * testsuite/script_test_3.t: Likewise.
2582 * testsuite/script_test_4.t: Likewise.
2583 * testsuite/script_test_5.t: Likewise.
2584 * testsuite/script_test_6.t: Likewise.
2585 * testsuite/script_test_7.t: Likewise.
2586 * testsuite/script_test_9.t: Likewise.
2587
2588 2012-09-05 Alan Modra <amodra@gmail.com>
2589
2590 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2591 (Powerpc_relocate_functions::Status): New typedef.
2592 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2593 (Target_powerpc::Scan::local): Handle REL64.
2594 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2595 for REL32 and REL64.
2596 (Target_powerpc::symval_for_branch): New function, extracted from..
2597 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
2598 checks. Report overflow errors.
2599
2600 2012-09-05 Alan Modra <amodra@gmail.com>
2601
2602 * object.h (Sized_relobj_file::emit_relocs): Delete.
2603 (Sized_relobj_file::emit_relocs_reltype): Delete.
2604 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2605 relocate_relocs for --emit-relocs.
2606 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2607 * output.h: Update comment.
2608 (Output_segment::first_section): New function.
2609 (Output_segment::first_section_load_address): Use first_section.
2610 * output.cc (Output_segment::first_section): New function extracted..
2611 (Output_segment::first_section_load_address): ..from here. Delete.
2612 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2613 * target.h (Sized_target::relocate_for_relocatable): Likewise.
2614 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2615 adjust call to target.h function.
2616 * i386.cc (Target_i386): Likewise.
2617 * sparc.cc (Target_sparc): Likewise.
2618 * x86_64.cc (Target_x86_64): Likewise.
2619 * powerpc.cc (Target_powerpc): Likewise.
2620 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
2621 first tls section has section symbol for optimised local dynamic
2622 output relocs.
2623 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2624 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2625 optimised tls code.
2626 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2627 Rename to relocate_relocs. Update error message.
2628
2629 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
2630
2631 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2632 --just-symbols.
2633
2634 2012-08-31 Alan Modra <amodra@gmail.com>
2635
2636 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2637 (Powerpc_relobj::toc_base_offset): New stub function.
2638 (Target_powerpc): Add tp_offset, dtp_offset. Rename
2639 got_mod_index_offset to tlsld_got_offset. Update all refs.
2640 (Target_powerpc::Relocate::enum skip_tls): New.
2641 (Target_powerpc::call_tls_get_addr_): New var.
2642 (Target_powerpc::is_branch_reloc): Move to file scope.
2643 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2644 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2645 New functions.
2646 (Target_powerpc::enum Got_type): Delete old values, add new ones.
2647 (powerpc_info): Correct common_pagesize for ppc64.
2648 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2649 (Powerpc_relocate_functions): Add overflow check enums and functions.
2650 Add non-shift version of rela, rela_ua. Delete all rel public
2651 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
2652 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2653 addr16_ha3, addr14 functions.
2654 (Output_data_got_powerpc::add_constant_pair): New function.
2655 (Output_data_got_powerpc::got_base_offset): Likewise.
2656 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2657 (instruction constants): Sort, add some more.
2658 (Output_data_glink::do_write): Add and use Address typedef. Use
2659 object->toc_base_offset() stub for 64-bit.
2660 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2661 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2662 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2663 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
2664 Always treat .opd relocs as against locally defined symbol.
2665 Correct condition for RELATIVE relocs.
2666 (Target_powerpc::do_finalize_sections): Test for NULL sections.
2667 (Target_powerpc::Relocate::relocate): Use plt call stub as value
2668 for 32-bit syms with a plt entry. Correct ppc64 toc base
2669 calculations. Handle TLS relocs, and more. Add overflow
2670 checking and adjust for Powerpc_relocate_functions changes.
2671 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2672 Reinstate --emit-relocs code with FIXME.
2673
2674 2012-08-30 Alan Modra <amodra@gmail.com>
2675
2676 * layout.cc (Layout::set_segment_offsets): Set p_align to
2677 abi_pagesize, not common_pagesize.
2678 (Layout::relaxation_loop_body): Similarly use abi_pagesize
2679 to determine whether file header can go in segment.
2680
2681 2012-08-30 Alan Modra <amodra@gmail.com>
2682
2683 * output.h (Output_reloc::Output_reloc <output section>): Add
2684 is_relative param. Adjust calls.
2685 (Output_reloc::add_output_section_relative): New functions.
2686 * output.cc (Output_reloc::Output_reloc <output section>): Handle
2687 is_relative.
2688 (Output_reloc::symbol_value): Handle SECTION_CODE.
2689
2690 2012-08-24 Sriraman Tallam <tmsriram@google.com>
2691
2692 * gold.cc (queue_middle_tasks): Call layout again when unique
2693 segments for sections is desired.
2694 * layout.cc (Layout::Layout): Initialize new members.
2695 (Layout::get_output_section_flags): New function.
2696 (Layout::choose_output_section): Call get_output_section_flags.
2697 (Layout::layout): Make output section for mapping to a unique segment.
2698 (Layout::insert_section_segment_map): New function.
2699 (Layout::attach_allocated_section_to_segment): Make unique segment for
2700 output sections marked so.
2701 (Layout::segment_precedes): Check for unique segments when sorting.
2702 * layout.h (Layout::Unique_segment_info): New struct.
2703 (Layout::Section_segment_map): New typedef.
2704 (Layout::insert_section_segment_map): New function.
2705 (Layout::get_output_section_flags): New function.
2706 (Layout::is_unique_segment_for_sections_specified): New function.
2707 (Layout::set_unique_segment_for_sections_specified): New function.
2708 (Layout::unique_segment_for_sections_specified_): New member.
2709 (Layout::section_segment_map_): New member.
2710 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2711 Rename is_gc_pass_one to is_pass_one.
2712 Rename is_gc_pass_two to is_pass_two.
2713 Rename is_gc_or_icf to is_two_pass.
2714 Check for which pass based on whether symbols data is present.
2715 Make it two pass when unique segments for sections is desired.
2716 * output.cc (Output_section::Output_section): Initialize new
2717 members.
2718 * output.h (Output_section::is_unique_segment): New function.
2719 (Output_section::set_is_unique_segment): New function.
2720 (Output_section::is_unique_segment_): New member.
2721 (Output_section::extra_segment_flags): New function.
2722 (Output_section::set_extra_segment_flags): New function.
2723 (Output_section::extra_segment_flags_): New member.
2724 (Output_section::segment_alignment): New function.
2725 (Output_section::set_segment_alignment): New function.
2726 (Output_section::segment_alignment_): New member.
2727 (Output_segment::Output_segment): Initialize is_unique_segment_.
2728 (Output_segment::is_unique_segment): New function.
2729 (Output_segment::set_is_unique_segment): New function.
2730 (Output_segment::is_unique_segment_): New member.
2731 * plugin.cc (allow_unique_segment_for_sections): New function.
2732 (unique_segment_for_sections): New function.
2733 (Plugin::load): Add new functions to transfer vector.
2734 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2735 * Makefile.in: Regenerate.
2736 * testsuite/plugin_final_layout.sh: Check if unique segment
2737 functionality works.
2738 * testsuite/plugin_section_order.c (onload): Check if new interfaces
2739 are available.
2740 (allow_unique_segment_for_sections): New global.
2741 (unique_segment_for_sections): New global.
2742 (claim_file_hook): Call allow_unique_segment_for_sections.
2743 (all_symbols_read_hook): Call unique_segment_for_sections.
2744
2745 2012-08-22 Cary Coutant <ccoutant@google.com>
2746
2747 * layout.cc (Layout::include_section): Don't assert on GROUP
2748 sections with --emit-relocs.
2749
2750 2012-08-21 Cary Coutant <ccoutant@google.com>
2751
2752 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2753 if --export-dynamic-symbol names an undef symbol.
2754
2755 2012-08-18 Alan Modra <amodra@gmail.com>
2756
2757 * powerpc.cc: Formatting and white space.
2758 (Powerpc_relobj): Rename got2_section_ to special_.
2759 Add opd_ent_shndx_ and opd_ent_off_ vectors.
2760 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2761 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2762 (Target_powerpc): Add Address typedef and invalid_address. Use
2763 throughout.
2764 (Target_powerpc::is_branch_reloc): New function.
2765 (Powerpc_relocate_functions): Add Address typedef, use throughout.
2766 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2767 for dst_mask, value and addend.
2768 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2769 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2770 (Output_data_glink::do_write): Correct toc base. Don't try to use
2771 uint16_t for 24-bit offset. Use get_output_section_offset and
2772 check return.
2773 (Target_powerpc::Scan::local): Handle more relocs.
2774 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2775 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2776 Plug in toc restoring insn after plt calls. Translate branches
2777 to function descriptor symbols to corresponding entry point.
2778 (Target_powerpc::relocate_for_relocatable): Check return from
2779 get_output_section_offset.
2780 * symtab.h: Comment typo.
2781
2782 2012-08-14 Ian Lance Taylor <iant@google.com>
2783
2784 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2785 unsupported_relocal_local to call unsupported_reloc_global.
2786
2787 2012-08-14 Nick Clifton <nickc@redhat.com>
2788
2789 PR ld/14265
2790 * script-sections.cc (Sections_element::output_section_name): Add
2791 keep return parameter.
2792 (Output_section_element::match_name): Add keep return parameter.
2793 Return the value of the keep_ member.
2794 * script-sections.h (class Output_section): Update
2795 output_section_name prototype.
2796 * layout.cc (Layout::keep_input_section): New public member
2797 function.
2798 (Layout::choose_output_section): Pass keep parameter to
2799 output_section_name.
2800 * layout.h (class Layout): Add keep_input_section.
2801 * object.cc (Sized_relobj_file::do_layout): Check for kept input
2802 sections.
2803 * testsuite/Makefile.am: Add a test.
2804 * testsuite/Makefile.in: Regenerate.
2805 * testsuite/pr14265.c: Source file for the test.
2806 * testsuite/pr14265.t: Linker script for the test.
2807 * testsuite/pr14265.sh: Shell script for the test.
2808
2809 2012-08-14 Alan Modra <amodra@gmail.com>
2810
2811 * target.h (Target::output_section_name): New function.
2812 (Target::do_output_section_name): New function.
2813 * layout.cc (Layout::choose_output_section): Call the above.
2814 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2815
2816 2012-08-14 Alan Modra <amodra@gmail.com>
2817
2818 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2819 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2820 for replace_constant call.
2821 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2822 (Output_data_glink::do_print_to_mapfile): New function.
2823 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2824 (Target_powerpc::Relocate::relocate): Likewise.
2825
2826 2012-08-14 Alan Modra <amodra@gmail.com>
2827
2828 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2829 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2830 (Output_data_glink::add_entry,find_entry): Remove shndx param.
2831 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
2832 all references to shndx_. Handle special case for R_PPC_PLTREL24
2833 here.
2834 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2835 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2836 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2837 here.
2838 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2839 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2840
2841 2012-08-12 Alan Modra <amodra@gmail.com>
2842
2843 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
2844 (glink insn constants): Use uint32_t.
2845 (Output_data_glink::add_entry): Use insert, not [] operator.
2846
2847 2012-08-11 Alan Modra <amodra@gmail.com>
2848
2849 * object.h (Sized_relobj_file::find_shdr): New function.
2850 (Sized_relobj_file::find_special_sections): New function.
2851 * object.cc (Sized_relobj_file::find_shdr): New function.
2852 (Sized_relobj_file::find_eh_frame): Use find_shdr.
2853 (Sized_relobj_file::find_special_sections): New function, split out..
2854 (Sized_relobj_file::do_read_symbols): ..from here.
2855 * output.h (Output_data_got::replace_constant): New function.
2856 (Output_data_got::num_entries): New function.
2857 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2858 (Output_data_got::got_offset): Protected rather than private.
2859 (Output_data_got::replace_got_entry): New function.
2860 * output.cc (Output_data_got::replace_got_entry): New function.
2861 * powerpc.cc (class Powerpc_relobj): New.
2862 (class Powerpc_relocate_functions): Delete all psymval variants or
2863 convert to value,addend type. Delete pcrela, pcrela_unaligned.
2864 Implement _ha functions using corresponding _hi function.
2865 (Powerpc_relobj::find_special_sections): New function.
2866 (Target_powerpc::do_make_elf_object): New function.
2867 (class Output_data_got_powerpc): New.
2868 (class Output_data_glink): New.
2869 (class Powerpc_scan_relocatable_reloc): New.
2870 Many more changes througout file.
2871
2872 2012-08-09 Nick Clifton <nickc@redhat.com>
2873
2874 * po/vi.po: Updated Vietnamese translation.
2875
2876 2012-08-07 Ian Lance Taylor <iant@google.com>
2877
2878 * layout.cc (Layout::add_target_dynamic_tags): If
2879 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2880 plt_rel.
2881
2882 2012-07-30 Nick Clifton <nickc@redhat.com>
2883
2884 * po/gold.pot: Updated template.
2885 * po/es.po: Updated Spanish translation.
2886
2887 2012-07-18 Cary Coutant <ccoutant@google.com>
2888
2889 PR gold/14344
2890 * configure.ac: Add check for -gpubnames support.
2891 * configure: Regenerate.
2892 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2893 support; force -gno-pubnames.
2894 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2895 support.
2896 (gdb_index_test_4): New test.
2897 * testsuite/Makefile.in: Regenerate.
2898 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2899 * testsuite/gdb_index_test_2.sh: Likewise.
2900 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2901 * testsuite/gdb_index_test_4.sh: New script.
2902 * testsuite/gdb_index_test_comm.sh: New script with common code;
2903 don't look for space after colon.
2904
2905 2012-07-16 Sriraman Tallam <tmsriram@google.com>
2906
2907 * gold.cc (queue_middle_tasks): Update function order only after
2908 deferred objects due to plugins are processed.
2909
2910 2012-07-11 Ian Lance Taylor <iant@google.com>
2911
2912 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2913 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2914 (Target_arm::scan_reloc_for_stub): Likewise.
2915 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2916 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2917 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2918 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2919 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2920
2921 2012-07-10 Dodji Seketeli <dodji@redhat.com>
2922 Ian Lance Taylor <iant@google.com>
2923
2924 PR gold/14309
2925 * configure.ac: Test whether std::tr1::hash<off_t> works.
2926 * gold.h: Add a specialization for std::tr1::hash<off_t> if
2927 needed.
2928 * output.h (class Output_fill): Add virtual destructor.
2929 * configure, config.in: Rebuild.
2930
2931 2012-06-22 Roland McGrath <mcgrathr@google.com>
2932
2933 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2934
2935 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
2936
2937 * plugin.cc (Plugin::load): Handle position independent executables.
2938
2939 2012-06-06 Cary Coutant <ccoutant@google.com>
2940
2941 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2942 add .debug_macro.
2943 (lines_only_debug_sections): Likewise.
2944 (gdb_fast_lookup_sections): New static array.
2945 (is_gdb_debug_section): Rename formal parameter.
2946 (is_lines_only_debug_section): Likewise.
2947 (is_gdb_fast_lookup_section): New function.
2948 (Layout::include_section): Check for ".zdebug_" prefix; pass
2949 section name suffix to is_gdb_debug_section, et al.; check for
2950 fast-lookup sections when building .gdb_index.
2951 * options.h (--strip-debug-gdb): Update GDB version number.
2952
2953 2012-06-06 Cary Coutant <ccoutant@google.com>
2954
2955 * configure.ac: Add check for fallocate.
2956 * configure: Regenerate.
2957 * config.in: Regenerate.
2958
2959 * options.h (class General_options): Add --mmap-output-file and
2960 --posix-fallocate options.
2961 * output.cc: (posix_fallocate): Remove; replace with...
2962 (gold_fallocate): New function.
2963 (Output_file::map_no_anonymous): Call gold_fallocate.
2964 (Output_file::map): Check --mmap-output-file option.
2965
2966 2012-06-05 Jing Yu <jingyu@google.com>
2967
2968 * gold.h (textdomain): Add do {} to empty while(0).
2969 (bindtextdomain): Likewise.
2970
2971 2012-06-04 Cary Coutant <ccoutant@google.com>
2972
2973 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2974 has_dynsym_index.
2975
2976 2012-05-25 Sriraman Tallam <tmsriram@google.com>
2977
2978 * symtab.cc (Symbol_table::define_special_symbol):
2979 Initialize *poldsym to prevent uninitialized variable errors.
2980
2981 2012-05-23 Cary Coutant <ccoutant@google.com>
2982
2983 * layout.cc (Layout::section_name_mapping): Add rules to handle
2984 exact match on .data.rel.ro.local or .data.rel.ro.
2985 (Layout::output_section_name): Check for exact matches.
2986
2987 2012-05-23 Cary Coutant <ccoutant@google.com>
2988
2989 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2990 more carefully.
2991
2992 2012-05-22 Cary Coutant <ccoutant@google.com>
2993
2994 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2995 object before exporting symbol.
2996
2997 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
2998
2999 * testsuite/tls_test.cc: Include "config.h" first.
3000 * testsuite/tls_test_c.c: Likewise.
3001
3002 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
3003 Nick Clifton <nickc@redhat.com>
3004
3005 PR 14072
3006 * configure.in: Add check that sysdep.h has been included before
3007 any system header files.
3008 * configure: Regenerate.
3009 * config.in: Regenerate.
3010
3011 2012-05-14 Cary Coutant <ccoutant@google.com>
3012
3013 * layout.cc (Layout::make_output_section): Mark .tdata section
3014 as RELRO.
3015 * testsuite/relro_test.cc: Add a TLS variable.
3016
3017 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
3018
3019 PR gold/14091
3020 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3021 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3022 R_X86_64_64.
3023
3024 2012-05-08 Cary Coutant <ccoutant@google.com>
3025
3026 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3027 (lines_only_debug_sections): Likewise.
3028
3029 2012-05-02 Roland McGrath <mcgrathr@google.com>
3030
3031 * nacl.cc: New file.
3032 * nacl.h: New file.
3033 * Makefile.am (CCFILES, HFILES): Add them.
3034 * Makefile.in: Regenerate.
3035 * i386.cc (Output_data_plt_i386_nacl): New class.
3036 (Output_data_plt_i386_nacl_exec): New class.
3037 (Output_data_plt_i386_nacl_dyn): New class.
3038 (Target_i386_nacl): New class.
3039 (Target_selector_i386_nacl): New class.
3040 (target_selector_i386): Use it instead of Target_selector_i386.
3041 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3042 (Target_x86_64_nacl): New class.
3043 (Target_selector_x86_64_nacl): New class.
3044 (target_selector_x86_64, target_selector_x32): Use it instead of
3045 Target_selector_x86_64.
3046 * arm.cc (Output_data_plt_arm_nacl): New class.
3047 (Target_arm_nacl): New class.
3048 (Target_selector_arm_nacl): New class.
3049 (target_selector_arm, target_selector_armbe): Use it instead of
3050 Target_selector_arm.
3051
3052 * target-select.cc (select_target): Take new Input_file* and off_t
3053 arguments, pass them on to recognize method of selector.
3054 * object.cc (make_elf_sized_object): Update caller.
3055 * parameters.cc (parameters_force_valid_target): Likewise.
3056 * incremental.cc (make_sized_incremental_binary): Likewise.
3057 * target-select.h: Update decl.
3058 (Target_selector::recognize): Take new Input_file* argument,
3059 pass it on to do_recognize.
3060 (Target_selector::do_recognize): Take new Input_file* argument.
3061 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3062 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3063 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3064 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3065
3066 * target.h (Target::Target_info): New members isolate_execinstr
3067 and rosegment_gap.
3068 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3069 * arm.cc (Target_arm::arm_info): Update initializer.
3070 * i386.cc (Target_i386::i386_info): Likewise.
3071 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3072 * sparc.cc (Target_sparc::sparc_info): Likewise.
3073 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3074 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3075 * layout.cc (Layout::attach_allocated_section_to_segment):
3076 Take new const Target* argument. If target->isolate_execinstr(), act
3077 like --rosegment.
3078 (Layout::find_first_load_seg): Take new const Target* argument;
3079 if target->isolate_execinstr(), reject PF_X segments.
3080 (Layout::relaxation_loop_body): Update caller.
3081 (Layout::set_segment_offsets): If target->isolate_execinstr(),
3082 reset file offset to zero when we hit LOAD_SEG, and then do a second
3083 loop over the segments before LOAD_SEG to reassign offsets after
3084 addresses have been determined. Handle target->rosegment_gap().
3085 (Layout::attach_section_to_segment): Take new const Target* argument;
3086 pass it to attach_allocated_section_to_segment.
3087 (Layout::make_output_section): Update caller.
3088 (Layout::attach_sections_to_segments): Take new const Target* argument;
3089 pass it to attach_section_to_segment.
3090 * gold.cc (queue_middle_tasks): Update caller.
3091 * layout.h (Layout): Update method decls with new arguments.
3092
3093 * arm.cc (Target_arm::Target_arm): Take optional argument for the
3094 Target_info pointer to use.
3095 (Target_arm::do_make_data_plt): New virtual method.
3096 (Target_arm::make_data_plt): New method that calls it.
3097 (Target_arm::make_plt_entry): Use it.
3098 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3099 for the section alignment.
3100 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3101 method.
3102 (Output_data_plt_arm::first_plt_entry_offset): Call it.
3103 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3104 method.
3105 (Output_data_plt_arm::get_plt_entry_size): Call it.
3106 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3107 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3108 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3109 method.
3110 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3111 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3112 method instead of sizeof(plt_entry).
3113 (Output_data_plt_arm::add_entry): Likewise.
3114 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3115 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3116 than static method.
3117 (Target_arm::plt_entry_size): Likewise.
3118 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3119 Move to ...
3120 (Output_data_plt_arm_standard): ... here, new class.
3121 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3122 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3123 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3124
3125 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3126 Take additional argument for the PLT entry size.
3127 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3128 Use get_plt_entry_size method rather than plt_entry_size variable.
3129 (Output_data_plt_x86_64::reserve_slot): Likewise.
3130 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3131 (Output_data_plt_x86_64::add_entry): Likewise.
3132 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3133 (Output_data_plt_x86_64::address_for_global): Likewise.
3134 (Output_data_plt_x86_64::address_for_local): Likewise.
3135 (Output_data_plt_x86_64::set_final_data_size): Likewise.
3136 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3137 Make method non-static.
3138 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3139 method.
3140 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3141 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3142 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3143 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3144 virtual method.
3145 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3146 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3147 virtual method.
3148 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3149 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3150 virtual method.
3151 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3152 (Output_data_plt_x86_64::plt_entry_size)
3153 (Output_data_plt_x86_64::first_plt_entry)
3154 (Output_data_plt_x86_64::plt_entry)
3155 (Output_data_plt_x86_64::tlsdesc_plt_entry)
3156 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3157 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3158 (Output_data_plt_x86_64_standard): ... here, new class.
3159 (Target_x86_64::Target_x86_64): Take optional argument for the
3160 Target_info pointer to use.
3161 (Target_x86_64::do_make_data_plt): New virtual method.
3162 (Target_x86_64::make_data_plt): New method to call it.
3163 (Target_x86_64::init_got_plt_for_update): Use that.
3164 Call this->plt_->add_eh_frame method here.
3165 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3166 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3167 rather than static method.
3168 (Target_x86_64::plt_entry_size): Likewise.
3169 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3170 rather than plt_entry_size variable. Move guts of PLT filling to...
3171 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3172 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3173 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3174
3175 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3176 additional argument for the section alignment.
3177 Don't do add_eh_frame_for_plt here.
3178 (Output_data_plt_i386::first_plt_entry_offset): Make the method
3179 non-static. Use get_plt_entry_size method rather than plt_entry_size
3180 variable.
3181 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3182 method.
3183 (Output_data_plt_i386::get_plt_entry_size): Call it.
3184 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3185 (Output_data_plt_i386::add_eh_frame): New method to call it.
3186 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3187 method.
3188 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3189 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3190 method.
3191 (Output_data_plt_i386::fill_plt_entry): New method to call it.
3192 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3193 method instead of plt_entry_size.
3194 (Output_data_plt_i386::plt_entry_size)
3195 (Output_data_plt_i386::plt_eh_frame_fde_size)
3196 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3197 (Output_data_plt_i386_standard): ... here, new class.
3198 (Output_data_plt_i386_exec): New class.
3199 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3200 (Output_data_plt_i386_exec::first_plt_entry): ... here.
3201 (Output_data_plt_i386::exec_plt_entry): Move to ...
3202 (Output_data_plt_i386_exec::plt_entry): ... here.
3203 (Output_data_plt_i386_dyn): New class.
3204 (Output_data_plt_i386::first_plt_entry): Move to ...
3205 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3206 (Output_data_plt_i386::dyn_plt_entry): Move to ...
3207 (Output_data_plt_i386_dyn::plt_entry): ... here.
3208 (Target_i386::Target_i386): Take optional argument for the Target_info
3209 pointer to use.
3210 (Target_i386::do_make_data_plt): New virtual method.
3211 (Target_i386::make_data_plt): New method to call it.
3212 (Target_i386::make_plt_section): Use that.
3213 Call this->plt_->add_eh_frame method here.
3214 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3215 rather than plt_entry_size variable.
3216 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3217 (Output_data_plt_i386::address_for_local): Likewise.
3218 (Output_data_plt_i386::do_write): Likewise.
3219 Move guts of PLT filling to...
3220 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3221 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3222 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3223 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3224
3225 2012-05-01 Cary Coutant <ccoutant@google.com>
3226
3227 * dwarf_reader.cc (Dwarf_die::read_attributes)
3228 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3229 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3230 * reduced_debug_output.cc
3231 (Output_reduced_debug_info_section::get_die_end): Remove
3232 DW_FORM_GNU_ref_index. Add default case.
3233
3234 2012-04-26 Mark Wielaard <mjw@redhat.com>
3235
3236 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3237 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3238 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3239 DW_AT_high_pc as offset from DW_AT_low_pc.
3240
3241 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3242 * testsuite/Makefile.in: Regenerate.
3243 * testsuite/gdb_index_test_3.c: New test source file.
3244 * testsuite/gdb_index_test_3.sh: New test source file.
3245
3246 2012-04-25 Ian Lance Taylor <iant@google.com>
3247
3248 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3249 pointer.
3250 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3251 as a class, not a struct.
3252 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3253 (Target_arm::apply_cortex_a8_workaround): Likewise.
3254 * gc.h: Declare Reloc_types as a struct, not a class.
3255 * object.h: Declare Symbols_data as a struct.
3256 * reloc.h: Declare Read_relocs_data as a struct.
3257 * target.h: Declare Relocate_info as a struct.
3258
3259 2012-04-24 David S. Miller <davem@davemloft.net>
3260
3261 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3262 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3263 and R_SPARC_WPLT30.
3264
3265 2012-04-24 Cary Coutant <ccoutant@google.com>
3266
3267 * incremental-dump.cc (find_input_containing_global): Replace
3268 magic number with symbolic constant.
3269 (dump_incremental_inputs): Update version number.
3270 * incremental.cc (Output_section_incremental_inputs): Update version
3271 number; import symbolic constants from Incremental_inputs_reader.
3272 (Incremental_inputs::create_data_sections): Align relocations
3273 section correctly for 64-bit targets.
3274 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3275 constants; add padding.
3276 (Output_section_incremental_inputs::write_header): Add assert for
3277 header_size.
3278 (Output_section_incremental_inputs::write_input_files): Add assert
3279 for input_entry_size.
3280 (Output_section_incremental_inputs::write_info_blocks): Add padding;
3281 add assert for object_info_size, input_section_entry_size,
3282 global_sym_entry_size.
3283 * incremental.h (Incremental_inputs_reader): Add symbolic constants
3284 for data structure sizes; use them.
3285 (Incremental_input_entry_reader): Import symbolic constants from
3286 Incremental_inputs_reader; use them.
3287
3288 2012-04-23 David S. Miller <davem@davemloft.net>
3289
3290 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3291 and elf_flags_set_.
3292 (Target_sparc::Target_sparc): Initialize new fields.
3293 (Target_sparc::do_make_elf_object): New function.
3294 (Target_sparc::do_adjust_elf_header): New function.
3295
3296 2012-04-23 Cary Coutant <ccoutant@google.com>
3297
3298 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3299 CU range table of gdb index.
3300
3301 2012-04-20 David S. Miller <davem@davemloft.net>
3302
3303 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3304 instead of false.
3305
3306 2012-04-16 David S. Miller <davem@davemloft.net>
3307
3308 * sparc.cc (Target_sparc::got_address): New function.
3309 (Sparc_relocate_functions::gdop_hix22): New function.
3310 (Sparc_relocate_functions::gdop_lox10): New function.
3311 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3312 relocs.
3313 (Target_sparc::Scan::local): Likewise if the global symbol is not
3314 preemptible and is not IFUNC.
3315 (Target_sparc::Relocate::relocate): Perform GOTDATA code
3316 transformations for local and non-preemptible non-IFUNC global
3317 symbols.
3318
3319 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3320 writing out 64-bit part of ranges.
3321
3322 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3323 -fpic and -fpie respectively.
3324 * Makefile.in: Regenerate.
3325
3326 * sparc.cc (class Target_sparc): Add rela_ifunc_.
3327 (Target_sparc::Target_sparc): Initialize new field.
3328 (Target_sparc::do_plt_section_for_global): New function.
3329 (Target_sparc::do_plt_section_for_local): New function.
3330 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3331 (Target_sparc::make_plt_section): New function, broken out of
3332 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
3333 (Target_sparc::make_plt_entry): Call make_plt_section.
3334 (Target_sparc::make_local_ifunc_plt_entry): New function.
3335 (Target_sparc::rela_ifunc_section): New function.
3336 (Target_sparc::plt_section): Remove const.
3337 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
3338 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3339 and ifunc_count_ fields.
3340 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3341 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3342 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3343 (Output_data_plt_sparc::rela_ifunc): New function.
3344 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3345 (Output_data_plt_sparc::has_ifunc_section): New function.
3346 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3347 (Output_data_plt_sparc::address_for_global): New function.
3348 (Output_data_plt_sparc::address_for_local): New function.
3349 (Output_data_plt_sparc::plt_index_to_offset): New function.
3350 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3351 and entry_count.
3352 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3353 entry_count.
3354 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3355 R_SPARC_JMP_IREL to switch.
3356 (Target_sparc::Scan::check_non_pic): Likewise.
3357 (Target_sparc::Scan::local): Handle IFUNC symbols.
3358 (Target_sparc::Scan::local): Likewise.
3359 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3360 and plt_address_for_local.
3361 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3362 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3363
3364 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3365 (class Output_data_reloc): Adjust calls to Output_reloc_type.
3366 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3367 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3368 global relocs too.
3369 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3370 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3371 calls.
3372 * sparc.cc (Target_sparc::Scan::global): Likewise.
3373 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3374
3375 2012-04-16 Cary Coutant <ccoutant@google.com>
3376
3377 * archive.cc (Library_base::should_include_member): Check for
3378 --export-dynamic-symbol.
3379 * options.h (class General_options): Add --export-dynamic-symbol.
3380 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3381 --export-dynamic-symbol.
3382 (Symbol_table::gc_mark_undef_symbols): Likewise.
3383 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3384
3385 2012-04-12 David S. Miller <davem@davemloft.net>
3386
3387 * sparc.cc (Reloc::wdisp10): New relocation method.
3388 (Reloc::h34): Likewise.
3389 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3390 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3391 R_SPARC_WDISP10.
3392 (Target_sparc::Scan::local): Likewise.
3393 (Target_sparc::Scan::global): Likewise.
3394 (Target_sparc::Relocate::relocate): Likewise.
3395
3396 2012-04-09 Cary Coutant <ccoutant@google.com>
3397
3398 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3399 low_pc == 0.
3400
3401 2012-04-06 Ian Lance Taylor <iant@google.com>
3402
3403 * timer.cc: #include <unistd.h>.
3404
3405 2012-04-06 Roland McGrath <mcgrathr@google.com>
3406
3407 * configure.in (AC_CHECK_HEADERS): Add locale.h.
3408 * config.in: Regenerate.
3409 * configure: Regenerate.
3410
3411 2012-04-05 Nick Clifton <nickc@redhat.com>
3412
3413 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3414 (AM_LC_MESSAGES): Add.
3415 * aclocal.m4: Regenerate.
3416 * config.in: Regenerate.
3417 * configure: Regenerate.
3418
3419 2012-03-21 Cary Coutant <ccoutant@google.com>
3420
3421 * Makefile.am: Add gdb-index.cc, gdb-index.h.
3422 * Makefile.in: Regenerate.
3423 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3424 (Sized_elf_reloc_mapper::symbol_section): New function.
3425 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3426 (make_elf_reloc_mapper): New function.
3427 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3428 (Dwarf_abbrev_table::do_read_abbrevs): New function.
3429 (Dwarf_abbrev_table::do_get_abbrev): New function.
3430 (Dwarf_ranges_table::read_ranges_table): New function.
3431 (Dwarf_ranges_table::read_range_list): New function.
3432 (Dwarf_pubnames_table::read_section): New function.
3433 (Dwarf_pubnames_table::read_header): New function.
3434 (Dwarf_pubnames_table::next_name): New function.
3435 (Dwarf_die::Dwarf_die): New function.
3436 (Dwarf_die::read_attributes): New function.
3437 (Dwarf_die::skip_attributes): New function.
3438 (Dwarf_die::set_name): New function.
3439 (Dwarf_die::set_linkage_name): New function.
3440 (Dwarf_die::attribute): New function.
3441 (Dwarf_die::string_attribute): New function.
3442 (Dwarf_die::int_attribute): New function.
3443 (Dwarf_die::uint_attribute): New function.
3444 (Dwarf_die::ref_attribute): New function.
3445 (Dwarf_die::child_offset): New function.
3446 (Dwarf_die::sibling_offset): New function.
3447 (Dwarf_info_reader::check_buffer): New function.
3448 (Dwarf_info_reader::parse): New function.
3449 (Dwarf_info_reader::do_parse): New function.
3450 (Dwarf_info_reader::do_read_string_table): New function.
3451 (Dwarf_info_reader::lookup_reloc): New function.
3452 (Dwarf_info_reader::get_string): New function.
3453 (Dwarf_info_reader::visit_compilation_unit): New function.
3454 (Dwarf_info_reader::visit_type_unit): New function.
3455 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3456 Sized_elf_reloc_mapper.
3457 (Sized_dwarf_line_info::symbol_section): Remove function.
3458 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3459 (Sized_dwarf_line_info::read_line_mappings): Remove object
3460 parameter, adjust callers.
3461 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3462 * dwarf_reader.h: Include <sys/types.h>.
3463 (class Track_relocs): Remove forward declaration.
3464 (class Elf_reloc_mapper): New class.
3465 (class Sized_elf_reloc_mapper): New class.
3466 (class Dwarf_abbrev_table): New class.
3467 (class Dwarf_range_list): New class.
3468 (class Dwarf_ranges_table): New class.
3469 (class Dwarf_pubnames_table): New class.
3470 (class Dwarf_die): New class.
3471 (class Dwarf_info_reader): New class.
3472 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3473 (Sized_dwarf_line_info::symbol_section): Remove member function.
3474 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3475 base class.
3476 * gdb-index.cc: New source file.
3477 * gdb-index.h: New source file.
3478 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3479 and .debug_types sections, call Layout::add_to_gdb_index.
3480 (Sized_relobj_incr::do_section_name): Implement.
3481 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3482 return type; Implement.
3483 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3484 return type.
3485 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3486 parameter list and return type.
3487 (Sized_incr_dynobj::do_section_contents): Likewise.
3488 * layout.cc: Include gdb-index.h.
3489 (Layout::Layout): Initialize gdb_index_data_.
3490 (Layout::init_fixed_output_section): Check for .gdb_index section.
3491 (Layout::add_to_gdb_index): New function. Instantiate.
3492 * layout.h: Add forward declaration for class Gdb_index.
3493 (Layout::add_to_gdb_index): New member function.
3494 (Layout::gdb_index_data_): New data member.
3495 * main.cc: Include gdb-index.h.
3496 (main): Print statistics for gdb index.
3497 * object.cc (Object::section_contents): Move code into
3498 do_section_contents.
3499 (need_decompressed_section): Check for sections needed when building
3500 gdb index.
3501 (build_compressed_section_map): Likewise.
3502 (Sized_relobj_file::do_read_symbols): Need local symbols when building
3503 gdb index.
3504 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3505 sections; call Layout::add_to_gdb_index.
3506 (Sized_relobj_file::do_decompressed_section_contents): Call
3507 do_section_contents directly.
3508 * object.h (Object::do_section_contents): Adjust parameter list and
3509 return type.
3510 (Object::do_decompressed_section_contents): Call do_section_contents
3511 directly.
3512 (Sized_relobj_file::do_section_contents): Adjust parameter list and
3513 return type.
3514 * options.h (class General_options): Add --gdb-index option.
3515 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3516 list and return type.
3517 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3518 * reloc.h (Track_relocs::checkpoint): New function.
3519 (Track_relocs::reset): New function.
3520
3521 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3522 New test cases.
3523 * testsuite/Makefile.in: Regenerate.
3524 * testsuite/gdb_index_test.cc: New test source file.
3525 * testsuite/gdb_index_test_1.sh: New test source file.
3526 * testsuite/gdb_index_test_2.sh: New test source file.
3527
3528 2012-03-19 Doug Kwan <dougkwan@google.com>
3529
3530 * arm.cc (Target_arm::do_define_standard_symbols): New method.
3531 (Target_arm::do_finalize_sections): Remove code which defines
3532 __exidx_start and __exidx_end. Make symbol table parameter
3533 anonymous as it is not used.
3534 * gold.cc (queue_middle_tasks): Call target hook to define any
3535 target-specific symbols.
3536 * target.h (Target::define_standard_symbols): New method.
3537 (Target::do_define_standard_symbols): Same.
3538 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3539 * testsuite/Makefile.in: Regenerate.
3540 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3541 and __exidx_end.
3542 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3543 relocations are generated for __exidx_start and __exidx_end.
3544
3545 2012-03-16 Doug Kwan <dougkwan@google.com>
3546
3547 * testsuite/Makefile.am: Disable test initpri3b.
3548 * testsuite/Makefile.in: Regenerate.
3549
3550 2012-03-15 Doug Kwan <dougkwan@google.com>
3551
3552 * arm.cc (Target_arm::got_section): Make .got section read-only
3553 if -z now is given.
3554
3555 2012-03-15 Ian Lance Taylor <iant@google.com>
3556
3557 PR gold/13850
3558 * layout.cc (Layout::make_output_section): Correctly mark
3559 SHT_INIT_ARRAY, et. al., as relro.
3560
3561 2012-03-14 Doug Kwan <dougkwan@google.com>
3562
3563 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3564 dynamic relocations for protected symbols in shared objects.
3565
3566 2012-03-13 Ian Lance Taylor <iant@google.com>
3567
3568 * resolve.cc (Symbol_table::resolve): When merging common symbols,
3569 keep the larger alignment.
3570
3571 2012-03-12 Cary Coutant <ccoutant@google.com>
3572
3573 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3574 handling of DW_LNE_define_file.
3575
3576 2012-03-12 Cary Coutant <ccoutant@google.com>
3577
3578 * reduced_debug_output.cc
3579 (Output_reduced_debug_info_section::get_die_end): Add new FORM
3580 codes to switch.
3581
3582 2012-02-29 Cary Coutant <ccoutant@google.com>
3583
3584 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3585
3586 2012-02-29 Cary Coutant <ccoutant@google.com>
3587
3588 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3589 Call Object::decompressed_section_contents.
3590 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3591 New dtor.
3592 (Sized_dwarf_line_info::buffer_start_): New data member.
3593 * merge.cc (Output_merge_data::do_add_input_section): Call
3594 Object::decompressed_section_contents.
3595 (Output_merge_string::do_add_input_section): Likewise.
3596 * object.cc (need_decompressed_section): New function.
3597 (build_compressed_section_map): Decompress sections needed later.
3598 (Sized_relobj_file::do_decompressed_section_contents): New function.
3599 (Sized_relobj_file::do_discard_decompressed_sections): New function.
3600 * object.h (Object::decompressed_section_contents): New function.
3601 (Object::discard_decompressed_sections): New function.
3602 (Object::do_decompressed_section_contents): New function.
3603 (Object::do_discard_decompressed_sections): New function.
3604 (Compressed_section_info): New type.
3605 (Compressed_section_map): Include decompressed section contents.
3606 (Sized_relobj_file::do_decompressed_section_contents): New function.
3607 (Sized_relobj_file::do_discard_decompressed_sections): New function.
3608
3609 2012-02-16 Cary Coutant <ccoutant@google.com>
3610
3611 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3612 * testsuite/Makefile.in: Regenerate.
3613
3614 2012-02-14 Cary Coutant <ccoutant@google.com>
3615
3616 * options.cc (General_options::finalize): Disallow -pie and -static.
3617
3618 2012-02-03 Doug Kwan <dougkwan@google.com>
3619
3620 * arm.cc (Arm_relocate_functions::abs8,
3621 Arm_relocate_functions::abs16): Use
3622 Bits::has_signed_unsigned_overflow32.
3623 (Arm_relocate_functions::thm_abs8): Correct range of
3624 overflow check.
3625 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3626 in assertions.
3627
3628 2012-02-02 Doug Kwan <dougkwan@google.com>
3629
3630 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3631 position independent outputs, not just shared objects.
3632
3633 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
3634
3635 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3636 * configure: Regenerated.
3637
3638 2012-01-27 Ian Lance Taylor <iant@google.com>
3639
3640 * reloc.h (Bits): New class with static functions, copied from
3641 namespace utils in arm.cc.
3642 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
3643 instead.
3644
3645 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3646
3647 * incremental.cc (write_info_blocks): Correct relocation offset.
3648
3649 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3650
3651 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3652 (Relocate::tls_gd_to_le): Likewise.
3653
3654 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3655
3656 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3657
3658 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
3659
3660 * configure.ac: Check if -mcmodel=medium works.
3661 * configure: Regenerated.
3662
3663 2012-01-24 Cary Coutant <ccoutant@google.com>
3664
3665 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3666 definition and ...
3667 (read_unsigned_LEB_128_x): ... this new function.
3668 (read_signed_LEB_128): Replaced with inline definition and ...
3669 (read_signed_LEB_128_x): ... this new function.
3670 * int_encoding.h (read_unsigned_LEB_128_x): New function.
3671 (read_unsigned_LEB_128): Add inline definition.
3672 (read_signed_LEB_128_x): New function.
3673 (read_signed_LEB_128): Add inline definition.
3674 * testsuite/Makefile.am (leb128_unittest): New unit test.
3675 * testsuite/Makefile.in: Regenerate.
3676 * testsuite/leb128_unittest.cc: New unit test.
3677
3678 2012-01-23 Ian Lance Taylor <iant@google.com>
3679
3680 PR gold/13617
3681 * i386.cc (Target_i386::do_code_fill): When using a jmp
3682 instruction, pad with nop instructions.
3683 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3684
3685 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
3686
3687 * x86_64.cc (gc_process_relocs): Add typename on types used in
3688 template.
3689 (scan_relocs): Likewise.
3690 (relocate_section): Likewise.
3691 (apply_relocation): Likewise.
3692
3693 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
3694
3695 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3696 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3697 under x32.
3698
3699 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
3700
3701 * x86_64.cc: Initial support for x32.
3702
3703 2012-01-03 Cary Coutant <ccoutant@google.com>
3704
3705 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3706 Use abstract base class for GOT.
3707 * gold/output.h (class Output_data_got_base): New abstract base class.
3708 (class Output_data_got): Derive from new base class, adjust ctors.
3709 (Output_data_got::reserve_slot): Make virtual; rename to
3710 do_reserve_slot; Adjust callers.
3711 * gold/target.h (Sized_target::init_got_plt_for_update): Return
3712 pointer to abstract base class.
3713 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3714
3715 2011-12-18 Ian Lance Taylor <iant@google.com>
3716
3717 * object.h (Relobj::local_symbol_value): New function.
3718 (Relobj::local_plt_offset): New function.
3719 (Relobj::local_has_got_offset): New function.
3720 (Relobj::local_got_offset): New function.
3721 (Relobj::set_local_got_offset): New function.
3722 (Relobj::do_local_symbol_value): New pure virtual function.
3723 (Relobj::do_local_plt_offset): Likewise.
3724 (Relobj::do_local_has_got_offset): Likewise.
3725 (Relobj::do_local_got_offset): Likewise.
3726 (Relobj::do_set_local_got_offset): Likewise.
3727 (Sized_relobj::do_local_has_got_offset): Rename from
3728 local_has_got_offset.
3729 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3730 (Sized_relobj::do_set_local_got_offset): Rename from
3731 set_local_got_offset.
3732 (Sized_relobj_file::do_local_plt_offset): Rename from
3733 local_plt_offset.
3734 (Sized_relobj_file::do_local_symbol_value): New function.
3735 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3736 local_plt_offset.
3737 * output.cc (Output_data_got::Got_entry::write): Change object to
3738 Relobj. Use local_symbol_value.
3739 (Output_data_got::add_global_with_rel): Change rel_dyn to
3740 Output_data_reloc_generic*. Use add_global_generic.
3741 (Output_data_got::add_global_with_rela): Remove. Change all
3742 callers to use add_global_with_rel.
3743 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3744 Output_data_reloc_generic*. Use add_global_generic.
3745 (Output_data_got::add_global_pair_with_rela): Remove. Change all
3746 callers to use add_global_pair_with_rel.
3747 (Output_data_got::add_local): Change object to Relobj*.
3748 (Output_data_got::add_local_plt): Likewise.
3749 (Output_data_got::add_local_with_rel): Change object to Relobj*,
3750 change rel_dyn to Output_data_reloc_generic*. Use
3751 add_local_generic.
3752 (Output_data_got::add_local_with_rela): Remove. Change all
3753 callers to use all_local_with_rel.
3754 (Output_data_got::add_local_pair_with_rel): Change object to
3755 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
3756 add_output_section_generic.
3757 (Output_data_got::add_local_pair_with_rela): Remove. Change all
3758 callers to use add_local_pair_with_rel.
3759 (Output_data_got::reserve_local): Change object to Relobj*.
3760 * output.h: (class Output_data_reloc_generic): Add pure virtual
3761 declarations for add_global_generic, add_local_generic,
3762 add_output_section_generic.
3763 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3764 functions for Output_data_reloc_generic. Update declarations for
3765 changes listed in output.cc.
3766 (class Output_data_got): Change template parameter to got_size.
3767 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
3768 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3769 function.
3770 (Sized_relobj_incr::do_local_plt_offset): New function.
3771 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3772 add_global_generic.
3773
3774 2011-12-17 Cary Coutant <ccoutant@google.com>
3775
3776 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3777 * resolve.cc (Symbol_table::resolve): Likewise.
3778 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3779 arrays.
3780 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3781
3782 2011-12-16 Ian Lance Taylor <iant@google.com>
3783
3784 * output.h (Output_data_reloc_generic::add): Only call
3785 add_dynamic_reloc if this is a dynamic reloc section.
3786
3787 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
3788
3789 PR gold/13505
3790 * target-reloc.h (apply_relocation): Replace <64, false> with
3791 <size, big_endian>.
3792
3793 2011-11-25 Nick Clifton <nickc@redhat.com>
3794
3795 * po/it.po: New Italian translation.
3796
3797 2011-11-17 Sterling Augustine <saugustine@google.com>
3798
3799 * script.cc (script_include_directive): Implement.
3800 (read_script_file): New local variables name and search_path. Update
3801 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3802 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3803 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3804
3805 2011-11-11 Sterling Augustine <saugustine@google.com>
3806
3807 * yyscript.y (section_cmd): Add support for INCLUDE directive.
3808 (file_or_sections_cmd): Likewise.
3809
3810 2011-11-11 Doug Kwan <dougkwan@google.com>
3811
3812 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3813 if --just-symbols is given.
3814
3815 2011-11-10 Doug Kwan <dougkwan@google.com>
3816
3817 PR gold/13362
3818 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3819 when processing data relocs.
3820 * reloc.h (Relocate_functions::rel_unaligned): New method.
3821 (Relocate_functions::pcrel_unaligned): Ditto.
3822 (Relocate_functions::rel32_unaligned): Ditto.
3823 (Relocate_functions::pcrel32_unaligned): Ditto.
3824
3825 2011-11-09 Doug Kwan <dougkwan@google.com>
3826
3827 PR gold/13362
3828 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3829 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3830 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3831 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3832 (Relocate_functions::rel_unaligned): New.
3833 (Relocate_functions::rel32_unaligned): New.
3834 * target-reloc.h (relocate_for_relocatable): Add code to handle
3835 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3836 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3837 arm_unaligned_reloc_r): New targets.
3838 * testsuite/Makefile.in: Regenerate.
3839 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3840 linking.
3841
3842 2011-11-02 Ian Lance Taylor <iant@google.com>
3843
3844 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
3845 NATIVE_LINKER.
3846 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3847 * options.cc (General_options::finalize): Use library search path
3848 from configure script if specified. If not native and no sysroot,
3849 only search TOOLLIBDIR.
3850 * options.h (Search_directory::Search_directory): Change name to
3851 const std::string&.
3852 (General_options::add_to_library_path_with_sysroot): Change arg to
3853 const std::string&.
3854 * configure, Makefile.in, config.in: Rebuild.
3855
3856 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3857
3858 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3859 we are working around the ARM1176 Erratum.
3860 * options.h (General_options::fix_arm1176): Add option.
3861 * testsuite/Makefile.am: Add testcases, and keep current ones
3862 working.
3863 * testsuite/Makefile.in: Regenerate.
3864 * testsuite/arm_fix_1176.s: New file.
3865 * testsuite/arm_fix_1176.sh: Likewise.
3866
3867 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
3868
3869 * arm.cc (Target_arm::Target_arm): Remove initialisation of
3870 may_use_blx_.
3871 (Target_arm::may_use_blx): Remove method.
3872 (Target_arm::set_may_use_blx): Likewise.
3873 (Target_arm::may_use_v4t_interworking): New method.
3874 (Target_arm::may_use_v5t_interworking): Likewise.
3875 (Target_arm::may_use_blx_): Remove member variable.
3876 (Arm_relocate_functions::arm_branch_common): Check for v5T
3877 interworking.
3878 (Arm_relocate_functions::thumb_branch_common): Likewise.
3879 (Reloc_stub::stub_type_for_reloc): Likewise.
3880 (Target_arm::do_finalize_sections): Correct interworking checks.
3881 * testsuite/Makefile.am: Add new tests.
3882 * testsuite/Makefile.in: Regenerate.
3883 * testsuite/arm_farcall_arm_arm.s: New test.
3884 * testsuite/arm_farcall_arm_arm.sh: Likewise.
3885 * testsuite/arm_farcall_arm_thumb.s: Likewise.
3886 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3887 * testsuite/arm_farcall_thumb_arm.s: Likewise.
3888 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3889 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3890 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3891
3892 2011-10-31 Cary Coutant <ccoutant@google.com>
3893
3894 PR gold/13023
3895 * expression.cc (Expression::eval_with_dot): Add
3896 is_section_dot_assignment parameter.
3897 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
3898 absolute and assigning to dot within a section.
3899 * script-sections.cc
3900 (Output_section_element_assignment::set_section_addresses): Pass
3901 dot_section to set_if_absolute.
3902 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3903 as is_section_dot_assignment flag to eval_with_dot.
3904 (Output_section_element_dot_assignment::set_section_addresses):
3905 Likewise.
3906 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3907 parameter. Also set value if relative to dot_section; set the
3908 symbol's output_section.
3909 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3910 parameter. Adjust all callers.
3911 (Expression::eval_maybe_dot): Likewise.
3912 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3913 Adjust all callers.
3914 * testsuite/script_test_2.t: Test assignment of an absolute value
3915 to dot within an output section element.
3916
3917 2011-10-31 Cary Coutant <ccoutant@google.com>
3918
3919 * options.h (class General_options): Add --[no-]gnu-unique options.
3920 * symtab.cc (Symbol_table::sized_write_globals): Convert
3921 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3922
3923 2011-10-31 Cary Coutant <ccoutant@google.com>
3924
3925 PR gold/13359
3926 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3927 unnecessary assertion.
3928 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3929
3930 2011-10-31 Sriraman Tallam <tmsriram@google.com>
3931
3932 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3933 gc_mark_symbol.
3934 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3935 gc_mark_symbol.
3936 Change to just keep the section associated with symbol.
3937 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3938 they are externally visible and --export-dynamic is turned on.
3939 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3940
3941 2011-10-19 Ian Lance Taylor <iant@google.com>
3942
3943 PR gold/13163
3944 * script-sections.cc
3945 (Output_section_element_dot_assignment::needs_output_section): New
3946 function.
3947
3948 2011-10-19 Ian Lance Taylor <iant@google.com>
3949
3950 PR gold/13204
3951 * layout.cc (Layout::segment_precedes): Don't assert failure if a
3952 --section-start option was seen.
3953 * options.h (General_options::any_section_start): New function.
3954
3955 2011-10-18 David S. Miller <davem@davemloft.net>
3956
3957 PR binutils/13301
3958 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3959 member to track relocation locations that have moved during TLS
3960 reloc optimizations.
3961 (Target_sparc::Relocate::Relocate): Initialize to NULL.
3962 (Target_sparc::Relocate::relocate): Adjust view down by 4
3963 bytes if it matches reloc_adjust_addr_.
3964 (Target_sparc::Relocate::relocate_tls): Always move the
3965 __tls_get_addr call delay slot instruction forward 4 bytes when
3966 performing relaxation.
3967
3968 2011-10-18 Cary Coutant <ccoutant@google.com>
3969
3970 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3971 (Output_file::map_no_anonymous): Check for non-zero
3972 return code from posix_fallocate.
3973
3974 2011-10-17 Cary Coutant <ccoutant@google.com>
3975
3976 PR gold/13245
3977 * plugin.cc (is_visible_from_outside): Check for symbols
3978 referenced from dynamic objects.
3979 * resolve.cc (Symbol_table::resolve): Don't count references
3980 from dynamic objects as references from real ELF files.
3981 * testsuite/plugin_test_2.sh: Adjust expected result.
3982
3983 2011-10-17 Cary Coutant <ccoutant@google.com>
3984
3985 * gold.cc: Include timer.h.
3986 (queue_middle_tasks): Stamp time.
3987 (queue_final_tasks): Likewise.
3988 * main.cc (main): Store timer in parameters. Print timers
3989 for each pass.
3990 * parameters.cc (Parameters::Parameters): Initialize timer_.
3991 (Parameters::set_timer): New function.
3992 (set_parameters_timer): New function.
3993 * parameters.h (Parameters::set_timer): New function.
3994 (Parameters::timer): New function.
3995 (Parameters::timer_): New data member.
3996 (set_parameters_timer): New function.
3997 * timer.cc (Timer::stamp): New function.
3998 (Timer::get_pass_time): New function.
3999 * timer.h (Timer::stamp): New function.
4000 (Timer::get_pass_time): New function.
4001 (Timer::pass_times_): New data member.
4002
4003 2011-10-17 Cary Coutant <ccoutant@google.com>
4004
4005 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4006 task for members of lib groups.
4007
4008 2011-10-17 Cary Coutant <ccoutant@google.com>
4009
4010 PR gold/13288
4011 * fileread.cc (File_read::find_view): Add assert.
4012 (File_read::make_view): Move bounds check (replace with assert)...
4013 (File_read::find_or_make_view): ... to here.
4014
4015 2011-10-12 Cary Coutant <ccoutant@google.com>
4016
4017 * output.cc (Output_file::open_base_file): Handle case where
4018 ::read returns less than requested size.
4019
4020 2011-10-10 Cary Coutant <ccoutant@google.com>
4021
4022 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4023 Initialize defined_count_.
4024 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4025 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4026 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4027 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4028 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4029 * incremental.h (Sized_relobj_incr::defined_count_): New data
4030 member.
4031 (Sized_incr_dynobj::defined_count_): New data member.
4032 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4033 Return zeroes instead of internal error.
4034
4035 2011-10-10 Cary Coutant <ccoutant@google.com>
4036
4037 PR gold/13249
4038 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4039 (Output_reloc::symbol_value): Return PLT offset if flag is set.
4040 * output.h (class Output_reloc): Add use_plt_offset flag.
4041 (Output_reloc::type_): Adjust size of bit field.
4042 (Output_reloc::use_plt_offset_): New bit field.
4043 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4044 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4045 flag. Adjust all callers.
4046 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4047 creating RELATIVE relocations.
4048
4049 2011-10-10 Nick Clifton <nickc@redhat.com>
4050
4051 * po/es.po: Updated Spanish translation.
4052 * po/fi.po: Updated Finnish translation.
4053
4054 2011-10-03 Diego Novillo <dnovillo@google.com>
4055
4056 * options.cc (parse_uint): Fix dereference of RETVAL.
4057
4058 2011-09-29 Sriraman Tallam <tmsriram@google.com>
4059
4060 * layout.h (section_order_map_): New member.
4061 (get_section_order_map): New member function.
4062 * output.cc (Output_section::add_input_section): Check for patterns
4063 only when --section-ordering-file is specified.
4064 * gold.cc (queue_middle_tasks): Delay updating order of sections till
4065 output_sections have been formed.
4066 * layout.cc (Layout_Layout): Initialize section_order_map_.
4067 * plugin.cc (update_section_order): Store order in order_map. Do not
4068 update the order.
4069 * testsuite/Makefile.am: Add test case for plugin_final_layout.
4070 * testsuite/Makefile.in: Regenerate.
4071 * testsuite/plugin_section_order.c: New file.
4072 * testsuite/plugin_final_layout.cc: New file.
4073 * testsuite/plugin_final_layout.sh: New file.
4074
4075 2011-09-29 Cary Coutant <ccoutant@google.com>
4076
4077 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4078 Check for NULL.
4079 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4080 symbols during incremental update.
4081 (Symbol_table::add_from_dynobj): Likewise.
4082
4083 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4084 Ian Lance Taylor <iant@google.com>
4085
4086 * symtab.cc (Symbol_table::define_special_symbol): Always
4087 canonicalize version string.
4088
4089 2011-09-26 Cary Coutant <ccoutant@google.com>
4090
4091 * gold.cc (queue_initial_tasks): Move option checks ...
4092 * options.cc (General_options::finalize): ... to here. Disable
4093 some options; make others fatal.
4094
4095 2011-09-26 Cary Coutant <ccoutant@google.com>
4096
4097 gcc PR lto/47247
4098 * plugin.cc (get_symbols_v2): New function.
4099 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4100 (is_referenced_from_outside): New function.
4101 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4102 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4103 (get_symbols): Pass version parameter.
4104 (get_symbols_v2): New function.
4105 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4106 parameter.
4107 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4108 (onload): Add LDPT_GET_SYMBOLS_V2.
4109 (all_symbols_read_hook): Use get_symbols_v2; check for
4110 LDPR_PREVAILING_DEF_IRONLY_EXP.
4111 * testsuite/plugin_test_3.sh: Update expected results.
4112
4113 2011-09-23 Simon Baldwin <simonb@google.com>
4114
4115 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4116 configuration options.
4117 * configure: Regenerate.
4118 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4119 * Makefile.in: Regenerate.
4120 * testsuite/Makefile.in: Regenerate.
4121
4122 2011-09-19 Sriraman Tallam <tmsriram@google.com>
4123
4124 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4125
4126 2011-09-19 Cary Coutant <ccoutant@google.com>
4127
4128 * incremental.cc (can_incremental_update): Fix typo in comment.
4129 * incremental.h (can_incremental_update): Likewise.
4130
4131 2011-09-18 Cary Coutant <ccoutant@google.com>
4132
4133 * incremental.cc (can_incremental_update): New function.
4134 * incremental.h (can_incremental_update): New function.
4135 * layout.cc (Layout::init_fixed_output_section): Call it.
4136 (Layout::make_output_section): Don't allow patch space in .eh_frame.
4137 * object.cc (Sized_relobj_file::do_layout): Call
4138 can_incremental_update.
4139
4140 2011-09-13 Cary Coutant <ccoutant@google.com>
4141
4142 * configure.ac: Check for glibc support for gnu_indirect_function
4143 support with static linking, setting automake conditional
4144 IFUNC_STATIC.
4145 * Makefile.in: Regenerate.
4146 * configure: Regenerate.
4147
4148 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4149 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4150 for IFUNC_STATIC.
4151 * testsuite/Makefile.in: Regenerate.
4152
4153 2011-09-13 Cary Coutant <ccoutant@google.com>
4154
4155 * incremental.cc (Sized_relobj_incr::do_layout): Call
4156 report_comdat_group for kept comdat sections.
4157 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4158 * testsuite/Makefile.in: Regenerate.
4159 * testsuite/incr_comdat_test_1.cc: New source file.
4160 * testsuite/incr_comdat_test_2_v1.cc: New source file.
4161 * testsuite/incr_comdat_test_2_v2.cc: New source file.
4162 * testsuite/incr_comdat_test_2_v3.cc: New source file.
4163
4164 2011-09-13 Ian Lance Taylor <iant@google.com>
4165
4166 * object.cc (Sized_relobj_file::do_layout): Remove unused local
4167 variable external_symbols_offset.
4168
4169 2011-09-12 Ian Lance Taylor <iant@google.com>
4170
4171 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4172 triggered if object has no symbols.
4173
4174 2011-09-09 David S. Miller <davem@davemloft.net>
4175
4176 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4177 (Output_fill_debug_line::do_write): Likewise.
4178
4179 2011-08-29 Cary Coutant <ccoutant@google.com>
4180
4181 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4182 casts to match formatting specs.
4183 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4184
4185 2011-08-26 Cary Coutant <ccoutant@google.com>
4186
4187 * layout.cc (Free_list::allocate): Provide guarantee of minimum
4188 remaining hole size when allocating.
4189 (Layout::make_output_section): Set fill methods for debug sections.
4190 * layout.h (Free_list::Free_list_node): Move from private to
4191 public.
4192 (Free_list::set_min_hole_size): New function.
4193 (Free_list::begin, Free_list::end): New functions.
4194 (Free_list::min_hole_): New data member.
4195 * output.cc: Include dwarf.h.
4196 (Output_fill_debug_info::do_minimum_hole_size): New function.
4197 (Output_fill_debug_info::do_write): New function.
4198 (Output_fill_debug_line::do_minimum_hole_size): New function.
4199 (Output_fill_debug_line::do_write): New function.
4200 (Output_section::Output_section): Initialize new data member.
4201 (Output_section::set_final_data_size): Ensure patch space is larger
4202 than minimum hole size.
4203 (Output_section::do_write): Fill holes in debug sections.
4204 * output.h (Output_fill): New class.
4205 (Output_fill_debug_info): New class.
4206 (Output_fill_debug_line): New class.
4207 (Output_section::set_free_space_fill): New function.
4208 (Output_section::free_space_fill_): New data member.
4209 * testsuite/Makefile.am (incremental_test_3): Add
4210 --incremental-patch option.
4211 (incremental_test_4): Likewise.
4212 (incremental_test_5): Likewise.
4213 (incremental_test_6): Likewise.
4214 (incremental_copy_test): Likewise.
4215 (incremental_common_test_1): Likewise.
4216 * testsuite/Makefile.in: Regenerate.
4217
4218 2011-08-26 Nick Clifton <nickc@redhat.com>
4219
4220 * po/es.po: Updated Spanish translation.
4221
4222 2011-08-01 Cary Coutant <ccoutant@google.com>
4223
4224 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4225 * gold/testsuite/Makefile.in: Regenerate.
4226 * gold/testsuite/justsyms_exec.c: New source file.
4227 * gold/testsuite/justsyms_lib.c: New source file.
4228
4229 2011-08-01 Cary Coutant <ccoutant@google.com>
4230
4231 * layout.cc (Layout::set_segment_offsets): Don't realign text
4232 segment if -Ttext was specified.
4233 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4234 file type.
4235 * object.h (Sized_relobj_file::e_type): New function.
4236 (Sized_relobj_file::e_type_): New data member.
4237 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4238 base address for ET_EXEC files.
4239 * target.cc (Target::do_make_elf_object_implementation): Allow
4240 ET_EXEC files with --just-symbols option.
4241
4242 2011-07-28 Cary Coutant <ccoutant@google.com>
4243
4244 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4245 Add thread_number parameter.
4246 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4247 * workqueue-threads.cc
4248 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4249 current thread if its thread number is greater than desired thread
4250 count.
4251 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4252 Add thread_number parameter.
4253 (Workqueue::should_cancel_thread): Likewise.
4254 (Workqueue::find_runnable_or_wait): Pass thread_number to
4255 should_cancel_thread.
4256 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4257 parameter.
4258
4259 2011-07-22 Sriraman Tallam <tmsriram@google.com>
4260
4261 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4262 only after checking if it cannot be forced local.
4263 * symtab.h (is_externally_visible): Check if the symbol is not forced
4264 local.
4265
4266 2011-07-15 Ian Lance Taylor <iant@google.com>
4267
4268 * options.h (class General_options): Add --print-output-format.
4269 Move -EL next to -EB, for better --help output.
4270 * target-select.cc: Include <cstdio>, "options.h", and
4271 "parameters.h".
4272 (Target_selector::do_target_bfd_name): New function.
4273 (print_output_format): New function.
4274 * target-select.h (class Target_selector): Update declarations.
4275 (Target_selector::target_bfd_name): New function.
4276 (print_output_format): Declare.
4277 * main.cc: Include "target-select.h".
4278 (main): Handle --print-output-format.
4279 * gold.cc: Include "target-select.h".
4280 (queue_initial_tasks): Handle --print-output-format when there are
4281 no input files.
4282 * parameters.cc (parameters_force_valid_target): Give a better
4283 error message if -EB/-EL does not match target.
4284 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4285 function.
4286
4287 2011-07-15 Ian Lance Taylor <iant@google.com>
4288
4289 * i386.cc (class Output_data_plt_i386): Add layout_ field.
4290 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4291 (Output_data_plt_i386::do_write): Write address of .dynamic
4292 section to first entry in .got.plt section.
4293 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4294 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4295 Initialize layout_.
4296 (Output_data_plt_x86_64::do_write): Write address of .dynamic
4297 section to first entry in .got.plt section.
4298 * layout.h (Layout::dynamic_section): New function.
4299
4300 2011-07-13 Sriraman Tallam <tmsriram@google.com>
4301
4302 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4303 to claim_file call.
4304 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4305 input_section_position_, and input_section_glob_.
4306 (read_layout_from_file): Call function section_ordering_specified.
4307 * layout.h (is_section_ordering_specified): New function.
4308 (section_ordering_specified): New function.
4309 (section_ordering_specified_): New boolean member.
4310 * main.cc(main): Call load_plugins after layout object is defined.
4311 * output.cc (Output_section::add_input_section): Use
4312 function section_ordering_specified to check if section ordering is
4313 needed.
4314 * output.cc (Output_section::add_relaxed_input_section): Use
4315 function section_ordering_specified to check if section ordering is
4316 needed.
4317 (Output_section::update_section_layout): New function.
4318 (Output_section::sort_attached_input_sections): Check if input section
4319 must be reordered.
4320 * output.h (Output_section::update_section_layout): New function.
4321 * plugin.cc (get_section_count): New function.
4322 (get_section_type): New function.
4323 (get_section_name): New function.
4324 (get_section_contents): New function.
4325 (update_section_order): New function.
4326 (allow_section_ordering): New function.
4327 (Plugin::load): Add the new interfaces to the transfer vector.
4328 (Plugin_manager::load_plugins): New parameter.
4329 (Plugin_manager::all_symbols_read): New parameter.
4330 (Plugin_manager::claim_file): New parameter. Save the elf object for
4331 unclaimed objects.
4332 (Plugin_manager::get_elf_object): New function.
4333 (Plugin_manager::get_view): Change to directly use the bool to check
4334 if get_view is called from claim_file_hook.
4335 * plugin.h (input_objects): New function
4336 (Plugin__manager::load_plugins): New parameter.
4337 (Plugin_manager::claim_file): New parameter.
4338 (Plugin_manager::get_elf_object): New function.
4339 (Plugin_manager::in_claim_file_handler): New function.
4340 (Plugin_manager::in_claim_file_handler_): New member.
4341 (layout): New function.
4342 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4343 handler with an extra parameter. Make the elf object before calling
4344 claim_file handler.
4345 * testsuite/plugin_test.c (get_section_count): New function pointer.
4346 (get_section_type): New function pointer.
4347 (get_section_name): New function pointer.
4348 (get_section_contents): New function pointer.
4349 (update_section_order): New function pointer.
4350 (allow_section_ordering): New function pointer.
4351 (onload): Check if the new interfaces exist.
4352
4353 2011-07-13 Ian Lance Taylor <iant@google.com>
4354
4355 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4356 relro section.
4357 * x86_64.cc (Target_x86_64::got_section): Likewise.
4358 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4359 (relro_now_test_SOURCES): New variable.
4360 (relro_now_test_DEPENDENCIES): New variable.
4361 (relro_now_test_LDFLAGS): New variable.
4362 (relro_now_test_LDADD): New variable.
4363 (relro_now_test.so): New target.
4364 * testsuite/Makefile.in: Rebuild.
4365
4366 2011-07-12 Ian Lance Taylor <iant@google.com>
4367
4368 PR gold/12980
4369 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4370 GLOB_DAT relocation rather than a RELATIVE relocation for a
4371 protected symbol when creating a shared library.
4372 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4373 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4374 * testsuite/protected_main_1.cc (main): Test that protected
4375 function has same address.
4376
4377 2011-07-11 Ian Lance Taylor <iant@google.com>
4378
4379 PR gold/12979
4380 * options.h (class General_options): Add -Bgroup.
4381 * options.cc (General_options::finalize): If -Bgroup is set,
4382 default to --unresolved-symbols=report-all.
4383 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4384 * target-reloc.h (issue_undefined_symbol_error): Handle
4385 --unresolved-symbols=report-all.
4386
4387 2011-07-08 Ian Lance Taylor <iant@google.com>
4388
4389 PR gold/11985
4390 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4391 if linker script discards key sections.
4392 (Layout::create_dynamic_symtab): Likewise.
4393 (Layout::assign_local_dynsym_offsets): Likewise.
4394 (Layout::sized_create_version_sections): Likewise.
4395 (Layout::create_interp): Likewise.
4396 (Layout::finish_dynamic_section): Likewise.
4397 (Layout::set_dynamic_symbol_size): Likewise.
4398
4399 2011-07-08 Ian Lance Taylor <iant@google.com>
4400
4401 PR gold/12386
4402 * options.h (class General_options): Add --unresolved-symbols.
4403 * target-reloc.h (issue_undefined_symbol_error): Check
4404 --unresolved-symbols. Add comments.
4405
4406 2011-07-08 Ian Lance Taylor <iant@google.com>
4407
4408 * testsuite/odr_violation2.cc (Ordering::operator()): Make
4409 expression more complex.
4410
4411 2011-07-08 Ian Lance Taylor <iant@google.com>
4412
4413 PR gold/11317
4414 * target-reloc.h (issue_undefined_symbol_error): New inline
4415 function, broken out of relocate_section.
4416 (relocate_section): Call issue_undefined_symbol_error.
4417 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4418 there is no TLS segment if we are about to issue an undefined
4419 symbol error.
4420 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4421
4422 2011-07-08 Ian Lance Taylor <iant@google.com>
4423
4424 PR gold/12279
4425 * resolve.cc (Symbol_table::should_override): Add fromtype
4426 parameter. Change all callers. Give error when linking together
4427 TLS and non-TLS symbol.
4428 (Symbol_table::should_override_with_special): Add fromtype
4429 parameter. Change all callers.
4430 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4431 there is no TLS segment if we have reported some errors.
4432 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4433
4434 2011-07-08 Ian Lance Taylor <iant@google.com>
4435
4436 PR gold/12372
4437 * target.h (Target::plt_address_for_global): New function.
4438 (Target::plt_address_for_local): New function.
4439 (Target::plt_section_for_global): Remove.
4440 (Target::plt_section_for_local): Remove.
4441 (Target::do_plt_address_for_global): New virtual function.
4442 (Target::do_plt_address_for_local): New virtual function.
4443 (Target::do_plt_section_for_global): Remove.
4444 (Target::do_plt_section_for_local): Remove.
4445 (Target::register_global_plt_entry): Add Symbol_table and Layout
4446 parameters.
4447 * output.cc (Output_data_got::Got_entry::write): Use
4448 plt_address_for_global and plt_address_for_local.
4449 * layout.cc (Layout::add_target_dynamic_tags): Use size and
4450 address of output section.
4451 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4452 got_irelative_, and irelative_count_ fields. Update
4453 declarations.
4454 (Output_data_plt_i386::has_irelative_section): New function.
4455 (Output_data_plt_i386::entry_count): Add irelative_count_.
4456 (Output_data_plt_i386::set_final_data_size): Likewise.
4457 (class Target_i386): Add got_irelative_ and rel_irelative_
4458 fields. Update declarations.
4459 (Target_i386::Target_i386): Initialize new fields.
4460 (Target_i386::do_plt_address_for_global): New function replacing
4461 do_plt_section_for_global.
4462 (Target_i386::do_plt_address_for_local): New function replacing
4463 do_plt_section_for_local.
4464 (Target_i386::got_section): Create got_irelative_.
4465 (Target_i386::rel_irelative_section): New function.
4466 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4467 fields. Don't define __rel_iplt_{start,end}.
4468 (Output_data_plt_i386::add_entry): Add symtab and layout
4469 parameters. Change all callers. Use different PLT and GOT for
4470 IFUNC symbols.
4471 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4472 layout parameters. Change all callers. Use different PLT and
4473 GOT.
4474 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4475 (Output_data_plt_i386::rel_irelative): New function.
4476 (Output_data_plt_i386::address_for_global): New function.
4477 (Output_data_plt_i386::address_for_local): New function.
4478 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
4479 IRELATIVE GOT when changing IFUNC GOT entries.
4480 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4481 reloc.
4482 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4483 if we didn't create an IRELATIVE GOT.
4484 (Target_i386::Relocate::relocate): Use plt_address_for_global and
4485 plt_address_for_local.
4486 (Target_i386::do_dynsym_value): Use plt_address_for_global.
4487 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4488 got_irelative_, and irelative_count_ fields. Update
4489 declarations.
4490 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4491 Initialize new fields. Remove symtab parameter. Change all
4492 callers.
4493 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4494 irelative_count_.
4495 (Output_data_plt_x86_64::has_irelative_section): New function.
4496 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4497 (class Target_x86_64): Add got_irelative_ and rel_irelative_
4498 fields. Update declarations.
4499 (Target_x86_64::Target_x86_64): Initialize new fields.
4500 (Target_x86_64::do_plt_address_for_global): New function replacing
4501 do_plt_section_for_global.
4502 (Target_x86_64::do_plt_address_for_local): New function replacing
4503 do_plt_section_for_local.
4504 (Target_x86_64::got_section): Create got_irelative_.
4505 (Target_x86_64::rela_irelative_section): New function.
4506 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
4507 all callers. Don't create __rel_iplt_{start,end}.
4508 (Output_data_plt_x86_64::add_entry): Add symtab and layout
4509 parameters. Change all callers. Use different PLT and GOT for
4510 IFUNC symbols.
4511 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4512 layout parameters. Change all callers. Use different PLT and
4513 GOT.
4514 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4515 parameters. Change all callers. Use different PLT and GOT for
4516 IFUNC symbols.
4517 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4518 (Output_data_plt_x86_64::rela_irelative): New function.
4519 (Output_data_plt_x86_64::address_for_global): New function.
4520 (Output_data_plt_x86_64::address_for_local): New function.
4521 (Output_data_plt_x86_64::set_final_data_size): Likewise.
4522 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4523 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4524 (Target_x86_64::register_global_plt_entry): Add symtab and layout
4525 parameters.
4526 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4527 reloc.
4528 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4529 symbols if we didn't create an IRELATIVE GOT.
4530 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4531 plt_address_for_local.
4532 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4533 * testsuite/ifuncvar1.c: New test file.
4534 * testsuite/ifuncvar2.c: New test file.
4535 * testsuite/ifuncvar3.c: New test file.
4536 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4537 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4538 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4539 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4540 * testsuite/Makefile.in: Rebuild.
4541
4542 2011-07-07 Cary Coutant <ccoutant@google.com>
4543
4544 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4545 (two_file_test_1_ndebug.o): Likewise.
4546 (two_file_test_1b_ndebug.o): Likewise.
4547 (two_file_test_2_ndebug.o): Likewise.
4548 (two_file_test_main_ndebug.o): Likewise.
4549 (incremental_test_2): Link with no-debug versions.
4550
4551 2011-07-06 Cary Coutant <ccoutant@google.com>
4552
4553 * gold/incremental.cc
4554 (Output_section_incremental_inputs::write_info_blocks): Check for
4555 hidden and internal symbols.
4556
4557 2011-07-06 Cary Coutant <ccoutant@google.com>
4558
4559 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4560 Check disposition for startup file.
4561 (Incremental_inputs::report_command_line): Ignore
4562 --incremental-startup-unchanged option.
4563 * options.cc (General_options::parse_incremental_startup_unchanged):
4564 New function.
4565 (General_options::General_options): Initialize new data member.
4566 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4567 (General_options): Add --incremental-startup-unchanged option.
4568 (General_options::incremental_startup_disposition): New function.
4569 (General_options::incremental_startup_disposition_): New data member.
4570
4571 2011-07-06 Cary Coutant <ccoutant@google.com>
4572
4573 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4574 input file index to Script_info ctor.
4575 (Sized_incremental_binary::do_file_has_changed): Find the
4576 command-line argument for files named in scripts.
4577 * incremental.h (Script_info::Script_info): New ctor
4578 with input file index.
4579 (Script_info::input_file_index): New function.
4580 (Script_info::input_file_index_): New data member.
4581 (Incremental_binary::get_library): Add const.
4582 (Incremental_binary::get_script_info): Add const.
4583 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4584 * testsuite/Makefile.am (incremental_test_5): New test case.
4585 (incremental_test_6): New test case.
4586 * testsuite/Makefile.in: Regenerate.
4587
4588 2011-07-06 Cary Coutant <ccoutant@google.com>
4589
4590 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4591 debug output when command lines differ.
4592
4593 2011-07-06 Cary Coutant <ccoutant@google.com>
4594
4595 * incremental.cc (Incremental_inputs::report_command_line): Ignore
4596 --incremental-patch option.
4597 * layout.cc (Free_list::allocate): Extend allocation beyond original
4598 end if enabled.
4599 (Layout::make_output_section): Mark sections that should get
4600 patch space.
4601 * options.cc (parse_percent): New function.
4602 * options.h (parse_percent): New function.
4603 (DEFINE_percent): New macro.
4604 (General_options): Add --incremental-patch option.
4605 * output.cc (Output_section::Output_section): Initialize new data
4606 members.
4607 (Output_section::add_input_section): Print section name when out
4608 of patch space.
4609 (Output_section::add_output_section_data): Likewise.
4610 (Output_section::set_final_data_size): Add patch space when
4611 doing --incremental-full.
4612 (Output_section::do_reset_address_and_file_offset): Remove patch
4613 space.
4614 (Output_segment::set_section_list_addresses): Print debug output
4615 only if --incremental-update.
4616 * output.h (Output_section::set_is_patch_space_allowed): New function.
4617 (Output_section::is_patch_space_allowed_): New data member.
4618 (Output_section::patch_space_): New data member.
4619 * parameters.cc (Parameters::incremental_full): New function.
4620 * parameters.h (Parameters::incremental_full): New function
4621 * testsuite/Makefile.am (incremental_test_2): Add test for
4622 --incremental-patch option.
4623 * testsuite/Makefile.in: Regenerate.
4624 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4625 (t18): Remove function body.
4626
4627 2011-07-05 Doug Kwan <dougkwan@google.com>
4628
4629 PR gold/12771
4630 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4631 Arm_Address type for relocation result.
4632 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
4633 overflow check.
4634 (Arm_relocate_functions::abs32): Use unaligned access.
4635 (Arm_relocate_functions::rel32): Ditto.
4636 (Arm_relocate_functions::prel31): Ditto.
4637 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4638 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4639 static data relocations.
4640 * testsuite/Makefile.in: Regnerate.
4641 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4642
4643 2011-07-05 Ian Lance Taylor <iant@google.com>
4644
4645 PR gold/12392
4646 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4647 symbols if necessary.
4648 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4649
4650 2011-07-05 Ian Lance Taylor <iant@google.com>
4651
4652 PR gold/12952
4653 * resolve.cc (Symbol::override_base_with_special): Simply override
4654 version with special symbol version, ignoring previous version.
4655
4656 2011-07-05 Ian Lance Taylor <iant@google.com>
4657
4658 * object.cc (Sized_relobj_file::include_section_group): Add
4659 information to comment about signature location.
4660
4661 2011-07-02 Ian Lance Taylor <iant@google.com>
4662
4663 PR gold/12957
4664 * options.h (class General_options): Add -f and -F.
4665 * options.cc (General_options::finalize): Fatal error if -f/-F
4666 are used without -shared.
4667 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4668
4669 2011-07-02 Ian Lance Taylor <iant@google.com>
4670
4671 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4672
4673 2011-07-01 Ian Lance Taylor <iant@google.com>
4674
4675 PR gold/12525
4676 PR gold/12952
4677 * resolve.cc (Symbol::override_base_with_special): Don't override
4678 the version if the overriding symbol has a different name.
4679 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
4680 all callers. If we give an error about an undefined version,
4681 define the base version if necessary.
4682 * dynobj.h (class Versions): Update declaration.
4683 * testsuite/weak_alias_test_5.cc: New file.
4684 * testsuite/weak_alias_test.script: New file.
4685 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4686 and versioned_alias have the right value, and call t2.
4687 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4688 weak_alias_test_5.so.
4689 (weak_alias_test_LDADD): Likewise.
4690 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4691 * testsuite/Makefile.in: Rebuild.
4692
4693 2011-07-01 Ian Lance Taylor <iant@google.com>
4694
4695 PR gold/12525
4696 * options.h (class General_options): Support -z notext.
4697 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4698 -Wl,-z,notext.
4699 (two_file_shared_nonpic.so): Likewise.
4700 (two_file_shared_mixed.so): Likewise.
4701 (two_file_shared_mixed_1.so): Likewise.
4702 (weak_undef_lib_nonpic.so): Likewise.
4703 (alt/weak_undef_lib_nonpic.so): Likewise.
4704 (tls_test_shared_nonpic.so): Likewise.
4705 * testsuite/Makefile.in: Rebuild.
4706
4707 2011-07-01 Ian Lance Taylor <iant@google.com>
4708
4709 PR gold/12525
4710 * configure.ac: Test whether static linking works, setting
4711 the automake conditional HAVE_STATIC.
4712 * testsuite/Makefile.am: Disable tests using -static if
4713 HAVE_STATIC is not true.
4714 * configure, testsuite/Makefile.in: Rebuild.
4715
4716 2011-07-01 Ian Lance Taylor <iant@google.com>
4717
4718 PR gold/12525
4719 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4720 Assert if we see DW_EH_PE_indirect.
4721 * target.h (Target::ehframe_datarel_base): New function.
4722 (Target::do_ehframe_datarel_base): New target function.
4723 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4724 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4725 function.
4726
4727 2011-07-01 Ian Lance Taylor <iant@google.com>
4728
4729 PR gold/12571
4730 * options.h (class General_options): Add
4731 --ld-generated-unwind-info.
4732 * ehframe.cc (Fde::write): Add address parameter. Change all
4733 callers. If associated with PLT, fill in address and size.
4734 (Cie::set_output_offset): Only add merge mapping if there is an
4735 object.
4736 (Cie::write): Add address parameter. Change all callers.
4737 (Eh_frame::add_ehframe_for_plt): New function.
4738 * ehframe.h (class Fde): Update declarations. Move shndx_ and
4739 input_offset_ fields into union u_, with new plt field.
4740 (Fde::Fde): Adjust for new union field.
4741 (Fde::Fde) [Output_data version]: New constructor.
4742 (Fde::add_mapping): Only add merge mapping if there is an object.
4743 (class Cie): Update declarations.
4744 (class Eh_frame): Declare add_ehframe_for_plt.
4745 * layout.cc (Layout::layout_eh_frame): Break out code into
4746 make_eh_frame_section, and call it.
4747 (Layout::make_eh_frame_section): New function.
4748 (Layout::add_eh_frame_for_plt): New function.
4749 * layout.h (class Layout): Update declarations.
4750 * merge.cc (Merge_map::add_mapping): Add assertion.
4751 * i386.cc: Include "dwarf.h".
4752 (class Output_data_plt_i386): Make first_plt_entry,
4753 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
4754 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4755 and plt_eh_frame_fde.
4756 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4757 boundary. Call add_eh_frame_for_plt if appropriate.
4758 * x86_64.cc: Include "dwarf.h".
4759 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
4760 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
4761 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4762 and plt_eh_frame_fde.
4763 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4764 appropriate.
4765
4766 2011-06-29 Ian Lance Taylor <iant@google.com>
4767
4768 PR gold/12629
4769 * object.cc (Sized_relobj_file::layout_section): Change shdr
4770 parameter to be const.
4771 (Sized_relobj_file::layout_eh_frame_section): New function, broken
4772 out of do_layout.
4773 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4774 appropriate. Call layout_eh_frame_section.
4775 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4776 sections.
4777 * object.h (class Sized_relobj_file): Update declarations.
4778
4779 2011-06-29 Ian Lance Taylor <iant@google.com>
4780
4781 PR gold/12652
4782 * script.cc (Token::integer_value): Accept trailing M/m/K/k
4783 modifier.
4784 (Lex::gather_token): Accept trailing M/m/K/k for integers.
4785
4786 2011-06-29 Ian Lance Taylor <iant@google.com>
4787
4788 PR gold/12675
4789 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4790 SHT_X86_64_UNWIND.
4791 * layout.cc (Layout::layout_eh_frame): Likewise.
4792
4793 2011-06-29 Ian Lance Taylor <iant@google.com>
4794
4795 PR gold/12695
4796 * layout.cc (Layout::symtab_section_shndx): New function.
4797 * layout.h (class Layout): Declare symtab_section_shndx.
4798 * output.cc (Output_section::write_header): Call it.
4799
4800 2011-06-29 Ian Lance Taylor <iant@google.com>
4801
4802 PR gold/12818
4803 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4804 symbols which are not used in a relocation.
4805
4806 2011-06-28 Ian Lance Taylor <iant@google.com>
4807
4808 PR gold/12898
4809 * layout.cc (Layout::segment_precedes): Don't crash if a linker
4810 script create indistinguishable segments.
4811 (Layout::set_segment_offsets): Use stable_sort when sorting
4812 segments. Pass this to Compare_segments constructor.
4813 * layout.h (class Layout): Make segment_precedes non-static.
4814 (class Compare_segments): Change from struct to class. Add
4815 layout_ field. Add constructor.
4816 * script-sections.cc
4817 (Script_sections::attach_sections_using_phdrs_clause): Rename
4818 local orphan to is_orphan. Don't report failure to put empty
4819 section in segment. On attachment failure, report name of
4820 section, and attach to first PT_LOAD segment.
4821
4822 2011-06-28 Ian Lance Taylor <iant@google.com>
4823
4824 PR gold/12934
4825 * target-select.cc (Target_selector::Target_selector): Add
4826 emulation parameter. Change all callers.
4827 (select_target_by_bfd_name): Rename from select_target_by_name.
4828 Change all callers.
4829 (select_target_by_emulation): New function.
4830 (supported_emulation_names): New function.
4831 * target-select.h (class Target_selector): Add emulation_ field.
4832 Update declarations.
4833 (Target_selector::recognize_by_bfd_name): Rename from
4834 recognize_by_name. Change all callers.
4835 (Target_selector::supported_bfd_names): Rename from
4836 supported_names. Change all callers.
4837 (Target_selector::recognize_by_emulation): New function.
4838 (Target_selector::supported_emulations): New function.
4839 (Target_selector::emulation): New function.
4840 (Target_selector::do_recognize_by_bfd_name): Rename from
4841 do_recognize_by_name. Change all callers.
4842 (Target_selector::do_supported_bfd_names): Rename from
4843 do_supported_names. Change all callers.
4844 (Target_selector::do_recognize_by_emulation): New function.
4845 (Target_selector::do_supported_emulations): New function.
4846 (select_target_by_bfd_name): Change name in declaration.
4847 (select_target_by_emulation): Declare.
4848 (supported_emulation_names): Declare.
4849 * parameters.cc (parameters_force_valid_target): Try to find
4850 target based on emulation from -m option.
4851 * options.h (class General_options): Change doc string for -m.
4852 * options.cc (help): Print emulations.
4853 (General_options::parse_V): Likewise.
4854 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4855 Add emulation parameter. Change all callers.
4856
4857 2011-06-28 Ian Lance Taylor <iant@google.com>
4858
4859 * target.h (class Target): Add osabi_ field.
4860 (Target::osabi): New function.
4861 (Target::set_osabi): New function.
4862 (Target::Target): Initialize osabi_.
4863 (Target::do_adjust_elf_header): Make pure virtual.
4864 (Sized_target::do_adjust_elf_header): Declare.
4865 * target.cc (Sized_target::do_adjust_elf_header): New function.
4866 (class Sized_target): Instantiate all versions.
4867 * freebsd.h (class Target_freebsd): Remove.
4868 (Target_selector_freebsd::do_recognize): Call set_osabi on
4869 Target.
4870 (Target_selector_freebsd::do_recognize_by_name): Likewise.
4871 (Target_selector_freebsd::set_osabi): Remove.
4872 * i386.cc (class Target_i386): Inherit from Sized_target rather
4873 than Target_freebsd.
4874 * x86_64.cc (class Target_x86_64): Likewise.
4875
4876 2011-06-28 Ian Lance Taylor <iant@google.com>
4877
4878 * target.h (Target::can_check_for_function_pointers): Rewrite.
4879 Make non-virtual.
4880 (Target::can_icf_inline_merge_sections): Likewise.
4881 (Target::section_may_have_icf_unsafe_poineters): Likewise.
4882 (Target::Target_info): Add can_icf_inline_merge_sections field.
4883 (Target::do_can_check_for_function_pointers): New virtual
4884 function.
4885 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4886 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4887 from can_check_for_function_pointers, move in file.
4888 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4889 section_may_have_icf_unsafe_poineters, move in file.
4890 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4891 * i386.cc (Target_i386::do_can_check_for_function_pointers):
4892 Rename from can_check_for_function_pointers, move in file.
4893 (Target_i386::can_icf_inline_merge_sections): Remove.
4894 (Target_i386::i386_info): Initialize
4895 can_icf_inline_merge_sections.
4896 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4897 Initialize can_icf_inline_merge_sections.
4898 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4899 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4900 Rename from can_check_for_function_pointers, move in file.
4901 (Target_x86_64::can_icf_inline_merge_sections): Remove.
4902 (Target_x86_64::x86_64_info): Initialize
4903 can_icf_inline_merge_sections.
4904 * testsuite/testfile.cc (Target_test::test_target_info):
4905 Likewise.
4906 * icf.cc (get_section_contents): Correct formatting.
4907
4908 2011-06-27 Ian Lance Taylor <iant@google.com>
4909
4910 * symtab.cc (Symbol::versioned_name): New function.
4911 (Symbol_table::add_to_final_symtab): Use versioned_name when
4912 appropriate.
4913 (Symbol_table::sized_write_symbol): Likewise.
4914 * symtab.h (class Symbol): Declare versioned_name.
4915 * stringpool.h (class Stringpool_template): Add variant of add
4916 which takes a std::basic_string.
4917 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4918 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4919 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4920 (ver_test_12.o): New target.
4921 * testsuite/Makefile.in: Rebuild.
4922
4923 2011-06-27 Doug Kwan <dougkwan@google.com>
4924
4925 * arm.cc (Arm_relocate_functions::thm_jump8,
4926 Arm_relocate_functions::thm_jump11): Use a wider signed
4927 type to compute offset.
4928 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4929 arm_thm_jump8.
4930 * testsuite/Makefile.in: Regenerate.
4931 * testsuite/arm_branch_in_range.sh: Check test results of
4932 arm_thm_jump11 and arm_thm_jump8.
4933 * testsuite/arm_thm_jump11.s: New test source file.
4934 * testsuite/arm_thm_jump11.t: New linker script.
4935 * testsuite/arm_thm_jump8.s: New test source file.
4936 * testsuite/arm_thm_jump8.t: New linker script.
4937
4938 2011-06-24 Ian Lance Taylor <iant@google.com>
4939
4940 * layout.cc: Include "object.h".
4941 (ctors_sections_in_init_array): New static variable.
4942 (Layout::is_ctors_in_init_array): New function.
4943 (Layout::layout): Add entry to ctors_sections_in_init_array if
4944 appropriate.
4945 * layout.h (class Layout): Declare is_ctors_in_init_array.
4946 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4947 is_ctors_reverse_view is set.
4948 (Sized_relobj_file::write_sections): Add layout parameter. Change
4949 all callers. Set is_ctors_reverse_view field of View_size.
4950 (Sized_relobj_file::reverse_words): New function.
4951 * object.h (Sized_relobj_file::View_size): Add
4952 is_ctors_reverse_view field.
4953 (class Sized_relobj_file): Update declarations.
4954 * testsuite/initpri3.c: New test.
4955 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4956 initpri3b.
4957 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4958 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4959 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4960 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4961 * testsuite/Makefile.in: Rebuild.
4962
4963 2011-06-24 Cary Coutant <ccoutant@google.com>
4964
4965 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4966 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4967 (debug_msg_cdebug.err): New targets.
4968 * testsuite/Makefile.in: Regenerate.
4969 * testsuite/debug_msg.sh: Check output of link with compressed debug.
4970 Fix checks for link with shared library.
4971
4972 2011-06-24 Doug Kwan <dougkwan@google.com>
4973
4974 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4975 skip empty text sections.
4976 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4977
4978 2011-06-22 Ian Lance Taylor <iant@google.com>
4979
4980 PR gold/12910
4981 * options.h (class General_options): Add --ctors-in-init-array.
4982 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4983 friends as SHT_PROGBITS for merging sections.
4984 (Layout::layout): Remove special handling of .init_array and
4985 friends. Don't sort if doing relocatable link. Sort for .ctors
4986 and .dtors if ctors_in_init_array.
4987 (Layout::make_output_section): Force correct section types for
4988 .init_array and friends. Don't sort if doing relocatable link,
4989 Don't sort .ctors and .dtors if ctors_in_init_array.
4990 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4991 (Layout::output_section_name): Add relobj parameter. Change all
4992 callers. Handle .ctors. and .dtors. in code rather than table.
4993 Handle .ctors and .dtors if ctors_in_init_array.
4994 (Layout::match_file_name): New function, moved from output.cc.
4995 * layout.h (class Layout): Update declarations.
4996 * output.cc: Include "layout.h".
4997 (Input_section_sort_entry::get_priority): New function.
4998 (Input_section_sort_entry::match_file_name): Just call
4999 Layout::match_file_name.
5000 (Output_section::Input_section_sort_init_fini_compare::operator()):
5001 Handle .ctors and .dtors. Sort by explicit priority rather than
5002 by name.
5003 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5004 * testsuite/initpri2.c: New test.
5005 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5006 (check_PROGRAMS): Add initpri2.
5007 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5008 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5009 * configure, testsuite/Makefile.in: Rebuild.
5010
5011 2011-06-19 Ian Lance Taylor <iant@google.com>
5012
5013 PR gold/12880
5014 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5015 .interp section to a PT_INTERP segment even if we have seen a
5016 --dynamic-linker option. Don't do it if we have seen a PHDRS
5017 clause in a linker script.
5018 (Layout::finalize): Don't create a .interp section if we've
5019 already create a PT_INTERP segment.
5020 (Layout::create_interp): Always call choose_output_section (revert
5021 patch of 2011-06-17). Don't create PT_INTERP segment.
5022 * script-sections.cc
5023 (Script_sections::create_note_and_tls_segments): Add a .interp
5024 section to a PT_INTERP segment even if we have seen a
5025 --dynamic-linker option.
5026
5027 2011-06-18 Ian Lance Taylor <iant@google.com>
5028
5029 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5030 merely because a non-PT_LOAD segment has a dynamic reloc.
5031
5032 2011-06-18 Ian Lance Taylor <iant@google.com>
5033
5034 * layout.cc (Layout::finish_dynamic_section): Don't create
5035 DT_FLAGS entry if not needed.
5036
5037 2011-06-18 Ian Lance Taylor <iant@google.com>
5038
5039 PR gold/12745
5040 * layout.cc (Layout::layout_eh_frame): Correct handling of
5041 writable .eh_frame section.
5042
5043 2011-06-17 Ian Lance Taylor <iant@google.com>
5044
5045 PR gold/12893
5046 * resolve.cc (Symbol_table::resolve): Don't give an error if a
5047 symbol is redefined with the exact same object and value.
5048
5049 2011-06-17 Ian Lance Taylor <iant@google.com>
5050
5051 PR gold/12880
5052 * layout.h (class Layout): Add interp_segment_ field.
5053 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5054 (Layout::attach_allocated_section_to_segment): If making shared
5055 library, put .interp section in PT_INTERP segment.
5056 (Layout::finalize): Also call create_interp if -dynamic-linker
5057 option was used.
5058 (Layout::create_interp): Assert that there is no PT_INTERP
5059 segment. If not using a SECTIONS clause, use make_output_section.
5060 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5061 * script-sections.cc
5062 (Script_sections::create_note_and_tls_segments): If making shared
5063 library, put .interp section in PT_INTERP segment.
5064
5065 2011-06-17 Ian Lance Taylor <iant@google.com>
5066
5067 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5068 when making a shared library.
5069
5070 2011-06-17 Ian Lance Taylor <iant@google.com>
5071
5072 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5073 parameter. Change all callers. Don't issue warning about PC32
5074 against locally defined symbol.
5075
5076 2011-06-16 Ian Lance Taylor <iant@google.com>
5077
5078 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5079 occurs in same object.
5080
5081 2011-06-14 Alan Modra <amodra@gmail.com>
5082
5083 * po/POTFILES.in: Regenerate.
5084
5085 2011-06-09 Ian Lance Taylor <iant@google.com>
5086
5087 * script-sections.cc
5088 (Orphan_output_section::set_section_addresses): For a relocatable
5089 link set address to 0.
5090
5091 2011-06-09 Cary Coutant <ccoutant@google.com>
5092
5093 PR gold/12804
5094 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5095 used with --compress-debug-sections.
5096 * gold/object.cc (Sized_relobj_file::do_layout): Report
5097 uncompressed size of compressed input sections.
5098
5099 2011-06-08 Cary Coutant <ccoutant@google.com>
5100
5101 PR gold/12804
5102 * testsuite/two_file_test_2_v1.cc: Change initialization of
5103 v2 to keep it in .data.
5104
5105 2011-06-07 Cary Coutant <ccoutant@google.com>
5106
5107 * common.cc (Symbol_table::do_allocate_commons_list): Call
5108 gold_fallback.
5109 * errors.cc (Errors::fatal): Adjust call to gold_exit.
5110 (Errors::fallback): New function.
5111 (gold_fallback): New function.
5112 * errors.h (Errors::fallback): New function.
5113 * gold.cc (gold_exit): Change status parameter to enum; adjust
5114 all callers.
5115 (queue_initial_tasks): Call gold_fallback.
5116 * gold.h: Include cstdlib.
5117 (Exit_status): New enum type.
5118 (gold_exit): Change status parameter to enum.
5119 (gold_fallback): New function.
5120 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5121 (Layout::create_symtab_sections): Likewise.
5122 (Layout::create_shdrs): Likewise.
5123 * main.cc (main): Adjust call to gold_exit.
5124 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5125 (Output_data_got::add_got_entry_pair): Likewise.
5126 (Output_section::add_input_section): Likewise.
5127 (Output_section::add_output_section_data): Likewise.
5128 (Output_segment::set_section_list_addresses): Likewise.
5129 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5130
5131 2011-06-07 Cary Coutant <ccoutant@google.com>
5132
5133 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5134 for incremental links.
5135 * output.cc (Output_segment::set_section_list_addresses): Remove
5136 FIXME and test for TLS or BSS.
5137
5138 2011-06-07 Cary Coutant <ccoutant@google.com>
5139
5140 * testsuite/Makefile.am: Add incremental_copy_test,
5141 incremental_common_test_1.
5142 * testsuite/Makefile.in: Regenerate.
5143 * testsuite/common_test_1_v1.c: New source file.
5144 * testsuite/common_test_1_v2.c: New source file.
5145 * testsuite/copy_test_v1.cc: New source file.
5146
5147 2011-06-07 Cary Coutant <ccoutant@google.com>
5148
5149 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5150 update, allocate common from bss section's free list.
5151 * incremental-dump.cc (dump_incremental_inputs): Print flag for
5152 linker-defined symbols.
5153 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5154 Skip GOT and PLT entries that are no longer referenced.
5155 (Output_section_incremental_inputs::write_info_blocks): Mark
5156 linker-defined symbols.
5157 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5158 * output.cc (Output_section::allocate): New function.
5159 * output.h (Output_section::allocate): New function.
5160 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5161 linker-defined symbols.
5162 (Symbol::override_base_with_special): Copy is_predefined_ flag.
5163 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5164 (Symbol::init_base_output_data): Likewise.
5165 (Symbol::init_base_output_segment): Likewise.
5166 (Symbol::init_base_constant): Likewise.
5167 (Sized_symbol::init_output_data): Likewise.
5168 (Sized_symbol::init_output_segment): Likewise.
5169 (Sized_symbol::init_constant): Likewise.
5170 (Symbol_table::do_define_in_output_data): Likewise.
5171 (Symbol_table::do_define_in_output_segment): Likewise.
5172 (Symbol_table::do_define_as_constant): Likewise.
5173 * symtab.h (Symbol::is_predefined): New function.
5174 (Symbol::init_base_output_data): Add is_predefined parameter.
5175 (Symbol::init_base_output_segment): Likewise.
5176 (Symbol::init_base_constant): Likewise.
5177 (Symbol::is_predefined_): New data member.
5178 (Sized_symbol::init_output_data): Add is_predefined parameter.
5179 (Sized_symbol::init_output_segment): Likewise.
5180 (Sized_symbol::init_constant): Likewise.
5181 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5182
5183 2011-06-07 Cary Coutant <ccoutant@google.com>
5184
5185 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5186 instead of emit_copy_reloc.
5187 (Copy_relocs::emit_copy_reloc): Refactor.
5188 (Copy_relocs::make_copy_reloc): New function.
5189 (Copy_relocs::add_copy_reloc): Remove.
5190 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5191 section.
5192 (Copy_relocs::make_copy_reloc): New function.
5193 (Copy_relocs::add_copy_reloc): Remove.
5194 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5195 unchanged input files.
5196 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5197 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5198 Reserve BSS space for COPY relocations.
5199 (Sized_incremental_binary::do_emit_copy_relocs): New function.
5200 (Output_section_incremental_inputs::write_info_blocks): Record
5201 whether a symbol is copied from a shared object.
5202 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5203 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5204 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5205 (Incremental_input_entry_reader::get_output_symbol_index): Add
5206 is_copy parameter.
5207 (Incremental_binary::emit_copy_relocs): New function.
5208 (Incremental_binary::do_emit_copy_relocs): New function.
5209 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5210 new data member.
5211 (Sized_incremental_binary::add_copy_reloc): New function.
5212 (Sized_incremental_binary::do_emit_copy_relocs): New function.
5213 (Sized_incremental_binary::Copy_reloc): New struct.
5214 (Sized_incremental_binary::Copy_relocs): New typedef.
5215 (Sized_incremental_binary::copy_relocs_): New data member.
5216 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5217 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5218 * target.h (Sized_target::emit_copy_reloc): New function.
5219 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5220
5221 2011-06-02 Cary Coutant <ccoutant@google.com>
5222
5223 PR gold/12163
5224 * gold/archive.cc (Archive::Archive): Initialize new data member.
5225 (Archive::include_all_members): Return if archive has already been
5226 included.
5227 * gold/archive.h (Archive::include_all_members_): New data member.
5228
5229 2011-06-02 Nick Clifton <nickc@redhat.com>
5230
5231 * dynobj.h: Fix spelling mistake in comment.
5232 * output.cc: Likewise.
5233
5234 2011-05-31 Doug Kwan <dougkwan@google.com>
5235 Asier Llano
5236
5237 PR gold/12826
5238 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5239 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5240 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
5241 redundant arm_exidx_test.so.
5242 * testsuite/Makefile.in: Regenerate.
5243 (check_SCRIPTS): Add pr12826.sh
5244 (check_DATA): Add pr12826.stdout
5245 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5246 * testsuite/pr12826.sh: New file.
5247 * testsuite/pr12826_1.s: Ditto.
5248 * testsuite/pr12826_1.s: Ditto.
5249
5250 2011-05-30 Ian Lance Taylor <iant@google.com>
5251
5252 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5253 sections.
5254
5255 2011-05-29 Ian Lance Taylor <iant@google.com>
5256
5257 PR gold/12804
5258 * testsuite/Makefile.am: Use different file name for two_file_test
5259 temporary file for each incremental test.
5260 * testsuite/Makefile.in: Rebuild.
5261
5262 2011-05-29 Ian Lance Taylor <iant@google.com>
5263
5264 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5265 binary input file is empty.
5266
5267 2011-05-27 Ian Lance Taylor <iant@google.com>
5268
5269 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5270 (ver_test_9.so): Likewise.
5271 * testsuite/Makefile.in: Rebuild.
5272
5273 2011-05-26 Cary Coutant <ccoutant@google.com>
5274
5275 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5276 * incremental.cc (Incremental_inputs::report_input_section): Fix
5277 comment, indentation.
5278 (Incremental_inputs::report_comdat_group): New function.
5279 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5280 of data for incremental input file entry.
5281 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5282 group count, COMDAT group signatures.
5283 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5284 an unchanged input file.
5285 * incremental.h (Incremental_object_entry::Incremental_object_entry):
5286 Initialize new data member.
5287 (Incremental_object_entry::add_comdat_group): New function.
5288 (Incremental_object_entry::get_comdat_group_count): New function.
5289 (Incremental_object_entry::get_comdat_signature_key): New function.
5290 (Incremental_object_entry::groups_): New data member.
5291 (Incremental_inputs::report_comdat_group): New function.
5292 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5293 data for incremental input file entry.
5294 (Incremental_input_entry_reader::get_comdat_group_count): New function.
5295 (Incremental_input_entry_reader::get_input_section): Adjust size of
5296 data for incremental input file entry.
5297 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5298 (Incremental_input_entry_reader::get_comdat_group_signature): New
5299 function.
5300 * object.cc (Sized_relobj::include_section_group): Report kept
5301 COMDAT groups for incremental links.
5302
5303 2011-05-24 David Meyer <pdox@google.com>
5304
5305 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5306 with name parameter. Add found_name parameter.
5307 * fileread.cc (Input_file::find_file): Adjust code accordingly.
5308 * dirsearch.h (class Dirsearch): Update declaration.
5309
5310 2011-05-24 Ian Lance Taylor <iant@google.com>
5311
5312 * archive.cc (Library_base::should_include_member): Pull in object
5313 from archive if it defines the entry symbol.
5314 * parameters.cc (Parameters::entry): New function.
5315 * parameters.h (class Parameters): Declare entry.
5316 * output.h (class Output_file_header): Remove entry_ field.
5317 * output.cc (Output_file_header::Output_file_header): Remove entry
5318 parameter. Change all callers.
5319 (Output_file_header::entry): Use parameters->entry.
5320 * gold.cc (queue_middle_tasks): Likewise.
5321 * plugin.cc (Plugin_hook::run): Likewise.
5322
5323 2011-05-24 Cary Coutant <ccoutant@google.com>
5324
5325 * gold.cc (queue_initial_tasks): Pass incremental base filename
5326 to Output_file::open_base_file; don't print error message.
5327 * incremental-dump.cc (main): Adjust call to
5328 Output_file::open_for_modification.
5329 * incremental-dump.cc (main): Likewise.
5330 * incremental.cc (Incremental_inputs::report_command_line):
5331 Ignore --incremental-base option when comparing command lines.
5332 Ignore parameter when given as separate argument.
5333 * options.h (class General_options): Add --incremental-base.
5334 * output.cc (Output_file::Output_file):
5335 (Output_file::open_base_file): Add base_name and writable parameters;
5336 read base file into new file; print error message here.
5337 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5338 callers.
5339 * output.h (Output_file::open_for_modification): Rename to...
5340 (Output_file::open_base_file): ...this; add base_name and
5341 writable parameters; adjust all callers.
5342 (Output_file::map_no_anonymous): Add writable parameter; adjust all
5343 callers.
5344 * testsuite/Makefile.am (incremental_test_4): Test
5345 --incremental-base.
5346 * testsuite/Makefile.in: Regenerate.
5347
5348 2011-05-24 Cary Coutant <ccoutant@google.com>
5349
5350 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5351 incremental_test_4.
5352 * testsuite/Makefile.in: Regenerate.
5353 * testsuite/two_file_test_1_v1.cc: New test source file.
5354 * testsuite/two_file_test_1b_v1.cc: New test source file.
5355 * testsuite/two_file_test_2_v1.cc: New test source file.
5356
5357 2011-05-24 Cary Coutant <ccoutant@google.com>
5358
5359 * dynobj.h (Dynobj::do_dynobj): New function.
5360 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5361 flag and soname for shared objects.
5362 * incremental.cc (Incremental_inputs::report_object): Make
5363 either Incremental_object_entry or Incremental_dynobj_entry; add
5364 soname to string table.
5365 (Incremental_inputs::report_input_section): Add assertion.
5366 (Output_section_incremental_inputs::set_final_data_size): Adjust
5367 type of input file entry for shared libraries; adjust size of
5368 shared library info entry.
5369 (Output_section_incremental_inputs::write_input_files): Write
5370 as_needed flag for shared libraries.
5371 (Output_section_incremental_inputs::write_info_blocks): Adjust type
5372 of input file entry for shared libraries; write soname.
5373 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5374 soname from incremental info.
5375 * incremental.h (enum Incremental_input_flags): Add
5376 INCREMENTAL_INPUT_AS_NEEDED.
5377 (Incremental_input_entry::Incremental_input_entry): Initialize new
5378 data member.
5379 (Incremental_input_entry::set_as_needed): New function.
5380 (Incremental_input_entry::as_needed): New function.
5381 (Incremental_input_entry::do_dynobj_entry): New function.
5382 (Incremental_input_entry::as_needed_): New data member.
5383 (Incremental_object_entry::Incremental_object_entry): Don't check
5384 for shared library.
5385 (Incremental_object_entry::do_type): Likewise.
5386 (class Incremental_dynobj_entry): New class.
5387 (Incremental_input_entry_reader::as_needed): New function.
5388 (Incremental_input_entry_reader::get_soname): New function.
5389 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5390 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5391 size of shared library info entry.
5392 * layout.cc (Layout::finish_dynamic_section): Don't test for
5393 incremental link when adding DT_NEEDED entries.
5394 * object.h (Object::Object): Initialize new data member.
5395 (Object::dynobj): New function.
5396 (Object::set_as_needed): New function.
5397 (Object::as_needed): New function.
5398 (Object::do_dynobj): New function.
5399 (Object::as_needed_): New data member.
5400
5401 2011-05-24 Cary Coutant <ccoutant@google.com>
5402
5403 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5404 info; adjust display of GOT entries.
5405 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5406 vector of input objects; remove file_status_.
5407 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5408 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5409 got_plt reader; call target hooks to reserve GOT entries.
5410 (Output_section_incremental_inputs::set_final_data_size): Adjust size
5411 of input file info header and GOT info entry.
5412 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5413 relocation info.
5414 (Got_plt_view_info::got_descriptor): Remove.
5415 (Got_plt_view_info::sym_index): New data member.
5416 (Got_plt_view_info::input_index): New data member.
5417 (Local_got_offset_visitor::visit): Write input file index.
5418 (Global_got_offset_visitor::visit): Write 0 for input file index.
5419 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5420 with sym_index and input_index.
5421 (Output_section_incremental_inputs::write_got_plt): Adjust size of
5422 incremental info GOT entry; replace got_descriptor with input_index.
5423 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5424 map from input file index to object.
5425 (Sized_relobj_incr::do_layout): Replace direct data member reference
5426 with accessor function.
5427 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5428 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5429 Adjust size of input file info header.
5430 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5431 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5432 (Incremental_input_entry_reader::get_input_section): Adjust size of
5433 input file info header.
5434 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5435 of incremental info GOT entry.
5436 (Incremental_got_plt_reader::get_got_desc): Remove.
5437 (Incremental_got_plt_reader::get_got_symndx): New function.
5438 (Incremental_got_plt_reader::get_got_input_index): New function.
5439 (Sized_incremental_binary::Sized_incremental_binary): Remove
5440 file_status_; add input_objects_.
5441 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5442 (Sized_incremental_binary::set_file_is_unchanged): Remove.
5443 (Sized_incremental_binary::file_is_unchanged): Remove.
5444 (Sized_incremental_binary::set_input_object): New function.
5445 (Sized_incremental_binary::input_object): New function.
5446 (Sized_incremental_binary::file_status_): Remove.
5447 (Sized_incremental_binary::input_objects_): New data member.
5448 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5449 references.
5450 (Sized_relobj_incr::invalid_address): Move to base class.
5451 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5452 class.
5453 (Sized_relobj_incr::do_output_section_offset): Likewise.
5454 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5455 (Sized_relobj_incr::section_offsets_): Likewise.
5456 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5457 function.
5458 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5459 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5460 with accessor function.
5461 (Sized_relobj_file::do_layout): Likewise.
5462 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5463 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5464 (Sized_relobj_file::compute_final_local_value): Replace refs to
5465 section_offsets_ with accessor function.
5466 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5467 * object.h (Relobj::Relobj): Initialize new data members.
5468 (Relobj::add_dyn_reloc): New function.
5469 (Relobj::first_dyn_reloc): New function.
5470 (Relobj::dyn_reloc_count): New function.
5471 (Relobj::first_dyn_reloc_): New data member.
5472 (Relobj::dyn_reloc_count_): New data member.
5473 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5474 references.
5475 (Sized_relobj::Address): New typedef.
5476 (Sized_relobj::invalid_address): Move here from child class.
5477 (Sized_relobj::Sized_relobj): Initialize new data members.
5478 (Sized_relobj::sized_relobj): New function.
5479 (Sized_relobj::is_output_section_offset_invalid): Move here from
5480 child class.
5481 (Sized_relobj::get_output_section_offset): Likewise.
5482 (Sized_relobj::local_has_got_offset): Likewise.
5483 (Sized_relobj::local_got_offset): Likewise.
5484 (Sized_relobj::set_local_got_offset): Likewise.
5485 (Sized_relobj::do_for_all_local_got_entries): Likewise.
5486 (Sized_relobj::clear_got_offsets): New function.
5487 (Sized_relobj::section_offsets): Move here from child class.
5488 (Sized_relobj::do_output_section_offset): Likewise.
5489 (Sized_relobj::do_set_section_offset): Likewise.
5490 (Sized_relobj::Local_got_offsets): Likewise.
5491 (Sized_relobj::local_got_offsets_): Likewise.
5492 (Sized_relobj::section_offsets_): Likewise.
5493 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5494 references.
5495 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5496 class.
5497 (Sized_relobj_file::sized_relobj): New function
5498 (Sized_relobj_file::local_has_got_offset): Move to base class.
5499 (Sized_relobj_file::local_got_offset): Likewise.
5500 (Sized_relobj_file::set_local_got_offset): Likewise.
5501 (Sized_relobj_file::get_output_section_offset): Likewise.
5502 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5503 (Sized_relobj_file::do_output_section_offset): Likewise.
5504 (Sized_relobj_file::do_set_section_offset): Likewise.
5505 (Sized_relobj_file::Local_got_offsets): Likewise.
5506 (Sized_relobj_file::local_got_offsets_): Likewise.
5507 (Sized_relobj_file::section_offsets_): Likewise.
5508 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5509 (all constructors).
5510 (set_needs_dynsym_index): Convert relobj to derived class pointer.
5511 (Output_reloc::get_symbol_index): Likewise.
5512 (Output_reloc::local_section_offset): Likewise.
5513 (Output_reloc::get_address): Likewise.
5514 (Output_reloc::symbol_value): Likewise.
5515 (Output_data_got::reserve_slot): Move to class definition.
5516 (Output_data_got::reserve_local): New function.
5517 (Output_data_got::reserve_slot_for_global): Remove.
5518 (Output_data_got::reserve_global): New function.
5519 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5520 (all constructors, two instantiations).
5521 (Output_reloc::get_relobj): New function (two instantiations).
5522 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5523 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5524 (Output_data_reloc::add_global): Adjust type of relobj.
5525 (Output_data_reloc::add_global_relative): Likewise.
5526 (Output_data_reloc::add_symbolless_global_addend): Likewise.
5527 (Output_data_reloc::add_local): Likewise.
5528 (Output_data_reloc::add_local_relative): Likewise.
5529 (Output_data_reloc::add_symbolless_local_addend): Likewise.
5530 (Output_data_reloc::add_local_section): Likewise.
5531 (Output_data_reloc::add_output_section): Likewise.
5532 (Output_data_reloc::add_absolute): Likewise.
5533 (Output_data_reloc::add_target_specific): Likewise.
5534 (Output_data_got::reserve_slot): Move definition here.
5535 (Output_data_got::reserve_local): New function.
5536 (Output_data_got::reserve_global): New function.
5537 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5538 section_offsets_ with accessor function.
5539 (Sized_relobj_file::write_sections): Likewise.
5540 (Sized_relobj_file::do_relocate_sections): Likewise.
5541 * target.h (Sized_target::reserve_local_got_entry): New function.
5542 (Sized_target::reserve_global_got_entry): New function.
5543 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5544 (Target_x86_64::reserve_global_got_entry): New function.
5545 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5546
5547 2011-05-23 Cary Coutant <ccoutant@google.com>
5548
5549 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5550 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5551 bit when checking got_type.
5552 * incremental.cc (Sized_incremental_binary::setup_readers):
5553 Store symbol table and string table locations; initialize bit vector
5554 of file status flags.
5555 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5556 unchanged files.
5557 (Sized_incremental_binary::do_process_got_plt): New function.
5558 (Sized_incremental_binary::get_symtab_view): Use stored locations.
5559 (Output_section_incremental_inputs::set_final_data_size): Record
5560 file index for each input file.
5561 (Output_section_incremental_inputs::write_got_plt): Store file index
5562 instead of input entry offset for each GOT entry.
5563 * incremental.h
5564 (Incremental_input_entry::Incremental_input_entry): Initialize new
5565 data member.
5566 (Incremental_input_entry::set_offset): Store file index.
5567 (Incremental_input_entry::get_file_index): New function.
5568 (Incremental_input_entry::file_index_): New data member.
5569 (Incremental_binary::process_got_plt): New function.
5570 (Incremental_binary::do_process_got_plt): New function.
5571 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5572 data members.
5573 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5574 (Sized_incremental_binary::set_file_is_unchanged): New function.
5575 (Sized_incremental_binary::file_is_unchanged): New function.
5576 (Sized_incremental_binary::do_process_got_plt): New function.
5577 (Sized_incremental_binary::file_status_): New data member.
5578 (Sized_incremental_binary::main_symtab_loc_): New data member.
5579 (Sized_incremental_binary::main_strtab_loc_): New data member.
5580 * output.cc (Output_data_got::Got_entry::write): Add case
5581 RESERVED_CODE.
5582 (Output_data_got::add_global): Call add_got_entry.
5583 (Output_data_got::add_global_plt): Likewise.
5584 (Output_data_got::add_global_with_rel): Likewise.
5585 (Output_data_got::add_global_with_rela): Likewise.
5586 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5587 (Output_data_got::add_global_pair_with_rela): Likewise.
5588 (Output_data_got::add_local): Call add_got_entry.
5589 (Output_data_got::add_local_plt): Likewise.
5590 (Output_data_got::add_local_with_rel): Likewise.
5591 (Output_data_got::add_local_with_rela): Likewise.
5592 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5593 (Output_data_got::add_local_pair_with_rela): Likewise.
5594 (Output_data_got::reserve_slot): New function.
5595 (Output_data_got::reserve_slot_for_global): New function.
5596 (Output_data_got::add_got_entry): New function.
5597 (Output_data_got::add_got_entry_pair): New function.
5598 (Output_section::add_output_section_data): Edit FIXME.
5599 * output.h
5600 (Output_section_data_build::Output_section_data_build): New
5601 constructor with size parameter.
5602 (Output_data_space::Output_data_space): Likewise.
5603 (Output_data_got::Output_data_got): Initialize new data member; new
5604 constructor with size parameter.
5605 (Output_data_got::add_constant): Call add_got_entry.
5606 (Output_data_got::reserve_slot): New function.
5607 (Output_data_got::reserve_slot_for_global): New function.
5608 (class Output_data_got::Got_entry): Add RESERVED_CODE.
5609 (Output_data_got::add_got_entry): New function.
5610 (Output_data_got::add_got_entry_pair): New function.
5611 (Output_data_got::free_list_): New data member.
5612 * target.h (Sized_target::init_got_plt_for_update): New function.
5613 (Sized_target::register_global_plt_entry): New function.
5614 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5615 Initialize new data member; call init; add constructor with PLT count.
5616 (Output_data_plt_x86_64::init): New function.
5617 (Output_data_plt_x86_64::add_relocation): New function.
5618 (Output_data_plt_x86_64::reserve_slot): New function.
5619 (Output_data_plt_x86_64::free_list_): New data member.
5620 (Target_x86_64::init_got_plt_for_update): New function.
5621 (Target_x86_64::register_global_plt_entry): New function.
5622 (Output_data_plt_x86_64::add_entry): Allocate from free list for
5623 incremental updates.
5624 (Output_data_plt_x86_64::add_relocation): New function.
5625 * testsuite/object_unittest.cc (Object_test): Set default options.
5626
5627 2011-05-16 Ian Lance Taylor <iant@google.com>
5628
5629 * options.h (class General_options): Make -i a synonym for -r.
5630
5631 2011-05-16 Ian Lance Taylor <iant@google.com>
5632
5633 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5634
5635 2011-05-10 Cary Coutant <ccoutant@google.com>
5636
5637 * object.cc (Sized_relobj::do_count_local_symbols): Check for
5638 strip_all (-s).
5639
5640 2011-05-06 Ian Lance Taylor <iant@google.com>
5641
5642 * layout.cc (Layout::layout): If the output section flags change,
5643 update the ordering.
5644
5645 2011-04-25 Cary Coutant <ccoutant@google.com>
5646
5647 * incremental-dump.cc (dump_incremental_inputs): Print local
5648 symbol info for each input file.
5649 * incremental.cc
5650 (Output_section_incremental_inputs::set_final_data_size): Add local
5651 symbol info to input file entries in incremental info.
5652 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5653 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5654 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5655 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5656 implementation.
5657 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5658 (Sized_incr_relobj::do_relocate): Write the local symbols.
5659 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5660 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5661 Adjust size of input file header.
5662 (Incremental_inputs_reader::get_local_symbol_offset): New function.
5663 (Incremental_inputs_reader::get_local_symbol_count): New function.
5664 (Incremental_inputs_reader::get_input_section): Adjust size of input
5665 file header.
5666 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5667 (Sized_incr_relobj::This): New typedef.
5668 (Sized_incr_relobj::sym_size): New const data member.
5669 (Sized_incr_relobj::Local_symbol): New struct.
5670 (Sized_incr_relobj::do_output_local_symbol_count): New function.
5671 (Sized_incr_relobj::do_local_symbol_offset): New function.
5672 (Sized_incr_relobj::local_symbol_count_): New data member.
5673 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5674 (Sized_incr_relobj::local_symbol_index_): New data member.
5675 (Sized_incr_relobj::local_symbol_offset_): New data member.
5676 (Sized_incr_relobj::local_dynsym_offset_): New data member.
5677 (Sized_incr_relobj::local_symbols_): New data member.
5678 * object.h (Relobj::output_local_symbol_count): New function.
5679 (Relobj::local_symbol_offset): New function.
5680 (Relobj::do_output_local_symbol_count): New function.
5681 (Relobj::do_local_symbol_offset): New function.
5682 (Sized_relobj::do_output_local_symbol_count): New function.
5683 (Sized_relobj::do_local_symbol_offset): New function.
5684
5685 2011-04-22 Vladimir Simonov <sv@sw.ru>
5686
5687 * descriptors.cc (set_close_on_exec): New function.
5688 (Descriptors::open): Use set_close_on_exec.
5689 * output.cc (S_ISLNK): Define if not defined.
5690
5691 2011-04-22 Cary Coutant <ccoutant@google.com>
5692
5693 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5694 global symbol map.
5695 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5696 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5697 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5698 relocations.
5699 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5700 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5701 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5702 * incremental.h
5703 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5704 function.
5705 (Incremental_binary::apply_incremental_relocs): New function.
5706 (Incremental_binary::do_apply_incremental_relocs): New function.
5707 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5708 data member.
5709 (Sized_incremental_binary::add_global_symbol): New function.
5710 (Sized_incremental_binary::global_symbol): New function.
5711 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5712 (Sized_incremental_binary::symbol_map_): New data member.
5713 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5714 * target.h (Sized_target::apply_relocation): New function.
5715 * target-reloc.h (apply_relocation): New function.
5716 * x86_64.cc (Target_x86_64::apply_relocation): New function.
5717
5718 2011-04-22 Doug Kwan <dougkwan@google.com>
5719
5720 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5721 flag of a SHT_ARM_EXIDX section.
5722 * testsuite/Makefile.am (arm_exidx_test): New test rules.
5723 * testsuite/Makefile.in: Regenerate.
5724 * testsuite/arm_exidx_test.s: New file.
5725 * testsuite/arm_exidx_test.sh: Same.
5726
5727 2011-04-20 Cary Coutant <ccoutant@google.com>
5728
5729 PR gold/12689
5730 * archive.h (Incremental_archive_entry::Archive_member):
5731 Initialize arg_serial_ (second constructor).
5732
5733 2011-04-17 Ian Lance Taylor <iant@google.com>
5734
5735 * object.cc (Relocate_info::location): Simplify location string.
5736 * errors.cc (Errors::error_at_location): Don't print program
5737 name.
5738 (Errors::warning_at_location): Likewise.
5739 (Errors::undefined_symbol): Likewise.
5740 * testsuite/debug_msg.sh: Update accordingly.
5741
5742 2011-04-14 Cary Coutant <ccoutant@google.com>
5743
5744 * gold/layout.cc (Layout::symtab_section_offset): New function.
5745 * gold/layout.h (Layout::symtab_section_offset): New function.
5746 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5747
5748 2011-04-12 Ian Lance Taylor <iant@google.com>
5749
5750 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
5751 with MREMAP_MAYMOVE.
5752 * output.h (class Output_file): Add map_is_allocated_ field.
5753 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
5754 not available, provide stubs. If mremap is not available, #define
5755 it to gold_mremap.
5756 (MREMAP_MAYMOVE): Define if not defined.
5757 (Output_file::Output_file): Initialize map_is_allocated_.
5758 (Output_file::resize): Check map_is_allocated_.
5759 (Output_file::map_anonymous): If mmap fails, use malloc.
5760 (Output_file::unmap): Don't do anything for an anonymous map.
5761 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
5762 is not available, provide stubs.
5763 (File_read::View::~View): Use free rather than delete[].
5764 (File_read::make_view): Use malloc rather than new[]. If mmap
5765 fails, use malloc.
5766 (File_read::find_or_make_view): Use malloc rather than new[].
5767 * gold.h: Remove HAVE_REMAP code.
5768 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
5769 exists. Rename mremap to gold_mremap. If mmap is not available
5770 don't do anything.
5771 * configure, config.in: Rebuild.
5772
5773 2011-04-11 Ian Lance Taylor <iant@google.com>
5774
5775 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5776 initialize local variable v.
5777
5778 2011-04-11 Cary Coutant <ccoutant@google.com>
5779
5780 * archive.cc (Archive::include_member): Adjust call to
5781 report_object.
5782 (Add_archive_symbols::run): Track argument serial numbers.
5783 (Lib_group::include_member): Likewise.
5784 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5785 * archive.h (Incremental_archive_entry::Archive_member):
5786 Initialize arg_serial_.
5787 (Archive_member::arg_serial_): New data member.
5788 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5789 (Sized_dynobj::do_add_symbols): Track symbols when doing an
5790 incremental link.
5791 (Sized_dynobj::do_for_all_local_got_entries): New function.
5792 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5793 function.
5794 * fileread.cc (get_mtime): New function.
5795 * fileread.h (get_mtime): New function.
5796 * gold.cc (queue_initial_tasks): Check for incremental update.
5797 (process_incremental_input): New function.
5798 (queue_middle_tasks): Don't force valid target for incremental
5799 update.
5800 * incremental-dump.cc (find_input_containing_global): Adjust
5801 size of symbol info entry.
5802 (dump_incremental_inputs): Dump argument serial number and
5803 in_system_directory flag; bias shndx by 1; print symbol names
5804 when dumping per-file symbol lists; use new symbol info readers.
5805 * incremental.cc
5806 (Output_section_incremental_inputs:update_data_size): New function.
5807 (Sized_incremental_binary::setup_readers): Setup input readers
5808 for each input file; build maps for files added from libraries
5809 and scripts.
5810 (Sized_incremental_binary::check_input_args): New function.
5811 (Sized_incremental_binary::do_check_inputs): Build map of argument
5812 serial numbers to input arguments.
5813 (Sized_incremental_binary::do_file_has_changed): Rename
5814 do_file_is_unchanged to this; compare file modification times.
5815 (Sized_incremental_binary::do_init_layout): New function.
5816 (Sized_incremental_binary::do_reserve_layout): New function.
5817 (Sized_incremental_binary::do_get_input_reader): Remove.
5818 (Sized_incremental_binary::get_symtab_view): New function.
5819 (Incremental_checker::can_incrementally_link_output_file): Remove.
5820 (Incremental_inputs::report_command_line): Exclude --debug options.
5821 (Incremental_inputs::report_archive_begin): Add parameter; track
5822 argument serial numbers; don't put input file entry for archive
5823 before archive members.
5824 (Incremental_inputs::report_archive_end): Put input file entry
5825 for archive after archive members.
5826 (Incremental_inputs::report_object): Add parameter; track argument
5827 serial numbers and in_system_directory flag.
5828 (Incremental_inputs::report_script): Add parameter; track argument
5829 serial numbers.
5830 (Output_section_incremental_inputs::set_final_data_size): Adjust
5831 size of symbol info entry; check for forwarding symbols.
5832 (Output_section_incremental_inputs::write_input_files): Write
5833 in_system_directory flag and argument serial number.
5834 (Output_section_incremental_inputs::write_info_blocks): Map section
5835 indices between incremental info and original input file; store
5836 input section index for each symbol.
5837 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5838 change operator() to visit().
5839 (class Global_got_offset_visitor): Likewise.
5840 (class Global_symbol_visitor_got_plt):
5841 (Output_section_incremental_inputs::write_got_plt): Use new visitor
5842 classes.
5843 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5844 (Sized_incr_relobj::do_read_symbols): New function.
5845 (Sized_incr_relobj::do_layout): New function.
5846 (Sized_incr_relobj::do_layout_deferred_sections): New function.
5847 (Sized_incr_relobj::do_add_symbols): New function.
5848 (Sized_incr_relobj::do_should_include_member): New function.
5849 (Sized_incr_relobj::do_for_all_global_symbols): New function.
5850 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5851 (Sized_incr_relobj::do_section_size): New function.
5852 (Sized_incr_relobj::do_section_name): New function.
5853 (Sized_incr_relobj::do_section_contents): New function.
5854 (Sized_incr_relobj::do_section_flags): New function.
5855 (Sized_incr_relobj::do_section_entsize): New function.
5856 (Sized_incr_relobj::do_section_address): New function.
5857 (Sized_incr_relobj::do_section_type): New function.
5858 (Sized_incr_relobj::do_section_link): New function.
5859 (Sized_incr_relobj::do_section_info): New function.
5860 (Sized_incr_relobj::do_section_addralign): New function.
5861 (Sized_incr_relobj::do_initialize_xindex): New function.
5862 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5863 (Sized_incr_relobj::do_read_relocs): New function.
5864 (Sized_incr_relobj::do_gc_process_relocs): New function.
5865 (Sized_incr_relobj::do_scan_relocs): New function.
5866 (Sized_incr_relobj::do_count_local_symbols): New function.
5867 (Sized_incr_relobj::do_finalize_local_symbols): New function.
5868 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5869 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5870 (Sized_incr_relobj::do_relocate): New function.
5871 (Sized_incr_relobj::do_set_section_offset): New function.
5872 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5873 (Sized_incr_dynobj::do_read_symbols): New function.
5874 (Sized_incr_dynobj::do_layout): New function.
5875 (Sized_incr_dynobj::do_add_symbols): New function.
5876 (Sized_incr_dynobj::do_should_include_member): New function.
5877 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5878 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5879 (Sized_incr_dynobj::do_section_size): New function.
5880 (Sized_incr_dynobj::do_section_name): New function.
5881 (Sized_incr_dynobj::do_section_contents): New function.
5882 (Sized_incr_dynobj::do_section_flags): New function.
5883 (Sized_incr_dynobj::do_section_entsize): New function.
5884 (Sized_incr_dynobj::do_section_address): New function.
5885 (Sized_incr_dynobj::do_section_type): New function.
5886 (Sized_incr_dynobj::do_section_link): New function.
5887 (Sized_incr_dynobj::do_section_info): New function.
5888 (Sized_incr_dynobj::do_section_addralign): New function.
5889 (Sized_incr_dynobj::do_initialize_xindex): New function.
5890 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5891 (make_sized_incremental_object): New function.
5892 (Incremental_library::copy_unused_symbols): New function.
5893 (Incremental_library::do_for_all_unused_symbols): New function.
5894 * incremental.h (enum Incremental_input_flags): New type.
5895 (class Incremental_checker): Remove.
5896 (Incremental_input_entry::Incremental_input_entry): Add argument
5897 serial number.
5898 (Incremental_input_entry::arg_serial): New function.
5899 (Incremental_input_entry::set_is_in_system_directory): New function.
5900 (Incremental_input_entry::is_in_system_directory): New function.
5901 (Incremental_input_entry::arg_serial_): New data member.
5902 (Incremental_input_entry::is_in_system_directory_): New data member.
5903 (class Script_info): Move here from script.h.
5904 (Script_info::Script_info): Add filename parameter.
5905 (Script_info::filename): New function.
5906 (Script_info::filename_): New data member.
5907 (Incremental_script_entry::Incremental_script_entry): Add argument
5908 serial number.
5909 (Incremental_object_entry::Incremental_object_entry): Likewise.
5910 (Incremental_object_entry::add_input_section): Build list of input
5911 sections with map to original shndx.
5912 (Incremental_object_entry::get_input_section_index): New function.
5913 (Incremental_object_entry::shndx_): New data member.
5914 (Incremental_object_entry::name_key_): Rename; adjust all refs.
5915 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5916 (Incremental_archive_entry::Incremental_archive_entry): Add argument
5917 serial number.
5918 (Incremental_inputs::report_archive_begin): Likewise.
5919 (Incremental_inputs::report_object): Likewise.
5920 (Incremental_inputs::report_script): Likewise.
5921 (class Incremental_global_symbol_reader): New class.
5922 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5923 and store flags and input file type.
5924 (Incremental_input_entry_reader::arg_serial): New function.
5925 (Incremental_input_entry_reader::type): Extract type from flags.
5926 (Incremental_input_entry_reader::is_in_system_directory): New function.
5927 (Incremental_input_entry_reader::get_input_section_count): Call
5928 accessor function for type.
5929 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5930 function for type; adjust size of global symbol entry.
5931 (Incremental_input_entry_reader::get_global_symbol_count): Call
5932 accessor function for type.
5933 (Incremental_input_entry_reader::get_object_count): Likewise.
5934 (Incremental_input_entry_reader::get_object_offset): Likewise.
5935 (Incremental_input_entry_reader::get_member_count): Likewise.
5936 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5937 (Incremental_input_entry_reader::get_member_offset): Likewise.
5938 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5939 (Incremental_input_entry_reader::Global_symbol_info): Remove.
5940 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5941 (Incremental_input_entry_reader::get_global_symbol_reader): New
5942 function.
5943 (Incremental_input_entry_reader::get_output_symbol_index): New
5944 function.
5945 (Incremental_input_entry_reader::type_): Remove.
5946 (Incremental_input_entry_reader::flags_): New data member.
5947 (Incremental_inputs_reader::input_file_offset): New function.
5948 (Incremental_inputs_reader::input_file_index): New function.
5949 (Incremental_inputs_reader::input_file): Call input_file_offset.
5950 (Incremental_inputs_reader::input_file_at_offset): New function.
5951 (Incremental_relocs_reader::get_r_type): Reformat.
5952 (Incremental_relocs_reader::get_r_shndx): Reformat.
5953 (Incremental_relocs_reader::get_r_offset): Reformat.
5954 (Incremental_relocs_reader::data): New function.
5955 (Incremental_binary::Incremental_binary): Initialize new data members.
5956 (Incremental_binary::check_inputs): Add cmdline parameter.
5957 (Incremental_binary::file_is_unchanged): Remove.
5958 (Input_reader::arg_serial): New function.
5959 (Input_reader::get_unused_symbol_count): New function.
5960 (Input_reader::get_unused_symbol): New function.
5961 (Input_reader::do_arg_serial): New function.
5962 (Input_reader::do_get_unused_symbol_count): New function.
5963 (Input_reader::do_get_unused_symbol): New function.
5964 (Incremental_binary::input_file_count): New function.
5965 (Incremental_binary::get_input_reader): Change signature to use
5966 index instead of filename.
5967 (Incremental_binary::file_has_changed): New function.
5968 (Incremental_binary::get_input_argument): New function.
5969 (Incremental_binary::get_library): New function.
5970 (Incremental_binary::get_script_info): New function.
5971 (Incremental_binary::init_layout): New function.
5972 (Incremental_binary::reserve_layout): New function.
5973 (Incremental_binary::output_file): New function.
5974 (Incremental_binary::do_check_inputs): New function.
5975 (Incremental_binary::do_file_is_unchanged): Remove.
5976 (Incremental_binary::do_file_has_changed): New function.
5977 (Incremental_binary::do_init_layout): New function.
5978 (Incremental_binary::do_reserve_layout): New function.
5979 (Incremental_binary::do_input_file_count): New function.
5980 (Incremental_binary::do_get_input_reader): Change signature.
5981 (Incremental_binary::input_args_map_): New data member.
5982 (Incremental_binary::library_map_): New data member.
5983 (Incremental_binary::script_map_): New data member.
5984 (Sized_incremental_binary::Sized_incremental_binary): Initialize
5985 new data members.
5986 (Sized_incremental_binary::output_section): New function.
5987 (Sized_incremental_binary::inputs_reader): Add const.
5988 (Sized_incremental_binary::symtab_reader): Add const.
5989 (Sized_incremental_binary::relocs_reader): Add const.
5990 (Sized_incremental_binary::got_plt_reader): Add const.
5991 (Sized_incremental_binary::get_symtab_view): New function.
5992 (Sized_incremental_binary::Inputs_reader): New typedef.
5993 (Sized_incremental_binary::Input_entry_reader): New typedef.
5994 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5995 (Sized_incremental_binary::do_file_is_unchanged): Remove.
5996 (Sized_incremental_binary::do_file_has_changed): New function.
5997 (Sized_incremental_binary::do_init_layout): New function.
5998 (Sized_incremental_binary::do_reserve_layout): New function.
5999 (Sized_input_reader::Inputs_reader): Remove.
6000 (Sized_input_reader::Input_entry_reader): Remove.
6001 (Sized_input_reader::do_arg_serial): New function.
6002 (Sized_input_reader::do_get_unused_symbol_count): New function.
6003 (Sized_input_reader::do_get_unused_symbol): New function.
6004 (Sized_incremental_binary::do_input_file_count): New function.
6005 (Sized_incremental_binary::do_get_input_reader): Change signature;
6006 use index instead of filename.
6007 (Sized_incremental_binary::section_map_): New data member.
6008 (Sized_incremental_binary::input_entry_readers_): New data member.
6009 (class Sized_incr_relobj): New class.
6010 (class Sized_incr_dynobj): New class.
6011 (make_sized_incremental_object): New function.
6012 (class Incremental_library): New class.
6013 * layout.cc (Free_list::num_lists): New static data member.
6014 (Free_list::num_nodes): New static data member.
6015 (Free_list::num_removes): New static data member.
6016 (Free_list::num_remove_visits): New static data member.
6017 (Free_list::num_allocates): New static data member.
6018 (Free_list::num_allocate_visits): New static data member.
6019 (Free_list::init): New function.
6020 (Free_list::remove): New function.
6021 (Free_list::allocate): New function.
6022 (Free_list::dump): New function.
6023 (Free_list::print_stats): New function.
6024 (Layout_task_runner::run): Resize output file for incremental updates.
6025 (Layout::Layout): Initialize new data members.
6026 (Layout::set_incremental_base): New function.
6027 (Layout::init_fixed_output_section): New function.
6028 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6029 incremental updates.
6030 (Layout::create_gold_note): Do not create gold note section for
6031 incremental updates.
6032 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6033 for incremental updates.
6034 (Layout::set_section_offsets): For incremental updates, allocate space
6035 from free list.
6036 (Layout::create_symtab_sections): Layout with offsets relative to
6037 start of section; for incremental updates, allocate space from free
6038 list.
6039 (Layout::create_shdrs): For incremental updates, allocate space from
6040 free list.
6041 (Layout::finish_dynamic_section): For incremental updates, do not
6042 check --as-needed (fixed in subsequent patch).
6043 * layout.h (class Free_list): New class.
6044 (Layout::set_incremental_base): New function.
6045 (Layout::incremental_base): New function.
6046 (Layout::init_fixed_output_section): New function.
6047 (Layout::allocate): New function.
6048 (Layout::incremental_base_): New data member.
6049 (Layout::free_list_): New data member.
6050 * main.cc (main): Print Free_list statistics.
6051 * object.cc (Relobj::finalize_incremental_relocs): Add
6052 clear_counts parameter; clear counts only when clear_counts is set.
6053 (Sized_relobj::Sized_relobj): Initialize new base class.
6054 (Sized_relobj::do_layout): Don't report special sections.
6055 (Sized_relobj::do_for_all_local_got_entries): New function.
6056 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6057 symtab_off to all symbol table offsets.
6058 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6059 * object.h (class Got_offset_list): Move to top of file.
6060 (Object::Object): Allow case where input_file == NULL.
6061 (Object::~Object): Likewise.
6062 (Object::input_file): Assert that input_file != NULL.
6063 (Object::lock): Allow case where input_file == NULL.
6064 (Object::unlock): Likewise.
6065 (Object::is_locked): Likewise.
6066 (Object::token): Likewise.
6067 (Object::release): Likewise.
6068 (Object::is_incremental): New function.
6069 (Object::get_mtime): New function.
6070 (Object::for_all_local_got_entries): New function.
6071 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6072 (Object::set_is_in_system_directory): New function.
6073 (Object::is_in_system_directory): New function.
6074 (Object::do_is_incremental): New function.
6075 (Object::do_get_mtime): New function.
6076 (Object::do_for_all_local_got_entries): New function.
6077 (Object::is_in_system_directory_): New data member.
6078 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6079 (class Sized_relobj_base): New class.
6080 (class Sized_relobj): Derive from Sized_relobj_base.
6081 (class Sized_relobj::Symbols): Redeclare from base class.
6082 (class Sized_relobj::local_got_offset_list): Remove.
6083 (class Sized_relobj::Output_sections): Redeclare from base class.
6084 (class Sized_relobj::do_for_all_local_got_entries): New function.
6085 (class Sized_relobj::write_local_symbols): Add offset parameter.
6086 (class Sized_relobj::local_symbol_offset_): Update comment.
6087 (class Sized_relobj::local_dynsym_offset_): Update comment.
6088 * options.cc (Input_arguments::add_file): Remove const.
6089 * options.h (Input_file_argument::Input_file_argument):
6090 Initialize arg_serial_ (all constructors).
6091 (Input_file_argument::set_arg_serial): New function.
6092 (Input_file_argument::arg_serial): New function.
6093 (Input_file_argument::arg_serial_): New data member.
6094 (Input_arguments::Input_arguments): Initialize file_count_.
6095 (Input_arguments::add_file): Remove const.
6096 (Input_arguments::number_of_input_files): New function.
6097 (Input_arguments::file_count_): New data member.
6098 (Command_line::number_of_input_files): Call
6099 Input_arguments::number_of_input_files.
6100 * output.cc (Output_segment_headers::Output_segment_headers):
6101 Set current size.
6102 (Output_section::Input_section::current_data_size): New function.
6103 (Output_section::Output_section): Initialize new data members.
6104 (Output_section::add_input_section): Don't do merge sections for
6105 an incremental link; allocate space from free list for an
6106 incremental update.
6107 (Output_section::add_output_section_data): Allocate space from
6108 free list for an incremental update.
6109 (Output_section::update_data_size): New function.
6110 (Output_section::set_fixed_layout): New function.
6111 (Output_section::reserve): New function.
6112 (Output_segment::set_section_addresses): Remove const.
6113 (Output_segment::set_section_list_addresses): Remove const; allocate
6114 space from free list for an incremental update.
6115 (Output_segment::set_offset): Adjust size of RELRO segment for an
6116 incremental update.
6117 * output.h (Output_data::current_data_size): Move here from
6118 child classes.
6119 (Output_data::pre_finalize_data_size): New function.
6120 (Output_data::update_data_size): New function.
6121 (Output_section_headers::update_data_size): new function.
6122 (Output_section_data_build::current_data_size): Move to Output_data.
6123 (Output_data_strtab::update_data_size): New function.
6124 (Output_section::current_data_size): Move to Output_data.
6125 (Output_section::set_fixed_layout): New function.
6126 (Output_section::has_fixed_layout): New function.
6127 (Output_section::reserve): New function.
6128 (Output_section::update_data_size): New function.
6129 (Output_section::has_fixed_layout_): New data member.
6130 (Output_section::free_list_): New data member.
6131 (Output_segment::set_section_addresses): Remove const.
6132 (Output_segment::set_section_list_addresses): Remove const.
6133 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6134 New function.
6135 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6136 New function.
6137 * readsyms.cc (Read_symbols::do_read_symbols): Add library
6138 parameter when calling Add_symbols constructor; store argument
6139 serial number for members of a lib group.
6140 (Add_symbols::locks): Allow case where token == NULL.
6141 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6142 (Read_member::~Read_member): New function.
6143 (Read_member::is_runnable): New function.
6144 (Read_member::locks): New function.
6145 (Read_member::run): New function.
6146 (Check_script::~Check_script): New function.
6147 (Check_script::is_runnable): New function.
6148 (Check_script::locks): New function.
6149 (Check_script::run): New function.
6150 (Check_library::~Check_library): New function.
6151 (Check_library::is_runnable): New function.
6152 (Check_library::locks): New function.
6153 (Check_library::run): New function.
6154 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6155 (Add_symbols::library_): New data member.
6156 (class Read_member): New class.
6157 (class Check_script): New class.
6158 (class Check_library): New class.
6159 * reloc.cc (Read_relocs::is_runnable): Allow case where
6160 token == NULL.
6161 (Read_relocs::locks): Likewise.
6162 (Scan_relocs::locks): Likewise.
6163 (Relocate_task::locks): Likewise.
6164 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6165 to clear counters.
6166 (Sized_relobj::incremental_relocs_scan): Fix comment.
6167 (Sized_relobj::do_relocate): Pass output file offset to
6168 write_local_symbols.
6169 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6170 from class declaration.
6171 * script.cc (read_input_script): Allocate Script_info; pass
6172 argument serial number to report_script.
6173 * script.h (class Script_info): Move to incremental.h.
6174 * symtab.cc (Symbol_table::add_from_incrobj): New function.
6175 * symtab.h (Symbol_table::add_from_incrobj): New function.
6176 (Symbol_table::set_file_offset): New function.
6177
6178 2011-04-05 Cary Coutant <ccoutant@google.com>
6179
6180 * incremental-dump.cc (dump_incremental_inputs): Change signature
6181 to take a Sized_incremental_binary; change caller. Use readers
6182 in Sized_incremental_binary.
6183 * incremental.cc
6184 (Sized_incremental_binary::find_incremental_inputs_sections):
6185 Rename do_find_incremental_inputs_sections to this.
6186 (Sized_incremental_binary::setup_readers): New function.
6187 (Sized_incremental_binary::do_check_inputs): Check
6188 has_incremental_info_ flag; move setup code to setup_readers;
6189 use input readers.
6190 (Sized_incremental_binary::do_file_is_unchanged): New function.
6191 (Sized_incremental_binary::do_get_input_reader): New function.
6192 * incremental.h (class Incremental_binary): Move to end of file.
6193 (Incremental_binary::file_is_unchanged): New function.
6194 (Incremental_binary::do_file_is_unchanged): New function.
6195 (Incremental_binary::Input_reader): New class.
6196 (Incremental_binary::get_input_reader): New function.
6197 (class Sized_incremental_binary): Move to end of file.
6198 (Sized_incremental_binary::Sized_incremental_binary): Setup the
6199 input section reader classes.
6200 (Sized_incremental_binary::has_incremental_info): New function.
6201 (Sized_incremental_binary::inputs_reader): New function.
6202 (Sized_incremental_binary::symtab_reader): New function.
6203 (Sized_incremental_binary::relocs_reader): New function.
6204 (Sized_incremental_binary::got_plt_reader): New function.
6205 (Sized_incremental_binary::do_file_is_unchanged): New function.
6206 (Sized_incremental_binary::Sized_input_reader): New class.
6207 (Sized_incremental_binary::get_input_reader): New function.
6208 (Sized_incremental_binary::find_incremental_inputs_sections):
6209 Rename do_find_incremental_inputs_sections to this.
6210 (Sized_incremental_binary::setup_readers): New function.
6211 (Sized_incremental_binary::has_incremental_info_): New data member.
6212 (Sized_incremental_binary::inputs_reader_): New data member.
6213 (Sized_incremental_binary::symtab_reader_): New data member.
6214 (Sized_incremental_binary::relocs_reader_): New data member.
6215 (Sized_incremental_binary::got_plt_reader_): New data member.
6216 (Sized_incremental_binary::current_input_file_): New data member.
6217
6218 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
6219
6220 PR gold/12640
6221 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6222 violation.
6223
6224 2011-03-30 Cary Coutant <ccoutant@google.com>
6225
6226 * archive.cc (Archive::include_member): Adjust call to report_object.
6227 (Add_archive_symbols::run): Add script_info to call to
6228 report_archive_begin.
6229 (Lib_group::include_member): Adjust call to report_object.
6230 (Add_lib_group_symbols::run): Adjust call to report_object.
6231 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6232 blocks. Add object count for script input files.
6233 * incremental.cc (Incremental_inputs::report_archive_begin): Add
6234 script_info parameter; change all callers.
6235 (Incremental_inputs::report_object): Add script_info parameter;
6236 change all callers.
6237 (Incremental_inputs::report_script): Store backpointer to
6238 incremental info entry.
6239 (Output_section_incremental_inputs::set_final_data_size): Record
6240 additional information for scripts.
6241 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6242 * incremental.h (Incremental_script_entry::add_object): New function.
6243 (Incremental_script_entry::get_object_count): New function.
6244 (Incremental_script_entry::get_object): New function.
6245 (Incremental_script_entry::objects_): New data member; adjust
6246 constructor.
6247 (Incremental_inputs::report_archive_begin): Add script_info parameter.
6248 (Incremental_inputs::report_object): Add script_info parameter.
6249 (Incremental_inputs_reader::get_object_count): New function.
6250 (Incremental_inputs_reader::get_object_offset): New function.
6251 * options.cc (Input_arguments::add_file): Return reference to
6252 new input argument.
6253 * options.h (Input_argument::set_script_info): New function.
6254 (Input_argument::script_info): New function.
6255 (Input_argument::script_info_): New data member; adjust all
6256 constructors.
6257 (Input_file_group::add_file): Return reference to new input argument.
6258 (Input_file_lib::add_file): Likewise.
6259 (Input_arguments::add_file): Likewise.
6260 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6261 * script.cc (Parser_closure::Parser_closure): Add script_info
6262 parameter; adjust all callers.
6263 (Parser_closure::script_info): New function.
6264 (Parser_closure::script_info_): New data member.
6265 (read_input_script): Report scripts earlier to incremental info.
6266 (script_add_file): Set script_info in Input_argument.
6267 (script_add_library): Likewise.
6268 * script.h (Script_options::Script_info): Rewrite class.
6269
6270 2011-03-29 Cary Coutant <ccoutant@google.com>
6271
6272 * archive.cc (Library_base::should_include_member): Move
6273 method here from class Archive.
6274 (Archive::Archive): Initialize base class.
6275 (Archive::should_include_member): Move to base class.
6276 (Archive::do_for_all_unused_symbols): New function.
6277 (Add_archive_symbols::run): Remove redundant access to
6278 incremental_inputs.
6279 (Lib_group::Lib_group): Initialize base class.
6280 (Lib_group::do_filename): New function.
6281 (Lib_group::include_member): Pass pointer to Lib_group to
6282 report_object.
6283 (Lib_group::do_for_all_unused_symbols): New function.
6284 (Add_lib_group_symbols::run): Report archive information for
6285 incremental links.
6286 * archive.h (class Library_base): New base class.
6287 (class Archive): Derive from Library_base.
6288 (Archive::filename): Move to base class.
6289 (Archive::set_incremental_info): Likewise.
6290 (Archive::incremental_info): Likewise.
6291 (Archive::Should_include): Likewise.
6292 (Archive::should_include_member): Likewise.
6293 (Archive::Armap_entry): Remove.
6294 (Archive::Unused_symbol_iterator): Remove.
6295 (Archive::unused_symbols_begin): Remove.
6296 (Archive::unused_symbols_end): Remove.
6297 (Archive::do_filename): New function.
6298 (Archive::do_get_mtime): New function.
6299 (Archive::do_for_all_unused_symbols): New function.
6300 (Archive::task_): Move to base class.
6301 (Archive::incremental_info_): Likewise.
6302 (class Lib_group): Derive from Library_base.
6303 (Lib_group::do_filename): New function.
6304 (Lib_group::do_get_mtime): New function.
6305 (Lib_group::do_for_all_unused_symbols): New function.
6306 (Lib_group::task_): Move to base class.
6307 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6308 function.
6309 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6310 function.
6311 * incremental.cc (Incremental_inputs::report_archive_begin):
6312 Use Library_base; call library's get_mtime; add incremental inputs
6313 entry before members.
6314 (class Unused_symbol_visitor): New class.
6315 (Incremental_inputs::report_archive_end): Use Library_base; use
6316 visitor class to record unused symbols; don't add incremental inputs
6317 entry after members.
6318 (Incremental_inputs::report_object): Use Library_base.
6319 * incremental.h
6320 (Incremental_archive_entry::Incremental_archive_entry): Remove
6321 unused Archive parameter.
6322 (Incremental_inputs::report_archive_begin): Use Library_base.
6323 (Incremental_inputs::report_archive_end): Likewise.
6324 (Incremental_inputs::report_object): Likewise.
6325 * object.cc (Sized_relobj::do_for_all_global_symbols): New
6326 function.
6327 * object.h (Object::for_all_global_symbols): New function.
6328 (Object::do_for_all_global_symbols): New function.
6329 (Sized_relobj::do_for_all_global_symbols): New function.
6330 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
6331 function.
6332 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
6333 function.
6334
6335 2011-03-27 Ian Lance Taylor <iant@google.com>
6336
6337 * archive.cc (Archive::interpret_header): Return -1 if something
6338 goes wrong. Change callers accordingly.
6339
6340 2011-03-25 Cary Coutant <ccoutant@google.com>
6341
6342 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6343 * testsuite/Makefile.in: Regenerate.
6344
6345 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
6346
6347 * plugin.cc (get_view): New.
6348 (Plugin::load): Pass get_view to the plugin.
6349 (Plugin_manager::get_view): New.
6350
6351 2011-03-21 Ian Lance Taylor <iant@google.com>
6352
6353 * testsuite/final_layout.sh: Rewrite to not use dc.
6354 * testsuite/relro_test.sh: Fail if dc is not present.
6355
6356 2011-03-21 Sriraman Tallam <tmsriram@google.com>
6357
6358 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6359 Change == to -eq.
6360 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6361 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6362 Change == to -eq.
6363 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6364 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6365
6366 2011-03-14 Ian Lance Taylor <iant@google.com>
6367
6368 * script-sections.cc (Sort_output_sections::script_compare):
6369 Rename from is_before, change return type.
6370 (Sort_output_sections::operator()): Adjust accordingly.
6371
6372 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
6373
6374 PR gold/12572
6375 * testsuite/odr_violation2.cc: Add comment to make all error line
6376 numbers double digits.
6377 * testsuite/debug_msg.sh: Adjust expected errors.
6378
6379 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
6380
6381 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6382 but mark earlier ones as non-canonical
6383 (offset_to_iterator): Update search target and example
6384 (do_addr2line): Return extra lines in a vector*
6385 (format_file_lineno): Extract from do_addr2line
6386 (one_addr2line): Add vector* out-param
6387 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6388 when a lineno entry appeared last for its instruction
6389 (Dwarf_line_info): Add vector* out-param
6390 * object.cc (Relocate_info): Pass NULL for the vector* out-param
6391 * symtab.cc (Odr_violation_compare): Include the lineno in the
6392 comparison again.
6393 (linenos_from_loc): New. Combine the canonical line for an
6394 address with its other lines.
6395 (True_if_intersect): New. Helper functor to make
6396 std::set_intersection a query.
6397 (detect_odr_violations): Compare sets of lines instead of just
6398 one line for each function. This became less deterministic, but
6399 has fewer false positives.
6400 * symtab.h: Declarations.
6401 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6402 mix an optimized and non-optimized object in the same binary
6403 (odr_violation2.so): Same.
6404 * testsuite/Makefile.in: Regenerate from Makefile.am.
6405 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6406 * testsuite/debug_msg.sh: Update line numbers and add
6407 assertions.
6408 * testsuite/odr_violation1.cc: Use OdrDerived, in a
6409 non-optimized context.
6410 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6411 isn't inlined, and use OdrDerived in an optimized context.
6412 * testsuite/odr_header1.h: Defines OdrDerived, where
6413 optimization will change the
6414 first-instruction-in-the-destructor's file and line number.
6415 * testsuite/odr_header2.h: Defines OdrBase.
6416
6417 2011-03-09 Ian Lance Taylor <iant@google.com>
6418
6419 * fileread.cc (File_read::clear_views): Don't delete the whole
6420 file view.
6421
6422 2011-03-08 Ian Lance Taylor <iant@google.com>
6423
6424 PR gold/12525
6425 * fileread.cc: #include <climits>.
6426 (GOLD_IOV_MAX): Define.
6427 (File_read::read_multiple): Limit number of entries by iov_max.
6428 * fileread.h (class File_read): Always set max_readv_entries to
6429 128.
6430
6431 2011-03-07 Ian Lance Taylor <iant@google.com>
6432
6433 PR gold/12525
6434 * options.h (class General_options): Add -dy and -dn.
6435
6436 2011-03-02 Cary Coutant <ccoutant@google.com>
6437
6438 * testsuite/script_test_9.t: Add TLS segment.
6439
6440 2011-03-02 Simon Baldwin <simonb@google.com>
6441
6442 * configure.ac: Add check for gnu_indirect_function support in
6443 the toolchain building binutils.
6444 * configure: Rebuild.
6445
6446 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
6447
6448 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6449 plugin only symbols.
6450 (Symbol_table::sized_finalize_symbol) Mark symbol only present
6451 in plugin files as not needed in the symbol table.
6452
6453 2011-02-11 Sriraman Tallam <tmsriram@google.com>
6454
6455 * output.cc (Output_section::add_input_section): Delay fill
6456 generation for section ordering.
6457
6458 2011-02-09 Ian Lance Taylor <iant@google.com>
6459
6460 PR gold/12316
6461 * object.h (class Sized_relobj): Remove clear_local_symbols.
6462 * reloc.cc (Sized_relobj::do_relocate): Don't call
6463 clear_local_symbols.
6464
6465 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
6466
6467 * plugin.cc (is_visible_from_outside): Return true for symbols
6468 in the -u option.
6469
6470 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
6471
6472 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6473 filename.
6474
6475 2011-02-02 Sriraman Tallam <tmsriram@google.com>
6476
6477 * icf.h (is_section_foldable_candidate): Change type of parameter
6478 to std::string.
6479 * icf.cc (Icf::find_identical_sections): Change type of local variable
6480 section_name to be std::string.
6481 (is_function_ctor_or_dtor): Change type of parameter to std::string.
6482
6483 2011-01-25 Ian Lance Taylor <iant@google.com>
6484
6485 * script.cc (script_add_extern): Rewrite to use
6486 add_symbol_reference.
6487
6488 2011-01-25 Doug Kwan <dougkwan@google.com>
6489
6490 * icf.cc (get_section_contents): Always lock section's object.
6491
6492 2011-01-24 Ian Lance Taylor <iant@google.com>
6493
6494 * options.h (class General_options): Accept
6495 --no-detect-odr-violations.
6496
6497 2011-01-24 Ian Lance Taylor <iant@google.com>
6498
6499 * version.cc (version_string): Bump to 1.11.
6500
6501 2011-01-24 Ian Lance Taylor <iant@google.com>
6502
6503 * plugin.cc (class Plugin_rescan): Define new class.
6504 (Plugin_manager::claim_file): Set any_claimed_.
6505 (Plugin_manager::save_archive): New function.
6506 (Plugin_manager::save_input_group): New function.
6507 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6508 necessary.
6509 (Plugin_manager::new_undefined_symbol): New function.
6510 (Plugin_manager::rescan): New function.
6511 (Plugin_manager::rescannable_defines): New function.
6512 (Plugin_manager::add_input_file): Set any_added_.
6513 * plugin.h (class Plugin_manager): define new fields rescannable_,
6514 undefined_symbols_, any_claimed_, and any_added_. Declare
6515 Plugin_rescan as friend. Declare new functions.
6516 (Plugin_manager::Rescannable): Define type.
6517 (Plugin_manager::Rescannable_list): Define type.
6518 (Plugin_manager::Undefined_symbol_list): Define type.
6519 (Plugin_manager::Plugin_manager): Initialize new fields.
6520 * archive.cc (Archive::defines_symbol): New function.
6521 (Add_archive_symbols::run): Pass archive to plugins if any.
6522 * archive.h (class Archive): Declare defines_symbol.
6523 * readsyms.cc (Input_group::~Input_group): New function.
6524 (Finish_group::run): Pass input_group to plugins if any.
6525 * readsyms.h (class Input_group): Declare destructor.
6526 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6527 any.
6528
6529 2011-01-10 Ian Lance Taylor <iant@google.com>
6530
6531 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6532 section as relro.
6533 (Layout::set_segment_offsets): Reset increase_relro before calling
6534 set_section_addresses a second time.
6535
6536 2011-01-04 Cary Coutant <ccoutant@google.com>
6537
6538 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6539 sections before NOBITS sections.
6540
6541 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
6542
6543 * version.cc (print_version): Update copyright to 2011.
6544
6545 2010-12-23 Cary Coutant <ccoutant@google.com>
6546
6547 * output.h (Output_data_reloc::add_output_section): Pass OD instead
6548 of OS to this->add. Add OD parameter to second form of the function.
6549
6550 2010-12-20 Ian Lance Taylor <iant@google.com>
6551
6552 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6553 second of two consecutive entries with same offset.
6554
6555 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6556
6557 * testsuite/Makefile.am (ifuncmain2static_LDADD)
6558 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6559 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6560 to avoid unneeded links against $(LDADD).
6561 * testsuite/Makefile.in: Regenerate.
6562
6563 2010-12-15 Ian Lance Taylor <iant@google.com>
6564
6565 PR gold/12324
6566 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6567 for R_X86_64_32 and R_X86_64_PC32.
6568 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6569 ver_matching_def_pic.o.
6570 (ver_matching_def_pic.o): New target.
6571
6572 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6573
6574 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6575 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6576 Move definition before File_read::View member definitions.
6577 (File_read::View::~View): Initialize and hold lock before
6578 updating current_mapped_bytes.
6579
6580 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6581
6582 * dwarf_reader.cc: Remove outdated comment.
6583 * gold-threads.cc: Fix typo in error message.
6584 * archive.cc: Fix typos in comments.
6585 * archive.h: Likewise.
6586 * arm-reloc-property.cc: Likewise.
6587 * arm-reloc-property.h: Likewise.
6588 * arm-reloc.def: Likewise.
6589 * arm.cc: Likewise.
6590 * attributes.h: Likewise.
6591 * cref.cc: Likewise.
6592 * ehframe.cc: Likewise.
6593 * fileread.h: Likewise.
6594 * gold.h: Likewise.
6595 * i386.cc: Likewise.
6596 * icf.cc: Likewise.
6597 * incremental.h: Likewise.
6598 * int_encoding.cc: Likewise.
6599 * layout.h: Likewise.
6600 * main.cc: Likewise.
6601 * merge.h: Likewise.
6602 * object.cc: Likewise.
6603 * object.h: Likewise.
6604 * options.cc: Likewise.
6605 * readsyms.cc: Likewise.
6606 * reduced_debug_output.cc: Likewise.
6607 * reloc.cc: Likewise.
6608 * script-sections.cc: Likewise.
6609 * sparc.cc: Likewise.
6610 * symtab.h: Likewise.
6611 * target-reloc.h: Likewise.
6612 * target.cc: Likewise.
6613 * target.h: Likewise.
6614 * timer.cc: Likewise.
6615 * timer.h: Likewise.
6616 * x86_64.cc: Likewise.
6617
6618 2010-12-09 Cary Coutant <ccoutant@google.com>
6619
6620 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6621 stack.
6622 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6623 parameter; change all callers.
6624 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6625 * options.h (warn_execstack): New option.
6626
6627 2010-12-07 Doug Kwan <dougkwan@google.com>
6628
6629 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6630 like function call relocations.
6631
6632 2010-12-07 Ian Lance Taylor <iant@google.com>
6633
6634 * archive.cc (Archive::get_elf_object_for_member): Permit
6635 punconfigured to be NULL.
6636 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6637 (Archive::include_member): Pass NULL to get_elf_object_for_member
6638 if we searched for the archive and this is the first included
6639 object.
6640
6641 2010-12-01 Ian Lance Taylor <iant@google.com>
6642
6643 * dwarf_reader.h (class Sized_dwarf_line_info): Add
6644 track_relocs_type_ field.
6645 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6646 Set track_relocs_type_.
6647 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6648 contents when using RELA relocs.
6649 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6650 reloc_map_.
6651 * reloc.cc (Track_relocs::next_addend): New function.
6652 * reloc.h (class Track_relocs): Declare next_addend.
6653
6654 2010-12-01 Ian Lance Taylor <iant@google.com>
6655
6656 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6657 virtual destructor.
6658
6659 2010-12-01 Ian Lance Taylor <iant@google.com>
6660
6661 * README: Update compilers known to work and fail.
6662
6663 2010-11-23 Matthias Klose <doko@ubuntu.com>
6664
6665 * configure.in: For --enable-gold, handle value `default' instead of
6666 `both*'. Always install ld as ld.bfd, install as ld if gold is
6667 not the default.
6668 * configure: Regenerate.
6669
6670 2010-11-18 Doug Kwan <dougkwan@google.com>
6671
6672 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6673 and right_alignment to be zero. Store result alignment only if it is
6674 greater than existing alignment.
6675
6676 2010-11-16 Cary Coutant <ccoutant@google.com>
6677
6678 PR gold/12220
6679 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6680 Check for ".zdebug_line".
6681
6682 2010-11-16 Doug Kwan <dougkwan@google.com>
6683 Cary Coutant <ccoutant@google.com>
6684
6685 * output.h (Output_segment::set_section_addresses): Pass increase_relro
6686 by reference; adjust all callers.
6687 * output.cc (Output_segment::set_section_addresses): Adjust references
6688 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6689 list is empty.
6690 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6691 end at page boundary.
6692
6693 2010-11-16 Cary Coutant <ccoutant@google.com>
6694
6695 PR gold/12220
6696 * layout.cc (Layout::choose_output_section): Transform names of
6697 compressed sections even when using a script with a SECTIONS clause.
6698 (Layout::output_section_name): Remove code to transform
6699 compressed debug section names.
6700 * output.cc (Output_section::add_input_section): Use uncompressed
6701 section size when tracking input sections.
6702
6703 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
6704
6705 * symtab.h (Symbol::NON_PIC_REF): Remove.
6706 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6707 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
6708 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6709 (Symbol::use_plt_offset): Take a flags argument and pass it
6710 directly to needs_dynamic_reloc. Restrict check for undefined
6711 weak symbols to function calls.
6712 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6713 (Target_arm::Scan::global): Use it.
6714 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6715 (Target_arm::Relocate::relocate): Likewise.
6716 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6717 parameter with an r_type parameter. Use get_reference_flags
6718 to get the flags.
6719 (Target_arm::Relocate::relocate): Update accordingly.
6720 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6721 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6722 (Target_i386::Scan::global): Likewise.
6723 (Target_i386::Relocate::relocate): Likewise.
6724 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6725 parameter with an r_type parameter. Use get_reference_flags
6726 to get the flags.
6727 (Target_i386::Relocate::relocate): Update accordingly.
6728 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6729 (Target_powerpc::Scan::global): Use it.
6730 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6731 (Target_powerpc::Relocate::relocate): Likewise.
6732 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6733 (Target_sparc::Scan::global): Use it.
6734 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6735 (Target_sparc::Relocate::relocate): Likewise.
6736 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6737 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6738 (Target_x86_64::Scan::global): Likewise.
6739 (Target_x86_64::Relocate::relocate): Likewise.
6740
6741 2010-11-08 Doug Kwan <dougkwan@google.com>
6742 Cary Coutant <ccoutant@google.com>
6743
6744 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6745 (Arm_exidx_merge_section::section_contents_): New data member.
6746 (Arm_input_section::Arm_input_section): Initialize original_contents_.
6747 (Arm_input_section::~Arm_input_section): De-allocate memory.
6748 (Arm_input_section::original_contents_): New data member.
6749 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6750 in parameters instead of calling Object::section_contents without
6751 locking.
6752 (Arm_output_section::group_section): New parameter TASK. Pass it
6753 to callees that need locking objects.
6754 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
6755 to lock EXIDX input sections. Fix a formatting issue. Call
6756 Arm_exidx_merged_section::build_contents to create merged section
6757 contents.
6758 (Arm_output_section::create_stub_group): New parameter TASK. Use it
6759 to lock object of stub table owner.
6760 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6761 TEXT_SIZE to initialize data member TEXT_SIZE_.
6762 (Arm_exidx_input_section::addralign): Fix typo in comment.
6763 (Arm_exidx_input_section::text_size): New method.
6764 (Target_arm::do_relax): New parameter TASK. Pass it to callees
6765 that require locking objects. Lock objects before scanning for stubs
6766 and updating local symbols.
6767 (Arm_input_section<big_endian>::init): Copy contents of original
6768 input section.
6769 (Arm_input_section<big_endian>::do_write): Use saved contents of
6770 original input section instead of calling Object::section_contents
6771 without locking.
6772 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6773 size without calling Object::section_size().
6774 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6775 for size. Allocate a buffer for merged EXIDX entries.
6776 (Arm_exidx_merged_section::build_contents): New method.
6777 (Arm_exidx_merged_section::do_write): Move merge section contents
6778 building code to Arm_exidx_merged_section::build_contetns. Write
6779 out contetns in buffer instead of building it on the fly.
6780 (Arm_relobj::make_exidx_input_section): Also pass text section size
6781 to Arm_exidx_input_section constructor.
6782 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
6783 (Arm_dynobj::do_read_symbols): Fix memory leak.
6784 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6785 * target.h: (class Task): Add forward declaration.
6786 (Target::relax): Add new parameter TASK and pass it to
6787 Target::do_relax().
6788 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
6789
6790 2010-11-05 Cary Coutant <ccoutant@google.com>
6791
6792 PR gold/10708
6793 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6794 object when reading from the file.
6795 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6796 second layout pass.
6797 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6798 when reading section contents.
6799 (get_section_contents): Likewise.
6800 (icf::find_identical_sections): Likewise.
6801 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6802 object when reading from the file.
6803 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6804 the object when doing deferred section layout.
6805
6806 2010-11-03 Nick Clifton <nickc@redhat.com>
6807
6808 PR gold/12001
6809 * script.h (class Symbol_assignment: name): New member. Returns
6810 the name of the symbol.
6811 * scrfipt.cc (Script_options::is_pending_assignment): New member.
6812 Returns true if the given symbol name is on the list of
6813 assignments wating to be processed.
6814 * archive.cc (should_incldue_member): If the symbol is undefined,
6815 check to see if it is on the list of symbols pending assignment.
6816
6817 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
6818
6819 * script-sections.cc (Script_sections::find_memory_region): Check
6820 for a NULL output section pointer.
6821
6822 2010-10-29 Doug Kwan <dougkwan@google.com>
6823
6824 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6825 Output_section::add_relaxed_input_section.
6826 * output.cc (Output_section::add_relaxed_input_section): Add new
6827 arguments LAYOUT and NAME. Set section order index.
6828 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6829 Copy section order index.
6830 * output.h (Output_section::add_relaxed_input_section): Add new
6831 arguments LAYOUT and NAME.
6832
6833 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6834
6835 * testsuite/Makefile.am: Move gcctestdir/ld rule to
6836 NATIVE_OR_CROSS_LINKER.
6837 * testsuite/Makefile.in: Regenerate.
6838
6839 2010-10-20 Doug Kwan <dougkwan@google.com>
6840
6841 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6842 without SHF_LINK_ORDER flags.
6843 * layout.cc (Layout::choose_output_section): Do not filter
6844 SHF_LINK_ORDER flag in a relocatable link.
6845
6846 2010-10-17 Cary Coutant <ccoutant@google.com>
6847
6848 * output.h (Output_segment::set_section_addresses): Change function
6849 signature. Update all callers.
6850 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6851 sections.
6852 (Output_segment::set_section_addresses): Align after last TLS
6853 section. Add padding before last relro section instead of after.
6854
6855 2010-10-17 Doug Kwan <dougkwan@google.com>
6856
6857 * gold/arm.cc (Target_arm::got_section): Use correct order and set
6858 GOT output section to be writable.
6859
6860 2010-10-14 Cary Coutant <ccoutant@google.com>
6861
6862 * debug.h (DEBUG_INCREMENTAL): New flag.
6863 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6864 * gold.cc (queue_initial_tasks): Check parameters for incremental link
6865 mode.
6866 * incremental.cc (report_command_line): Ignore all forms of
6867 --incremental.
6868 * layout.cc (Layout::Layout): Check parameters for incremental link
6869 mode.
6870 * options.cc (General_options::parse_incremental): New function.
6871 (General_options::parse_no_incremental): New function.
6872 (General_options::parse_incremental_full): New function.
6873 (General_options::parse_incremental_update): New function.
6874 (General_options::incremental_mode_): New data member.
6875 (General_options::finalize): Check incremental_mode_.
6876 * options.h (General_options): Update help text for --incremental.
6877 Add --no-incremental, --incremental-full, --incremental-update.
6878 (General_options::Incremental_mode): New enum type.
6879 (General_options::incremental_mode): New function.
6880 (General_options::incremental_mode_): New data member.
6881 * parameters.cc (Parameters::incremental_mode_): New data member.
6882 (Parameters::set_options): Set incremental_mode_.
6883 (Parameters::set_incremental_full): New function.
6884 (Parameters::incremental): New function.
6885 (Parameters::incremental_update): New function.
6886 (set_parameters_incremental_full): New function.
6887 * parameters.h (Parameters::set_incremental_full): New function.
6888 (Parameters::incremental): New function.
6889 (Parameters::incremental_update): New function.
6890 (Parameters::incremental_mode_): New data member.
6891 (set_parameters_incremental_full): New function.
6892 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6893 incremental link mode.
6894 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6895 (Sized_relobj::do_relocate_sections): Likewise.
6896 * testsuite/Makefile.am (incremental_test): Use --incremental-full
6897 option.
6898 * testsuite/Makefile.in: Regenerate.
6899 * testsuite/incremental_test.sh: Filter all forms of --incremental.
6900
6901 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6902
6903 * script-sections.h (class Script_sections): Make
6904 Sections_elements typedef public.
6905 * script-sections.cc (class Sort_output_sections): Add elements_
6906 field. Add constructor which sets it; change all callers.
6907 (Sort_output_sections::is_before): New function.
6908 (Sort_output_sections::operator()): Call is_before.
6909 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6910 conditional.
6911 * testsuite/script_test_10.sh: New test. Test script section
6912 order.
6913 * testsuite/script_test_10.t: Likewise.
6914 * testsuite/script_test_10.s: Likewise.
6915 * testsuite/Makefile.am: Wrap the cross linker tests and the
6916 common tests into NATIVE_OR_CROSS_LINKER.
6917 (check_SCRIPTS): Add script_test_10.sh.
6918 (check_DATA): Add script_test_10.stdout.
6919 (script_test_10.o, script_test_10): New targets.
6920 (script_test_10.stdout): New target.
6921 * configure, testsuite/Makefile.in: Regenerate.
6922
6923 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6924
6925 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6926 error for the deprecated relocations.
6927 (Target_arm::Scan::global): Likewise.
6928 (Target_arm::Relocate::relocate): Likewise.
6929
6930 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
6931
6932 * fileread.cc (Input_file::find_file): Initialize *found_name
6933 and *namep when using the fallback search for case 4.
6934
6935 2010-10-11 Cary Coutant <ccoutant@google.com>
6936
6937 * options.h (class General_options): Redefine -z lazy as an alias for
6938 the negation of -z now.
6939
6940 2010-10-11 Ian Lance Taylor <iant@google.com>
6941
6942 * resolve.cc (symbol_to_bits): Report the value of the unsupported
6943 binding.
6944
6945 2010-10-06 Nick Clifton <nickc@redhat.com>
6946
6947 * script-sections.cc(class Memory_region): Remove
6948 current_lma_offset_ field. Rename current_vma_offset_ to
6949 current_offset_. Add last_section_ field.
6950 (Memory_region::get_current_vma_address): Rename to
6951 get_current_address.
6952 (Memory_region::get_current_lma_address): Delete.
6953 (Memory_region::increment_vma_offset): Rename to
6954 increment_offset.
6955 (Memory_region::increment_lma_offset): Delete.
6956 (Memory_region::attributes_compatible): New method. Returns
6957 true if the provided section is compatible with the region.
6958 (Memory_region::get_last_section): New method. Returns the last
6959 section to use the region.
6960 (Memory_region::set_last_section): New method. Stores the last
6961 section to use the region.
6962 (Script_sections::block_in_region): New method. Returns true if
6963 a block of memory is contained within a region.
6964 (Script_sections::find_memory_region): New method. Locates a
6965 memory region to be used to set a VMA or LMA address.
6966 (Output_section_definition::set_section_addresses): Add code to
6967 check for addresses set by memory regions.
6968 (Output_segment::set_section_addresses): Remove memory region
6969 walking code.
6970 (Script_sections::create_segment): Add a warning if a header
6971 segment is created outside of any region.
6972 * script-sections.h (class Script_sections): Add prototypes for
6973 find_memory_region and block_in_region methods.
6974 * testsuite/memory_test.s: Use .long instead of .word.
6975 * testsuite/memory_test.t: Add some more output sections.
6976 * testsuite/memory_test.sh: Update expected output.
6977
6978 2010-10-02 Doug Kwan <dougkwan@google.com>
6979
6980 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6981 defintion to symtab.h
6982 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6983 declaration to defintion.
6984
6985 2010-10-01 Nick Clifton <nickc@redhat.com>
6986
6987 * expression.cc (eval): Replace dummy argument with NULL.
6988 (eval_maybe_dot): Check for a NULL result section pointer.
6989 (Symbol_expression::value): Likewise.
6990 (Dot_expression::value): Likewise.
6991 (BINARY_EXPRESSION): Likewise.
6992 (Max_expression::value): Likewise.
6993 (Min_expression::value): Likewise.
6994 (Absolute_expression::value): Likewise.
6995 (Addr_expression::value_from_output_section): Likewise.
6996 (Loaddddr_expression::value_from_output_section): Likewise.
6997 (Segment_start_expression::value): Likewise.
6998 * script-sections.cc
6999 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7000 argument with NULL.
7001 (Sections_elememt_dot_assignment::set_section_addresses):
7002 Likewise.
7003 (Output_data_expression::do_write_to_buffer): Likewise.
7004 (Output_section_definition::finalize_symbols): Likewise.
7005 (Output_section_definition::set_section_addresses): Likewise.
7006
7007 2010-09-30 Doug Kwan <dougkwan@google.com>
7008
7009 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7010
7011 2010-09-28 Sriraman Tallam <tmsriram@google.com>
7012
7013 * target.h (Target::can_icf_inline_merge_sections): New virtual
7014 function.
7015 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7016 virtual function.
7017 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7018 virtual function.
7019 * icf.cc (get_section_contents): Inline merge sections only when
7020 target allows it.
7021
7022 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7023
7024 * configure: Regenerate.
7025
7026 2010-09-17 Ian Lance Taylor <iant@google.com>
7027
7028 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7029 * testsuite/Makefile.am (memory_test.o): New target.
7030 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7031 memory_test.t.
7032 * testsuite/Makefile.in: Rebuild.
7033
7034 2010-09-17 Doug Kwan <dougkwan@google.com>
7035
7036 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7037 defintion if relocation uses GOT entries of the symbol.
7038 * testsuite/icf_safe_test.sh: Fix test.
7039 * testsuite/icf_safe_so_test.sh: Fix test.
7040
7041 2010-09-16 Cary Coutant <ccoutant@google.com>
7042
7043 * script_sections.cc (class Memory_region): Remove "NULL" from
7044 vector initializations.
7045
7046 2010-09-15 Cary Coutant <ccoutant@google.com>
7047
7048 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7049 Resolve forwarding symbols.
7050
7051 2010-09-15 Doug Kwan <dougkwan@google.com>
7052
7053 * gold/testsuite/script_test_3.t: Add ARM special sections.
7054 * gold/testsuite/script_test_4.t: Same.
7055 * gold/testsuite/script_test_5.t: Same.
7056 * gold/testsuite/script_test_6.t: Same.
7057 * gold/testsuite/script_test_7.t: Same.
7058 * gold/testsuite/script_test_7.t: Same.
7059 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7060
7061 2010-09-14 Cary Coutant <ccoutant@google.com>
7062
7063 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7064 (Target_x86_64::Relocate::relocate_tls): Replace check for
7065 saw_tls_block_reloc_ with test for executable section.
7066
7067 2010-09-12 Cary Coutant <ccoutant@google.com>
7068
7069 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7070 position-independent executables to shared libraries need dynamic
7071 relocations.
7072 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7073 position-independent executables.
7074 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7075 * testsuite/Makefile.in: Regenerate.
7076
7077 2010-09-10 Nick Clifton <nickc@redhat.com>
7078
7079 PR gold/11997
7080 * testsuite/memory_test.t: Discard any sections that are not
7081 needed.
7082
7083 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
7084
7085 PR gold/11996
7086 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7087 "This::" to work around a bug in gcc 4.2.
7088
7089 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7090
7091 2010-09-09 Rafael Espindola <espindola@google.com>
7092
7093 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7094 sections with different PF_X flags in the same segment.
7095 (Layout::find_first_load_seg): Search all segments to find the first
7096 one.
7097 * options.h (rosegment): New.
7098
7099 2010-09-08 Rafael Espindola <espindola@google.com>
7100
7101 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7102
7103 2010-09-08 Doug Kwan <dougkwan@google.com>
7104
7105 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7106 (Arm_relobj::do_relocate_sections): Add new parameter for output
7107 file to match the parent.
7108 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7109 of local symbols instead of input values. Update code to track
7110 changes in gold::relocate_section.
7111 * object.cc (Sized_relobj::compute_final_local_value): New methods.
7112 (Sized_relobj::compute_final_local_value_internal): New methods.
7113 (Sized_relobj::do_finalize_local_symbols): Move code from loop
7114 body into private version of Sized_relobj::compute_final_local_value.
7115 Call the inline method.
7116 * object.h (Symbol_value::Symbol_value): Define destructor. Free
7117 merged symbol value if there is one.
7118 (Symbol_value::has_output_value): New method defintiion.
7119 (Sized_relobj::Compute_final_local_value_status): New enum type.
7120 (Sized_relobj::compute_final_local_value): New methods.
7121 (Sized_relobj::compute_final_local_value_internal): New methods.
7122 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7123 and arm_cortex_a8.sh.
7124 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7125 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7126 New tests.
7127 * Makefile.in: Regenerate.
7128 * testsuite/arm_bl_out_of_range.s: Update test.
7129 * testsuite/thumb_bl_out_of_range.s: Ditto.
7130 * testsuite/thumb_blx_out_of_range.s: Ditto.
7131 * testsuite/arm_branch_out_of_range.sh: New file.
7132 * testsuite/arm_cortex_a8.sh: Ditto.
7133 * testsuite/arm_cortex_a8_b.s: Ditto.
7134 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7135 * testsuite/arm_cortex_a8_b_local.s: Ditto.
7136 * testsuite/arm_cortex_a8_bl.s: Ditto.
7137 * testsuite/arm_cortex_a8_blx.s: Ditto.
7138 * testsuite/arm_cortex_a8_local.s: Ditto.
7139 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7140 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7141
7142 2010-09-08 Rafael Espindola <espindola@google.com>
7143
7144 * Makefile.am (memory_test.stdout): Run readelf with -W.
7145 * Makefile.in: Regenerate.
7146 * testsuite/memory_test.sh: Make the regexps accept both 32 and
7147 64 bit output.
7148
7149 2010-09-08 Rafael Espindola <espindola@google.com>
7150
7151 * script-sections.cc (Script_sections::add_memory_region): Convert
7152 field precision to int.
7153 * script.cc (script_set_section_region, script_set_section_region):
7154 Convert field precision to int.
7155
7156 2010-09-08 Rafael Espindola <espindola@google.com>
7157
7158 * arm.cc (do_finalize_sections): Create the __exidx_start and
7159 __exdix_end symbols even when the section is missing.
7160
7161 2010-09-08 Nick Clifton <nickc@redhat.com>
7162
7163 * README: Remove claim that MEMORY is not supported.
7164 * expression.cc (script_exp_function_origin)
7165 (script_exp_function_length): Move from here to ...
7166 * script.cc: ... here.
7167 (script_set_section_region, script_add_memory)
7168 (script_parse_memory_attr, script_include_directive): New
7169 functions.
7170 * script-sections.cc
7171 (class Memory_region): New class.
7172 (class Output_section_definition): Add set_memory_region,
7173 set_section_vma, set_section_lma and get_section_name methods.
7174 (class Script_Sections): Add add_memory_region,
7175 find_memory_region, find_memory_region_origin,
7176 find_memory_region_length and set_memory_region methods.
7177 Have set_section_addresses method walk the list of set memory
7178 regions.
7179 Extend the print methos to display memory regions.
7180 * script-sections.h: Add prototypes for new methods.
7181 Add enum for MEMORY region attributes.
7182 * yyscript.y: Add support for parsing MEMORY regions.
7183 * script-c.h: Add prototypes for new functions.
7184 * testsuite/Makefile.am: Add test of MEMORY region functionality.
7185 * testsuite/Makefile.in: Regenerate.
7186 * testsuite/memory_test.sh: New script.
7187 * testsuite/memory_test.s: New assembler source file.
7188 * testsuite/memory_test.t: New linker script.
7189
7190 2010-08-27 Doug Kwan <dougkwan@google.com>
7191
7192 * gold/resolve.cc (Symbol_table::should_override): Let a weak
7193 reference override an existing dynamic weak reference.
7194 * testsuite/Makefile.am: Add new test dyn_weak_ref.
7195 * testsuite/Makefile.in: Regenerate.
7196 * testsuite/dyn_weak_ref.sh: New file.
7197 * testsuite/dyn_weak_ref_1.c: Ditto.
7198 * testsuite/dyn_weak_ref_2.c: Ditto.
7199
7200 2010-08-27 Ian Lance Taylor <iant@google.com>
7201
7202 * incremental.h (class Incremental_input_entry): Add virtual
7203 destructor.
7204
7205 2010-08-27 Ian Lance Taylor <iant@google.com>
7206
7207 * testsuite/start_lib_test_3.c: Mark t3 as used.
7208
7209 2010-08-27 Nick Clifton <nickc@redhat.com>
7210
7211 * options.cc (version_script): Fix small typo in previous
7212 whitespace tidyup.
7213
7214 2010-08-25 Nick Clifton <nickc@redhat.com>
7215
7216 * archive.cc: Formatting fixes: Remove whitespace between
7217 typename and following asterisk. Remove whitespace between
7218 function name and opening parenthesis.
7219 * archive.h: Likewise.
7220 * arm.cc: Likewise.
7221 * attributes.cc: Likewise.
7222 * attributes.h: Likewise.
7223 * common.cc: Likewise.
7224 * copy-relocs.cc: Likewise.
7225 * dirsearch.h: Likewise.
7226 * dynobj.cc: Likewise.
7227 * ehframe.cc: Likewise.
7228 * ehframe.h: Likewise.
7229 * expression.cc: Likewise.
7230 * fileread.cc: Likewise.
7231 * fileread.h: Likewise.
7232 * gc.h: Likewise.
7233 * gold-threads.cc: Likewise.
7234 * gold.cc: Likewise.
7235 * i386.cc: Likewise.
7236 * icf.h: Likewise.
7237 * incremental-dump.cc: Likewise.
7238 * incremental.cc: Likewise.
7239 * layout.cc: Likewise.
7240 * layout.h: Likewise.
7241 * main.cc: Likewise.
7242 * merge.cc: Likewise.
7243 * merge.h: Likewise.
7244 * object.cc: Likewise.
7245 * object.h: Likewise.
7246 * options.cc: Likewise.
7247 * options.h: Likewise.
7248 * output.cc: Likewise.
7249 * output.h: Likewise.
7250 * plugin.cc: Likewise.
7251 * plugin.h: Likewise.
7252 * powerpc.cc: Likewise.
7253 * reloc.cc: Likewise.
7254 * script-c.h: Likewise.
7255 * script-sections.cc: Likewise.
7256 * script.cc: Likewise.
7257 * stringpool.cc: Likewise.
7258 * symtab.cc: Likewise.
7259 * symtab.h: Likewise.
7260 * target.cc: Likewise.
7261 * timer.cc: Likewise.
7262 * timer.h: Likewise.
7263 * version.cc: Likewise.
7264 * x86_64.cc: Likewise.
7265
7266 2010-08-24 Nick Clifton <nickc@redhat.com>
7267
7268 PR 11899
7269 * layout.cc (segment_precedes): Sort segments by their physical
7270 addresses, if they have been set.
7271
7272 2010-08-23 Cary Coutant <ccoutant@google.com>
7273
7274 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7275 symbols data.
7276 (Lib_group::include_member): Unlock object after deleting its
7277 symbols data.
7278 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7279 the bug fixed here.
7280
7281 2010-08-19 Neil Vachharajani <nvachhar@google.com>
7282 Cary Coutant <ccoutant@google.com>
7283
7284 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7285 constructor, and set_blocker.
7286 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7287 readsyms_blocker_.
7288 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7289 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7290 * testsuite/Makefile.am (start_lib_test): New test case.
7291 * testsuite/Makefile.in: Regenerate.
7292 * testsuite/start_lib_test_main.c: New file.
7293 * testsuite/start_lib_test_1.c: New file.
7294 * testsuite/start_lib_test_2.c: New file.
7295 * testsuite/start_lib_test_3.c: New file.
7296
7297 2010-08-19 Ian Lance Taylor <iant@google.com>
7298
7299 * Makefile.in: Rebuild with automake 1.11.1.
7300 * aclocal.m4: Likewise.
7301 * testsuite/Makefile.in: Likewise.
7302
7303 2010-08-19 Ian Lance Taylor <iant@google.com>
7304
7305 PR 10893
7306 * i386.cc (class Output_data_plt_i386): Update declarations.
7307 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
7308 local_ifuncs_ fields.
7309 (Target_i386::do_plt_section_for_global): New function.
7310 (Target_i386::do_plt_section_for_local): New function.
7311 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7312 parameter; change all callers. Initialize global_ifuncs_ and
7313 local_ifuncs_. If doing a static link define __rel_iplt_start and
7314 __rel_iplt_end.
7315 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7316 (Output_data_plt_i386::add_local_ifunc_entry): New function.
7317 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7318 symbols.
7319 (Target_i386::make_plt_section): New function, broken out of
7320 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
7321 (Target_i386::make_plt_entry): Call make_plt_section.
7322 (Target_i386::make_local_ifunc_plt_entry): New function.
7323 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7324 (Target_i386::Scan::local): Handle IFUNC symbols. Add
7325 R_386_IRELATIVE to switch.
7326 (Target_i386::Scan::global): Likewise.
7327 (Target_i386::Relocate::relocate): Likewise.
7328 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7329 switch.
7330 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7331 (Target_x86_64::do_plt_section_for_global): New function.
7332 (Target_x86_64::do_plt_section_for_local): New function.
7333 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7334 parameter; change all callers. If doing a static link define
7335 __rela_iplt_start and __rela_iplt_end.
7336 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7337 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7338 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7339 to point to .plt.
7340 (Target_x86_64::make_local_ifunc_plt_entry): New function.
7341 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7342 switch.
7343 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7344 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
7345 R_X86_64_IRELATIVE to switch.
7346 (Target_x86_64::Scan::global): Likewise.
7347 (Target_x86_64::Relocate::relocate): Likewise.
7348 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7349 switch.
7350 * target.h (class Target): Add plt_section_for_global and
7351 plt_section_for_local functions. Add do_plt_section_for_global
7352 and do_plt_section_for_local virtual functions.
7353 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
7354 clarifying comments.
7355 (Symbol::use_plt_offset): Handle IFUNC symbol.
7356 * object.cc (Sized_relobj::Sized_relobj): Initialize
7357 local_plt_offsets_.
7358 (Sized_relobj::local_has_plt_offset): New function.
7359 (Sized_relobj::local_plt_offset): New function.
7360 (Sized_relobj::set_local_plt_offset): New function.
7361 (Sized_relobj::do_count): Handle IFUNC symbol.
7362 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
7363 a bit away from input_shndx_ field. Add set_is_func_symbol and
7364 is_ifunc_symbol functions.
7365 (class Sized_relobj): Update declarations. Remove Tls_got_entry
7366 and Local_tls_got_offsets. Define Local_plt_offsets. Add
7367 local_plt_offsets_ field.
7368 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7369 * output.h (class Output_section_data): Add non-const
7370 output_section function.
7371 (class Output_data_got): Update declarations.
7372 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7373 Add use_plt_offset parameter to global and local constructors.
7374 Change all callers. Change local_sym_index_ field to 31 bits.
7375 Change GSYM_CODE and CONSTANT_CODE accordingly.
7376 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7377 doing a static link don't set sh_link field.
7378 (Output_data_got::Got_entry::write): Use PLT offset if
7379 appropriate.
7380 (Output_data_got::add_global_plt): New function.
7381 (Output_data_got::add_local_plt): New function.
7382 * target-reloc.h (relocate_section): Handle IFUNC symbol.
7383 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7384 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7385 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7386 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7387 IFUNC conditional.
7388 * testsuite/ifunc-sel.h: New file.
7389 * testsuite/ifuncmain1.c: New file.
7390 * testsuite/ifuncmain1vis.c: New file.
7391 * testsuite/ifuncmod1.c: New file.
7392 * testsuite/ifuncdep2.c: New file.
7393 * testsuite/ifuncmain2.c: New file.
7394 * testsuite/ifuncmain3.c: New file.
7395 * testsuite/ifuncmod3.c: New file.
7396 * testsuite/ifuncmain4.c: New file.
7397 * testsuite/ifuncmain5.c: New file.
7398 * testsuite/ifuncmod5.c: New file.
7399 * testsuite/ifuncmain6pie.c: New file.
7400 * testsuite/ifuncmod6.c: New file.
7401 * testsuite/ifuncmain7.c: New file.
7402 * configure, testsuite/Makefile.in: Rebuild.
7403
7404 2010-08-18 Ian Lance Taylor <iant@google.com>
7405
7406 * incremental.cc
7407 (Output_section_incremental_inputs::write_input_files): Add cast
7408 to avoid signed/unsigned comparison warning.
7409 (Output_section_incremental_inputs::write_info_blocks): Likewise.
7410
7411 2010-08-12 Cary Coutant <ccoutant@google.com>
7412
7413 * common.cc (Sort_commons::operator()): Remove unnecessary code.
7414
7415 2010-08-13 Ian Lance Taylor <iant@google.com>
7416
7417 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7418
7419 2010-08-12 Cary Coutant <ccoutant@google.com>
7420 Doug Kwan <dougkwan@google.com>
7421
7422 * resolve.cc (Symbol_table::should_override): When a weak dynamic
7423 defintion overrides non-weak undef, remember that the original undef
7424 is not weak.
7425 * symtab.cc (Symbol_table::sized_write_global): For undef without
7426 an original weak binding, set binding to global in output.
7427 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7428 * testsuite/Makefile.in: Regenerate.
7429 * testsuite/strong_ref_weak_def.sh: New file.
7430 * testsuite/strong_ref_weak_def_1.c: Ditto.
7431 * testsuite/strong_ref_weak_def_2.c: Ditto.
7432
7433 2010-08-12 Cary Coutant <ccoutant@google.com>
7434
7435 * testsuite/incremental_test.sh: Rewrite.
7436 * testsuite/incremental_test_1.c: Rewrite.
7437 * testsuite/incremental_test_2.c: Rewrite.
7438
7439 2010-08-12 Cary Coutant <ccoutant@google.com>
7440
7441 * arm.cc (Target_arm::got_size): Add const.
7442 (Target_arm::got_entry_count): New function.
7443 (Target_arm::plt_entry_count): New function.
7444 (Target_arm::first_plt_entry_offset): New function.
7445 (Target_arm::plt_entry_size): New function.
7446 (Output_data_plt_arm::entry_count): New function.
7447 (Output_data_plt_arm::first_plt_entry_offset): New function.
7448 (Output_data_plt_arm::get_plt_entry_size): New function.
7449 * i386.cc (Target_i386::got_size): Add const.
7450 (Target_i386::got_entry_count): New function.
7451 (Target_i386::plt_entry_count): New function.
7452 (Target_i386::first_plt_entry_offset): New function.
7453 (Target_i386::plt_entry_size): New function.
7454 (Output_data_plt_i386::entry_count): New function.
7455 (Output_data_plt_i386::first_plt_entry_offset): New function.
7456 (Output_data_plt_i386::get_plt_entry_size): New function.
7457 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7458 find_incremental_inputs_sections. Dump incremental_got_plt section.
7459 * incremental.cc: Include target.h.
7460 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7461 parameter. Adjust all callers. Find incremental_got_plt section.
7462 (Incremental_inputs::create_data_sections): Create incremental_got_plt
7463 section.
7464 (Output_section_incremental_inputs::set_final_data_size): Calculate
7465 size of incremental_got_plt section.
7466 (Output_section_incremental_inputs::do_write): Write the
7467 incremental_got_plt section.
7468 (Got_plt_view_info): New struct.
7469 (Local_got_offset_visitor): New class.
7470 (Global_got_offset_visitor): New class.
7471 (Global_symbol_visitor_got_plt): New class.
7472 (Output_section_incremental_inputs::write_got_plt): New function.
7473 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7474 Add parameter. Adjust all callers.
7475 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7476 (Incremental_inputs::got_plt_section): New function.
7477 (Incremental_inputs::got_plt_section_): New data member.
7478 (Incremental_got_plt_reader): New class.
7479 * layout.cc (Layout::create_incremental_info_sections): Add the
7480 incremental_got_plt section.
7481 * object.h (Got_offset_list::get_list): New function.
7482 (Got offset_list::for_all_got_offsets): New function.
7483 (Sized_relobj::local_got_offset_list): New function.
7484 * powerpc.cc (Target_powerpc::got_size): Add const.
7485 (Target_powerpc::got_entry_count): New function.
7486 (Target_powerpc::plt_entry_count): New function.
7487 (Target_powerpc::first_plt_entry_offset): New function.
7488 (Target_powerpc::plt_entry_size): New function.
7489 (Output_data_plt_powerpc::entry_count): New function.
7490 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7491 (Output_data_plt_powerpc::get_plt_entry_size): New function.
7492 * sparc.cc (Target_sparc::got_size): Add const.
7493 (Target_sparc::got_entry_count): New function.
7494 (Target_sparc::plt_entry_count): New function.
7495 (Target_sparc::first_plt_entry_offset): New function.
7496 (Target_sparc::plt_entry_size): New function.
7497 (Output_data_plt_sparc::entry_count): New function.
7498 (Output_data_plt_sparc::first_plt_entry_offset): New function.
7499 (Output_data_plt_sparc::get_plt_entry_size): New function.
7500 * symtab.h (Symbol::got_offset_list): New function.
7501 (Symbol_table::for_all_symbols): New function.
7502 * target.h (Sized_target::got_entry_count): New function.
7503 (Sized_target::plt_entry_count): New function.
7504 (Sized_target::plt_entry_size): New function.
7505 * x86_64.cc (Target_x86_64::got_size): Add const.
7506 (Target_x86_64::got_entry_count): New function.
7507 (Target_x86_64::plt_entry_count): New function.
7508 (Target_x86_64::first_plt_entry_offset): New function.
7509 (Target_x86_64::plt_entry_size): New function.
7510 (Output_data_plt_x86_64::entry_count): New function.
7511 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7512 (Output_data_plt_x86_64::get_plt_entry_size): New function.
7513
7514 2010-08-12 Cary Coutant <ccoutant@google.com>
7515
7516 * archive.cc: Include incremental.h.
7517 (Archive::Archive): Initialize incremental_info_.
7518 (Archive::include_member): Record archive members in incremental info.
7519 (Add_archive_symbols::run): Record begin and end of an archive in
7520 incremental info.
7521 (Lib_group::include_member): Record objects in incremental info.
7522 * archive.h (Incremental_archive_entry): Forward declaration.
7523 (Archive::set_incremental_info): New member function.
7524 (Archive::incremental_info): New member function.
7525 (Archive::Unused_symbol_iterator): New class.
7526 (Archive::unused_symbols_begin): New member function.
7527 (Archive::unused_symbols_end): New member function.
7528 (Archive::incremental_info_): New data member.
7529 * incremental-dump.cc (find_input_containing_global): New function.
7530 (dump_incremental_inputs): Dump new incremental info sections.
7531 * incremental.cc: Include symtab.h.
7532 (Output_section_incremental_inputs): New class.
7533 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7534 new incremental info sections.
7535 (Sized_incremental_binary::do_check_inputs): Likewise.
7536 (Incremental_inputs::report_archive): Remove.
7537 (Incremental_inputs::report_archive_begin): New function.
7538 (Incremental_inputs::report_archive_end): New function.
7539 (Incremental_inputs::report_object): New function.
7540 (Incremental_inputs::finalize_inputs): Remove.
7541 (Incremental_inputs::report_input_section): New function.
7542 (Incremental_inputs::report_script): Rewrite.
7543 (Incremental_inputs::finalize): Do nothing but finalize string table.
7544 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7545 (Incremental_inputs::sized_create_inputs_section_data): Remove.
7546 (Incremental_inputs::create_data_sections): New function.
7547 (Incremental_inputs::relocs_entsize): New function.
7548 (Output_section_incremental_inputs::set_final_data_size): New function.
7549 (Output_section_incremental_inputs::do_write): New function.
7550 (Output_section_incremental_inputs::write_header): New function.
7551 (Output_section_incremental_inputs::write_input_files): New function.
7552 (Output_section_incremental_inputs::write_info_blocks): New function.
7553 (Output_section_incremental_inputs::write_symtab): New function.
7554 * incremental.h (Incremental_script_entry): Forward declaration.
7555 (Incremental_object_entry): Forward declaration.
7556 (Incremental_archive_entry): Forward declaration.
7557 (Incremental_inputs): Forward declaration.
7558 (Incremental_inputs_header_data): Remove.
7559 (Incremental_inputs_header): Remove.
7560 (Incremental_inputs_header_write): Remove.
7561 (Incremental_inputs_entry_data): Remove.
7562 (Incremental_inputs_entry): Remove.
7563 (Incremental_inputs_entry_write): Remove.
7564 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7565 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7566 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7567 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7568 Likewise.
7569 (Incremental_input_entry): New class.
7570 (Incremental_script_entry): New class.
7571 (Incremental_object_entry): New class.
7572 (Incremental_archive_entry): New class.
7573 (Incremental_inputs::Incremental_inputs): Initialize new data members.
7574 (Incremental_inputs::report_inputs): Remove.
7575 (Incremental_inputs::report_archive): Remove.
7576 (Incremental_inputs::report_archive_begin): New function.
7577 (Incremental_inputs::report_archive_end): New function.
7578 (Incremental_inputs::report_object): Change prototype.
7579 (Incremental_inputs::report_input_section): New function.
7580 (Incremental_inputs::report_script): Change prototype.
7581 (Incremental_inputs::get_reloc_count): New function.
7582 (Incremental_inputs::set_reloc_count): New function.
7583 (Incremental_inputs::create_data_sections): New function.
7584 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7585 (Incremental_inputs::inputs_section): New function.
7586 (Incremental_inputs::symtab_section): New function.
7587 (Incremental_inputs::relocs_section): New function.
7588 (Incremental_inputs::get_stringpool): Add const.
7589 (Incremental_inputs::command_line): Add const.
7590 (Incremental_inputs::inputs): Remove.
7591 (Incremental_inputs::command_line_key): New function.
7592 (Incremental_inputs::input_file_count): New function.
7593 (Incremental_inputs::input_files): New function.
7594 (Incremental_inputs::relocs_entsize): New function.
7595 (Incremental_inputs::sized_create_inputs_section_data): Remove.
7596 (Incremental_inputs::finalize_inputs): Remove.
7597 (Incremental_inputs::Input_info): Remove.
7598 (Incremental_inputs::lock_): Remove.
7599 (Incremental_inputs::inputs_): Change type.
7600 (Incremental_inputs::inputs_map_): Remove.
7601 (Incremental_inputs::current_object_entry_): New data member.
7602 (Incremental_inputs::inputs_section_): New data member.
7603 (Incremental_inputs::symtab_section_): New data member.
7604 (Incremental_inputs::relocs_section_): New data member.
7605 (Incremental_inputs::reloc_count_): New data member.
7606 (Incremental_inputs_reader): New class.
7607 (Incremental_symtab_reader): New class.
7608 (Incremental_relocs_reader): New class.
7609 * layout.cc (Layout::finalize): Move finalization of incremental info
7610 and creation of incremental info sections to follow finalization of
7611 symbol table. Set offsets for postprocessing sections.
7612 (Layout::create_incremental_info_sections): Call
7613 Incremental_inputs::create_data_sections. Add incremental symtab
7614 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
7615 sections to layout after input sections.
7616 * layout.h (struct Timespec): Forward declaration.
7617 (Layout::incremental_inputs): Add const.
7618 (Layout::create_incremental_info_sections): Add parameter.
7619 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7620 * object.cc: Include incremental.h.
7621 (Relobj::finalize_incremental_relocs): New function.
7622 (Sized_relobj::do_layout): Record input sections in incremental info.
7623 * object.h (Object::output_section): New function.
7624 (Object::output_section_offset): Moved from Relobj.
7625 (Object::get_incremental_reloc_base): New function.
7626 (Object::get_incremental_reloc_count): New function.
7627 (Object::do_output_section): New function.
7628 (Object::do_output_section_offset): Moved from Relobj.
7629 (Object::do_get_incremental_reloc_base): New function.
7630 (Object::do_get_incremental_reloc_count): New function.
7631 (Object::Object): Initialize new data members.
7632 (Relobj::output_section): Renamed do_output_section and moved to
7633 protected.
7634 (Relobj::output_section_offset): Moved to Object.
7635 (Relobj::do_get_incremental_reloc_base): New function.
7636 (Relobj::do_get_incremental_reloc_count): New function.
7637 (Relobj::allocate_incremental_reloc_counts): New function.
7638 (Relobj::count_incremental_reloc): New function.
7639 (Relobj::finalize_incremental_relocs): New function.
7640 (Relobj::next_incremental_reloc_index): New function.
7641 (Relobj::reloc_counts_): New data member.
7642 (Relobj::reloc_bases_): New data member.
7643 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
7644 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
7645 (Sized_relobj::incremental_relocs_scan): New function.
7646 (Sized_relobj::incremental_relocs_scan_reltype): New function.
7647 (Sized_relobj::incremental_relocs_write): New function.
7648 (Sized_relobj::incremental_relocs_write_reltype): New function.
7649 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7650 incremental link.
7651 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7652 archives and object files elsewhere.
7653 (Add_symbols::run): Report object files here.
7654 (Finish_group::run): Report end of archive at end of group.
7655 * reloc.cc: Include layout.h, incremental.h.
7656 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7657 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7658 (Sized_relobj::incremental_relocs_scan): New function.
7659 (Sized_relobj::incremental_relocs_scan_reltype): New function.
7660 (Sized_relobj::do_relocate_sections): Write incremental relocations.
7661 (Sized_relobj::incremental_relocs_write): New function.
7662 (Sized_relobj::incremental_relocs_write_reltype): New function.
7663 * script.cc (read_input_script): Rewrite test for incremental link.
7664 Change call to Incremental_inputs::report_script.
7665 * symtab.h (Symbol_table::first_global_index): New function.
7666 (Symbol_table::output_count): New function.
7667
7668 2010-08-12 Doug Kwan <dougkwan@google.com>
7669
7670 * arm.cc (Target_arm::merge_object_attributes): Check command line
7671 options --no-wchar-size-warning and --no-enum-size-warning.
7672 * options.h (General_options): Add ld-compatible options
7673 --no-enum-size-warning and --no-wchar-size-warning.
7674
7675 2010-08-04 Ian Lance Taylor <iant@google.com>
7676
7677 * x86_64.cc (Target_x86_64::Scan::local): Use
7678 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7679 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7680 (Target_x86_64::Scan::global): Likewise.
7681 (Target_x86_64::Relocate::relocate): Likewise.
7682 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7683 Likewise.
7684
7685 2010-08-03 Cary Coutant <ccoutant@google.com>
7686
7687 * merge.cc (Output_merge_string::do_add_input_section): Count strings
7688 to reserve space in merged_strings vector. Keep total input size
7689 for stats.
7690 (Output_merge_string::do_print_merge_stats): Print total input size.
7691 * merge.h (Output_merge_string): Add input_size_ field.
7692 * stringpool.cc (Stringpool_template::string_length): Move
7693 implementations out of Stringpool_template class and place in
7694 stringpool.h.
7695 * stringpool.h (string_length): Move out of Stringpool_template.
7696
7697 2010-08-03 Ian Lance Taylor <iant@google.com>
7698
7699 PR 11712
7700 * layout.cc (relaxation_loop_body): If address of load segment is
7701 set, adjust address to include headers if possible.
7702
7703 2010-08-03 Ian Lance Taylor <iant@google.com>
7704
7705 * version.cc (version_string): Bump to 1.10.
7706
7707 2010-08-03 Ian Lance Taylor <iant@google.com>
7708
7709 PR 11805
7710 * layout.h (enum Output_section_order): Define.
7711 (class Layout): Update declarations.
7712 * layout.cc (Layout::get_output_section): Add order parameter.
7713 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7714 is_first_non_relro parameters. Change all callers.
7715 (Layout::choose_output_section): Likewise.
7716 (Layout::add_output_section_data): Likewise.
7717 (Layout::make_output_section): Likewise. Set order.
7718 (Layout::default_section_order): New function.
7719 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7720 * output.cc (Output_section::Output_section): Initialize order_.
7721 Don't initialize deleted fields.
7722 (Output_segment::Output_segment): Don't initialize deleted
7723 fields.
7724 (Output_segment::add_output_section_to_load): New function
7725 replacing add_output_section. Change all callers to call this or
7726 add_output_section_to_nonload.
7727 (Output_segment::add_output_section_to_nonload): New function.
7728 (Output_segment::remove_output_section): Rewrite.
7729 (Output_segment::add_initial_output_data): Likewise.
7730 (Output_segment::has_any_data_sections): Likewise.
7731 (Output_segment::is_first_section_relro): Likewise.
7732 (Output_segment::maximum_alignment): Likewise.
7733 (Output_segment::has_dynamic_reloc): New function replacing
7734 dynamic_reloc_count. Change all callers.
7735 (Output_segment::has_dynamic_reloc_list): New function replacing
7736 dynamic_reloc_count_list. Change all callers.
7737 (Output_segment::set_section_addresses): Rewrite.
7738 (Output_segment::set_offset): Rewrite.
7739 (Output_segment::find_first_and_last_list): Remove.
7740 (Output_segment::set_tls_offsets): Rewrite.
7741 (Output_segment::first_section_load_address): Likewise.
7742 (Output_segment::output_section_count): Likewise.
7743 (Output_segment::section_with_lowest_load_address): Likewise.
7744 (Output_segment::write_section_headers): Likewise.
7745 (Output_segment::print_sections_to_map): Likewise.
7746 * output.h (class Output_data): Remove dynamic_reloc_count_
7747 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
7748 (Output_data::add_dynamic_reloc): Rewrite.
7749 (Output_data::has_dynamic_reloc): New function.
7750 (Output_data::dynamic_reloc_count): Remove.
7751 (class Output_section): Add order_ field. Remvoe is_relro_local_,
7752 is_last_relro_, is_first_non_relro_, is_interp_,
7753 is_dynamic_linker_section_ fields. Add order and set_order
7754 functions. Remove is_relro_local, set_is_relro_local,
7755 is_last_relro, set_is_last_relro, is_first_non_relro,
7756 set_is_first_non_relro functions, is_interp, set_is_interp,
7757 is_dynamic_linker_section, and set_is_dynamic_linker_section
7758 functions.
7759 (class Output_segment): Change Output_data_list from std::list to
7760 std:;vector. Add output_lists_ field. Remove output_data_ and
7761 output_bss_ fields. Update declarations.
7762
7763 2010-08-02 Ian Lance Taylor <iant@google.com>
7764
7765 * arm.cc (Target_arm::gc_process_relocs): Use typename.
7766 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7767 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7768
7769 2010-08-02 Ian Lance Taylor <iant@google.com>
7770
7771 PR 11855
7772 * script.cc (Script_options::Script_options): Initialize
7773 symbol_definitions_ and symbol_references_.
7774 (Script_options::add_symbol_assignment): Update
7775 symbol_definitions_ and symbol_references_.
7776 (Script_options::add_symbol_reference): New function.
7777 (script_symbol): New function.
7778 * script.h (class Script_options): Add symbol_definitions_ and
7779 symbol_references_ fields.
7780 (Script_options::referenced_const_iterator): New type.
7781 (Script_options::referenced_begin): New function.
7782 (Script_options::referenced_end): New function.
7783 (Script_options::is_referenced): New function.
7784 (Script_options::any_unreferenced): New function.
7785 * script-c.h (script_symbol): Declare.
7786 * yyscript.y (exp): Call script_symbol.
7787 * symtab.cc: Include "script.h".
7788 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7789 Change all callers. Check symbols referenced by scripts.
7790 (Symbol_table::add_undefined_symbols_from_command_line): Add
7791 layout parameter. Change all callers.
7792 (Symbol_table::do_add_undefined_symbols_from_command_line):
7793 Likewise. Break out loop body. Check symbols referenced by
7794 scripts.
7795 (Symbol_table::add_undefined_symbol_from_command_line): New
7796 function broken out of
7797 do_add_undefined_symbols_from_command_line.
7798 * symtab.h (class Symbol_table): Update declarations.
7799 * archive.cc: Include "layout.h".
7800 (Archive::should_include_member): Add layout parameter. Change
7801 all callers. Check for symbol mentioned in expression.
7802 * archive.h (class Archive): Update declaration.
7803 * object.cc (Sized_relobj::do_should_include_member): Add layout
7804 parameter.
7805 * object.h (Object::should_include_member): Add layout parameter.
7806 Change all callers.
7807 (Object::do_should_include_member): Add layout parameter.
7808 (class Sized_relobj): Update declaration.
7809 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7810 parameter.
7811 * dynobj.h (class Sized_dynobj): Update declaration.
7812 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7813 layout parameter.
7814 * plugin.h (class Sized_pluginobj): Update declaration.
7815
7816 2010-08-02 Ian Lance Taylor <iant@google.com>
7817
7818 PR 11866
7819 * output.cc (Output_segment::set_offset): Search for the first and
7820 last sections rather than assuming that the list is in order.
7821 (Output_segment::find_first_and_last_list): New function.
7822 * output.h (class Output_segment): Update declarations.
7823 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7824 (relro_strip_test_SOURCES): New variable.
7825 (relro_strip_test_DEPENDENCIES): New variable.
7826 (relro_strip_test_LDFLAGS): New variable.
7827 (relro_strip_test_LDADD): New variable.
7828 (relro_strip_test.so): New target.
7829
7830 2010-08-02 Ian Lance Taylor <iant@google.com>
7831
7832 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7833 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7834 (Target_i386::got_tlsdesc_section): New function.
7835 (Target_i386::got_section): Create space for GOT entries for
7836 TLSDESC relocations.
7837 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7838 R_386_TLS_GOTDESC.
7839 (Target_i386::Scan::global): Likewise.
7840 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7841 using TLSDESC GOT.
7842 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7843 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7844 (Target_x86_64::got_tlsdesc_section): New function.
7845 (Target_x86_64::got_section): Create space for GOT entries for
7846 TLSDESC relocations.
7847 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7848 R_386_TLS_GOTDESC.
7849 (Target_x86_64::Scan::global): Likewise.
7850 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7851 using TLSDESC GOT.
7852
7853 2010-08-02 Ian Lance Taylor <iant@google.com>
7854
7855 * testsuite/final_layout.sh: Use dc to convert from hex to
7856 decimal.
7857
7858 2010-07-29 Sriraman Tallam <tmsriram@google.com>
7859
7860 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7861 paramter to the call to gold::gc_process_relocs.
7862 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7863 paramter to the call to gold::gc_process_relocs.
7864 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7865 parameter to the call to gold::gc_process_relocs.
7866 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7867 template parameter to the call to gold::gc_process_relocs.
7868 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7869 paramter to the call to gold::gc_process_relocs.
7870 * gc.h (get_embedded_addend_size): New function.
7871 (gc_process_relocs): Save the size of the reloc for use by ICF.
7872 * icf.cc (get_section_contents): Get the addend from the text section
7873 for SHT_REL relocation sections.
7874 * icf.h (Icf::Reloc_addend_size_info): New typedef.
7875 (Icf::Reloc_info): Add new member reloc_addend_size_info.
7876 * int_encoding.h (read_from_pointer): New overloaded function.
7877 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7878 * testsuite/icf_sht_rel_addend_test.sh: New file.
7879 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7880 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7881
7882 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7883
7884 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7885 * Makefile.in: Regenerate.
7886 * testsuite/Makefile.in: Regenerate.
7887
7888 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
7889
7890 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7891 * gold/testsuite/debug_msg.cc: Likewise.
7892 * gold/testsuite/odr_violation1.cc
7893 * gold/testsuite/odr_violation2.cc
7894
7895 2010-07-21 Cary Coutant <ccoutant@google.com>
7896
7897 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7898 string, and length fields.
7899 (Output_merge_string::Merged_strings_list): New type.
7900 (Output_merge_string::Merged_strings_lists): New typedef.
7901 (Output_merge_string): Replace merged_strings_ with
7902 merged_strings_lists_.
7903 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7904 Merged_strings_list per input object and section. Don't store pointer
7905 to the string. Don't store length with each merged string entry.
7906 (Output_merge_string::finalize_merged_data): Loop over list of merged
7907 strings lists. Recompute length of each merged string.
7908
7909 2010-07-15 Cary Coutant <ccoutant@google.com>
7910
7911 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7912 here.
7913
7914 2010-07-14 Ian Lance Taylor <iant@google.com>
7915
7916 * descriptors.cc (Descriptors::open): Report correct name in error
7917 message.
7918
7919 2010-07-13 Doug Kwan <dougkwan@google.com>
7920
7921 * arm.cc (Arm_input_section::Arm_input_section): For a
7922 SHT_ARM_EXIDX section, always keeps the input sections.
7923 (Arm_input_section::set_exidx_section_link): New method.
7924 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7925 has_errors_ to false.
7926 (Arm_exidx_input_section::has_errors,
7927 Arm_exidx_input_section::set_has_errors): New methods.
7928 (Arm_exidx_input_section::has_errors_): New data member.
7929 (Arm_relobj::get_exidx_shndx_list): New method.
7930 (Arm_output_section::append_text_sections_to_list): Do not skip
7931 section without SHF_EXECINSTR.
7932 (Arm_output_section::fix_exidx_coverage): Skip input sections with
7933 errors.
7934 (Arm_relobj::make_exidx_input_section): Add new parameter for text
7935 section header. Make error messages more verbose. Check for
7936 a non-executable section linked to an EXIDX section.
7937 (Arm_relobj::do_read_symbols): Remove error checking, which has been
7938 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
7939 check that there is no deferred EXIDX section if we exit early.
7940 Instead of not making an EXIDX section in case of an error, make one
7941 and set the has_errors flag of it.
7942 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7943 in a relocatable link.
7944 (Target_arm::do_relax): Look for the EXIDX output section instead of
7945 assuming that it is called .ARM.exidx.
7946 (Target_arm::fix_exidx_coverage): Add a new parameter for input
7947 section list. Do not check for SHF_EXECINSTR section flags but
7948 skip any input section with errors.
7949 * output.cc (Output_section::Output_section): Initialize
7950 always_keeps_input_sections_ to false.
7951 (Output_section::add_input_section): Check for
7952 always_keeps_input_sections_.
7953 * output.h (Output_section::always_keeps_input_sections,
7954 Output_section::set_always_keeps_input_sections): New methods.
7955 (Output_section::always_keeps_input_sections): New data member.
7956
7957 2010-07-13 Rafael Espindola <espindola@google.com>
7958
7959 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7960 * fileread.h (Input_file): Add try_extra_search_path and find_file.
7961
7962 2010-07-13 Philip Herron <herron.philip@googlemail.com>
7963 Ian Lance Taylor <iant@google.com>
7964
7965 * output.h (Output_section_lookup_maps::add_merge_section):
7966 Correct check of whether value was inserted.
7967 (Output_section_lookup_maps::add_merge_input_section): Likewise.
7968 (Output_section_lookup_maps::add_relaxed_input_section):
7969 Likewise.
7970 * arm.cc (Target_arm::got_section): Remove used local os.
7971 * i386.cc (Target_i386::got_section): Likewise.
7972 * x86_64.cc (Target_x86_64::got_section): Likewise.
7973 * sparc.cc (Target_sparc::got_section): Likewise.
7974 (Target_sparc::relocate): Remove unused local have_got_offset.
7975 * powerpc.cc (Target_powerpc::relocate): Likewise.
7976
7977 2010-07-13 Ian Lance Taylor <iant@google.com>
7978
7979 * compressed_output.cc (zlib_decompress): Fix signature in
7980 !HAVE_ZLIB_H case.
7981
7982 * archive.cc (Archive::include_member): Unlock an external member
7983 of a thin archive. Don't bother to delete an object we know is
7984 NULL.
7985
7986 2010-07-12 Cary Coutant <ccoutant@google.com>
7987
7988 * compressed_output.cc (zlib_decompress): New function.
7989 (get_uncompressed_size): New function.
7990 (decompress_input_section): New function.
7991 * compressed_output.h (get_uncompressed_size): New function.
7992 (decompress_input_section): New function.
7993 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7994 Handle compressed debug sections.
7995 * layout.cc (is_compressed_debug_section): New function.
7996 (Layout::output_section_name): Map compressed section names to
7997 canonical names.
7998 * layout.h (is_compressed_debug_section): New function.
7999 (is_debug_info_section): Recognize compressed debug sections.
8000 * merge.cc: Include compressed_output.h.
8001 (Output_merge_data::do_add_input_section): Handle compressed
8002 debug sections.
8003 (Output_merge_string::do_add_input_section): Handle compressed
8004 debug sections.
8005 * object.cc: Include compressed_output.h.
8006 (Sized_relobj::Sized_relobj): Initialize new data members.
8007 (build_compressed_section_map): New function.
8008 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8009 * object.h (Object::section_is_compressed): New method.
8010 (Object::do_section_is_compressed): New method.
8011 (Sized_relobj::Compressed_section_map): New type.
8012 (Sized_relobj::do_section_is_compressed): New method.
8013 (Sized_relobj::compressed_sections_): New data member.
8014 * output.cc (Output_section::add_input_section): Handle compressed
8015 debug sections.
8016 * reloc.cc: Include compressed_output.h.
8017 (Sized_relobj::write_sections): Handle compressed debug sections.
8018
8019 2010-07-08 Cary Coutant <ccoutant@google.com>
8020
8021 * resolve.cc (Symbol_table::resolve): Remember whether undef was
8022 weak when resolving to a dynamic def.
8023 (Symbol_table::should_override): Add adjust_dyndef flag; set it
8024 for weak undef/dynamic def cases. Adjust callers.
8025 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8026 undef_binding_weak_.
8027 (Symbol_table::sized_write_globals): Adjust symbol binding.
8028 (Symbol_table::sized_write_symbol): Add binding parameter.
8029 * symtab.h (Symbol::set_undef_binding): New method.
8030 (Symbol::is_undef_binding_weak): New method.
8031 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8032 (Symbol_table::should_override): Add new parameter.
8033 (Symbol_table::sized_write_symbol): Add new parameter.
8034
8035 * testsuite/weak_undef_file1.cc: Add new test case.
8036 * testsuite/weak_undef_file2.cc: Fix header comment.
8037 * testsuite/weak_undef_test.cc: Add new test case.
8038
8039 2010-06-29 Doug Kwan <dougkwan@google.com>
8040
8041 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8042 Initialize USE_SYMBOL_.
8043 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8044 definition.
8045 (Arm_reloc_property::uses_symbol_): New data member declaration.
8046 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8047 uses symbol value and symbol is undefined but not weakly undefined.
8048
8049 2010-06-28 Rafael Espindola <espindola@google.com>
8050
8051 * plugin.cc (Plugin::load): Use dlerror.
8052
8053 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
8054
8055 * symtab.cc (detect_odr_violations): When reporting an ODR
8056 violation, report an object where the symbol is defined.
8057
8058 2010-06-25 Doug Kwan <dougkwan@google.com>
8059
8060 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8061 (Target_arm::section_may_have_icf_unsafe_pointers): New method
8062 definition.
8063 (Target_arm::Scan::local_reloc_may_be_function_pointer,
8064 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8065 target hook to detect function points.
8066 (Target_arm::Scan::possible_function_pointer_reloc): New method.
8067 * icf.h (Icf::check_section_for_function_pointers): Change type of
8068 parameter SECTION_NAME to const reference to std::string. Use
8069 target hook to determine if section may have unsafe pointers.
8070 * target.h (Target::section_may_have_icf_unsafe_pointers): New
8071 method definition.
8072
8073 2010-06-21 Rafael Espindola <espindola@google.com>
8074
8075 * fileread.cc (Input_file::find_fie): New
8076 (Input_file::open): Use Input_file::find_fie.
8077 * fileread.h (Input_file::find_fie): New
8078 * plugin.cc (set_extra_library_path): New.
8079 (Plugin::load): Add set_extra_library_path to the transfer vector.
8080 (Plugin_manager::set_extra_library_path): New.
8081 (Plugin_manager::add_input_file): Use the extra search path if set.
8082 (set_extra_library_path(): New.
8083 * plugin.h (Plugin_manager): Add set_extra_library_path and
8084 extra_search_path_.
8085
8086 2010-06-19 Cary Coutant <ccoutant@google.com>
8087
8088 * layout.cc (gdb_sections): Add .debug_types.
8089 (lines_only_debug_sections): Likewise.
8090
8091 2010-06-18 Rafael Espindola <espindola@google.com>
8092
8093 * plugin.cc (add_input_file,add_input_library)
8094 (Plugin_manager::add_input_file): Make filename arguments const.
8095 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8096 const.
8097
8098 2010-06-16 Doug Kwan <dougkwan@google.com>
8099
8100 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8101 .ARM.attributes section if we have not merged any input
8102 attributes sections.
8103
8104 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8105
8106 * arm.cc: Allow combining objects with no EABI version
8107 information.
8108
8109 2010-06-15 Rafael Espindola <espindola@google.com>
8110
8111 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8112
8113 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8114
8115 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8116 (struct iovec): Correct !HAVE_READV definition.
8117
8118 2010-06-10 Cary Coutant <ccoutant@google.com>
8119
8120 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8121 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8122 reloc sections.
8123 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8124
8125 PR 11683
8126 * symtab.h (Symbol::is_placeholder): New member function.
8127 * target-reloc.h (relocate_section): Check for placeholder symbols.
8128
8129 * testsuite/Makefile.am (plugin_test_8): New test.
8130 (plugin_test_9): New test.
8131 * testsuite/Makefile.in: Regenerate.
8132
8133 2010-06-09 Nick Clifton <nickc@redhat.com>
8134
8135 * yyscript.y (input_list_element): Allow strings prefixed with
8136 the '-' character. Treat these as libraries.
8137 * script.cc (script_add_library): New function. Adds a library
8138 specified by "-l<name>" found in an input script.
8139 * script-c.h: Add prototype for script_add_library.
8140
8141 2010-06-07 Doug Kwan <dougkwan@google.com>
8142
8143 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8144 Restrict stub-group size to be within long conditional branch
8145 range when working around cortex-A8 erratum.
8146
8147 2010-06-07 Damien Diederen <dd@crosstwine.com>
8148
8149 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8150 #ifdef typo.
8151
8152 2010-06-03 Sriraman Tallam <tmsriram@google.com>
8153
8154 PR gold/11658
8155 * output.cc
8156 (Output_section::Input_section_sort_entry::compare_section_ordering):
8157 Change to return non-zero correctly.
8158 (Output_section::Input_section_sort_section_order_index_compare
8159 ::operator()): Change to fix ambiguity in comparisons.
8160
8161 2010-06-01 Sriraman Tallam <tmsriram@google.com>
8162
8163 * gold.h (is_wildcard_string): New function.
8164 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8165 (Layout::layout_eh_frame): Ditto.
8166 (Layout::find_section_order_index): New method.
8167 (Layout::read_layout_from_file): New method.
8168 * layout.h (Layout::find_section_order_index): New method.
8169 (Layout::read_layout_from_file): New method.
8170 (Layout::input_section_position_): New private member.
8171 (Layout::input_section_glob_): New private member.
8172 * main.cc (main): Call read_layout_from_file here.
8173 * options.h (--section-ordering-file): New option.
8174 * output.cc (Output_section::input_section_order_specified_): New
8175 member.
8176 (Output_section::Output_section): Initialize new member.
8177 (Output_section::add_input_section): Add new parameter.
8178 Keep input sections when --section-ordering-file is used.
8179 (Output_section::set_final_data_size): Sort input sections when
8180 section ordering file is specified.
8181 (Output_section::Input_section_sort_entry): Add new parameter.
8182 Check sorting type.
8183 (Output_section::Input_section_sort_entry::compare_section_ordering):
8184 New method.
8185 (Output_section::Input_section_sort_compare::operator()): Change to
8186 consider section_order_index.
8187 (Output_section::Input_section_sort_init_fini_compare::operator()):
8188 Change to consider section_order_index.
8189 (Output_section::Input_section_sort_section_order_index_compare
8190 ::operator()): New method.
8191 (Output_section::sort_attached_input_sections): Change to sort
8192 according to section order when specified.
8193 (Output_section::add_input_section<32, true>): Add new parameter.
8194 (Output_section::add_input_section<64, true>): Add new parameter.
8195 (Output_section::add_input_section<32, false>): Add new parameter.
8196 (Output_section::add_input_section<64, false>): Add new parameter.
8197 * output.h (Output_section::add_input_section): Add new parameter.
8198 (Output_section::input_section_order_specified): New
8199 method.
8200 (Output_section::set_input_section_order_specified): New method.
8201 (Input_section::Input_section): Initialize section_order_index_.
8202 (Input_section::section_order_index): New method.
8203 (Input_section::set_section_order_index): New method.
8204 (Input_section::section_order_index_): New member.
8205 (Input_section::Input_section_sort_section_order_index_compare): New
8206 struct.
8207 (Output_section::input_section_order_specified_): New member.
8208 * script-sections.cc (is_wildcard_string): Delete and move modified
8209 method to gold.h.
8210 (Output_section_element_input::Output_section_element_input): Modify
8211 call to is_wildcard_string.
8212 (Output_section_element_input::Input_section_pattern
8213 ::Input_section_pattern): Ditto.
8214 (Output_section_element_input::Output_section_element_input): Ditto.
8215 * testsuite/Makefile.am (final_layout): New test case.
8216 * testsuite/Makefile.in: Regenerate.
8217 * testsuite/final_layout.cc: New file.
8218 * testsuite/final_layout.sh: New file.
8219
8220 2010-06-01 Rafael Espindola <espindola@google.com>
8221
8222 * plugin.cc (Plugin::load): Pass the output name to the plugin.
8223
8224 2010-06-01 Rafael Espindola <espindola@google.com>
8225
8226 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8227 visibility of symbols.
8228
8229 2010-05-27 Doug Kwan <dougkwan@google.com>
8230
8231 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8232 from start of output section instead of address for a local symbol
8233 in a merged or relaxed section when doing a relocatable link.
8234
8235 2010-05-26 Rafael Espindola <espindola@google.com>
8236
8237 PR 11604
8238 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8239 adding sections the garbage collector removed.
8240 * gold/testsuite/Makefile.am: Add test.
8241 * gold/testsuite/Makefile.in: Regenerate.
8242 * gold/testsuite/plugin_test_7.sh: New.
8243 * gold/testsuite/plugin_test_7_1.c: New.
8244 * gold/testsuite/plugin_test_7_2.c: New.
8245
8246 2010-05-26 Rafael Espindola <espindola@google.com>
8247
8248 * script-sections.cc (Output_section_definition::set_section_addresses):
8249 Check for --section-start.
8250
8251 2010-05-26 Doug Kwan <dougkwan@google.com>
8252
8253 * arm.cc (Arm_scan_relocatable_relocs): New class.
8254 (Target_arm::relocate_special_relocatable): New method.
8255 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8256 (Arm_relocate_functions::thumb_branch_common): Same.
8257 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8258 instead of Default_scan_relocatable_relocs.
8259 * target-reloc.h (relocate_for_relocatable): Let target handle
8260 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8261 * target.h (Sized_target::relocate_special_relocatable): New method.
8262
8263 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8264
8265 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8266
8267 2010-05-23 Doug Kwan <dougkwan@google.com>
8268
8269 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8270 instead of a cast.
8271 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8272 with a direct branch, not a conditional branch, to a stub.
8273 * merge.cc (Output_merge_base::record_input_section): New method
8274 defintion.
8275 (Output_merge_data::do_add_input_section): Record input section if
8276 keeps-input-sections flag is set.
8277 (Output_merge_string::do_add_input_section): Ditto.
8278 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8279 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8280 INPUT_SECTIONS_.
8281 (Output_merge_base::keeps_input_sections,
8282 Output_merge_base::set_keeps_input_sections,
8283 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8284 method definitions.
8285 (Output_merge_base::Input_sections): New type declaration.
8286 (Output_merge_base::input_sections_begin,
8287 Output_merge_base::input_sections_end,
8288 Output_merge_base::do_set_keeps_input_sections): New method definitions.
8289 (Output_merge_base::bool keeps_input_sections_,
8290 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8291 Output_merge_base::input_sections_): New data members.
8292 (Output_merge_data::do_set_keeps_input_sections): New method
8293 defintion.
8294 (Output_merge_string::do_set_keeps_input_sections): Ditto.
8295 * output.cc (Output_section::Input_section::relobj): Move method
8296 defintion from class declaration to here and handle merge sections.
8297 (Output_section::Input_section::shndx): Ditto.
8298 (Output_section::Output_section): Remove initializations of removed
8299 data members and initialize new data member LOOKUP_MAPS_.
8300 (Output_section::add_input_section): Set keeps-input-sections flag
8301 for a newly created merge output section as appropriate. Adjust code
8302 to use Output_section_lookup_maps class.
8303 (Output_section::add_relaxed_input_section): Adjst code for lookup
8304 maps code refactoring.
8305 (Output_section::add_merge_input_section): Add a new parameter
8306 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
8307 class. If adding input section to a newly created merge output
8308 section fails, remove the new merge section.
8309 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8310 Adjust code for use of the Output_section_lookup_maps class.
8311 (Output_section::find_merge_section): Ditto.
8312 (Output_section::build_lookup_maps): New method defintion.
8313 (Output_section::find_relaxed_input_section): Adjust code to use
8314 Output_section_lookup_maps class.
8315 (Output_section::get_input_sections): Export merge sections. Adjust
8316 code to use Output_section_lookup_maps class.
8317 (Output_section:::add_script_input_section): Adjust code to use
8318 Output_section_lookup_maps class. Update lookup maps for merge
8319 sections also.
8320 (Output_section::discard_states): Use Output_section_lookup_maps.
8321 (Output_section::restore_states): Same.
8322 * output.h (Merge_section_properties): Move class defintion out of
8323 Output_section.
8324 (Output_section_lookup_maps): New class.
8325 (Output_section::Input_section::is_merge_section): New method
8326 defintion.
8327 (Output_section::Input_section::relobj): Move defintion out of class
8328 defintion. Declare method only.
8329 (Output_section::Input_section::shndx): Ditto.
8330 (Output_section::Input_section::output_merge_base): New method defintion.
8331 (Output_section::Input_section::u2_.pomb): New union field.
8332 (Output_section::Merge_section_by_properties_map,
8333 Output_section::Output_section_data_by_input_section_map,
8334 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8335 Remove types.
8336 (Output_section::add_merge_input_section): Add new parameter
8337 KEEPS_INPUT_SECTIONS.
8338 (Output_section::build_lookup_maps): New method declaration.
8339 (Output_section::merge_section_map_,
8340 Output_section::merge_section_by_properties_map_,
8341 Output_section::relaxed_input_section_map_,
8342 Output_section::is_relaxed_input_section_map_valid_): Remove data
8343 members.
8344 (Output_section::lookup_maps_): New data member.
8345
8346 2010-05-21 Doug Kwan <dougkwan@google.com>
8347
8348 PR gold/11619
8349 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8350 avoid a compilation error.
8351
8352 2010-05-19 Rafael Espindola <espindola@google.com>
8353
8354 * script-sections.cc (Output_section_definition::allocate_to_segment):
8355 Update the phdrs_list even when the output section is NULL.
8356 * testsuite/Makefile.am: Add test.
8357 * testsuite/Makefile.in: Regenerate.
8358 * testsuite/script_test_9.cc: New.
8359 * testsuite/script_test_9.sh: New.
8360 * testsuite/script_test_9.t: New.
8361
8362 2010-05-19 Doug Kwan <dougkwan@google.com>
8363
8364 * arm.cc (Arm_input_section::original_size): New method.
8365 (Arm_input_section::do_addralign): Add a cast.
8366 (Arm_input_section::do_output_offset): Remove static cast.
8367 (Arm_input_section::original_addralign,
8368 Arm_input_section::original_size_): Change type to uint32_t.
8369 (Arm_input_section::init): Add safe casts for section alignment
8370 and size.
8371 (Arm_input_section::set_final_data_size): Do not set address and
8372 offset of stub table.
8373 (Arm_output_section::fix_exidx_coverage): Change use of of
8374 Output_section::Simple_input_section to that of
8375 Output_section::Input_section.
8376 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8377 except for the first pass.
8378 * output.cc (Output_section::get_input_sections): Change type of
8379 input_sections to std::list<Input_section>.
8380 (Output_section::add_script_input_section): Rename from
8381 Output_section::add_simple_input_section. Change type of SIS
8382 parameter from Simple_input_section to Input_section.
8383 * output.h (Output_section::Simple_input_section): Remove class.
8384 (Output_section::Input_section): Change class visibility to public.
8385 (Output_section::Input_section::addralign): Use stored alignments
8386 for special input sections if set.
8387 (Output_section::Input_section::set_addralign): New method.
8388 (Output_section::get_input_sections): Change parameter type from
8389 list of Simple_input_section to list of Input_section.
8390 (Output_section::add_script_input_section): Rename from
8391 Output_section::add_simple_input_section. Change first parameter's
8392 type from Simple_input_section to Input_section and remove the
8393 second and third parameters.
8394 * script-sections.cc (Input_section::Input_section_list): Change
8395 type to list of Output_section::Input_section/
8396 (Input_section_info::Input_section_info): Change parameter type of
8397 INPUT_SECTION to Output_section::Input_section.
8398 (Input_section_info::input_section): Change return type.
8399 (Input_section_info::input_section_): Change type to
8400 Output_section::Input_section.
8401 (Output_section_element_input::set_section_addresses): Adjust code
8402 to use Output_section::Input_section instead of
8403 Output_section::Simple_input_section. Adjust code for renaming
8404 of Output_section::add_simple_input_section.
8405 (Orphan_output_section::set_section_addresses): Ditto.
8406
8407 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8408
8409 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8410 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8411
8412 2010-05-18 Rafael Espindola <espindola@google.com>
8413
8414 * options.cc (General_options::finalize): Handle -nostdlib.
8415 * options.h (nostdlib): New option.
8416 * script.cc (script_add_search_dir): Handle -nostdlib.
8417
8418 2010-05-12 Doug Kwan <dougkwan@google.com>
8419
8420 * arm.cc (Target_arm::do_finalize_sections): Create an empty
8421 attributes section only if there no attributes section after merging.
8422 (Target_arm::merge_object_attributes): Move value of
8423 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8424 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8425 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8426 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8427 and arm_attr_merge_7.stdout.
8428 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8429 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8430 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8431 arm_attr_merge_7b.o): New rules.
8432 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8433 arm_attr_merge_7
8434 * testsuite/Makefile.in: Regenerate.
8435 * testsuite/arm_attr_merge.sh: New file.
8436 * testsuite/arm_attr_merge_[67][ab].s: Same.
8437
8438 2010-05-05 Nick Clifton <nickc@redhat.com>
8439
8440 * po/es.po: Updated Spanish translation.
8441
8442 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8443
8444 * Makefile.am (install-exec-local): Properly install gold as
8445 default cross linker.
8446 * Makefile.in: Regenerated.
8447
8448 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
8449 Nick Clifton <nickc@redhat.com>
8450
8451 * configure.ac (install_as_default): Define and set to false
8452 unless --enable-gold or --enable-gold=both/gold has been
8453 specified.
8454 * configure: Regenerate.
8455
8456 * Makefile.am (install-exec-local): Install the executable as
8457 'ld.gold'. If install_as_default is true then also install it as
8458 'ld'.
8459 * Makefile.in: Regenerated.
8460
8461 2010-04-24 Ian Lance Taylor <iant@google.com>
8462
8463 * layout.cc (Layout::layout_reloc): In relocatable link don't
8464 combine reloc sections for grouped sections.
8465
8466 2010-04-23 Sriraman Tallam <tmsriram@google.com>
8467
8468 * gc.h (gc_process_relocs): Pass information on relocs pointing to
8469 sections that are not ordinary to icf.
8470 * icf.cc (get_section_contents): Handle relocation pointing to section
8471 with no object or shndx information.
8472 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8473 * testsuite/Makefile.in: Regenerate.
8474 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8475 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8476
8477 2010-04-22 Ian Lance Taylor <iant@google.com>
8478
8479 * expression.cc (Expression::Expression_eval_info): Add
8480 result_alignment_pointer field.
8481 (Expression::eval_with_dot): Add result_alignment_pointer
8482 parameter. Change all callers.
8483 (Expression::eval_maybe_dot): Likewise.
8484 (class Binary_expression): Add alignment_pointer parameter to
8485 left_value and right_value. Change all callers.
8486 (BINARY_EXPRESSION): Set result alignment.
8487 (class Trinary_expression): Add alignment_pointer parameter to
8488 arg2_value and arg3_value. Change all callers.
8489 (Trinary_cond::value): Set result alignment.
8490 (Max_expression::value, Min_expression::value): Likewise.
8491 (Align_expression::value): Likewise.
8492 * script-sections.cc (class Sections_element): Add dot_alignment
8493 parameter to set_section_addresses virtual function. Update
8494 instantiations.
8495 (class Output_section_element): Likewise.
8496 (Script_sections::create_segments): Add dot_alignment parameter.
8497 Change all callers.
8498 (Script_sections::create_segments_from_phdrs_clause): Likewise.
8499 (Script_sections::set_phdrs_clause_addresses): Likewise.
8500 * script-sections.h: Update declarations.
8501 * script.h: Update declarations.
8502 * output.h (Output_segment::set_minimum_p_align): Don't decrease
8503 min_p_align.
8504 * testsuite/script_test_3.t: Set large alignment.
8505 * testsuite/script_test_3.sh: Make sure that at least one LOAD
8506 segment has expected alignment.
8507
8508 2010-04-22 Nick Clifton <nickc@redhat.com>
8509
8510 * po/gold.pot: Updated by the Translation project.
8511 * po/vi.po: Updated Vietnamese translation.
8512
8513 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
8514
8515 * testsuite/Makefile.am (check_PROGRAMS): Add
8516 icf_virtual_function_folding_test.
8517 * testsuite/Makefile.in: Regenerated.
8518
8519 2010-04-15 Andrew Haley <aph@redhat.com>
8520
8521 * options.h (merge_exidx_entries): New option.
8522 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8523 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8524 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8525 (Target_arm::merge_exidx_entries): New function.
8526 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8527 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8528 to Arm_exidx_fixup constructor.
8529 Add new arg, merge_exidx_entries.
8530 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8531 Arm_output_section::fix_exidx_coverage.
8532
8533 2010-04-18 Sriraman Tallam <tmsriram@google.com>
8534
8535 * icf.cc (get_section_contents): Check for preemptible functions.
8536 Ignore addend when appropriate.
8537 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
8538 section folded.
8539 (add_from_relobj): Check for section folded.
8540 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8541 * symtab.h (should_add_dynsym_entry): Add new parameter.
8542 * target-reloc.h (scan_relocs): Check for section folded.
8543 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8544 Check reloc types for function pointers in shared objects.
8545 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8546 case.
8547 (icf_preemptible_functions_test): New test case.
8548 (icf_string_merge_test): New test case.
8549 * testsuite.Makefile.in: Regenerate.
8550 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8551 bar_glob. Refactor code.
8552 * testsuite/icf_preemptible_functions_test.cc: New file.
8553 * testsuite/icf_preemptible_functions_test.sh: New file.
8554 * testsuite/icf_string_merge_test.cc: New file.
8555 * testsuite/icf_string_merge_test.sh: New file.
8556 * testsuite/icf_virtual_function_folding_test.cc: New file.
8557 * testsuite/icf_virtual_function_folding_test.sh: New file.
8558
8559 2010-04-14 Doug Kwan <dougkwan@google.com>
8560
8561 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8562 for local symbol recounting if we remove a section due to ICF.
8563 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8564 there are no regular objects in input.
8565
8566 2010-04-13 Doug Kwan <dougkwan@google.com>
8567
8568 * arm.cc (Arm_input_section::set_final_data_size): Compute
8569 accurate final data size instead of using current data size.
8570
8571 2010-04-09 Doug Kwan <dougkwan@google.com>
8572
8573 * layout.cc (Layout::choose_output_section): Handle script section
8574 types.
8575 (Layout::make_output_section_for_script): Add section type parameter.
8576 Handle script section types.
8577 * layout.h (Layout::make_output_section_for_script): Add section
8578 type parameter.
8579 * output.cc (Output_section::Output_section): Initialize data member
8580 is_noload_.
8581 (Output_section::do_reset_address_and_file_offset): Do not set address
8582 to 0 if section is a NOLOAD section.
8583 * output.h (Output_section::is_noload): New method.
8584 (Output_section::set_is_noload): Ditto.
8585 (Output_section::is_noload_): New data member.
8586 * script-c.h (Script_section_type): New enum type.
8587 (struct Parser_output_section_header): Add new file section_type.
8588 * script-sections.cc (Sections_element::output_section_name): Add
8589 parameter for returning script section type.
8590 (Output_section_definition::output_section_name): Ditto.
8591 (Output_section_definition::section_type)P; New method.
8592 (Output_section_definiton::script_section_type_name): Ditto.
8593 (Output_section_definition::script_section_type_): New data member.
8594 (Output_section_definition::Output_section_definition): Initialize
8595 data member Output_section_definition::script_section_type_.
8596 (Output_section_definition::create_sections): Pass script section type
8597 to Layout::make_output_section_for_script.
8598 (Output_section_definition::output_section_name): Return script
8599 section type to caller.
8600 (Output_section_definition::set_section_address): Do not advance
8601 dot value and load address if section type is NOLOAD. Set address
8602 of NOLOAD sections regardless of section flags.
8603 (Output_section_definition::print): Print section type if it is
8604 not SCRIPT_SECTION_TYPE_NONE.
8605 (Output_section_definition::section_type): New method.
8606 (Output_section_definition::script_section_type_name): Ditto.
8607 (Script_sections::output_section_name): Add new parameter
8608 PSECTION_TYPE for returning script section type. Pass it to
8609 section elements. Handle discard sections.
8610 (Sort_output_sections::operator()): Handle NOLOAD sections.
8611 * script-sections.h (Script_sections::Section_type): New enum type.
8612 (Script_sections::output_section_name): Add a new parameter for
8613 returning script section type.
8614 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8615 INFO and NOLOAD.
8616 * yyscript.y (union): Add new field SECTION_TYPE.
8617 (COPY, DSECT, INFO, NOLOAD): New tokens.
8618 (opt_address_and_section_type): Change type to output_section_header.
8619 (section_type): New non-terminal
8620 (section_header): Handle section type.
8621 (opt_address_and_section_type): Return section type value.
8622
8623 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
8624
8625 * testsuite/plugin_common_test_1.c (foo): Add prototype.
8626 * testsuite/plugin_common_test_2.c (foo): Likewise.
8627
8628 2010-04-08 Doug Kwan <dougkwan@google.com>
8629
8630 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8631 Output_merge_data.
8632 * output.cc (Output_section::add_merge_input_section): Simplify
8633 code and return status of Output_merge_base::add_input_section.
8634 Update merge section map only if Output_merge_base::add_input_section
8635 returns true.
8636
8637 2010-04-07 Doug Kwan <dougkwan@google.com>
8638
8639 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8640 if section is marked as containing instructions but has no mapping
8641 symbols.
8642 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8643 correct section index.
8644 (Arm_relobj::find_linked_text_section): Ditto.
8645
8646 2010-04-07 Cary Coutant <ccoutant@google.com>
8647
8648 * archive.cc (include_member): Destroy Read_symbols_data object before
8649 releasing file.
8650 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8651 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8652 (Read_symbols_data::~Read_symbols_data) New destructor.
8653 (Section_relocs::Section_relocs) New constructor.
8654 (Section_relocs::~Section_relocs) New destructor.
8655 (Read_relocs_data::Read_relocs_data) New constructor.
8656 (Read_relocs_data::~Read_relocs_data) New destructor.
8657 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8658 pointers to NULL after deleting.
8659
8660 2010-04-07 Doug Kwan <dougkwan@google.com>
8661
8662 * arm.cc: Replace "endianity" with "endianness" in comments.
8663 (Arm_exidx_cantunwind): Ditto.
8664 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8665 (Arm_relobj::merge_flags_and_attributes): New method.
8666 (Arm_relobj::merge_flags_and_attributes_): New data member.
8667 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8668 (Arm_relobj::scan_sections_for_stubs): Ditto.
8669 (Arm_relobj::do_read_symbols): Check to see if we really want to
8670 merge processor-specific flags and attributes. Exit early if
8671 an object is empty except for section names and the undefined symbol.
8672 (Target_arm::do_finalize_sections): Move check for ELF format to
8673 Arm_relobj::do_read_symbols. Merge processor specific flags and
8674 attributes from a regular object only when we have determined that
8675 it is aapropriate. Do not create an .ARM.attributes section in
8676 output if there is no regular input object.
8677 (Target_arm::merge_processor_specific_flags): Check
8678 --warn-mismatch before printing any error.
8679 (Target_arm::merge_object_attributes): Ditto.
8680 * gold.cc (queue_middle_tasks): Handle the case in which there is
8681 no regular object in input.
8682 * options.cc (General_options::parse_EB): New method.
8683 (General_options::parse_EL): Same.
8684 (General_options::General_options): Initialize endianness_.
8685 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8686 New options.
8687 (General_options::Endianness): New enum.
8688 (General_options::endianness): New method.
8689 (General_options::endianness_): New data member.
8690 * parameters.cc (Parameters::set_options): Check target endianness.
8691 (Parameters::set_target_once): Ditto.
8692 (Parameters::check_target_endianness): New method.
8693 (parameters_force_valid_target): If either -EL or -EB is specified,
8694 use it to define endianness of default target.
8695 * parameters.h (Parameters::check_target_endianness): New method
8696 declaration.
8697 * target.h (class Target): Change "endianity" to "endianness"
8698 in comments.
8699
8700 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
8701
8702 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8703 * configure: Regenerate.
8704 * Makefile.in: Regenerate.
8705 * testsuite/Makefile.in: Regenerate.
8706
8707 2010-04-06 Cary Coutant <ccoutant@google.com>
8708
8709 gcc PR lto/42757
8710 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8711 prevailing definitions of common symbols.
8712 * testsuite/plugin_test_6.sh: New test case.
8713 * testsuite/plugin_common_test_1.c: New test case.
8714 * testsuite/plugin_common_test_2.c: New test case.
8715 * testsuite/Makefile.am (plugin_test_6): New test case.
8716 * testsuite/Makefile.in: Regenerate.
8717
8718 2010-04-06 Nick Clifton <nickc@redhat.com>
8719
8720 * po/vi.po: New Vietnamese translation.
8721
8722 2010-03-30 Doug Kwan <dougkwan@google.com>
8723
8724 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8725
8726 2010-03-25 Doug Kwan <dougkwan@google.com>
8727
8728 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8729 to avoid a conversion warning on a 32-bit host.
8730
8731 2010-03-24 Ian Lance Taylor <iant@google.com>
8732
8733 * testsuite/script_test_3.t: Add a TLS segment.
8734 * testsuite/Makefile.am (check_PROGRAMS): Add
8735 tls_phdrs_script_test.
8736 (tls_phdrs_script_test_SOURCES): Define.
8737 (tls_phdrs_script_test_DEPENDENCIES): Define.
8738 (tls_phdrs_script_test_LDFLAGS): Define.
8739 (tls_phdrs_script_test_LDADD): Define.
8740 * testsuite/Makefile.in: Rebuild.
8741
8742 2010-03-23 Cary Coutant <ccoutant@google.com>
8743
8744 * fileread.cc (find_or_make_view): Fix comment.
8745
8746 2010-03-23 Ian Lance Taylor <iant@google.com>
8747
8748 * script-sections.cc (class Orphan_section_placement): Define
8749 PLACE_TLS and PLACE_TLS_BSS.
8750 (Orphan_section_placement::Orphan_section_placement): Initialize
8751 new places.
8752 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8753 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8754 (tls_script_test_SOURCES): Define.
8755 (tls_script_test_DEPENDENCIES): Define.
8756 (tls_script_test_LDFLAGS): Define.
8757 (tls_script_test_LDADD): Define.
8758 * testsuite/Makefile.in: Rebuild.
8759
8760 2010-03-22 Doug Kwan <dougkwan@google.com>
8761
8762 * arm.cc (Arm_relocate_functions::abs8,
8763 Arm_relocate_functions::abs16): Use correct check for overflow
8764 specified in the ARM ELF specs.
8765 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
8766 target of a BLX instruction specially.
8767 (Reloc_stub::stub_type_for_reloc): Ditto.
8768 (Relocate::relocate): Use symbolic names instead of numeric relocation
8769 codes to report error.
8770 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8771 workaround.
8772 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8773 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8774 thumb2_blx_out_of_range.stdout
8775 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8776 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8777 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8778 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8779 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8780 thumb2_blx_in_range, thumb2_blx_in_range.o,
8781 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8782 thumb2_blx_out_of_range.o): New rules.
8783 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8784 thumb2_blx_in_range and thumb2_blx_out_of_range.
8785 * testsuite/Makefile.in: Regenerate.
8786 * arm_branch_in_range.sh: Add tests for THUMB BLX.
8787 * testsuite/thumb_blx_in_range.s: New file.
8788 * testsuite/thumb_blx_out_of_range.s: New file.
8789
8790 2010-03-22 Rafael Espindola <espindola@google.com>
8791
8792 * archive.cc (Should_include): Move to archive.h.
8793 (should_include_member): Make it a member of Archive.
8794 (Lib_group): New.
8795 (Add_lib_group_symbols): New.
8796 * archive.h: Include options.h.
8797 (Archive_member): Moved from Archive.
8798 (Should_include): Moved from archive.cc.
8799 (Lib_group): New.
8800 (Add_lib_group_symbols): New.
8801 * dynobj.cc (do_should_include_member): New.
8802 * dynobj.h (do_should_include_member): New.
8803 * gold.cc (queue_initial_tasks): Update call to queue.
8804 * main.cc (main): Print lib group stats.
8805 * object.cc (do_should_include_member): New.
8806 * object.h: Include archive.h.
8807 (Object::should_include_member): New.
8808 (Object::do_should_include_member): New.
8809 (Sized_relobj::do_should_include_member): New.
8810 * options.cc (General_options::parse_start_lib): New.
8811 (General_options::parse_end_lib): New.
8812 (Input_arguments::add_file): Handle lib groups.
8813 (Input_arguments::start_group): Check we are not in a lib.
8814 (Input_arguments::start_lib): New.
8815 (Input_arguments::end_lib): New.
8816 * options.h (General_options): Add start_lib and end_lib.
8817 (Input_argument::lib_): New.
8818 (Input_argument::lib): New.
8819 (Input_argument::is_lib): New.
8820 (Input_file_lib): New.
8821 (Input_arguments::in_lib_): New.
8822 (Input_arguments::in_lib): New.
8823 (Input_arguments::start_lib): New.
8824 (Input_arguments::end_lib_): New.
8825 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8826 in unused members as preempted.
8827 (Sized_pluginobj::do_should_include_member): New.
8828 * plugin.h (Sized_pluginobj::do_should_include_member): New.
8829 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8830 return the blocker.
8831 (Read_symbols::do_whole_lib_group): New.
8832 (Read_symbols::do_lib_group): New.
8833 (Read_symbols::do_read_symbols): Handle lib groups.
8834 (Read_symbols::get_name): Handle lib groups.
8835 * readsyms.h (Read_symbols): Add an archive member pointer.
8836 (Read_symbols::do_whole_lib_group): New.
8837 (Read_symbols::do_lib_group): New.
8838 (Read_symbols::member_): New.
8839 * script.cc (read_input_script): Update call to queue_soon.
8840
8841 2010-03-19 Doug Kwan <dougkwan@google.com>
8842
8843 * arm.cc (Stub_table::Stub_table): Initialize new data members
8844 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8845 (Stub_table::add_reloc_stub): Assign stub offset and update
8846 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8847 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8848 New data members.
8849 (Stub_table::update_data_size_and_addralign): Use
8850 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8851 instead of going over all reloc stubs.
8852 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8853 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8854 Stringpool_template::offset_ to size of Stringpool_char.
8855 (Stringpool_template::new_key_offset): Remove code to initialize
8856 Stringpool_template::offset_.
8857 * stringpool.h (Stringpool_template::set_no_zero_null): Set
8858 Stringpool_template::offset_ to zero.
8859
8860 2010-03-15 Doug Kwan <dougkwan@google.com>
8861
8862 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8863 offset_.
8864 (Stringpool_template::new_key_offset): New method.
8865 (Stringpool_template::add_string): Assign offsets when adding new
8866 strings.
8867 (Stringpool_template::set_string_offsets): Do not set string offsets
8868 when not optimizing.
8869 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8870 member size_.
8871 (Chunked_vector::clear): Clear size_.
8872 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8873 (Chunked_vector::size): Return size_.
8874 (Chunked_vector::push_back): Use size_ to find insert position.
8875 (Chunked_vector::size_): New data member.
8876 (Stringpool_template::set_no_zero_null): Assert string set is empty.
8877 (Stringpool_template::new_key_offset): New method declaration.
8878 (Stringpool_template::offset_): New data member.
8879
8880 2010-03-15 Rafael Espindola <espindola@google.com>
8881
8882 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8883 Add_symbols' constructor.
8884 * readsyms.h (Add_symbols): Remove the input_group member.
8885
8886 2010-03-10 Ian Lance Taylor <iant@google.com>
8887
8888 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8889 target to ask whether a reference to a symbol requires a stack
8890 split.
8891 * target.h (Target::is_call_to_non_split): New function.
8892 (Target::do_is_call_to_non_split): Declare virtual function.
8893 * target.cc: Include "symtab.h".
8894 (Target::do_is_call_to_non_split): New function.
8895 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8896
8897 2010-03-10 Cary Coutant <ccoutant@google.com>
8898
8899 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8900 (File_read::open[1]): Remove initial mapping of whole_file_view_.
8901 (File_read::open[2]): Add whole_file_view_ to list of views.
8902 (File_read::make_view): Remove test of whole_file_view_.
8903 (File_read::find_or_make_view): Create whole_file_view_ if
8904 necessary.
8905 (File_read::clear_views): Replace bool parameter with enum;
8906 adjust all callers. Don't delete views with permanent data;
8907 do delete cached views and views from archives if
8908 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
8909 if clearing the corresponding view.
8910 * fileread.h (File_read::Clear_views_mode): New enum.
8911 (File_read::View::is_permanent_view): New method.
8912 (File_read::clear_views): Replace bool parameter
8913 with enum; adjust all callers.
8914 * options.h (General_options): Change keep_files_mapped option;
8915 add map_whole_files.
8916 * readsyms.cc (Add_symbols::run): Delete sd_ object before
8917 releasing the file.
8918 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8919 the file.
8920
8921 2010-03-10 David S. Miller <davem@davemloft.net>
8922
8923 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8924
8925 2010-03-09 Sriraman Tallam <tmsriram@google.com>
8926
8927 * icf.cc (get_section_contents): Add '@' marker after processing the
8928 merge reloc.
8929
8930 2010-03-08 Doug Kwan <dougkwan@google.com>
8931
8932 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8933 due to a conversion warning.
8934 (Arm_relobj::update_output_local_symbol_count): Check for local
8935 symbol with unset output index.
8936
8937 2010-03-05 Ian Lance Taylor <iant@google.com>
8938
8939 * options.h (class General_options): Add --spare-dynamic-tags.
8940 * output.cc (Output_data_dynamic::set_final_data_size): Implement
8941 --spare-dynamic-tags.
8942
8943 2010-03-05 Ian Lance Taylor <iant@google.com>
8944
8945 * incremental.cc: Include "libiberty.h".
8946
8947 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
8948
8949 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8950 function, is_info_ member.
8951 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8952 (Versions::Versions): Update caller.
8953 (Versions::define_base_version): Likewise.
8954 (Versions::add_def): Likewise.
8955
8956 2010-03-03 Sriraman Tallam <tmsriram@google.com>
8957
8958 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8959 (Scan::possible_function_pointer_reloc): New function.
8960 (Scan::local_reloc_may_be_function_pointer): Change to call
8961 possible_function_pointer_reloc.
8962 (Scan::global_reloc_may_be_function_pointer): Ditto.
8963 * icf.h (Icf::check_section_for_function_pointers): Change to reject
8964 relocations in ".data.rel.ro._ZTV" section.
8965 * testsuite/icf_safe_so_test.sh: Change to pass i386.
8966 * testsuite/icf_safe_so_test.cc: Ditto.
8967 * testsuite/icf_safe_test.cc: Ditto.
8968 * testsuite/icf_safe_test.sh: Ditto.
8969
8970 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8971 Ian Lance Taylor <iant@google.com>
8972
8973 * target-reloc.h (relocate_section): Check the symbol table index
8974 for -1U before setting the local symbol index.
8975 (scan_relocatable_relocs): If copying the relocation, record that
8976 the local symbol is required.
8977 * object.h (Symbol_value::is_output_symtab_index_set): New
8978 function.
8979 (Symbol_value::may_be_discarded_from_output_symtab): New
8980 function.
8981 (Symbol_value::has_output_symtab_entry): New function.
8982 (Symbol_value::needs_output_symtab_entry): Remove.
8983 (Symbol_value::output_symtab_index): Make sure the symbol index is
8984 set.
8985 (Symbol_value::set_output_symtab_index): Make sure the symbol
8986 index is not set. Make sure the new index is valid.
8987 (Symbol_value::set_must_have_output_symtab_entry): New function.
8988 (Symbol_value::has_output_dynsym_entry): New function.
8989 (Symbol_value::set_output_dynsym_index): Make sure the new index
8990 is valid.
8991 (Sized_relobj::set_must_have_output_symtab_entry): New function.
8992 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8993 local symbol if permitted.
8994 (Sized_relobj::do_finalize_local_symbols): Call
8995 is_output_symtab_index_set rather than needs_output_symtab_entry.
8996 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8997 rather than needs_output_symtab_entry. Call
8998 has_output_dynsym_entry rather than needs_output_dynsym_entry.
8999 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9000 is_output_symtab_index_set rather than needs_output_symtab_entry.
9001 * testsuite/discard_locals_relocatable_test.c: New file.
9002 * testsuite/discard_locals_test.sh: Test -r.
9003 * testsuite/Makefile.am (check_DATA): Add
9004 discard_locals_relocatable_test1.syms,
9005 discard_local_relocatable_test2.syms.
9006 (MOSTLYCLEANFILES): Likewise. Also add
9007 discard_locals_relocatable_test1.lout and
9008 discard_locals_relocatable_test2.out.
9009 (discard_locals_relocatable_test1.syms): New target.
9010 (discard_locals_relocatable_test.o): New target.
9011 (discard_locals_relocatable_test1.out): New target.
9012 (discard_locals_relocatable_test2.syms): New target.
9013 (discard_locals_relocatable_test2.out): New target.
9014 (various): Add missing ../ld-new dependencies.
9015 * testsuite/Makefile.in: Rebuild.
9016
9017 2010-03-03 Nick Clifton <nickc@redhat.com>
9018
9019 * po/fi.po: New Finnish translation.
9020
9021 2010-03-01 Doug Kwan <dougkwan@google.com>
9022
9023 * layout.cc (Layout::Layout): Force section types of .init_array*,
9024 .preinit_array* and .fini_array* sections.
9025 * output.cc (Output_section::Input_section_sort_entry::has_priority):
9026 Fix check of return value of std::string::find.().
9027 (Output_section::Input_section_sort_compare::operator()): Remove
9028 comment about .init_array.
9029 (Output_section::Input_section_sort_init_fini_compare::operator()):
9030 New method.
9031 (Output_section::sort_attached_input_sections): Handle .init_array
9032 and .fini_array specially.
9033 * output.h (Output_section::Inut_section_sort_compare): Update
9034 comment.
9035 (Output_section::Input_section_sort_init_fini_compare): New struct.
9036
9037 2010-02-26 Doug Kwan <dougkwan@google.com>
9038
9039 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9040 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9041 * testsuite/debug_msg.sh: Avoid matching source line number for
9042 use of global variable undef_int.
9043
9044 2010-02-26 Doug Kwan <dougkwan@google.com>
9045
9046 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9047 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9048 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9049 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9050 * options.cc (General_options::General_options): Initialize member
9051 fix_v4bx_.
9052 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9053 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9054 and rm_no_fix_v4bx.stdout
9055 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9056 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9057 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9058 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9059 and arm_no_fix_v4bx.
9060 * Makefile.in: Regenerate.
9061 * testsuite/arm_fix_v4bx.s: New file.
9062 * testsuite/arm_fix_v4bx.sh: Ditto.
9063
9064 2010-02-24 Doug Kwan <dougkwan@google.com>
9065
9066 * arm.cc (Target_arm::got_section): Make the .got section the first
9067 non RELRO section in the data segment.
9068 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9069 suffixes of section names.
9070
9071 2010-02-24 Doug Kwan <dougkwan@google.com>
9072
9073 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9074 flags and attributes merging if an input file is a binary file.
9075 * fileread.cc (Input_file::open): Record format of original file.
9076 * fileread.h (Input_file::Format): New enum type.
9077 (Input_file::Input_file): Initialize data member format_.
9078 (Input_file::format): New method definition.
9079 (Input_file::format_):: New data member.
9080
9081 2010-02-24 Doug Kwan <dougkwan@google.com>
9082
9083 * arm.cc (Arm_output_data_got): New class.
9084 (ARM_TCB_SIZE): New constant
9085 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9086 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9087 If user uses a script with a SECTIONS clause, issue only a warning
9088 for a misplaced EXIDX input section. Otherwise, issue an error.
9089 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9090 garbage collection.
9091 (Target_arm::got_mode_index_entry): Handle static linking.
9092 (Target_arm::Scan::local): Ditto.
9093 (Target_arm::Scan::global): Ditto.
9094 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
9095 all incorrectly implemented relocations.
9096 (Target_arm::fix_exidx_coverage): Pass layout to
9097 Arm_output_section::fix_exidx_coverage.
9098 * layout.cc (Layout::section_name_mapping): Remove trailing dots
9099 from ".ARM.exidx." and ".ARM.extab.".
9100
9101 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9102
9103 * arm.cc (Target_arm::do_finalize_sections): Create attribute
9104 section if it does not already exist.
9105 * attributes.cc (Attributes_section_data::Attributes_section_data):
9106 Don't crash if size is zero.
9107
9108 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9109 Ian Lance Taylor <iant@google.com>
9110
9111 * gold.cc (queue_middle_tasks): If no input files were opened,
9112 exit.
9113 * workqueue.h (Task_function::Task_function): Assert that there is
9114 a blocker.
9115
9116 2010-02-22 Doug Kwan <dougkwan@google.com>
9117
9118 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9119 * icf.cc (get_section_contents): Cast snprintf arguments to long long
9120 types to avoid warnings due to different uint64_t implementations
9121 on different hosts.
9122
9123 2010-02-21 Doug Kwan <dougkwan@google.com>
9124
9125 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9126 handling of the maximum backward branch offset.
9127 (Arm_relocate_functions::thumb_branch_common): Ditto.
9128 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9129 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9130 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9131 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9132 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9133 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9134 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9135 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9136 thumb_bl_out_of_range thumb_bl_out_of_range.o,
9137 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9138 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9139 thumb2_bl_out_of_range.o): New rules.
9140 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9141 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9142 thumb2_bl_out_of_range
9143 * testsuite/Makefile.in: Regenerate.
9144 * testsuite/arm_bl_in_range.s: New file.
9145 * testsuite/arm_bl_out_of_range.s: Ditto.
9146 * testsuite/arm_branch_in_range.sh: Ditto.
9147 * testsuite/arm_branch_range.t: Ditto.
9148 * testsuite/thumb2_branch_range.t: Ditto.
9149 * testsuite/thumb_bl_in_range.s: Ditto.
9150 * testsuite/thumb_bl_out_of_range.s: Ditto.
9151 * testsuite/thumb_branch_range.t: Ditto.
9152
9153 2010-02-20 Sriraman Tallam <tmsriram@google.com>
9154
9155 * gc.h (gc_process_relocs): Change vectors to point to the new list.
9156 Add reloc offset information.
9157 * icf.cc (get_section_contents): Change iterators to point to the new
9158 vectors. Add reloc offset information to the contents.
9159 * icf.h (Icf::Sections_reachable_info): New typedef.
9160 (Icf::Sections_reachable_list): New typedef.
9161 (Icf::Offset_info): New typedef.
9162 (Icf::Reloc_info): New struct typedef.
9163 (Icf::Reloc_info_list): New typedef.
9164 (Icf::symbol_reloc_list): Delete method.
9165 (Icf::addend_reloc_list): Delete method.
9166 (Icf::section_reloc_list): Delete method.
9167 (Icf::reloc_info_list): New method.
9168 (Icf::reloc_info_list_): New member.
9169
9170 2010-02-19 Doug Kwan <dougkwan@google.com>
9171
9172 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9173 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9174 * arm.cc (Arm_relocation_functions): New forward declaration.
9175 (Target_arm::Target_arm): Initialize new data members
9176 got_mod_index_offset_ and tls_base_symbol_defined_.
9177 (Target_arm::Relocate::relocate_tls): New method.
9178 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9179 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9180 New methods.
9181 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9182 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9183 (Target_arm::got_mod_index_offset_,
9184 Target_arm::tls_base_symbol_defined_): New data members.
9185 (Target_arm::Scan::local, Target::Scan::global,
9186 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9187 relocations.
9188
9189 2010-02-18 Doug Kwan <dougkwan@google.com>
9190
9191 * arm.cc (Arm_relobj::find_linked_text_section): New method.
9192 (Arm_relobj::make_exidx_input_section): Pass section index of linked
9193 text section as a parameter becuase some broken tools may not set
9194 the link in section header.
9195 (Target_arm::has_got_section): New method.
9196 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9197 without any mapping symbol as data only. Remove warning.
9198 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9199 link in its section header, try to discover the link by inspecting the
9200 REL31 relocation at the beginning of the section.
9201 (Target_arm::Scan::check_non_pic): Report name of offending relocation
9202 in error message.
9203 (Target_arm::Scan::global): Treat any reference to the symbol
9204 _GLOBAL_OFFSET_TABLE_ as a GOT access.
9205
9206 2010-02-12 Sriraman Tallam <tmsriram@google.com>
9207
9208 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9209 (Scan::global_reloc_may_be_function_pointer): New function.
9210 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9211 (Scan::global_reloc_may_be_function_pointer): New function.
9212 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9213 (Scan::global_reloc_may_be_function_pointer): New function.
9214 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9215 (Scan::global_reloc_may_be_function_pointer): New function.
9216 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9217 (Scan::global_reloc_may_be_function_pointer): New function.
9218 (Scan::possible_function_pointer_reloc): New function.
9219 (Target_x86_64::can_check_for_function_pointers): New function.
9220 * gc.h (gc_process_relocs): Scan relocation types to determine if
9221 function pointers were taken for targets that support it.
9222 * icf.cc (Icf::find_identical_sections): Include functions for
9223 folding in safe ICF whose pointer is not taken.
9224 * icf.h (Secn_fptr_taken_set): New typedef.
9225 (fptr_section_id_): New member.
9226 (section_has_function_pointers): New function.
9227 (set_section_has_function_pointers): New function.
9228 (check_section_for_function_pointers): New function.
9229 * options.h: Fix comment for safe ICF option.
9230 * target.h (can_check_for_function_pointers): New function.
9231 * testsuite/Makefile.am: Add icf_safe_so_test test case.
9232 Modify icf_safe_test for X86-64.
9233 * testsuite/Makefile.in: Regenerate.
9234 * testsuite/icf_safe_so_test.cc: New file.
9235 * testsuite/icf_safe_so_test.sh: New file.
9236 * testsuite/icf_safe_test.cc (kept_func_3): New function.
9237 (main): Change to take pointer to function kept_func_3.
9238 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9239 folding is done correctly for X86-64.
9240
9241 2010-02-12 David S. Miller <davem@davemloft.net>
9242
9243 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9244 is_symbolless parameter.
9245 (Output_reloc<SHT_REL>::is_symbolless): New.
9246 (Output_reloc<SHT_REL>::is_symbolless_): New.
9247 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9248 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9249 (Output_reloc<SHT_RELA>::is_symbolless): New.
9250 (Output_data_reloc::add_global): Handle is_symbolless.
9251 (Output_data_reloc::add_global_relative): Likewise.
9252 (Output_data_reloc::add_local): Likewise.
9253 (Output_data_reloc::add_local_relative): Likewise.
9254 (Output_data_reloc::add_symbolless_global_addend): New.
9255 (Output_data_reloc::add_symbolless_local_addend): New.
9256 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9257 is_symbolless.
9258 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9259 instead of ->is_relative_
9260 (Output_reloc::write): Likewise.
9261 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9262 (Output_reloc::write_rel): Simplify.
9263
9264 * sparc.cc (Target_sparc::Scan::local): Use
9265 ->add_symbolless_local_addend as needed.
9266 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9267 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
9268 based upon relocation offset.
9269
9270 2010-02-11 Doug Kwan <dougkwan@google.com>
9271
9272 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9273 (Target_arm::Scan::global): Ditto. Also remove a comment before the
9274 beginning of function.
9275 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9276 and MOVT_ABS relocations. Those are non issued in scanning. Fix
9277 parameter is_32bit in calls to should_apply_static_reloc.
9278 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9279 (check_DATA): Add arm_abs_global.stdout.
9280 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9281 arm_abs_global.stdout): New rules.
9282 (MOSTLLYCLEANFILES): Add arm_abs_global
9283 * Makefile.in: Regenerate.
9284 * testsuite/arm_abs_global.s: New file.
9285 * testsuite/arm_abs_global.sh: Ditto.
9286 * testsuite/arm_abs_lib.s: Ditto.
9287
9288 2010-02-11 Ian Lance Taylor <iant@google.com>
9289
9290 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9291 Read_relocs task.
9292 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
9293 Allocate_commons_task first.
9294 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9295 task, rather than symtab_lock_.
9296 (Gc_process_relocs::~Gc_process_relocs): New function.
9297 (Gc_process_relocs::is_runnable): Check this_blocker_.
9298 (Gc_process_relocs::locks): Use next_blocker_ rather than
9299 blocker_.
9300 (Scan_relocs::~Scan_relocs): New function.
9301 (Scan_relocs::is_runnable): Check this_blocker_ rather than
9302 symtab_lock_.
9303 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
9304 next_blocker_.
9305 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9306 fields. Add this_blocker_ and next_blocker_ fields. Adjust
9307 constructor accordingly.
9308 (class Gc_process_relocs): Likewise.
9309 (class Scan_relocs): Likewise.
9310 * common.h (class Allocate_commons_task): Remove symtab_lock_
9311 field, and corresponding constructor parameter.
9312 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9313 symtab_lock_.
9314 (Allocate_commons_task::locks): Likewise.
9315
9316 2010-02-11 Ian Lance Taylor <iant@google.com>
9317
9318 * gold-threads.h (class Once): Define.
9319 (class Initialize_lock): Rewrite as child of Once.
9320 * gold-threads.cc (class Once_initialize): Define.
9321 (once_pointer_control): New static variable.
9322 (once_pointer, once_arg): New static variables.
9323 (c_run_once): New static function.
9324 (Once::Once, Once::run_once, Once::internal_run): New functions.
9325 (class Initialize_lock_once): Remove.
9326 (initialize_lock_control): Remove.
9327 (initialize_lock_pointer): Remove.
9328 (initialize_lock_once): Remove.
9329 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9330 (Initialize_lock::initialize): Rewrite.
9331 (Initialize_lock::do_run_once): New function.
9332 * archive.cc (Archive::interpret_header): Only clear name if it is
9333 not already empty.
9334 * fileread.cc: Include "gold-threads.h"
9335 (file_counts_lock): New static variable.
9336 (file_counts_initialize_lock): Likewise.
9337 (File_read::release): Only increment counts when using --stats.
9338 Use a lock around the increment.
9339 * parameters.cc (class Set_parameters_target_once): Define.
9340 (set_parameters_target_once): New static variable.
9341 (Parameters::Parameters): Move here from parameters.h.
9342 (Parameters::set_target): Rewrite.
9343 (Parameters::set_target_once): New function.
9344 (Parameters::clear_target): Move here and rewrite.
9345 * parameters.h (class Parameters): Update declarations. Add
9346 set_parameters_target_once_ field.
9347 (Parameters::Parameters): Move to parameters.cc.
9348 (Parameters::clear_target): Likewise.
9349 * readsyms.cc (Read_symbols::do_group): Create a Start_group
9350 task.
9351 (Start_group::~Start_group): New function.
9352 (Start_group::is_runnable): New function.
9353 (Start_group::locks, Start_group::run): New functions.
9354 (Finish_group::run): Change saw_undefined to size_t.
9355 * readsyms.h (class Start_group): Define.
9356 (class Finish_group): Change saw_undefined_ field to size_t.
9357 (Finish_group::Finish_group): Remove saw_undefined and
9358 this_blocker parameters. Change all callers.
9359 (Finish_group::set_saw_undefined): New function.
9360 (Finish_group::set_blocker): New function.
9361 * symtab.h (class Symbol_table): Change saw_undefined to return
9362 size_t. Change saw_undefined_ field to size_t.
9363 * target-select.cc (Set_target_once::do_run_once): New function.
9364 (Target_selector::Target_selector): Initialize set_target_once_
9365 field. Don't initialize lock_ and initialize_lock_ fields.
9366 (Target_selector::instantiate_target): Rewrite.
9367 (Target_selector::set_target): New function.
9368 * target-select.h (class Set_target_once): Define.
9369 (class Target_selector): Update declarations. Make
9370 Set_target_once a friend. Remove lock_ and initialize_lock_
9371 fields. Add set_target_once_ field.
9372
9373 2010-02-10 Ian Lance Taylor <iant@google.com>
9374
9375 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9376 queueing any tasks.
9377 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
9378 (queue_middle_tasks): Add all blockers before queueing any tasks.
9379 (queue_final_tasks): Likewise.
9380 * token.h (Task_token::add_blockers): New function.
9381 * object.h (Input_objects::number_of_relobjs): New function.
9382
9383 2010-02-10 Ian Lance Taylor <iant@google.com>
9384
9385 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9386 shared, not if not position independent.
9387 * x86_64.cc (Relocate::relocate_tls): Likewise.
9388 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9389 (tls_pie_pic_test): New target.
9390 * testsuite/Makefile.in: Rebuild.
9391
9392 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9393 (tls_test_main_pie.o, tls_test_pie.o): New targets.
9394 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9395 * testsuite/Makefile.in: Rebuild.
9396
9397 2010-02-09 David S. Miller <davem@davemloft.net>
9398
9399 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9400 R_SPARC_RELATIVE using ->add_local_relative().
9401 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9402
9403 * output.h (Output_data_dynamic::add_section_size): New method
9404 that takes two Output_data objects.
9405 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9406 entry param. Handle it in initializers.
9407 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9408 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9409 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9410 arg.
9411 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9412 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9413 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9414 for dynrel_includes_plt.
9415 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9416 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9417 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9418 before .rela.plt
9419 (Target_sparc::do_finalize_sections): Update to pass true for
9420 dynrel_includes_plt.
9421 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9422 output before .rela.plt
9423 (Target_powerpc::do_finalize_sections): Update to pass true for
9424 dynrel_includes_plt when 32-bit.
9425
9426 2010-02-08 Doug Kwan <dougkwan@google.com>
9427
9428 * arm.cc (Arm_relobj::simple_input_section_output_address): New
9429 method.
9430 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9431 Arm_relobj::scan_section_for_cortex_a8_stubs,
9432 Arm_relobj::do_relocation_section): Instead of calling
9433 Output_section::output_address, use faster
9434 Arm_relobj::simple_input_section_output_address.
9435
9436 2010-02-08 David S. Miller <davem@davemloft.net>
9437
9438 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9439 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9440 relocation helper function.
9441
9442 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9443 just like R_SPARC_GOT{10,13,22}.
9444 (Target_sparc::Scan::local): Likewise.
9445 (Target_sparc::Relocate:relocate): Likewise.
9446
9447 2010-02-06 Ian Lance Taylor <iant@google.com>
9448
9449 * configure.ac: Rewrite targetobjs duplicate removal code to use
9450 only shell constructs.
9451 * configure: Rebuild.
9452
9453 2010-02-05 Doug Kwan <dougkwan@google.com>
9454
9455 PR 11247
9456 * arm.cc (Arm_relobj::section_is_scannable): New method.
9457 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9458 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9459
9460 2010-02-04 Doug Kwan <dougkwan@google.com>
9461
9462 PR 11247
9463 * arm-reloc-property.cc (cstdio): Include.
9464 * configure.ac (targetobjs): Remove duplicates.
9465 * configure: Regenerate.
9466 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9467 big and little endian version for a given address size.
9468
9469 2010-02-03 Doug Kwan <dougkwan@google.com>
9470
9471 * arm-reloc-property.cc
9472 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9473 definition.
9474 * arm-reloc-property.h
9475 (Arm_reloc_property_table::get_implemented_static_reloc_property):
9476 New method definition.
9477 (Arm_reloc_property_table::reloc_name_in_error_message): New method
9478 declaration.
9479 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9480 overflow to N.
9481 (GOT_PREL): Change implemented to Y.
9482 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9483 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9484 (Arm_relocate_functions::movw_abs_nc): Remove method.
9485 (Arm_relocate_functions::movt_abs): Ditto.
9486 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9487 (Arm_relocate_functions::thm_movt_abs): Ditto.
9488 (Arm_relocate_functions::movw_rel_nc): Ditto.
9489 (Arm_relocate_functions::movw_rel): Ditto.
9490 (Arm_relocate_functions::movt_rel): Ditto.
9491 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9492 (Arm_relocate_functions:thm_movw_rel): Ditto.
9493 (Arm_relocate_functions:thm_movt_rel): Ditto.
9494 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9495 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9496 New method definitions.
9497 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9498 (Arm_relocation_functions::arm_grp_ldr): Ditto.
9499 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9500 (Arm_relocation_functions::arm_grp_ldc): Ditto.
9501 (Target_arm::Relocate::relocate): Check for non-static or
9502 unimplemented relocation code and exit early. Change calls to
9503 Target_arm::reloc_uses_thumb_bit and
9504 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9505 instead. Refactor code to handle similar relocations to increase
9506 code sharing. Remove check for unsupported relocation code in switch
9507 statement.
9508 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9509 relocation property table to find out size. Change error message to
9510 print out the name of a relocation code instead of the numeric value.
9511 (Target_arm::scan_reloc_for_stub): Use relocation property table
9512 instead of calling Target_arm::reloc_uses_thumb_bit().
9513
9514 2010-02-02 Doug Kwan <dougkwan@google.com>
9515
9516 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9517 types of relaxed input section.
9518
9519 2010-02-02 Doug Kwan <dougkwan@google.com>
9520
9521 * Makefile.am (HFILES): Add arm-reloc-property.h.
9522 (DEFFILES): New.
9523 (TARGETSOURCES): Add arm-reloc-property.cc
9524 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9525 (libgold_a_SOURCES): $(DEFFILES)
9526 * Makefile.in: Regenerate.
9527 * arm-reloc-property.cc: New file.
9528 * arm-reloc-property.h: New file.
9529 * arm-reloc.def: New file.
9530 * arm.cc: Update comments.
9531 (arm-reloc-property.h): New included header.
9532 (arm_reloc_property_table): New global variable.
9533 (Target_arm::do_select_as_default_target): New method definition.
9534 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9535 arm-reloc-property to targ_extra_obj.
9536 * parameters.cc (set_parameters_target): Call
9537 Target::select_as_default_target().
9538 * target.h (Target::select_as_default_target): New method definition.
9539 (Target::do_select_as_default_target): Same.
9540
9541 2010-02-01 Doug Kwan <dougkwan@google.com>
9542
9543 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9544 first_output_text_section_.
9545 (Arm_exidx_fixup::first_output_text_section): New method definition.
9546 (Arm_exidx_fixup::first_output_text_section_): New data member.
9547 (Arm_exidx_fixup::process_exidx_section): Record the first text
9548 output section seen.
9549 (Arm_output_section::fix_exidx_coverage): Set correct linked section
9550 and entsize in output section header.
9551
9552 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9553
9554 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9555 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9556 (Arm_relocate_functions::thm_alu11): New Method.
9557 (Arm_relocate_functions::thm_pc8): New Method.
9558 (Arm_relocate_functions::thm_pc12): New Method.
9559 (Target_arm::Scan::local): Handle the relocations.
9560 (Target_arm::Scan::global): Likewise.
9561 (Target_arm::Relocate::relocate): Likewise.
9562 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9563
9564 2010-01-29 Doug Kwan <dougkwan@google.com>
9565
9566 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9567 of relocation types as ld.
9568
9569 2010-01-29 Doug Kwan <dougkwan@google.com>
9570
9571 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9572 to public.
9573 (Arm_relocate_functions::thumb_branch_common): Ditto.
9574 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9575 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9576 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9577 Arm_relocate_functions::jump24): Remove.
9578 (Target_arm::Relocate::relocate): Adjust code to call
9579 Arm_relocation_functions::arm_branch_common and
9580 Arm_relocation_functions::thumb_branch_common instead of their removed
9581 wrappers. Merge switch-cases together to reduce source code size.
9582
9583 2010-01-29 Doug Kwan <dougkwan@google.com>
9584
9585 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9586 output_local_symbol_count_needs_update_.
9587 (Arm_relobj::output_local_symbol_count_needs_update,
9588 Arm_relobj::set_output_local_symbol_count_needs_update,
9589 Arm_relobj::update_output_local_symbol_count): New methods.
9590 (Arm_relobj::output_local_symbol_count_needs_update_): New data
9591 member.
9592 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9593 of pointed function as in a R_ARM_PREL31 relocation.
9594 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9595 for output local symbol count updating.
9596 (Target_arm::do_relax): Update output local symbol counts in objects
9597 if necessary.
9598 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9599
9600 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9601
9602 * arm.cc: Added support for the ARM relocations:
9603 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9604 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9605 (Arm_relocate_functions::movw_rel_nc): Renamed (was
9606 movw_prel_nc).
9607 (Arm_relocate_functions::movw_rel): New method.
9608 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9609 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9610 thm_movw_prel_nc).
9611 (Arm_relocate_functions::thm_movw_rel): New method.
9612 (Arm_relocate_functions::thm_movt_rel): Renamed (was
9613 thm_movt_prel).
9614 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9615 relocations.
9616 (Target_arm::Scan::global): Likewise.
9617 (Target_arm::Relocate::relocate): Likewise.
9618 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9619 Likewise.
9620
9621 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9622
9623 * arm.cc: Added support for ARM group relocations.
9624 (Target_arm::reloc_needs_sym_origin): New method.
9625 (Arm_relocate_functions::calc_grp_kn): New method.
9626 (Arm_relocate_functions::calc_grp_residual): New method.
9627 (Arm_relocate_functions::calc_grp_gn): New method.
9628 (Arm_relocate_functions::arm_grp_alu): New Method.
9629 (Arm_relocate_functions::arm_grp_ldr): New Method.
9630 (Arm_relocate_functions::arm_grp_ldrs): New Method.
9631 (Arm_relocate_functions::arm_grp_ldc): New Method.
9632 (Target_arm::Scan::local): Handle the ARM group relocations.
9633 (Target_arm::Scan::global): Likewise.
9634 (Target_arm::Relocate::relocate): Likewise.
9635 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9636 Likewise.
9637
9638 2010-01-26 Doug Kwan <dougkwan@google.com>
9639
9640 * arm.cc (set): Include.
9641 (class Arm_exidx_fixup): Change type of last_input_section_ to const
9642 pointer type.
9643 (Arm_output_section::Text_section_list): New type.
9644 (Arm_output_section::append_text_sections_to_list): New method.
9645 (Arm_output_section::fix_exidx_coverage): Ditto.
9646 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9647 (Arm_relobj::convert_input_section_to_relaxed_section): Use
9648 Relobj::set_section_offset() instead of
9649 Sized_relobj::invalidate_section_offset().
9650 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9651 parameter for section headers. Ignore relocation sections for
9652 unallocated sections and EXIDX sections.
9653 (Target_arm::fix_exidx_coverage): New method.
9654 (Target_arm::output_section_address_less_than): New type.
9655 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9656 linked text section instead of the EXIDX section.
9657 (Arm_output_section::create_stub_group): Add an assertion to check
9658 that this is not an EXIDX output section.
9659 (Arm_output_section::append_text_sections_to_list): New method.
9660 (Arm_output_section::fix_exidx_coverage): Ditto.
9661 (Arm_relobj::scan_sections_for_stubs): Adjust call to
9662 Arm_relobj::section_needs_reloc_stub_scanning.
9663 (Target_arm::do_relax): Fix EXIDX output section coverage in the
9664 first pass.
9665 (Target_arm::fix_exidx_coverage): New method.
9666 * object.h (Relobj::set_output_section): New method.
9667 (Sized_relobj::invalidate_section_offset): Remove method.
9668 (Sized_relobj::do_invalidate_section_offset): Remove method.
9669 (Sized_relobj::do_set_section_offset): Handle offset value -1.
9670
9671 2010-01-25 Doug Kwan <dougkwan@google.com>
9672
9673 * arm.cc (Arm_exidx_merged_section::do_output_offset):
9674 Fix warning due to signed and unsigned comparison on a 32-bit host.
9675
9676 2010-01-22 Doug Kwan <dougkwan@google.com>
9677
9678 * arm.cc (Target_arm::do_relax): Record an output section for section
9679 offset adjustment it contains any stub table that has changed.
9680 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9681 offsets in an output section if necessary.
9682 * output.cc (Output_section::Output_section): Initialize
9683 section_offsets_need_adjustments_.
9684 (Output_section::add_input_section_for_script): Renamed to
9685 Output_section::add_simple_input_section.
9686 (Output_section::save_states): Add a comment.
9687 (Output_section::discard_states): New method defintion.
9688 (Output_section::adjust_section_offsets): Same.
9689 * output.h (Output_section::add_input_section_for_script): Renamed to
9690 Output_section::add_simple_input_section.
9691 (Output_section::discard_states): New method declaration.
9692 (Output_section::adjust_section_offsets): Same.
9693 (Output_section::section_offsets_need_adjustment,
9694 Output_section::set_section_offsets_need_adjustment): New method
9695 definitions.
9696 (Output_section::section_offsets_need_adjustment_): New data member.
9697 * script-sections.cc
9698 (Output_section_element_input::set_section_address): Adjust code for
9699 renaming of Output_section::add_input_section_for_script.
9700 (Orphan_output_section::set_section_address): Same.
9701
9702 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9703
9704 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9705 Fix_v4bx enum values .
9706 * gold/options.h (General_options): New option definitions.
9707 (General_options::fix_v4bx): New method.
9708 (General_options::Fix_v4bx): New enum.
9709 * gold/options.cc (General_options::parse_fix_v4bx): New method.
9710 (General_options::parse_fix_v4bx_interworking): New method.
9711
9712 2010-01-22 Doug Kwan <dougkwan@google.com>
9713
9714 * arm.cc (Arm_exidx_fixup): New class.
9715
9716 2010-01-21 Doug Kwan <dougkwan@google.com>
9717
9718 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9719 classes.
9720 (Arm_exidx_section_offset_map): New type.
9721
9722 2010-01-21 Doug Kwan <dougkwan@google.com>
9723
9724 * arm.cc (Arm_exidx_input_section): New class.
9725 (Arm_relobj::exidx_input_section_by_link,
9726 Arm_relobj::exidx_input_section_by_shndx,
9727 Arm_relobj::make_exidx_input_section): New methods.
9728 (read_arm_attributes_section): Remove.
9729 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9730 information about them.
9731 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9732 to here.
9733
9734 2010-01-20 Doug Kwan <dougkwan@google.com>
9735
9736 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9737 Input_section_specifier to Section_id.
9738 (Target_arm::new_arm_input_section: Adjust code for change of key
9739 type.
9740 (Target_arm::find_arm_input_section): Ditto.
9741 * gc.h (object.h): Include for Section_id nand Section_id_hash.
9742 (Section_id): Remove.
9743 (Garbage_collection::Section_id_hash): Remove.
9744 * icf.h (object.h): Include for Section_id nand Section_id_hash.
9745 (Section_id): Remove.
9746 (Icf::Section_id_hash): Remove.
9747 * object.h (Section_id, Const_section_id, Section_id_hash,
9748 Const_section_id_hash): New type definitions.
9749 * output.cc (Output_section::add_relaxed_input_section): Change to
9750 use Const_section_id instead of Input_section_specifier as key type.
9751 (Output_section::add_merge_input_section): Ditto.
9752 (Output_section::build_relaxation_map): Change to use Section_id
9753 instead of Input_section_specifier as key type.
9754 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9755 Ditto.
9756 (Output_section::convert_input_sections_to_relaxed_sections): Change
9757 to use Const_section_id instead of Input_section_specifier as key type.
9758 (Output_section::find_merge_section): Ditto.
9759 (Output_section::find_relaxed_input_section): Ditto.
9760 * output.h (Input_section_specifier): Remove class.
9761 (Output_section::Output_section_data_by_input_section_map): Change
9762 key type to Const_section_id.
9763 (Output_section::Output_relaxed_input_section_by_input_section_map):
9764 Ditto.
9765 (Output_section::Relaxation_map): Change key type to Section_id.
9766
9767 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9768
9769 * gold/arm.cc: Added support for R_ARM_V4BX relocation
9770 (class Arm_v4bx_stub): New class.
9771 (DEF_STUBS): Updated definition to support v4_veneer_bx.
9772 (Stub_factory::make_arm_v4bx_stub): New method.
9773 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9774 (Stub_table::empty): Handle v4bx stubs.
9775 (Stub_table::add_arm_v4bx_stub): New method.
9776 (Stub_table::find_arm_v4bx_stub): New method.
9777 (Arm_relocate_functions::v4bx): New method.
9778 (Target_arm::fix_v4bx): New method.
9779 (Target_arm::Target_arm): Handle R_ARM_V4BX.
9780 (Stub_table::relocate_stubs): Likewise.
9781 (Stub_table::do_write): Likewise.
9782 (Stub_table::update_data_size_and_addralign): Likewise.
9783 (Stub_table::finalize_stubs): Likewise.
9784 (Target_arm::Scan::local): Likewise.
9785 (Target_arm::Scan::global): Likewise.
9786 (Target_arm::do_finalize_sections): Likewise.
9787 (Target_arm::Relocate::relocate): Likewise.
9788 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9789 Likewise.
9790 (Target_arm::scan_reloc_for_stub): Likewise.
9791 (Target_arm::scan_reloc_section_for_stubs): Likewise.
9792
9793 2010-01-19 Ian Lance Taylor <iant@google.com>
9794
9795 * output.cc (Output_section_headers::do_sized_write): Write large
9796 segment count to sh_info field.
9797 (Output_file_header::do_sized_write): For large segment count,
9798 write PN_XNUM to e_phnum field.
9799
9800 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9801
9802 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9803 (Arm_relocate_functions::thm_jump8): New function.
9804 (Arm_relocate_functions::thm_jump11): New function.
9805 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9806 R_ARM_THM_JUMP11.
9807 (Target_arm::Scan::global): Likewise.
9808 (Target_arm::Relocate::relocate): Likewise.
9809 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9810 Likewise.
9811
9812 2010-01-14 Doug Kwan <dougkwan@google.com>
9813
9814 * arm.cc (map, utility): Include headers.
9815 (Target_arm::apply_cortex_a8_workaround): New method.
9816 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9817 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9818 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9819 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9820 the --[no-]fix-cortex-a8 command line options.
9821 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9822 (Target_arm::relocate_stub): Use addend in instruction template.
9823 * options.h (DEFINE_bool): Set the user-set flag.
9824 (General_options): Add --[no-]-fix-cortex options.
9825 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9826 : Update fast look-up map after conversion.
9827
9828 2010-01-14 Sriraman Tallam <tmsriram@google.com>
9829
9830 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9831 in the first pass of do_layout.
9832
9833 2010-01-13 Doug Kwan <dougkwan@google.com>
9834
9835 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9836 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9837 apparent compiler problem of not folding static constant integral
9838 data members of elfcpp::Elf_sizes<32>.
9839
9840 2010-01-13 Doug Kwan <dougkwan@google.com>
9841
9842 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9843 Arm_relobj::section_needs_cortex_a8_stub_scanning,
9844 Arm_relobj::scan_section_for_cortex_a8_erratum,
9845 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9846 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9847 sections to scan for relocation stubs into a new method
9848 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
9849 relocation and Cortex-A8 stub scanning.
9850 (Target_arm::do_relax): Force stubs to be after stubbed sections
9851 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
9852 the beginning of a new relaxation pass. Update a comment.
9853 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9854
9855 2010-01-12 Ian Lance Taylor <iant@google.com>
9856
9857 * target-reloc.h (visibility_error): New inline function.
9858 (relocate_section): Call visibility_error.
9859 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9860 (MOSTLYCLEANFILES): Likewise.
9861 (protected_4_pic.o, protected_3.err): New targets.
9862 * testsuite/protected_4.cc: New file.
9863
9864 2010-01-12 Doug Kwan <dougkwan@google.com>
9865
9866 * arm.cc (Cortex_a8_reloc): New class.
9867 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9868 and cortex_a8_relocs_info_.
9869 (Target_arm::fix_cortex_a8): New method definition.
9870 (Target_arm::Cortex_a8_relocs_info): New type.
9871 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9872 New data member declarations.
9873 (Target_arm::scan_reloc_for_stub): Record information about
9874 relocations for THUMB branches that might be exempted from the
9875 Cortex-A8 workaround.
9876 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9877 at the beginning of a relaxation pass.
9878
9879 2010-01-12 Doug Kwan <dougkwan@google.com>
9880
9881 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9882 (Arm_relobj::Mapping_symbol_position,
9883 Arm_reloj::Mapping_symbol_position_less,
9884 Arm_relobj::Mapping_symbols_info): New types.
9885 (Target_arm::is_mapping_symbol_name): New method definition.
9886 (Arm_relobj::do_count_local_symbols): Save information about mapping
9887 symbols.
9888
9889 2010-01-11 Doug Kwan <dougkwan@google.com>
9890
9891 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9892 Arm_relocate_functions::thumb32_branch_upper,
9893 Arm_relocate_functions::thumb32_branch_lower,
9894 Arm_relocate_functions::thumb32_cond_branch_offset,
9895 Arm_relocate_functions::thumb32_cond_branch_upper,
9896 Arm_relocate_functions::thumb32_cond_branch_lower,
9897 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9898 branch offset encoding.
9899 (Arm_relocate_functions::thumb_branch_common): Use new branch
9900 offset encoding methods to avoid code duplication.
9901 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9902 (Stub_addend_reader::operator()): Use new branch encoding method
9903 to avoid code duplication.
9904
9905 2010-01-11 Doug Kwan <dougkwan@google.com>
9906
9907 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9908 (Target_arm::do_finalize_sections): Define special EXIDX section
9909 symbols only if referenced.
9910 * gc.h (Garbage_collection::add_reference): New method.
9911 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9912 code duplication.
9913
9914 2010-01-11 Ian Lance Taylor <iant@google.com>
9915
9916 * script.cc (Version_script_info::build_expression_list_lookup):
9917 Change complaing about duplicate wildcard match from error to
9918 warning.
9919
9920 * script.cc (class Lazy_demangler): Recreate--revert part of patch
9921 of 2009-12-30.
9922 (Version_script_info::Version_script_info): Initialize globs_,
9923 default_version_, default_is_global_, and exact_. Don't
9924 initialize globals_ or locals_.
9925 (Version_script_info::build_lookup_tables): Build local symbols
9926 first.
9927 (Version_script_info::unquote): New function.
9928 (Version_script_info::add_exact_match): New function.
9929 (Version_script_info::build_expression_list_lookup): Remove lookup
9930 parameter. Add is_global parameter. Change all callers. Handle
9931 wildcard pattern specially. Unquote pattern. Call
9932 add_exact_match.
9933 (Version_script_info::get_name_to_match): New function.
9934 (Version_script_info::get_symbol_version): New function.
9935 (Version_script_info::get_symbol_version_helper): Remove.
9936 (Version_script_info::check_unmatched_names): Call unquote.
9937 * script.h (class Version_script_info): Change get_symbol_version
9938 to be non-inline and add is_global parameter; change all callers.
9939 Rewrite symbol_is_local. Update declarations. Define struct
9940 Version_tree_match, Exact, Globs. Don't define struct Lookup.
9941 Remove globals_ and locals_ members. Add exact_, globs_,
9942 default_version_, is_global_.
9943 (Version_script_info::Glob): Remove pattern, add expression and
9944 is_global. Update constructor. Change all callers.
9945 * dynobj.cc (Versions::finalize): Mark the version symbol as the
9946 default version.
9947 (Versions::symbol_section_contents): If a symbol is undefined, or
9948 defined in a dynamic object, set the version index to
9949 VER_NDX_LOCAL.
9950 * symtab.cc (Symbol_table::add_from_relobj): Don't call
9951 symbol_is_local.
9952 (Symbol_table::add_from_pluginobj): Likewise.
9953 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9954
9955 2010-01-11 Doug Kwan <dougkwan@google.com>
9956
9957 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9958 (incremental_dump_LDADD): Add linking option for libintl.
9959 * Makefile.in: Regenerate.
9960
9961 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
9962
9963 PR gold/11144
9964 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9965 instead of -Ds.
9966 * testsuite/Makefile.in: Regenerated.
9967
9968 2010-01-10 Doug Kwan <dougkwan@google.com>
9969
9970 * options.h (DEFINE_var): Use parentheses around argument varname__
9971 in macro body to avoid any unintended subsequent substitutions.
9972
9973 2010-01-10 Ian Lance Taylor <iant@google.com>
9974
9975 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9976 candidates before doing symbol resolution.
9977
9978 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9979 ODR candidates if only one is weak.
9980
9981 2010-01-08 Ian Lance Taylor <iant@google.com>
9982
9983 * script.cc (Version_script_info::build_expression_list_lookup):
9984 Don't warn about ambiguous version, just record the ambiguity.
9985 (Version_script_info::get_symbol_version_helper): Give error if
9986 version is ambiguous.
9987
9988 2010-01-08 Doug Kwan <dougkwan@google.com>
9989
9990 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9991 prev_data_size_ and prev_addralign_. Remove initializer for
9992 deleted data member has_been_changed_.
9993 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9994 to determine if the table is empty.
9995 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9996 Remove.
9997 (Stub_table::add_reloc_stub): Define method in class definition
9998 instead of just declaring it there.
9999 (Stub_table::add_cortex_a8_stub): New method definition.
10000 (Stub_table::update_data_size_and_addralign): Ditto.
10001 (Stub_table::finalize_stubs): Ditto.
10002 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10003 (Stub_table::do_addralign_): Return address alignment in the
10004 (Stub_table::do_reset_address_and_file_offset): Define method in
10005 class definition instead of declaring it there. Set current data
10006 size to be the data size of the previous pass.
10007 (Stub_table::set_final_data_size): Use current data size as the
10008 final data size.
10009 (Stub_table::relocate_stub): Change parameter type of stub from
10010 Reloc_stub pointer to Stub pointer.
10011 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10012 (Stub_table::Cortex_a8_stub_list): New typedef.
10013 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10014 Stub_table::prev_addralign_): New data member.
10015 (Arm_relobj::Arm_relobj): Initialize data member
10016 section_has_cortex_a8_workaround_.
10017 (Arm_relobj::section_has_cortex_a8_workaround,
10018 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10019 definitions.
10020 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10021 declarations.
10022 (Target_arm::relocate_stub): Change parameter type of stub from
10023 Reloc_stub pointer to Stub pointer.
10024 (Insn_template::size, Insn_template::alignment): Handle
10025 THUMB16_SPECIAL_TYPE.
10026 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10027 Stub_table::update_data_size_and_addralign,
10028 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10029 definitions.
10030 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10031 (Stub_table::do_write): Ditto.
10032 (Target_arm::do_relax): Adjust code for changes in Stub_table.
10033
10034 2010-01-08 Ian Lance Taylor <iant@google.com>
10035
10036 PR 11108
10037 * symtab.h (class Symbol): Remove fields is_target_special_ and
10038 has_plt_offset_. Add field is_defined_in_discarded_section_.
10039 (Symbol::is_defined_in_discarded_section): New function.
10040 (Symbol::set_is_defined_in_discarded_section): New function.
10041 (Symbol::has_plt_offset): Rewrite.
10042 (Symbol::set_plt_offset): Verify that new offset is not -1U.
10043 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10044 Don't initialize is_target_special_ or has_plt_offset_.
10045 Initialize is_defined_in_discarded_section_.
10046 (Symbol_table::add_from_relobj): If appropriate, set
10047 is_defined_in_discarded_section.
10048 * resolve.cc (Symbol::override_base_with_special): Don't test
10049 is_target_special_. Change has_plt_offset_ to has_plt_offset().
10050 * target-reloc.h (relocate_section): Do special handling for
10051 symbols defined in discarded sections for global symbols as well
10052 as local symbols.
10053
10054 2010-01-08 Ian Lance Taylor <iant@google.com>
10055
10056 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10057 the SHT_SYMTAB case.
10058
10059 2010-01-08 Ian Lance Taylor <iant@google.com>
10060
10061 * object.cc (Sized_relobj::do_layout): Don't get confused if
10062 layout_eh_frame returns NULL.
10063
10064 2010-01-08 Ian Lance Taylor <iant@google.com>
10065
10066 PR 11084
10067 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10068 dynamic symbol table, use the normal symbol table.
10069 (Sized_dynobj::do_read_symbols): Remove assertion about type of
10070 symbol table.
10071
10072 2010-01-08 Ian Lance Taylor <iant@google.com>
10073
10074 PR 11072
10075 * layout.cc (Layout::include_section): Remove .gnu_debuglink
10076 sections.
10077
10078 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
10079
10080 * version.cc (print_version): Change to "Copyright 2010".
10081
10082 2010-01-08 Ian Lance Taylor <iant@google.com>
10083
10084 PR 10287
10085 PR 11063
10086 * i386.cc (class Target_i386): Change return type of plt_section
10087 to be non-const.
10088 (class Output_data_plt_i386): Add tls_desc_rel_ field.
10089 (Output_data_plt_i386::Output_data_plt_i386): Initialize
10090 tls_desc_rel_ field.
10091 (Output_data_plt_i386::rel_tls_desc): New function.
10092 (Target_i386::rel_tls_desc_section): New function.
10093 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10094 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10095 R_386_TLS_DESC reloc in rel_tls_desc_section.
10096 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10097 Define struct Tlsdesc_info.
10098 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10099 (Target_x86_64::do_reloc_symbol_index): New function.
10100 (Target_x86_64::add_tlsdesc_info): New function.
10101 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10102 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10103 tlsdesc_rel_ field.
10104 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
10105 all callers.
10106 (Output_data_plt_x86_64::rela_tlsdesc): New function.
10107 (Target_x86_64::rela_tlsdesc_section): New function.
10108 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10109 handling.
10110 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10111 (Target_x86_64::do_reloc_addend): New function.
10112 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10113 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10114 declarations. Define TARGET_CODE. Add arg field to u1_ union.
10115 (Output_reloc::type): New function.
10116 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10117 (Output_reloc::is_target_specific): New function.
10118 (Output_reloc::target_arg): New function.
10119 (class Output_reloc) [SHT_RELA]: Add four new constructors for
10120 absolute relocs and target specific relocs.
10121 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10122 add_target_specific.
10123 (class Output_data_reloc) [SHT_RELA]: Likewise.
10124 * output.cc (Output_reloc::Output_reloc): Add four new versions
10125 for absolute relocs and target specific relocs.
10126 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10127 (Output_reloc::get_symbol_index): Likewise.
10128 (Output_reloc::local_section_offset): Check that local_sym_index_
10129 is not TARGET_CODE or 0.
10130 (Output_reloc::symbol_value): Likewise.
10131 (Output_reloc::write) [SHT_RELA]: Call target for target specific
10132 reloc.
10133 * target.h (class Target): Add reloc_symbol_index and reloc_addend
10134 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
10135 functions.
10136 * layout.cc (add_target_dynamic_tags): Use output section for
10137 DT_PLTRELSZ and DT_JMPREL.
10138
10139 2010-01-07 Ian Lance Taylor <iant@google.com>
10140
10141 PR 11061
10142 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10143 function.
10144 (class Output_data_reloc_generic): Define.
10145 (class Output_data_reloc_base): Change base class to
10146 Output_data_reloc_generic. Change add() method to call
10147 bump_relative_reloc_count for a relative reloc. Remove
10148 sort_relocs_ field.
10149 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10150 to sort_relocs().
10151 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10152 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
10153 appropriate.
10154 * layout.h (class Layout): Update declaration.
10155
10156 2010-01-07 Ian Lance Taylor <iant@google.com>
10157
10158 * output.h (class Output_data): Add const version of
10159 output_section and do_output_section.
10160 (class Output_section_data): Add const version of
10161 do_output_section.
10162 (class Output_section): Likewise.
10163 * layout.cc (Layout::add_target_dynamic_tags): New function.
10164 * layout.h (class Layout): Update declarations.
10165 * arm.cc (Target_arm::do_finalize_sections): Use
10166 add_target_dynamic_tags.
10167 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10168 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10169 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10170 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10171
10172 2010-01-07 Ian Lance Taylor <iant@google.com>
10173
10174 PR 11042
10175 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10176 object as needed.
10177
10178 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
10179 Ian Lance Taylor <iant@google.com>
10180
10181 PR 11019
10182 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10183 Xindex::read_symtab_xindex.
10184
10185 2010-01-07 Doug Kwan <dougkwan@google.com>
10186
10187 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10188 (Insn_template::thumb16_bcond_insn): New method declaration.
10189 (Insn_template): Fix spelling.
10190 (Stub::thumb16_special): New method declaration.
10191 (Stub::do_write): Define virtual method which was previously pure
10192 virtual.
10193 (Stub::do_thumb16_special): New method declaration.
10194 (Stub::do_fixed_endian_write): New template member.
10195 (Reloc_stub::do_write): Remove.
10196 (Reloc_stub::do_fixed_endian_write): Remove.
10197 (Cortex_a8_stub): New class definition.
10198 (Stub_factory::make_cortex_a8_stub): New method definition.
10199 (Stub_factory::Stub_factory): Add missing static storage class
10200 qualifier for elf32_arm_stub_a8_veneer_blx.
10201
10202 2010-01-07 Ian Lance Taylor <iant@google.com>
10203
10204 PR 10980
10205 * options.h (class General_options): Add --warn-unresolved-symbols
10206 and --error-unresolved-symbols.
10207 * errors.cc (Errors::undefined_symbol): Implement
10208 --warn-unresolved-symbols.
10209
10210 * options.h (class General_options): Add -z text and -z textoff.
10211 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10212
10213 2010-01-06 Sriraman Tallam <tmsriram@google.com>
10214
10215 * gc.h (Garbage_collection::Cident_section_map): New typedef.
10216 (Garbage_collection::cident_sections): New function.
10217 (Garbage_collection::add_cident_section): New function.
10218 (Garbage_collection::cident_sections_): New member.
10219 (gc_process_relocs): Add references to sections whose names are C
10220 identifiers.
10221 * gold.h (cident_section_start_prefix): New constant.
10222 (cident_section_stop_prefix): New constant.
10223 (is_cident): New function.
10224 * layout.cc (Layout::define_section_symbols): Replace string constants
10225 with the newly defined constants.
10226 * object.cc (Sized_relobj::do_layout): Track sections whose names are
10227 C identifiers.
10228 * testsuite/Makefile.am: Add gc_orphan_section_test.
10229 * testsuite/Makefile.in: Regenerate.
10230 * testsuite/gc_orphan_section_test.cc: New file.
10231 * testsuite/gc_orphan_section_test.sh: New file.
10232
10233 2010-01-06 Ian Lance Taylor <iant@google.com>
10234
10235 PR 10980
10236 * options.h (class General_options): Add --warn-shared-textrel.
10237 * layout.cc (Layout::finish_dynamic_section): Implement
10238 --warn-shared-textrel.
10239
10240 PR 10980
10241 * options.h (class General_options): Add --warn-multiple-gp.
10242
10243 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10244
10245 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10246 $(THREADSLIB) and $(LIBDL).
10247 * Makefile.in: Rebuild.
10248
10249 2010-01-06 Ian Lance Taylor <iant@google.com>
10250
10251 PR 10980
10252 * options.cc (General_options::parse_section_start): New function.
10253 (General_options::section_start): New function.
10254 (General_options::General_options): Initialize all members.
10255 * options.h: Include <map>
10256 (class General_options): Add --section-start. Add section_starts_
10257 member.
10258 * layout.cc (Layout::attach_allocated_section_to_segment): If
10259 --section-start was used, set the address of the segment. Remove
10260 local sort_sections.
10261 (Layout::relaxation_loop_body): If the address of the load segment
10262 has been set by --section-start, don't use it.
10263 * output.h (Output_segment::update_flags_for_output_section): New
10264 function.
10265 * output.cc (Output_segment::add_output_section): Call
10266 update_flags_for_output_section.
10267
10268 2010-01-05 Ian Lance Taylor <iant@google.com>
10269
10270 PR 10980
10271 * options.h (class General_options): Add --undefined-version.
10272 * script.cc (struct Version_expression): Add was_matched_by_symbol
10273 field.
10274 (Version_script_info::matched_symbol): New function.
10275 (Version_script_info::get_symbol_version_helper): Call
10276 matched_symbol.
10277 (Version_script_info::check_unmatched_names): New function.
10278 * script.h (class Version_script_info): Update declarations.
10279 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10280
10281 * options.h (class General_options): Use DEFINE_bool_alias for
10282 allow_multiple_definition.
10283 * resolve.cc (Symbol_table::should_override): Don't test
10284 allow_multiple_definition.
10285
10286 PR 10980
10287 * options.h (class General_options): Add --cref.
10288 * main.cc (main): Print cref table if --cref. Don't close mapfile
10289 until after printing cref table.
10290 * cref.cc: Include "symtab.h".
10291 (class Cref_inputs): Define Cref_table_compare and Cref_table.
10292 (Cref_table_compare::operator()): New function.
10293 (Cref_inputs::gather_cref): New function.
10294 (filecol): New static const.
10295 (Cref_inputs::print_cref): New function.
10296 (Cref::print_cref): New function.
10297 * cref.h: Include <cstdio>.
10298 (class Cref): Update declarations.
10299 * mapfile.h (Mapfile::file): New function.
10300 * object.h (class Object): Define Symbols. Declare virtual
10301 do_get_global_symbols.
10302 (Object::get_global_symbols): New function.
10303 * object.cc (Input_objects::add_object): Pass object to cref_ if
10304 --cref.
10305 (Input_objects::archive_start): Likewise.
10306 (Input_objects::archive_stop): Likewise.
10307 (Input_objects::print_cref): New function.
10308 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10309 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10310 --cref.
10311 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10312 function.
10313 * plugin.h (class Sized_pluginobj): Update declarations.
10314
10315 2010-01-05 Ian Lance Taylor <iant@google.com>
10316
10317 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10318 to is_default_version. Rename insdef to insdefault.
10319 (Symbol_table::add_from_relobj): Rename def to is_default_version
10320 and local to is_forced_local.
10321 (Symbol_table::add_from_pluginobj): Likewise.
10322 (Symbol_table::add_from_dynobj): Likewise.
10323 (Symbol_table::define_special_symbol): Rename insdef to
10324 insdefault.
10325
10326 2010-01-04 Ian Lance Taylor <iant@google.com>
10327
10328 PR 10980
10329 * options.h (class General_options): Add
10330 --allow-multiple-definition and -z muldefs.
10331 * resolve.cc (Symbol_table::should_override): Don't warn about a
10332 multiple symbol definition if --allow-multiple-definition or -z
10333 muldefs.
10334
10335 PR 10980
10336 * options.h (class General_options): Add --add-needed and
10337 --copy-dt-needed-entries. Tweak --as-needed help entry.
10338 * object.cc (Input_objects::check_dynamic_dependencies): Give an
10339 error if --copy-dt-needed-entries aka --add-needed is used and
10340 would cause a change in behaviour.
10341
10342 PR 10980
10343 * options.h (class General_options): Add -G as a short version of
10344 --shared. Add no-op options -assert, -g, and -i.
10345
10346 2010-01-04 Sriraman Tallam <tmsriram@google.com>
10347
10348 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10349 check for .text or .gnu.linkonce.t sections.
10350 * icf.cc (Icf::find_identical_sections): Ditto.
10351 Change the detection for mangled function name within the section
10352 name.
10353 * icf.h (is_section_foldable_candidate): New function.
10354
10355 2009-12-30 Ian Lance Taylor <iant@google.com>
10356
10357 PR 10980
10358 * options.h (class General_options): Permit two dashes with
10359 --retain-symbols-file.
10360
10361 2009-12-30 Ian Lance Taylor <iant@google.com>
10362
10363 PR 10979
10364 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10365 don't put the file header and segment headers in the text
10366 segment.
10367
10368 PR 10979
10369 * common.cc (Sort_commons::operator()): Stabilize sort when both
10370 entries are NULL.
10371 (Symbol_table::do_allocate_commons_list): When allocating common
10372 symbols, skip a symbol which is no longer common.
10373 * symtab.h (Symbol::is_common): Test whether the symbol comes from
10374 an object before checking its type.
10375 * testsuite/common_test_2.c: New file.
10376 * testsuite/common_test_3.c: New file.
10377 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10378 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10379 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10380 (common_test_2_pic.o, common_test_2.so): New targets.
10381 (common_test_3_pic.o, common_test_3.so): New targets.
10382 * testsuite/Makefile.in: Rebuild.
10383
10384 PR 10979
10385 * script.cc (read_input_script): If we see a new SECTIONS clause,
10386 and we have added an input section, give an error.
10387 * layout.h (class Layout): Add have_added_input_section function.
10388 Add have_added_input_section_ field.
10389 * layout.cc (Layout::Layout): Initialize
10390 have_added_input_section_.
10391 (Layout::layout): Set have_added_input_section_.
10392 (Layout::layout_eh_frame): Likewise.
10393
10394 2009-12-30 Ian Lance Taylor <iant@google.com>
10395
10396 PR 10931
10397 * options.h (class General_options): Add --sort-common option.
10398 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10399 * common.cc (Sort_common): Add sort_order parameter to
10400 constructor. Add sort_order_ field.
10401 (Sort_commons::operator): Check sort_order_.
10402 (Symbol_table::allocate_commons): Determine the sort order.
10403 (Symbol_table::do_allocate_commons): Add sort_order parameter.
10404 Change all callers.
10405 (Symbol_table::do_allocate_commons_list): Likewise.
10406
10407 2009-12-30 Ian Lance Taylor <iant@google.com>
10408
10409 PR 10916
10410 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10411 symbols from this object, don't change the visibility of an
10412 undefined symbol.
10413 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10414
10415 2009-12-30 Ian Lance Taylor <iant@google.com>
10416
10417 PR 10861
10418 * script.h (class Version_script_info): Define Language enum.
10419 Update declarations. Define Glob, Exact, and Lookup types. Add
10420 new fields globals_, locals_, and is_finalized_.
10421 * script.cc: Various formatting fixes.
10422 (class Parser_closure): Change language_stack_ from a vector of
10423 std::string to one of Version_script_info::Language. Adjust all
10424 uses accordingly.
10425 (class Lazy_demangler): Remove.
10426 (struct Version_expression): Change language from std::string to
10427 Version_script_info::Language.
10428 (Version_script_info::Version_script_info): New function.
10429 (Version_script_info::~Version_script_info): Don't call clear.
10430 (Version_script_info::finalize): New function.
10431 (Version_script_info::build_lookup_tables): New function.
10432 (Version_script_info::build_expression_list_lookup): New
10433 function.
10434 (Version_script_info::get_symbol_version_helper): Rewrite to use
10435 lookup tables.
10436 (Version_script_info::print_expression_list): Adjust to use
10437 Version_script_info::Language.
10438 (script_push_lex_into_version_mode): Check that the version script
10439 has not been finalized.
10440 (version_script_push_lang): Change language string to
10441 Version_script_info::Language.
10442 * options.cc (Command_line::version_script): New function.
10443 * options.h (class General_options): Add finalize_dynamic_list
10444 function. Change version_script from declaration to definition.
10445 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10446 * testsuite/version_script.map: Remove duplicate def of foo.
10447 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10448 version_script.map.
10449 * testsuite/Makefile.in: Rebuild.
10450
10451 2009-12-30 Ian Lance Taylor <iant@google.com>
10452
10453 PR 10843
10454 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10455 if the input symbol index is 0, make the output symbol index 0.
10456
10457 2009-12-30 Ian Lance Taylor <iant@google.com>
10458
10459 PR 10670
10460 * options.h (class General_options): Add -x/--discard-all.
10461 * object.cc (Sized_relobj::do_count_local_symbols): Handle
10462 --discard-all. If the local symbol needs a dynamic entry, check
10463 that before handling --discard-locals.
10464
10465 2009-12-30 Ian Lance Taylor <iant@google.com>
10466
10467 PR 10450
10468 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10469 flags to PF_R.
10470 (Output_segment::add_output_section): Don't change the flags if
10471 the type is PT_TLS.
10472
10473 PR 10450
10474 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10475 GNU hash table if they need a dynamic value. Otherwise, don't add
10476 them if they are defined in a dynamic object or are forced local.
10477
10478 2009-12-29 Ian Lance Taylor <iant@google.com>
10479
10480 PR 10450
10481 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10482 .gnu.hash table for a 32-bit target.
10483
10484 PR 10450
10485 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10486 regular and a dynamic object only needs a dynamic symbol table
10487 entry if it is externally visible.
10488
10489 PR 10450
10490 * i386.cc (class Target_i386): Initialize global_offset_table_ in
10491 constructor. Add global_offset_table_ field.
10492 (Target_i386::got_section): Set global_offset_table_.
10493 (Target_i386::do_finalize_sections): Set global_offset_table_
10494 size.
10495 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10496 in constructor. Add global_offset_table_ field.
10497 (Target_x86_64::got_section): Set global_offset_table_.
10498 (Target_x86_64::do_finalize_sections): Set global_offset_table_
10499 size.
10500
10501 * layout.cc (Layout::Layout): Initialize increase_relro_.
10502 (Layout::get_output_section): Add is_relro, is_last_relro, and
10503 is_first_non_relro parameters. Change all callers.
10504 (Layout::choose_output_section): Likewise.
10505 (Layout::add_output_section_data): Likewise.
10506 (Layout::make_output_section): Likewise.
10507 (Layout::set_segment_offsets): Clear increase_relro when using a
10508 linker script.
10509 * layout.h (class Layout): Add increase_relro method. Add
10510 increase_relro_ field. Update declarations.
10511 * output.cc (Output_section::Output_section): Initialize
10512 is_last_relro_ and is_first_non_relro_.
10513 (Output_segment::add_output_section): Group relro sections is
10514 do_sort is true. Handle is_last_relro and is_first_non_relro.
10515 (Output_segment::maximum_alignment): Remove relro handling.
10516 (Output_segment::set_section_addresses): Add increase_relro
10517 parameter. Change all callers. Add initial alignment to align
10518 relro sections on separate page. Remove old relro handling.
10519 (Output_segment::set_section_list_addresses): Remove in_relro
10520 parameter. Change all callers.
10521 (Output_segment::set_offset): Add increase parameter. Change all
10522 callers. Remove old relro handling.
10523 * output.h (class Output_section): Add new methods: is_last_relro,
10524 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10525 Add is_last_relro_ and is_first_non_relro_ fields.
10526 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10527 Create separate .got.plt section. Call increase_relro.
10528 * x86_64.cc (Target_x86_64::got_section): Likewise.
10529 * testsuite/relro_script_test.t: Add .got.plt.
10530
10531 PR 10450
10532 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10533 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10534 (Layout::finalize): Call set_dynamic_symbol_size.
10535 (Layout::set_dynamic_symbol_size): New function.
10536 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
10537 set_dynamic_symbol_size.
10538
10539 PR 10450
10540 * output.h (class Output_section): Add is_entsize_zero_ field.
10541 * output.cc (Output_section::Output_section): Initialize
10542 is_entsize_zero_.
10543 (Output_section::set_entsize): If two different entsizes are
10544 requested, force it to zero.
10545 (Output_section::add_input_section): Set flags for .debug_str
10546 before updating section flags. Set entsize.
10547 (Output_section::update_flags_for_input_section): Set SHF_MERGE
10548 and SHF_STRING if all input sections have those flags.
10549
10550 2009-12-29 Rafael Espindola <espindola@google.com>
10551
10552 * main.cc (main): Fix the sys time reporting.
10553 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10554 reporting.
10555
10556 2009-12-29 Sriraman Tallam <tmsriram@google.com>
10557
10558 * options.cc (General_options::parse_version): Allow -v to exit
10559 without an error if there is nothing to link.
10560
10561 2009-12-29 Ian Lance Taylor <iant@google.com>
10562
10563 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10564 using a version of gcc before 4.1.
10565 * configure: Rebuild.
10566
10567 2009-12-28 Chris Demetriou <cgd@google.com>
10568
10569 * attributes.cc (Output_attributes_section_data::do_write): Use
10570 std::vector::front rather than std::vector::data.
10571
10572 2009-12-28 Ian Lance Taylor <iant@google.com>
10573
10574 * symtab.h (class Symbol_table): Add enum Defined.
10575 * resolve.cc (Symbol_table::should_override): Add defined
10576 parameter. Change all callers. Test whether object is NULL
10577 before calling a method on it.
10578 (Symbol_table::report_resolve_problem): Add defined parameter.
10579 Change all callers.
10580 (Symbol_table::should_override_with_special): Likewise.
10581 * symtab.cc (Symbol_table::define_in_output_data): Add defined
10582 parameter. Change all callers.
10583 (Symbol_table::do_define_in_output_data): Likewise.
10584 (Symbol_table::define_in_output_segment): Likewise.
10585 (Symbol_table::do_define_in_output_segment): Likewise.
10586 (Symbol_table::define_as_constant): Likewise.
10587 (Symbol_table::do_define_as_constant): Likewise.
10588 * script.h (class Symbol_assignment): Add is_defsym parameter to
10589 constructor; change all callers.
10590 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10591 parameter. Change all callers. Add is_defsym_ field.
10592 (class Parser_closure): Add parsing_defsym parameter to
10593 constructor; change all callers. Add parsing_defsym accessor
10594 function. Add parsing_defsym_ field.
10595
10596 2009-12-28 Ian Lance Taylor <iant@google.com>
10597
10598 * gold.cc (queue_middle_tasks): Fix formatting.
10599 * object.cc (Relobj::is_section_name_included): Likewise.
10600
10601 2009-12-23 Ian Lance Taylor <iant@google.com>
10602
10603 * i386.cc (Target_i386::do_calls_non_split): Recognize
10604 -fsplit-stack prologue for a function with a static chain.
10605 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10606 -fsplit-stack prologue when using %r11.
10607
10608 2009-12-21 Sriraman Tallam <tmsriram@google.com>
10609
10610 * options.cc (General_options::parse_version): Make -v continue and do
10611 the link like GNU ld does.
10612
10613 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
10614
10615 * Makefile.am (CCFILES): Add timer.cc.
10616 (HFILES): Add timer.h.
10617 * configure.ac: Check for sysconf and times.
10618 * main.cc: include timer.h.
10619 (main): Use Timer instead of get_run_time.
10620 * timer.cc: New.
10621 * timer.h: New.
10622 * workqueue.cc: include timer.h.
10623 (Workqueue::find_and_run_task):
10624 Report user, sys and wall time.
10625 * Makefile.in: Regenerate.
10626 * config.in: Regenerate.
10627 * configure: Regenerate.
10628
10629 2009-12-16 Doug Kwan <dougkwan@google.com>
10630
10631 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10632 sections.
10633 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10634 relaxed input sections.
10635 * output.cc (Output_section::find_relaxed_input_section): Change
10636 return type to Output_relaxed_input_section pointer. Adjust code
10637 for new type of relaxed_input_section_map_.
10638 * output.h (Output_section::find_relaxed_input_section): Change
10639 return type to Output_relaxed_input_section pointer.
10640 (Output_section::Output_relaxed_input_section_by_input_section_map):
10641 New type.
10642 (Output_section::relaxed_input_section_map_): Change type to
10643 Output_section::Output_relaxed_input_section_by_input_section_map.
10644 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10645 input section.
10646
10647 2009-12-15 Ian Lance Taylor <iant@google.com>
10648
10649 * layout.cc (Layout::create_shstrtab): Only write out after input
10650 sections if we are compressing debug sections.
10651
10652 2009-12-15 Ian Lance Taylor <iant@google.com>
10653
10654 * archive.cc (Archive::add_symbols): Only look up a symbol without
10655 a version if there is, in fact, a version.
10656
10657 2009-12-14 Ian Lance Taylor <iant@google.com>
10658
10659 Revert -Wshadow changes, all changes from:
10660 2009-12-11 Doug Kwan <dougkwan@google.com>
10661 2009-12-11 Nick Clifton <nickc@redhat.com>
10662 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10663
10664 2009-12-11 Doug Kwan <dougkwan@google.com>
10665
10666 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10667 due to -Wshadow.
10668 * attributes.cc (Object_attribute::size): Ditto.
10669 (Attributes_section_data::size): Ditto.
10670 (Attributes_section_data::Attributes_section_data): Ditto.
10671 (Output_attributes_section_data::do_write): Ditto.
10672 * attributes.h (Object_attribute::set_type): Ditto.
10673 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10674
10675 2009-12-11 Nick Clifton <nickc@redhat.com>
10676
10677 * archive.cc: Fix shadowed variable warnings.
10678 * arm.cc: Likewise.
10679 * compressed_output.cc: Likewise.
10680 * compressed_output.h: Likewise.
10681 * configure: Likewise.
10682 * dwarf_reader.cc: Likewise.
10683 * dynobj.cc: Likewise.
10684 * dynobj.h: Likewise.
10685 * ehframe.cc: Likewise.
10686 * ehframe.h: Likewise.
10687 * errors.cc: Likewise.
10688 * expression.cc: Likewise.
10689 * fileread.cc: Likewise.
10690 * fileread.h: Likewise.
10691 * freebsd.h: Likewise.
10692 * i386.cc: Likewise.
10693 * icf.cc: Likewise.
10694 * incremental.h: Likewise.
10695 * layout.cc: Likewise.
10696 * layout.h: Likewise.
10697 * mapfile.cc: Likewise.
10698 * merge.cc: Likewise.
10699 * merge.h: Likewise.
10700 * object.cc: Likewise.
10701 * object.h: Likewise.
10702 * options.h: Likewise.
10703 * output.cc: Likewise.
10704 * output.h: Likewise.
10705 * parameters.cc: Likewise.
10706 * plugin.cc: Likewise.
10707 * powerpc.cc: Likewise.
10708 * reduced_debug_output.cc: Likewise.
10709 * reduced_debug_output.h: Likewise.
10710 * reloc.cc: Likewise.
10711 * reloc.h: Likewise.
10712 * resolve.cc: Likewise.
10713 * script-sections.cc: Likewise.
10714 * script.cc: Likewise.
10715 * script.h: Likewise.
10716 * sparc.cc: Likewise.
10717 * symtab.cc: Likewise.
10718 * symtab.h: Likewise.
10719 * target-select.cc: Likewise.
10720 * target-select.h: Likewise.
10721 * token.h: Likewise.
10722 * workqueue.cc: Likewise.
10723 * workqueue.h: Likewise.
10724 * x86_64.cc: Likewise.
10725
10726 2009-12-10 Doug Kwan <dougkwan@google.com>
10727
10728 * arm.cc (attributes.h): New include.
10729 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10730 (Arm_relobj::~Arm_relobj): Delete object pointed by
10731 attributes_section_data_.
10732 (Arm_relobj::attributes_section_data): New method definition.
10733 (Arm_relobj::attributes_section_data_): New data member declaration.
10734 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10735 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10736 attributes_section_data_.
10737 (Arm_dynobj::attributes_section_data): New method definition.
10738 (Arm_dynobj::attributes_section_data_): New data member declaration.
10739 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
10740 initialization value of may_use_blx_ to false.
10741 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10742 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10743 object attributes to compute results instead of hard-coding.
10744 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10745 Target_arm::get_secondary_compatible_arch,
10746 Target_arm::set_secondary_compatible_arch
10747 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10748 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10749 New method declarations.
10750 (Target_arm::get_aeabi_object_attribute): New method definition.
10751 (Target_arm::attributes_section_data_): New data member declaration.
10752 (read_arm_attributes_section): New template definition.
10753 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10754 (Arm_dynobj::do_read_symbols): Ditto.
10755 (Target_arm::do_finalize_sections): Merge attributes sections from
10756 input. Check for BLX use after attributes section merging.
10757 Fix __exidx_start and __exidx_end visibility. Create an
10758 .ARM.attributes section if necessary.
10759 (Target_arm::get_secondary_compatible_arch,
10760 Target_arm::set_secondary_compatible_arch,
10761 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10762 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10763 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10764 New method definitions.
10765
10766 2009-12-09 Ian Lance Taylor <iant@google.com>
10767
10768 * plugin.cc (Plugin::load): Don't cast from void* to a function
10769 pointer.
10770
10771 2009-12-09 Ian Lance Taylor <iant@google.com>
10772
10773 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10774 information fields.
10775
10776 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
10777
10778 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10779 Replace two_file_shared_1.so with two_file_shared_2.so.
10780 * testsuite/Makefile.in: Regenerated.
10781
10782 2009-12-08 Doug Kwan <dougkwan@google.com>
10783
10784 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10785 (HFILES): Add attributes.h and int_encoding.h.
10786 * Makefile.in: Regenerate.
10787 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10788 function definitions to int_encoding.cc
10789 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10790 prototypes to int_encoding.h
10791 * reduced_debug_output.cc (int_encoding.h): New include.
10792 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10793 function definitions to int_encoding.cc
10794 (insert_into_vector, read_from_pointer): Move template definitions to
10795 int_encoding.h
10796 * attributes.cc: New file.
10797 * attributes.h: New file.
10798 * int_encoding.cc: New file.
10799 * int_encoding.h: New file.
10800
10801 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
10802
10803 PR gold/11055
10804 * incremental-dump.cc (dump_incremental_inputs): New.
10805 (main): Use dump_incremental_inputs.
10806
10807 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
10808
10809 PR gold/10893
10810 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10811 checking elfcpp::STT_FUNC.
10812 (Target_i386::Relocate::relocate): Likewise.
10813 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10814
10815 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10816 symbols from shared libraries into normal FUNC symbols.
10817
10818 * symtab.h (Symbol): Add is_func and use it.
10819
10820 2009-12-05 Doug Kwan <dougkwan@google.com>
10821
10822 * arm.cc (Target_arm::arm_info): Initialize new fields
10823 attributes_section and attributes_vendor.
10824 * i386.cc (Target_i386::i386_info): Same.
10825 * object.cc (Sized_relobj::do_layout): Skip attribute section.
10826 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10827 fields attributes_section and attributes_vendor.
10828 * sparc.cc (Target_sparc::sparc_info): Same.
10829 * target.h (Target::attributes_section, Target::attributes_vendor,
10830 Target::is_attributes_section, Target::attribute_arg_type,
10831 Target::attributes_order): New method definitions.
10832 (Target::Target_info::attributes_section,
10833 Target::Target_info::attributes_vendor): New fields.
10834 (Target::do_attribute_arg_type, Target::do_attributes_order): New
10835 virtual method definitions.
10836 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10837 attributes_section and attributes_vendor.
10838 * testsuite/testfile.cc (Target_test::test_target_info): Same.
10839
10840 2009-12-05 Doug Kwan <dougkwan@google.com>
10841
10842 * arm.cc: Update comments about interworking and stub generation.
10843 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10844 considered as non-PIC.
10845 (Arm_relocate_functions::base_abs): Fix formatting.
10846 (Arm_relocate_functions::got_prel): Fix comment. Change interface
10847 of function to use GOT entry address instead of offset.
10848 (Target_arm::Scan::global): Issue an error if a symbol would need a
10849 PLT does not get one because it is untyped. Remove code to create
10850 dynamic symbols for relative branches.
10851 (Target_arm::Relocate::relocate: Use 0 instead of false since function
10852 takes unsigned integer instead of boolean.
10853
10854 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
10855
10856 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10857 (two_file_test_LDADD): Likewise.
10858 (common_test_1_LDADD): Likewise.
10859 (exception_test_LDADD) Likewise.
10860 (weak_test_LDADD): Likewise.
10861 (many_sections_test_LDADD): Likewise.
10862 (initpri1_LDADD): Likewise.
10863 (script_test_1_LDADD): Likewise.
10864 (script_test_2_LDADD): Likewise.
10865 (justsyms_LDADD): Likewise.
10866 (binary_test_LDADD): Likewise.
10867 (large_LDADD): Likewise.
10868 * testsuite/Makefile.in: Regenerated.
10869
10870 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
10871
10872 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10873 (Symbol_table::override_with_special): Likewise.
10874 (Symbol_table::add_from_object): Likewise.
10875
10876 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10877
10878 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10879 Don't set the data_offset twice.
10880
10881 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
10882
10883 * testsuite/Makefile.in: Regenerate.
10884
10885 2009-12-03 Doug Kwan <dougkwan@google.com>
10886
10887 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10888 (Target_arm::do_finalize_sections): Add parameter for symbol table
10889 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
10890 * i386.cc (Target_i386::do_finalize_sections): Add an additional
10891 parameter for symbol table pointer.
10892 * layout.cc (Layout::finalize): Call Target::finalize_sections with
10893 an additional parameter for a pointer to symbol table.
10894 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10895 parameter for a symbol table pointer.
10896 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10897 * target.h (Target::finalize_sections, Target::do_finalize_sections):
10898 Ditto.
10899 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10900 parameter for a symbol table pointer.
10901
10902 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
10903
10904 * incremental.cc (Incremental_inputs_header)
10905 (Incremental_inputs_header_write, Incremental_inputs_entry)
10906 (Incremental_inputs_entry_write): Move ...
10907 * incremental.h (Incremental_inputs_header)
10908 (Incremental_inputs_header_write, Incremental_inputs_entry)
10909 (Incremental_inputs_entry_write): here.
10910
10911 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10912
10913 * incremental.cc (make_sized_incremental_binary): Set the target.
10914 Error if it is incompatible.
10915 * output.h (Output_file): Add filename method.
10916
10917 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10918
10919 * incremental.cc (Incremental_inputs_entry): Remove unused argument
10920 from the get_* methods.
10921
10922 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10923
10924 * incremental-dump.cc (main): Check that the offeset of a script is 0.
10925 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10926 Write 0 for the data_offset of scripts.
10927
10928 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
10929
10930 * testsuite/Makefile.am: Add the incremental_test.sh test.
10931 * testsuite/incremental_test.sh: New.
10932 * testsuite/incremental_test_1.c: New.
10933 * testsuite/incremental_test_2.c: New.
10934
10935 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
10936
10937 * incremental-dump.cc (main): Fix typos.
10938
10939 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
10940
10941 PR gold/11025
10942 * incremental-dump.cc (main): Use llu to print 64 bit values.
10943
10944 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
10945 H.J. Lu <hongjiu.lu@intel.com>
10946
10947 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10948 $(LIBDL).
10949 (incremental_dump_LDADD): Likewise.
10950 * Makefile.in: Regenerated.
10951
10952 2009-11-25 Doug Kwan <dougkwan@google.com>
10953
10954 Revert:
10955
10956 2009-11-25 Doug Kwan <dougkwan@google.com>
10957
10958 * arm.cc (Target_arm::Target_arm): Move method definition
10959 outside of class definition. Add code to handle
10960 --target1-rel, --target1-abs and --target2= options.
10961 (Target_arm::get_reloc_reloc_type): Change method to be
10962 non-static and const.
10963 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10964 New data member declaration.
10965 (Target_arm::Scan::local, Target_arm::Scan::global,
10966 Target_arm::Relocate::relocate,
10967 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10968 Adjust call to Target_arm::get_real_reloc_type.
10969 (Target_arm::get_real_reloc_type): Use command line options
10970 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10971 * options.h (--target1-rel, --target1-abs, --target2): New
10972 ARM-only options.
10973
10974 2009-11-25 Doug Kwan <dougkwan@google.com>
10975
10976 * arm.cc (Target_arm::Target_arm): Move method definition outside of
10977 class definition. Add code to handle --target1-rel, --target1-abs
10978 and --target2= options.
10979 (Target_arm::get_reloc_reloc_type): Change method to be non-static
10980 and const.
10981 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10982 member declaration.
10983 (Target_arm::Scan::local, Target_arm::Scan::global,
10984 Target_arm::Relocate::relocate,
10985 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10986 call to Target_arm::get_real_reloc_type.
10987 (Target_arm::get_real_reloc_type): Use command line options to
10988 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10989 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10990 options.
10991
10992 2009-11-25 Doug Kwan <dougkwan@google.com>
10993
10994 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10995 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10996 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10997 formatting.
10998 (Arm_relocate_functions::thm_call): Replace body with a call to
10999 Arm_relocate_functions::thumb_branch_common.
11000 (Arm_relocate_functions::thm_jump24,
11001 Arm_relocate_functions::thm_xpc22): New method definitions.
11002 (Arm_relocate_functions::thumb_branch_common): New method definition.
11003 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11004 operator.
11005 (Target_arm::Relocate::relocate): Adjust call to thm_call.
11006 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11007
11008 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
11009
11010 * Makefile.am: Build incremental-dump
11011 * Makefile.in: Regenerate.
11012 * incremental-dump.cc: New.
11013 * incremental.cc (Incremental_inputs_header_data,
11014 Incremental_inputs_entry_data): Move to incremental.h
11015 * incremental.h: (Incremental_inputs_header_data,
11016 Incremental_inputs_entry_data): Move from incremental.cc
11017
11018 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
11019
11020 * incremental.cc (Incremental_inputs_header,
11021 Incremental_inputs_header_write, Incremental_inputs_entry,
11022 Incremental_inputs_entry_write): Add a typedef with the data type.
11023
11024 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
11025
11026 * incremental.cc (Incremental_inputs_header,
11027 Incremental_inputs_header_write, Incremental_inputs_entry,
11028 Incremental_inputs_entry_write): Update comment about which
11029 type has the filed descriptions.
11030
11031 2009-11-15 Doug Kwan <dougkwan@google.com>
11032
11033 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11034 (Arm_relocate_functions::arm_branch_common): Change method defintion
11035 in class definition to a method declaration and update list of formal
11036 parameters.
11037 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11038 Arm_relocation_functions::jump24): Adjust call to
11039 Arm_relocate_functions::arm_branch_common. Update list of formal
11040 parameters.
11041 (Arm_relocate_functions::xpc25): New method definition.
11042 (Arm_relocate_functions::arm_branch_common): Move method defintion
11043 out from class definition. Use stubs for mode-switching and extending
11044 branch ranges.
11045 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11046 specially. Change code to enable use of stubs in ARM branches.
11047
11048 2009-11-10 Doug Kwan <dougkwan@google.com>
11049
11050 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11051 in method declaration.
11052 (Target_arm::relocate_stub): New method declaration.
11053 (Target_arm::default_target): Change to return a pointer instead of
11054 a const reference.
11055 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11056 Target_arm::default_target.
11057 (Arm_Relobj::do_relocate_sections): Remove options paramater in
11058 method definition.
11059 (Target_arm::relocate_section): Adjust view.
11060 (Target_arm::relocate_stub): New method definition.
11061
11062 2009-11-10 Doug Kwan <dougkwan@google.com>
11063
11064 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11065 a format warning.
11066 * incremental.cc (open_incremental_binary): Initialized local
11067 variables to avoid warnings.
11068 * object.cc (make_elf_object): Ditto.
11069 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11070 a format warning.
11071
11072 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
11073
11074 PR gold/10930
11075 * testsuite/plugin_test.c: Include "config.h".
11076
11077 2009-11-09 Doug Kwan <dougkwan@google.com>
11078
11079 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11080 (arm_symbol_value): Remove.
11081 (Arm_relocate_functions::arm_branch_common,
11082 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11083 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11084 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11085 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11086 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11087 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11088 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11089 Arm_relocate_functions::thm_mobw_abs_nc,
11090 Arm_relocate_functions::thm_mov_abs,
11091 Arm_relocate_functions::movw_prel_nc,
11092 Arm_relocate_functions::thm_movt_abs,
11093 Arm_relocate_functions::movt_prel,
11094 Arm_relocate_functions::thm_movw_prel_nc,
11095 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11096 (Target_arm::Relocate::relocate): Only decompose address into two
11097 parts if relocation type uses the thumb-bit and pass the actual
11098 bit instead of a flag indicating that the thumb-bit is used. Adjust
11099 calls to methods in Arm_relocate_functions for this change.
11100
11101 2009-11-08 Ian Lance Taylor <iant@google.com>
11102
11103 PR 10925
11104 * reloc.cc: Instantiate
11105 Sized_relobj::initialize_input_to_output_maps and
11106 Sized_relobj:free_input_to_output_maps.
11107
11108 2009-11-06 Ian Lance Taylor <iant@google.com>
11109
11110 PR 10876
11111 * defstd.cc (in_segment): Set only_if_ref true for "end".
11112
11113 2009-11-06 Doug Kwan <dougkwan@google.com>
11114
11115 * arm.cc (class Reloc_stub): Correct a comment.
11116 (Target_arm::Target_arm): Initialize arm_input_section_map_.
11117 (Target_arm::scan_section_for_stubs): New method declaration.
11118 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11119 Change methods from private to protected.
11120 (Target_arm::do_may_relax): New method definition.
11121 (Target_arm::do_relax, Target_arm::group_sections,
11122 Target_arm::scan_reloc_for_stub,
11123 Target_arm::scan_reloc_section_for_stubs): New method declarations.
11124 (Target_arm::arm_input_section_map_): New data member declaration.
11125 (Target_arm::scan_reloc_for_stub,
11126 Target_arm::scan_reloc_section_for_stubs,
11127 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11128 Target_arm::do_relax): New method definitions.
11129
11130 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
11131
11132 * configure.ac: Check for (struct stat)::st_mtim
11133 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11134 * config.in: Regenerate.
11135 * configure: Regenerate.
11136
11137 2009-11-05 Ian Lance Taylor <iant@google.com>
11138
11139 PR 10910
11140 * output.cc (Output_segment::add_output_section): Add missing
11141 return statement.
11142
11143 2009-11-04 Ian Lance Taylor <iant@google.com>
11144
11145 PR 10880
11146 * object.h (class Object): Add is_needed and set_is_needed
11147 methods. Add is_needed_ field. Make bool fields into bitfields.
11148 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11149 defined in a dynamic object and referenced by a regular object,
11150 set is_needed for the dynamic object.
11151 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11152 if the file is marked with as_needed and it is not needed.
11153
11154 2009-11-04 Ian Lance Taylor <iant@google.com>
11155
11156 PR 10887
11157 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11158 tags if data is discarded by linker script.
11159 * i386.cc (Target_i386::do_finalize_sections): Likewise.
11160 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11161 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11162 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11163
11164 2009-11-04 Ian Lance Taylor <iant@google.com>
11165
11166 * layout.cc (Layout::get_output_section): Add is_interp and
11167 is_dynamic_linker_section parameters. Change all callers.
11168 (Layout::choose_output_section): Likewise.
11169 (Layout::make_output_section): Likewise.
11170 (Layout::add_output_section_data): Add is_dynamic_linker_section
11171 parameter. Change all callers.
11172 * layout.h (class Layout): Update declarations.
11173 * output.h (class Output_section): Add is_interp, set_is_interp,
11174 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11175 Add is_interp_, is_dynamic_linker_section_ fields. Change
11176 generate_code_fills_at_write_ to a bitfield.
11177 * output.cc (Output_section::Output_sections): Initialize new
11178 fields.
11179 (Output_segment::add_output_section): Add do_sort parameter.
11180 Change all callers.
11181
11182 2009-11-03 Ian Lance Taylor <iant@google.com>
11183
11184 PR 10860
11185 * options.h (class General_options): Add --warn-common.
11186 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11187 merging two common symbols.
11188 (Symbol_table::should_override): Handle --warn-common when merging
11189 a common symbol with a defined symbol. Use report_resolve_problem
11190 for multiple definitions.
11191 (Symbol_table::report_resolve_problem): New function.
11192 * symtab.h (class Symbol_table): Declare report_resolve_problem.
11193
11194 2009-11-03 Doug Kwan <dougkwan@google.com>
11195
11196 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11197 stub_factory_.
11198 (Target_arm::stub_factory): New method definition.
11199 (Target_arm::new_arm_input_section,
11200 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11201 Target_arm::reloc_uses_thumb_bit): New method declarations.
11202 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11203 New type definitions.
11204 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11205 member declarations.
11206 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11207 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11208 New method definitions.
11209
11210 2009-11-03 Ian Lance Taylor <iant@google.com>
11211
11212 * options.h (class General_options): Add --warn_constructors.
11213
11214 2009-11-03 Ian Lance Taylor <iant@google.com>
11215
11216 PR 10893
11217 * defstd.cc (in_section): Add entries for __rel_iplt_start,
11218 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11219
11220 2009-11-03 Ian Lance Taylor <iant@google.com>
11221
11222 PR 10895
11223 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11224 --msgid-bugs-address.
11225 (install-pdf): New target.
11226 (install-data_yes): Look up one directory to find mkinstalldirs.
11227
11228 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
11229
11230 * po/Make-in (.po.gmo): Don't generate .gmo files in source
11231 tree.
11232
11233 2009-10-30 Doug Kwan <dougkwan@google.com>
11234
11235 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11236
11237 2009-10-30 Doug Kwan <dougkwan@google.com>
11238
11239 * arm.cc (Stub_addend_reader): New struct template definition
11240 and partial specializations.
11241 (Stub_addend_reader::operator()): New method definition for a
11242 partially specialized template.
11243
11244 2009-10-30 Doug Kwan <dougkwan@google.com>
11245
11246 * arm.cc (Arm_relobj::processor_specific_flags): New method
11247 definition.
11248 (Arm_relobj::do_read_symbols): New method declaration.
11249 (Arm_relobj::processor_specific_flags_): New data member declaration.
11250 (Arm_dynobj): New class definition.
11251 (Target_arm::do_finalize_sections): Add input_objects parameter.
11252 (Target_arm::do_adjust_elf_header): New method declaration.
11253 (Target_arm::are_eabi_versions_compatible,
11254 (Target_arm::merge_processor_specific_flags): New method declaration.
11255 (Target_arm::do_make_elf_object): New overloaded method definitions
11256 and declaration.
11257 (Arm_relobj::do_read_symbols): New method definition.
11258 (Arm_dynobj::do_read_symbols): Ditto.
11259 (Target_arm::do_finalize_sections): Add input_objects parameters.
11260 Merge processor-specific flags from all input objects.
11261 (Target_arm::are_eabi_versions_compatible,
11262 Target_arm::merge_processor_specific_flags,
11263 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11264 New method definitions.
11265 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11266 Input_objects pointer type parameter.
11267 * layout.cc (Layout::finalize): Pass input objects to target's.
11268 finalize_sections function.
11269 * output.cc (Output_file_header::do_sized_write): Set ELF file
11270 header's processor-specific flags.
11271 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11272 Input_objects pointer type parameter.
11273 * sparc.cc (Target_sparc::do_finalize_sections): Same.
11274 * target.h (Input_objects): New forward class declaration.
11275 (Target::processor_specific_flags,
11276 Target::are_processor_specific_flags_sect): New method definitions.
11277 (Target::finalize_sections): Add input_objects parameter.
11278 (Target::Target): Initialize processor_specific_flags_ and
11279 are_processor_specific_flags_set_.
11280 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11281 parameter.
11282 (Target::set_processor_specific_flags): New method definition.
11283 (Target::processor_specific_flags_,
11284 Target::are_processor_specific_flags_set_): New data member
11285 declarations.
11286 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11287 Input_objects pointer type parameter.
11288
11289 2009-10-30 Doug Kwan <dougkwan@google.com>
11290
11291 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11292
11293 2009-10-28 Ian Lance Taylor <iant@google.com>
11294
11295 * object.h (class Relobj): Drop options parameter from
11296 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11297 do_scan_relocs, do_relocate. Change all callers.
11298 (class Sized_relobj): Drop options parameters from
11299 do_gc_process_relocs, do_scan_relocs, do_relocate,
11300 do_relocate_sections, relocate_sections, emit_relocs_scan,
11301 emit_relocs_scan_reltype. Change all callers.
11302 (struct Relocate_info): Remove options field and all references to
11303 it.
11304 * reloc.h (class Read_relocs): Remove options constructor
11305 parameter and options_ field. Change all callers.
11306 (class Gc_process_relocs, class Scan_relocs): Likewise.
11307 (class Relocate_task): Likewise.
11308 * target-reloc.h (scan_relocs): Remove options parameter. Change
11309 all callers.
11310 (scan_relocatable_relocs): Likewise.
11311 * target.h (class Sized_target): Remove options parameter from
11312 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
11313 all callers.
11314 * gc.h (gc_process_relocs): Remove options parameter. Change all
11315 callers.
11316 * arm.cc: Update functions to remove options parameters.
11317 * i386.cc: Likewise.
11318 * powerpc.cc: Likewise.
11319 * sparc.cc: Likewise.
11320 * x86_64.cc: Likewise.
11321 * testsuite/testfile.cc: Likewise.
11322
11323 2009-10-28 Doug Kwan <dougkwan@google.com>
11324
11325 * arm.cc (Arm_relobj): New class definition.
11326 (Arm_relobj::scan_sections_for_stubs,
11327 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11328 New method definitions.
11329
11330 2009-10-28 Cary Coutant <ccoutant@google.com>
11331
11332 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11333 (Plugin::cleanup_done_): New member.
11334 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11335 (Plugin_manager::cleanup_done_): Remove.
11336 (Plugin_manager::add_input_file): Edit error message.
11337 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11338 (Plugin_manager::cleanup): Remove use of cleanup_done_.
11339
11340 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
11341
11342 * fileread.cc: (File_read::View::~View): Use the new
11343 data_ownership_ filed.
11344 (File_read::~File_read): Dispose the new whole_file_view_.
11345 (File_read::open): Mmap the whole file if needed.
11346 (File_read::open): Use whole_file_view_ instead of contents_.
11347 (File_read::find_view): Use whole_file_view_ if applicable.
11348 (File_read::do_read): Use whole_file_view_ instead of contents_.
11349 (File_read::make_view): Use whole_file_view_ instead of contents_,
11350 update File_read::View::View call.
11351 (File_read::find_or_make_view): Update File_read::View::View
11352 call.
11353 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11354 remove contents_
11355 (File_read::View::Data_ownership): New enum.
11356 (File_read::View::View): Replace bool mapped_ with Data_ownership
11357 argument.
11358 (File_read::View::mapped_): Remove (replaced by data_ownership_).
11359 (File_read::View::data_ownership_): New field.
11360 (File_read::contents_): Remove (replaced by whole_file_view_).
11361 (File_read::whole_file_view_): New field.
11362 * options.h (class General_options): Add --keep-files-mapped.
11363
11364 2009-10-27 Cary Coutant <ccoutant@google.com>
11365
11366 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11367 * testsuite/Makefile.am (plugin_test_5): New test case.
11368 * testsuite/Makefile.in: Regenerate.
11369
11370 2009-10-25 Doug Kwan <dougkwan@google.com>
11371
11372 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11373 from private to protected to allow access by child class.
11374 (Sized_relobj::do_relocate_sections): New method declaration.
11375 (Sized_relobj::relocate_sections): Virtualize.
11376 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11377 Sized_relobj::relocate_sections. Instantiate template explicitly
11378 for different target sizes and endianity.
11379
11380 2009-10-24 Doug Kwan <dougkwan@google.com>
11381
11382 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11383 (Arm_input_section::as_arm_input_section): New method.
11384 (Arm_output_section): New class definition.
11385 (Arm_output_section::create_stub_group,
11386 Arm_output_section::group_sections): New method definitions.
11387
11388 2009-10-22 Doug Kwan <dougkwan@google.com>
11389
11390 * arm.cc (Arm_input_section): New class definition.
11391 (Arm_input_section::init, Arm_input_section:do_write,
11392 Arm_input_section::set_final_data_size,
11393 Arm_input_section::do_reset_address_and_file_offset): New method
11394 definitions.
11395
11396 2009-10-21 Doug Kwan <dougkwan@google.com>
11397
11398 * arm.cc (Stub_table, Arm_input_section): New forward class
11399 declarations.
11400 (Stub_table): New class defintion.
11401 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11402 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11403 New method definition.
11404
11405 2009-10-21 Doug Kwan <dougkwan@google.com>
11406
11407 * arm.cc: Update copyright comments.
11408 (Target_arm): New forward class template declaration.
11409 (Arm_address): New type.
11410 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11411 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11412 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11413 constants.
11414 (Insn_template): Same.
11415 (DEF_STUBS): New macro.
11416 (Stub_type): New enum type.
11417 (Stub_template): New class definition.
11418 (Stub): Same.
11419 (Reloc_stub): Same.
11420 (Stub_factory): Same.
11421 (Target_arm::Target_arm): Initialize may_use_blx_ and
11422 should_force_pic_veneer_.
11423 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11424 Target_arm::should_force_pic_veneer,
11425 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11426 Target_arm::using_thumb_only, Target_arm:;default_target): New
11427 method defintions.
11428 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11429 New data member declarations.
11430 (Insn_template::size, Insn_template::alignment): New method defintions.
11431 (Stub_template::Stub_template): New method definition.
11432 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11433 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11434 (Stub_factory::Stub_factory): New method definition.
11435 * gold.h (string_hash): New template.
11436 * output.h (Input_section_specifier::hash_value): Use
11437 gold::string_hash.
11438 (Input_section_specifier::string_hash): Remove.
11439 * stringpool.cc (Stringpool_template::string_hash): Use
11440 gold::string_hash.
11441
11442 2009-10-20 Doug Kwan <dougkwan@google.com>
11443
11444 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11445 symbols of relaxed input sections.
11446 * output.h (Output_section::find_relaxed_input_section): Make
11447 method public.
11448
11449 2009-10-16 Doug Kwan <dougkwan@google.com>
11450
11451 * dynobj.cc (Versions::Versions): Initialize version_script_.
11452 Only insert base version symbol definition for a shared object
11453 if version script defines any version versions.
11454 (Versions::define_base_version): New method definition.
11455 (Versions::add_def): Check that base version is not needed.
11456 (Versions::add_need): Define base version lazily.
11457 * dynobj.h (Versions::define_base_version): New method declaration.
11458 (Versions::needs_base_version_): New data member declaration.
11459 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11460 (check_DATA): Add no_version_test.stdout.
11461 (libno_version_test.so, no_version_test.o no_version_test.stdout):
11462 New make rules.
11463 * testsuite/Makefile.in: Regenerate.
11464 * testsuite/no_version_test.c: New file.
11465 * testsuite/no_version_test.sh: Ditto.
11466
11467 2009-10-16 Doug Kwan <dougkwan@google.com>
11468
11469 * expression.cc (class Segment_start_expression): New class definition.
11470 (Segment_start_expression::value): New method definition.
11471 (script_exp_function_segment_start): Return a new
11472 Segment_start_expression.
11473 * gold/script-c.h (script_saw_segment_start_expression): New function
11474 prototype.
11475 * script-sections.cc (Script_sections::Script_sections): Initialize
11476 SAW_SEGMENT_START_EXPRESSION_ to false.
11477 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11478 and -Tbbs options to specify section addresses if given in
11479 command line and no SEGMENT_START expression is seen in a script.
11480 * script-sections.h (Script_sections::saw_segment_start_expression,
11481 Script_sections::set_saw_segment_start_expression): New method
11482 definition.
11483 (Script_sections::saw_segment_start_expression_): New data member
11484 declaration.
11485 * script.cc (script_saw_segment_start_expression): New function.
11486 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11487 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11488 script_test_7.sh and script_test_8.sh.
11489 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11490 script_test_8.stdout.
11491 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11492 (script_test_6, script_test_6.stdout, script_test_7,
11493 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11494 * Makefile.in: Regenerate.
11495 * testsuite/script_test_6.sh: New file.
11496 * testsuite/script_test_6.t: Same.
11497 * testsuite/script_test_7.sh: Same.
11498 * testsuite/script_test_7.t: Same.
11499 * testsuite/script_test_8.sh: Same.
11500
11501 2009-10-16 Doug Kwan <dougkwan@google.com>
11502
11503 * output.cc (Output_segment::set_section_list_address): Cast
11504 expressions to unsigned long long type to avoid format warnings.
11505
11506 2009-10-15 Ian Lance Taylor <iant@google.com>
11507
11508 * script.cc (Script_options::add_symbol_assignment): Always add a
11509 dot assignment to script_sections_.
11510 * script-sections.cc (Script_sections::add_dot_assignment):
11511 Initialize if necessary.
11512
11513 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11514 program headers with no load segment if there is a linker script.
11515
11516 * layout.cc (Layout::set_segment_offsets): Align the file offset
11517 to the segment aligment for -N or -n with no load segment.
11518 * output.cc (Output_segment::add_output_section): Don't crash if
11519 the first section is a TLS section.
11520 (Output_segment::set_section_list_addresses): Print an error
11521 message if the address moves backward in a linker script.
11522 * script-sections.cc
11523 (Output_section_element_input::set_section_addresses): Don't
11524 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11525 (Orphan_output_section::set_section_addresses): Likewise.
11526
11527 2009-10-15 Doug Kwan <dougkwan@google.com>
11528
11529 * layout.cc (Layout::finish_dynamic_section): Generate tags
11530 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11531 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11532 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11533
11534 2009-10-14 Ian Lance Taylor <iant@google.com>
11535
11536 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11537 fields.
11538 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11539 data_shdr fields of relinfo.
11540 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11541 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
11542 R_386_TLS_LDO_32, adjust based on section flags.
11543 (Target_i386::Relocate::fix_up_ldo): Remove.
11544
11545 2009-10-13 Ian Lance Taylor <iant@google.com>
11546
11547 Add support for -pie.
11548 * options.h (class General_options): Add -pie and
11549 --pic-executable.
11550 (General_options::output_is_position_independent): Test -pie.
11551 (General_options::output_is_executable): Return true if not shared
11552 and not relocatable.
11553 (General_options::output_is_pie): Remove.
11554 * options.cc (General_options::finalize): Reject incompatible uses
11555 of -pie.
11556 * gold.cc (queue_middle_tasks): A -pie link is not static.
11557 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11558 * symtab.cc (Symbol::final_value_is_known): Return false if
11559 output_is_position_independent.
11560 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11561 output_is_position_independent.
11562 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11563 output_is_position_independent.
11564 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11565 output_is_position_independent.
11566 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11567 two_file_pie_test.
11568 (basic_pie_test.o, basic_pie_test): New targets.
11569 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11570 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11571 (two_file_pie_test): New target.
11572 * testsuite/Makefile.in: Rebuild.
11573 * README: Remove note saying that -pie is not supported.
11574
11575 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
11576
11577 * options.h (class General_options): Add -init and -fini.
11578 * layout.cc (Layout::finish_dynamic_section): Emit
11579 given init and fini functions.
11580
11581 2009-10-13 Sriraman Tallam <tmsriram@google.com>
11582
11583 * gc.h (gc_process_relocs): Check if icf is enabled using new
11584 function.
11585 * gold.cc (queue_initial_tasks): Likewise.
11586 (queue_middle_tasks): Likewise.
11587 * object.cc (do_layout): Likewise.
11588 * symtab.cc (is_section_folded): Likewise.
11589 * main.cc (main): Likewise.
11590 * reloc.cc (Read_relocs::run): Likewise.
11591 (Sized_relobj::do_scan_relocs): Likewise.
11592 * icf.cc (is_function_ctor_or_dtor): New function.
11593 (Icf::find_identical_sections): Check if function is ctor or dtor when
11594 safe icf is chosen.
11595 * options.h (General_options::icf): Change option to be an enum.
11596 (Icf_status): New enum.
11597 (icf_enabled): New method.
11598 (icf_safe_folding): New method.
11599 (set_icf_status): New method.
11600 (icf_status_): New variable.
11601 * (options.cc) (General_options::finalize): Set icf_status_.
11602 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11603 icf_test and icf_keep_unique_test to use the --icf enum flag.
11604 * testsuite/icf_safe_test.sh: New file.
11605 * testsuite/icf_safe_test.cc: New file.
11606
11607 2009-10-12 Sriraman Tallam <tmsriram@google.com>
11608
11609 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11610 includes to gc.h and icf.h.
11611 * arm.cc: Include gc.h.
11612 * gold.cc: Likewise.
11613 * i386.cc: Likewise.
11614 * powerpc.cc: Likewise.
11615 * sparc.cc: Likewise.
11616 * x86_64.cc: Likewise.
11617 * gc.h: Include icf.h.
11618
11619 2009-10-11 Ian Lance Taylor <iant@google.com>
11620
11621 * plugin.cc: Include "gold.h" before other header files.
11622
11623 2009-10-10 Chris Demetriou <cgd@google.com>
11624
11625 * options.h (Input_file_argument::Input_file_type): New enum.
11626 (Input_file_argument::is_lib_): Replace with...
11627 (Input_file_argument::type_): New member.
11628 (Input_file_argument::Input_file_argument): Take Input_file_type
11629 'type' rather than boolean 'is_lib' as second argument.
11630 (Input_file_argument::is_lib): Use type_.
11631 (Input_file_argument::is_searched_file): New function.
11632 (Input_file_argument::may_need_search): Handle is_searched_file.
11633 * options.cc (General_options::parse_library): Support -l:filename.
11634 (General_options::parse_just_symbols): Update for Input_file_argument
11635 changes.
11636 (Command_line::process): Likewise.
11637 * archive.cc (Archive::get_file_and_offset): Likewise.
11638 * plugin.cc (Plugin_manager::release_input_file): Likewise.
11639 * script.cc (read_script_file, script_add_file): Likewise.
11640 * fileread.cc (Input_file::Input_file): Likewise.
11641 (Input_file::will_search_for): Handle is_searched_file.
11642 (Input_file::open): Likewise.
11643 * readsyms.cc (Read_symbols::get_name): Likewise.
11644 * testsuite/Makefile.am (searched_file_test): New test.
11645 * testsuite/Makefile.in: Regenerate.
11646 * testsuite/searched_file_test.cc: New file.
11647 * testsuite/searched_file_test_lib.cc: New file.
11648
11649 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11650 Ian Lance Taylor <iant@google.com>
11651
11652 * descriptor.cc: Include <cstdio> and "binary-io.h".
11653 (Descriptors::open): Open the files in binary mode always.
11654 * script.cc (Lex::get_token): Treat \r as whitespace.
11655
11656 2009-10-09 Ian Lance Taylor <iant@google.com>
11657
11658 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11659
11660 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11661 Ian Lance Taylor <iant@google.com>
11662
11663 * configure.ac: Check for readv function also.
11664 * fileread.cc (readv): Define if not HAVE_READV.
11665 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11666 does not exist.
11667 * config.in: Regenerate.
11668 * configure: Regenerate.
11669
11670 2009-10-09 Doug Kwan <dougkwan@google.com>
11671
11672 * layout.cc (Layout::make_output_section): Call target hook to make
11673 ordinary output section.
11674 (Layout::finalize): Adjust parameter list of call the
11675 Target::may_relax().
11676 * layout.h (class Layout::section_list): New method.
11677 * merge.h (Output_merge_base::entsize): Change visibility to public.
11678 (Output_merge_base::is_string, Output_merge_base::do_is_string):
11679 New methods.
11680 (Output_merge_string::do_is_string): New method.
11681 * object.cc (Sized_relobj::do_setup): renamed from
11682 Sized_relobj::set_up.
11683 * object.h (Sized_relobj::adjust_shndx,
11684 Sized_relobj::initializ_input_to_output_maps,
11685 Sized_relobj::free_input_to_output_maps): Change visibilities to
11686 protected.
11687 (Sized_relobj::setup): Virtualize.
11688 (Sized_relobj::do_setup): New method declaration.
11689 (Sized_relobj::invalidate_section_offset,
11690 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11691 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11692 * options.cc (parse_int): New function.
11693 * options.h (parse_int): New declaration.
11694 (DEFINE_int): New macro.
11695 (stub_group_size): New option.
11696 * output.cc (Output_section::Output_section): Initialize memebers
11697 merge_section_map_, merge_section_by_properties_map_,
11698 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11699 (Output_section::add_input_section): Handled deferred code-fill
11700 generation and remove an old comment.
11701 (Output_section::add_relaxed_input_section): New method definition.
11702 (Output_section::add_merge_input_section): Use merge section by
11703 properties map to speed to search. Update merge section maps
11704 as appropriate.
11705 (Output_section::build_relaxation_map): New method definition.
11706 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11707 Same.
11708 (Output_section::relax_input_section): Renamed to
11709 Output_section::convert_input_sections_to_relaxed_sections and change
11710 interface to take a vector of pointers to relaxed sections.
11711 (Output_section::find_merge_section,
11712 Output_section::find_relaxed_input_section): New method definitions.
11713 (Output_section::is_input_address_mapped,
11714 Output_section::output_offset, Output_section::output_address):
11715 Use output section data maps to speed up searching.
11716 (Output_section::find_starting_output_address): Add comments.
11717 (Output_section::do_write,
11718 Output_section::write_to_postprocessing_buffer): Do code-fill
11719 generation as appropriate.
11720 (Output_section::get_input_sections): Invalidate relaxed input section
11721 map.
11722 (Output_section::restore_states): Adjust type of checkpoint .
11723 Invalidate relaxed input section map.
11724 * output.h (Output_merge_base): New class declaration.
11725 (Input_section_specifier): New class defintion.
11726 (class Output_relaxed_input_section) Change base class to
11727 Output_section_data_build.
11728 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11729 base class initializer.
11730 (Output_section::add_relaxed_input_section): New method declaration.
11731 (Output_section::Input_section): Change visibility to protected.
11732 (Output_section::Input_section::relobj,
11733 Output_section::Input_section::shndx): Handle relaxed input sections.
11734 Output_section::input_sections) Change visibility to protected. Also
11735 define overload to return a non-const pointer.
11736 (Output_section::Merge_section_properties): New class defintion.
11737 (Output_section::Merge_section_by_properties_map,
11738 Output_section::Output_section_data_by_input_section_map,
11739 Output_section::Relaxation_map): New types.
11740 (Output_section::relax_input_section): Rename method to
11741 Output_section::convert_input_sections_to_relaxed_sections and change
11742 interface to take a vector of relaxed section pointers.
11743 (Output_section::find_merge_section,
11744 Output_section::find_relaxed_input_section,
11745 Output_section::build_relaxation_map,
11746 Output_section::convert_input_sections_in_list_to_relaxed_sections):
11747 New method declarations.
11748 (Output_section::merge_section_map_
11749 Output_section::merge_section_by_properties_map_,
11750 Output_section::relaxed_input_section_map_,
11751 Output_section::is_relaxed_input_section_map_valid_,
11752 Output_section::generate_code_fills_at_write_): New data members.
11753 * script-sections.cc
11754 (Output_section_element_input::set_section_addresses): Call
11755 current_data_size and addralign methods of relaxed input sections.
11756 (Orphan_output_section::set_section_addresses): Call current_data_size
11757 and addralign methods of relaxed input sections.
11758 * symtab.cc (Symbol_table::compute_final_value): Extract template
11759 from the body of Symbol_table::sized_finalize_symbol.
11760 (Symbol_table::sized_finalized_symbol): Call
11761 Symbol_table::compute_final_value.
11762 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11763 (Symbol_table::compute_final_value): New templated method declaration.
11764 * target.cc (Target::do_make_output_section): New method defintion.
11765 * target.h (Target::make_output_section): New method declaration.
11766 (Target::relax): Add more parameters for input objects, symbol table
11767 and layout. Adjust call to do_relax.
11768 (Target::do_make_output_section): New method declaration.
11769 (Target::do_relax): Add parameters for input objects, symbol table
11770 and layout.
11771
11772 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11773
11774 * pread.c: Include stdio.h.
11775
11776 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11777
11778 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11779 defined.
11780
11781 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
11782
11783 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11784 Change read_shndx type to unsigned int.
11785 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11786 int.
11787 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11788 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11789 Change read_shndx type to unsigned int.
11790 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11791 int.
11792 (Sized_dwarf_line_info::read_line_mappings): Likewise.
11793 * layout.cc (Layout::create_symtab_sections): Cast the result of
11794 local_symcount * symsize to off_t in the gold_assert.
11795
11796 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11797
11798 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11799 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11800 R_ARM_BASE_ABS.
11801 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11802 (Arm_relocate_functions::thm_abs5): New function.
11803 (Arm_relocate_functions::abs12): New function.
11804 (Arm_relocate_functions::abs16): New function.
11805 (Arm_relocate_functions::base_abs): New function.
11806 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11807 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
11808 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11809 R_ARM_BASE_ABS.
11810 (Scan::global): Likewise.
11811 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11812 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11813 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11814 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11815 R_ARM_BASE_ABS.
11816
11817 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11818
11819 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11820 (Arm_relocate_functions::movt_prel): New function.
11821 (Arm_relocate_functions::thm_movw_prel_nc): New function.
11822 (Arm_relocate_functions::thm_movt_prel): New function.
11823 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11824 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11825 (Scan::global, Relocate::relocate): Likewise.
11826 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11827
11828 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11829
11830 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11831 Incremental_checker.
11832 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11833 unsigned int.
11834 (class Incremental_inputs_header): New class.
11835 (Incremental_inputs_header_writer): Edit comment.
11836 (Incremental_inputs_entry): New class.
11837 (Incremental_inputs_entry_writer): Edit comment.
11838 (Sized_incremental_binary::do_find_incremental_inputs_section):
11839 Add *strtab_shndx parameter, fill it.
11840 (Sized_incremental_binary::do_check_inputs): New method.
11841 (Incremental_checker::can_incrementally_link_output_file): Use
11842 Sized_incremental_binary::check_inputs.
11843 (Incremental_inputs::report_command_line): Save command line in
11844 command_line_.
11845 * incremental.h:
11846 (Incremental_binary::find_incremental_inputs_section): New
11847 method.
11848 (Incremental_binary::do_find_incremental_inputs_section): Add
11849 strtab_shndx parameter.
11850 (Incremental_binary::do_check_inputs): New pure virtual method.
11851 (Sized_incremental_binary::do_check_inputs): Declare.
11852 (Incremental_checker::Incremental_checker): Add incremental_inputs
11853 parameter, use it to initialize incremental_inputs_.
11854 (Incremental_checker::incremental_inputs_): New field.
11855 (Incremental_checker::command_line): New method.
11856 (Incremental_checker::inputs): New method.
11857 (Incremental_checker::command_line_): New field.
11858
11859 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
11860
11861 * incremental.cc: Include <cstdarg> and "target-select.h".
11862 (vexplain_no_incremental): New function.
11863 (explain_no_incremental): New function.
11864 (Incremental_binary::error): New method.
11865 (Sized_incremental_binary::do_find_incremental_inputs_section): New
11866 method.
11867 (make_sized_incremental_binary): New function.
11868 (open_incremental_binary): New function.
11869 (can_incrementally_link_file): Add checks if output is ELF and has
11870 inputs section.
11871 * incremental.h: Include "elfcpp_file.h" and "output.h".
11872 (Incremental_binary): New class.
11873 (Sized_incremental_binary): New class.
11874 (open_incremental_binary): Declare.
11875 * object.cc (is_elf_object): Use
11876 elfcpp::Elf_recognizer::is_elf_file.
11877 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11878 * output.h (Output_file::filesize): New method.
11879
11880 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11881
11882 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11883 New function.
11884 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11885 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11886 function.
11887 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11888 function.
11889 (Arm_relocate_functions::movw_abs_nc): New function.
11890 (Arm_relocate_functions::movt_abs): New function.
11891 (Arm_relocate_functions::thm_movw_abs_nc): New function.
11892 (Arm_relocate_functions::thm_movt_abs): New function.
11893 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11894 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11895 (Scan::global): Likewise.
11896 (Relocate::relocate): Likewise.
11897 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11898
11899 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11900
11901 * arm.cc (Arm_relocate_functions::got_prel) New function.
11902 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11903 (Relocate::relocate): Likewise.
11904 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11905
11906 2009-10-06 Ian Lance Taylor <iant@google.com>
11907
11908 * options.h (class General_options): Define
11909 split_stack_adjust_size parameter.
11910 * object.h (class Object): Add uses_split_stack_ and
11911 has_no_split_stack_ fields. Add uses_split_stack and
11912 has_no_split_stack accessor functions. Declare
11913 handle_split_stack_section.
11914 (class Reloc_symbol_changes): Define.
11915 (class Sized_relobj): Define Function_offsets. Declare
11916 split_stack_adjust, split_stack_adjust_reltype, and
11917 find_functions.
11918 * object.cc (Object::handle_split_stack_section): New function.
11919 (Sized_relobj::do_layout): Call handle_split_stack_section.
11920 * dynobj.cc (Sized_dynobj::do_layout): Call
11921 handle_split_stack_section.
11922 * reloc.cc (Sized_relobj::relocate_sections): Call
11923 split_stack_adjust for executable sections in split_stack
11924 objects. Pass reloc_map to relocate_section.
11925 (Sized_relobj::split_stack_adjust): New function.
11926 (Sized_relobj::split_stack_adjust_reltype): New function.
11927 (Sized_relobj::find_functions): New function.
11928 * target-reloc.h: Include "object.h".
11929 (relocate_section): Add reloc_symbol_changes parameter. Change
11930 all callers.
11931 * target.h (class Target): Add calls_non_split method. Declare
11932 do_calls_non_split virtual method. Declare match_view and
11933 set_view_to_nop.
11934 * target.cc: Include "elfcpp.h".
11935 (Target::do_calls_non_split): New function.
11936 (Target::match_view): New function.
11937 (Target::set_view_to_nop): New function.
11938 * gold.cc (queue_middle_tasks): Give an error if mixing
11939 split-stack and non-split-stack objects with -r.
11940 * i386.cc (Target_i386::relocate_section): Add
11941 reloc_symbol_changes parameter.
11942 (Target_i386::do_calls_non_split): New function.
11943 * x86_64.cc (Target_x86_64::relocate_section): Add
11944 reloc_symbol_changes parameter.
11945 (Target_x86_64::do_calls_non_split): New function.
11946 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11947 parameter.
11948 * powerpc.cc (Target_powerpc::relocate_section): Add
11949 reloc_symbol_changes parameter.
11950 * sparc.cc (Target_sparc::relocate_section): Add
11951 reloc_symbol_changes parameter.
11952 * configure.ac: Call AM_CONDITIONAL for the default target.
11953 * configure: Rebuild.
11954 * testsuite/Makefile.am (TEST_AS): New variable.
11955 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11956 (check_DATA): Add split_i386 and split_x86_64 files.
11957 (SPLIT_DEFSYMS): Define.
11958 (split_i386_[1234n].o): New targets.
11959 (split_i386_[124]): New targets.
11960 (split_i386_[1234r].stdout): New targets.
11961 (split_x86_64_[1234n].o): New targets.
11962 (split_x86_64_[124]): New targets.
11963 (split_x86_64_[1234r].stdout): New targets.
11964 (MOSTLYCLEANFILES): Add new executables.
11965 * testsuite/split_i386.sh: New file.
11966 * testsuite/split_x86_64.sh: New file.
11967 * testsuite/split_i386_1.s: New file.
11968 * testsuite/split_i386_2.s: New file.
11969 * testsuite/split_i386_3.s: New file.
11970 * testsuite/split_i386_4.s: New file.
11971 * testsuite/split_i386_n.s: New file.
11972 * testsuite/split_x86_64_1.s: New file.
11973 * testsuite/split_x86_64_2.s: New file.
11974 * testsuite/split_x86_64_3.s: New file.
11975 * testsuite/split_x86_64_4.s: New file.
11976 * testsuite/split_x86_64_n.s: New file.
11977 * testsuite/testfile.cc (Target_test): Update relocation_section
11978 function.
11979 * testsuite/Makefile.in: Rebuild.
11980
11981 2009-10-06 Ian Lance Taylor <iant@google.com>
11982
11983 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11984 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11985 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
11986 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11987 the address on ldo_addrs_.
11988 (Target_i386::Relocate::fix_up_ldo): New function.
11989
11990 2009-10-06 Rafael Espindola <espindola@google.com>
11991
11992 * plugin.cc (add_input_library): New.
11993 (Plugin::load): Add add_input_library to tv.
11994 (Plugin_manager::add_input_file): Add the is_lib argument.
11995 (add_input_file): Update call to Plugin_manager::add_input_file.
11996 (add_input_library): New.
11997 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11998
11999 2009-09-30 Doug Kwan <dougkwan@google.com>
12000
12001 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12002 symbol and call Symbol::may_need_copy_reloc to determine if
12003 a copy reloc is needed.
12004 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12005 nocopyreloc is given in command line.
12006 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12007 given in command line.
12008 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12009 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12010 of the removed Target_i386::may_need_copy_reloc.
12011 * options.h (copyreloc): New option with default value false.
12012 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12013 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12014 instead of the removed Target_powerpc::may_need_copy_reloc.
12015 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12016 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12017 instead of the removed Target_sparc::may_need_copy_reloc.
12018 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12019 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12020 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12021 instead of the removed Target_x86_64::may_need_copy_reloc.
12022
12023 2009-09-30 Ian Lance Taylor <iant@google.com>
12024
12025 * object.h (class Object): Remove target_ field, and target,
12026 sized_target, and set_target methods.
12027 (Object::sized_target): Remove.
12028 (class Sized_relobj): Update declarations. Remove sized_target.
12029 * object.cc (Sized_relobj::setup): Remove target parameter.
12030 Change all callers.
12031 (Input_objects::add_object): Don't do anything with the target.
12032 (make_elf_sized_object): Add punconfigured parameter. Change all
12033 callers. Set or test parameter target.
12034 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12035 Change all callers.
12036 * parameters.cc (Parameters::set_target): Change parameter type to
12037 be non-const.
12038 (Parameters::default_target): Remove.
12039 (set_parameters_target): Change parameter type to be non-const.
12040 (parameters_force_valid_target): New function.
12041 (parameters_clear_target): New function.
12042 * parameters.h (class Parameters): Update declarations. Remove
12043 default_target method. Add sized_target and clear_target
12044 methods. Change target_ to be non-const.
12045 (set_parameters_target): Update declaration.
12046 (parameters_force_valid_target): Declare.
12047 (parameters_clear_target): Declare.
12048 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12049 as NULL if we aren't searching.
12050 (Add_symbols::run): Don't check for compatible target.
12051 * fileread.cc (Input_file::open_binary): Call
12052 parameters_force_valid_target.
12053 * gold.cc (queue_middle_tasks): Likewise.
12054 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
12055 set_target on object.
12056 * dynobj.h (class Sized_dynobj): Update declarations.
12057 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12058 make_elf_object returns NULL.
12059 (Archive::include_member): Don't check whether object target is
12060 compatible.
12061 * output.cc (Output_section::add_input_section): Get target from
12062 parameters.
12063 (Output_section::relax_input_section): Likewise.
12064 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12065 parameters.
12066 (Sized_relobj::do_scan_relocs): Likewise.
12067 (Sized_relobj::relocate_sections): Likewise.
12068 * resolve.cc (Symbol_table::resolve): Likewise.
12069 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
12070 parameter. Change all callers.
12071 (Symbol_table::add_from_object): Get target from parameters.
12072 (Symbol_table::add_from_relobj): Don't check object target.
12073 (Symbol_table::add_from_dynobj): Likewise.
12074 (Symbol_table::define_special_symbol): Get target from
12075 parameters.
12076 * symtab.h (class Symbol_table): Update declaration.
12077 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12078 parameter. Change all callers. Clear parameter target.
12079 (Binary_test): Test target here.
12080 * testsuite/object_unittest.cc (gold_testsuite): Remove
12081 target_test_pointer parameter. Change all callers.
12082 (Object_test): Test target here.
12083
12084 2009-09-26 Ian Lance Taylor <iant@google.com>
12085
12086 * testsuite/initpri1.c: Don't try to use constructor priorities if
12087 compiling with gcc before 4.3.
12088
12089 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
12090
12091 * testsuite/retain_symbols_file_test.sh (check_present): Change
12092 output file name to retain_symbols_file_test.stdout.
12093 (check_absent): Likewise.
12094
12095 2009-09-18 Craig Silverstein <csilvers@google.com>
12096
12097 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12098 * options.cc: Include <cerrno> and <fstream>.
12099 (General_options::finalize): Parse -retain-symbols-file tag.
12100 * options.h: New flag.
12101 (General_options): New method should_retain_symbol, new
12102 variable symbols_to_retain.
12103 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12104 should_retain_symbol map.
12105 * testsuite/Makefile.am (retain_symbols_file_test): New test.
12106 * testsuite/Makefile.in: Regenerate.
12107 * testsuite/retain_symbols_file_test.sh: New file.
12108
12109 2009-09-18 Nick Clifton <nickc@redhat.com>
12110
12111 * po/es.po: Updated Spanish translation.
12112
12113 2009-09-17 Doug Kwan <dougkwan@google.com>
12114
12115 * debug.h (DEBUG_RELAXATION): New constant.
12116 (DEBUG_ALL): Add DEBUG_RELAXATION.
12117 (debug_string_to_enum): Add relaxation debug option.
12118 * layout.cc
12119 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12120 Layout::Relaxation_debug_check::read_sections,
12121 Layout::Relaxation_debug_check::read_sections): New method definitions.
12122 (Layout::Layout): Initialize data members
12123 record_output_section_data_from_scrips_,
12124 script_output_section_data_list_ and relaxation_debug_check_.
12125 (Layout::save_segments, Layout::restore_segments,
12126 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12127 Layout::relaxation_loop_body): New method definitions.
12128 (Layout::finalize): Support relaxation. Move section layout code to
12129 Layout::relaxation_loop_body.
12130 (Layout::set_asection_address_from_script): Move code for orphan
12131 section placement out.
12132 (Layout::place_orphan_sections_in_script): New method definition.
12133 * layout.h (Output_segment_headers, Output_file_header):
12134 New forward class declarations.
12135 (Layout::~Layout): Define.
12136 (Layout::new_output_section_data_from_script): New method definition.
12137 (Layout::place_orphan_sections_in_script): New method declaration.
12138 (Layout::Segment_states): New type declaration.
12139 (Layout::save_segments, Layout::restore_segments,
12140 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12141 Layout::relaxation_loop_body): New method declarations.
12142 (Layout::Output_section_data_list): New type declaration.
12143 (Layout::Relaxation_debug_check): New class definition.
12144 (Layout::record_output_section_data_from_script_,
12145 Layout::script_output_section_data_list_, Layout::segment_states_,
12146 Layout::relaxation_debug_check_): New data members.
12147 * output.cc: (Output_section_headers::do_size): New method definition.
12148 (Output_section_headers::Output_section_headers): Move size
12149 computation to Output_section_headers::do_size.
12150 (Output_segment_headers::do_size): New method definition.
12151 (Output_file_header::Output_file_header): Move size computation to
12152 Output_file_header::do_size and call it.
12153 (Output_file_header::do_size): New method definition.
12154 (Output_data_group::Output_data_group): Adjust call to
12155 Output_section_data.
12156 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12157 (Output_symtab_xindex::do_write): Add array bound check.
12158 (Output_section::Input_section::print_to_mapfile): Handle
12159 RELAXED_INPUT_SECTION_CODE.
12160 (Output_section::Output_section): Initialize data member checkpoint_.
12161 (Output_section::~Output_section): Delete checkpoint object pointed
12162 by checkpoint_.
12163 (Output_section::add_input_section): Always add an Input_section if
12164 relaxing.
12165 (Output_section::add_merge_input_section): Add assert.
12166 (Output_section::relax_input_section): New method definition.
12167 (Output_section::set_final_data_size): Set load address to zero for
12168 an unallocated section.
12169 (Output_section::do_address_and_file_offset_have_reset_values):
12170 New method definition.
12171 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12172 Handle relaxed input section.
12173 (Output_section::sort_attached_input_sections): Checkpoint input
12174 section list lazily.
12175 (Output_section::get_input_sections): Change type of input_sections to
12176 list of Simple_input_section pointers. Checkpoint input section list
12177 lazily. Also handle relaxed input sections.
12178 (Output_section::add_input_section_for_script): Take a reference to
12179 a Simple_input_section object instead of Relobj pointer and section
12180 index as parameter. Handle relaxed input sections.
12181 (Output_section::save_states, Output_section::restore_states): New
12182 method definitions.
12183 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12184 (Output_data::is_data_size_fixed): New method definition.
12185 (Output_data::reset_addresss_and_file_offset): Do not reset data size
12186 if it is fixed.
12187 (Output_data::address_and_file_offset_have_reset_values): New method
12188 definition.
12189 (Output_data::do_address_and_file_offset_have_reset_values): New method
12190 definition.
12191 (Output_data::set_data_size): Check that data size is not fixed.
12192 (Output_data::fix_data_size): New method definition.
12193 (Output_data::is_data_size_fixed_): New data member.
12194 (Output_section_headers::set_final_data_size): New method definition.
12195 (Output_section_headers::do_size): New method declaration.
12196 (Output_segment_headers::set_final_data_size): New method definition.
12197 (Output_segment_headers::do_size): New method declaration.
12198 (Output_file_header::set_final_data_size)::New method definition.
12199 (Output_file_header::do_size)::New method declaration.
12200 (Output_section_data::Output_section_data): Add new parameter
12201 is_data_size_fixed and use it to fix data size.
12202 (Output_data_const::Output_data_const): Adjust call to base class
12203 constructor and fix data size.
12204 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12205 base class constructor and fix data size.
12206 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12207 base class constructor and fix data size.
12208 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12209 class constructor and fix data size.
12210 (Output_data_group::set_final_data_size): New method definition.
12211 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12212 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12213 class constructor and fix data size.
12214 (Output_relaxed_input_section): New class definition.
12215 (Output_section::Simple_input_section): New class definition.
12216 (Output_section::get_input_sections): Adjust parameter list.
12217 (Output_section::add_input_section_for_script): Same.
12218 (Output_section::save_states, Output_section::restore_states,
12219 Output_section::do_address_and_file_offset_have_reset_values,
12220 (Output_section::Input_section::Input_section): Handle
12221 RELAXED_INPUT_SECTION_CODE. Add new overload for
12222 Output_relaxed_input_section.
12223 (Output_section::Input_section::is_input_section,
12224 Output_section::Input_section::set_output_section): Handle relaxed
12225 input section.
12226 (Output_section::Input_section::is_relaxed_input_section,
12227 Output_section::Input_section::output_section_data,
12228 Output_section::Input_section::relaxed_input_section): New method
12229 definitions.
12230 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12231 value.
12232 (Output_section::Input_section::u1_): Update comments.
12233 (Output_section::Input_section::u2_): Add new union member poris.
12234 (Output_section::Checkpoint_output_section): New classs definition.
12235 (Output_section::relax_input_section): New method declaration.
12236 (Output_section::checkpoint_): New data member.
12237 (Output_segment): Update comments.
12238 (Output_segment::Output_segment): Un-privatize copy constructor.
12239 (Output_segment::operator=): Un-privatize.
12240 * script-sections.cc (Output_section_element::Input_section_list):
12241 Change element type to Output_section::Simple_input_section.
12242 (Output_section_element_dot_assignment::set_section_addresses):
12243 Register output section data for relaxation clean up.
12244 (Output_data_exression::Output_data_expression): Adjust call to base
12245 constructor to fix data size.
12246 (Output_section_element_data::set_section_addresses): Register
12247 Output_data_expression object for relaxation clean up.
12248 (struct Input_section_info): Replace Relobj pointer and section index
12249 pair with Output_section::Simple_input_section and Convert struct to a
12250 class.
12251 (Input_section_sorter::operator()): Adjust access to
12252 Input_section_info data member to use accessors.
12253 (Output_section_element_input::set_section_addresses): Use layout
12254 parameter. Adjust code to use Output_section::Simple_input_section
12255 and Input_secction_info classes. Register filler for relaxation
12256 clean up.
12257 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12258 and section index pair with Output_section::Simple_input_section
12259 class. Adjust code accordingly.
12260 (Phdrs_element::release_segment): New method definition.
12261 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12262 segment list.
12263 (Script_sections::release_segments): New method definition.
12264 * gold/script-sections.h (Script_sections::release_segments): New
12265 method declaration.
12266 * gold/target.h (Target::may_relax, Target::relax,
12267 Target::do_may_relax, Target::do_relax): New method definitions.
12268
12269 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
12270
12271 * arm.cc (has_signed_unsigned_overflow): New function.
12272 (Arm_relocate_functions::abs8): New function.
12273 (Target_arm::Scan::local): Handle R_ARM_ABS8.
12274 (Target_arm::Scan::global): Likewise.
12275 (Target_arm::relocate::relocate): Likewise.
12276 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12277 Likewise.
12278
12279 2009-09-16 Cary Coutant <ccoutant@google.com>
12280
12281 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12282 * testsuite/Makefile.in: Regenerate.
12283
12284 2009-09-11 Nick Clifton <nickc@redhat.com>
12285
12286 * po/gold.pot: Updated by the Translation project.
12287
12288 2009-09-08 Cary Coutant <ccoutant@google.com>
12289
12290 * output.cc (Output_file::open): Add execute permission to empty file.
12291 * testsuite/Makefile.am (permission_test): New test.
12292 * testsuite/Makefile.in: Regenerate.
12293
12294 2009-09-02 Ian Lance Taylor <iant@google.com>
12295
12296 * output.cc (Output_file::resize): Call map_no_anonymous rather
12297 than map.
12298
12299 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
12300
12301 * gold.cc: Include "incremental.h".
12302 (queue_initial_tasks): Call Incremental_checker methods.
12303 * incremental.cc: Include "output.h".
12304 (Incremental_checker::can_incrementally_link_output_file): New
12305 method.
12306 * incremental.h (Incremental_checker): New class.
12307
12308 * output.cc (Output_file::open_for_modification): New method.
12309 (Output_file::map_anonymous): Changed return type to bool. Record
12310 map in base_ field.
12311 (Output_file::map_no_anonymous): New method, broken out of map.
12312 (Output_file::map): Use map_no_anonymous and map_anonymous.
12313 * output.h (class Output_file): Update declarations.
12314
12315 2009-08-24 Cary Coutant <ccoutant@google.com>
12316
12317 * options.h (Command_line::Pre_options): New class.
12318 (Command_line::pre_options): New member.
12319 * options.cc (gold::options::ready_to_register): New variable.
12320 (One_option::register_option): Do nothing if not registering options.
12321 Assert if same short option registered twice.
12322 (General_options::General_options): Turn off option registration when
12323 done constructing.
12324 (Command_line::Pre_options::Pre_options): New constructor.
12325
12326 2009-08-24 Cary Coutant <ccoutant@google.com>
12327
12328 * options.h (General_options::no_keep_memory): Remove incorrect
12329 short option.
12330
12331 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12332
12333 * Makefile.am (am__skiplex, am__skipyacc): New.
12334 * Makefile.in: Regenerate.
12335
12336 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
12337
12338 * Makefile.am (AM_CPPFLAGS): Renamed from ...
12339 (INCLUDES): ... this.
12340 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12341 (AM_CPPFLAGS): Renamed from ...
12342 (INCLUDE): ... this.
12343 * Makefile.in, testsuite/Makefile.in: Regenerate.
12344
12345 * Makefile.in: Regenerate.
12346 * aclocal.m4: Likewise.
12347 * config.in: Likewise.
12348 * configure: Likewise.
12349 * testsuite/Makefile.in: Likewise.
12350
12351 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12352 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12353 * Makefile.in: Regenerate.
12354 * testsuite/Makefile.in: Regenerate.
12355
12356 2009-08-19 Cary Coutant <ccoutant@google.com>
12357
12358 * resolve.cc (Symbol_table::resolve): Don't complain about defined
12359 symbols in shared libraries overridden by hidden or internal symbols
12360 in the main program.
12361
12362 2009-08-19 Chris Demetriou <cgd@google.com>
12363
12364 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12365 checking source file names in error messages.
12366
12367 2009-08-18 Doug Kwan <dougkwan@google.com>
12368
12369 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12370 an elcpp::Ehdr as parameter. Adjust call to set_target.
12371 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12372 an elfcpp::Ehdr as parameter.
12373 * object.cc (Object::set_target): Remove the version that looks up
12374 a target and sets it.
12375 (Sized_relobj::setup): Take a Target object instead of
12376 an elfcpp::Ehdr as parameter. Adjust call to set_target.
12377 (make_elf_sized_object): Find target and ask target to
12378 make an ELF object.
12379 * object.h: (Object::set_target): Remove the version that looks up
12380 a target and sets it.
12381 (Sized_relobj::setup): Take a Target object instead of
12382 an elfcpp:Ehdr as parameter.
12383 * target.cc: Include dynobj.h.
12384 (Target::do_make_elf_object_implementation): New.
12385 (Target::do_make_elf_object): New.
12386 * target.h (Target::make_elf_object): New template declaration.
12387 (Target::do_make_elf_object): New method declarations.
12388 (Target::do_make_elf_object_implementation): New template declaration.
12389
12390 2009-08-14 Ian Lance Taylor <iant@google.com>
12391
12392 * gold.h (FUNCTION_NAME): Define.
12393 (gold_unreachable): Use FUNCTION_NAME.
12394
12395 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12396
12397 * icf.cc (Icf::find_identical_sections): Issue a warning when a
12398 symbol in the --keep-unique list is not found.
12399
12400 2009-08-12 Sriraman Tallam <tmsriram@google.com>
12401
12402 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12403 been maked as --keep-unique.
12404 (Icf::unfold_section): New function.
12405 * icf.h (Icf::unfold_section): New function.
12406 * options.h (General_options::keep_unique): New option.
12407 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12408 * testsuite/Makefile.in: Regenerate.
12409 * testsuite/icf_keep_unique_test.sh: New file.
12410 * testsuite/icf_keep_unique_test.cc: New file.
12411
12412 2009-08-12 Cary Coutant <ccoutant@google.com>
12413
12414 PR 10471
12415 * resolve.cc (Symbol_table::resolve): Check for references from
12416 dynamic objects to hidden and internal symbols.
12417 * testsuite/Makefile.am (hidden_test.sh): New test.
12418 * testsuite/Makefile.in: Regenerate.
12419 * testsuite/hidden_test.sh: New script.
12420 * testsuite/hidden_test_1.c: New test source.
12421 * testsuite/hidden_test_main.c: New test source.
12422
12423 2009-08-11 Doug Kwan <dougkwan@google.com>
12424
12425 * arm.cc: Update comments.
12426 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12427 segment to locate the .ARM.exidx section if present.
12428
12429 2009-08-09 Doug Kwan <dougkwan@google.com>
12430
12431 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12432 patch.
12433
12434 2009-08-07 Sriraman Tallam <tmsriram@google.com>
12435 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12436 compiler warnings.
12437
12438 2009-08-06 Sriraman Tallam <tmsriram@google.com>
12439
12440 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12441 valid tls_segment only for non-debug-section relocations.
12442 * testsuite/Makefile.am: Add gc_tls_test.
12443 * testsuite/Makefile.in: Regenerate.
12444 * testsuite/gc_tls_test.cc: New file.
12445 * testsuite/gc_tls_test.sh: New file.
12446
12447 2009-08-05 Sriraman Tallam <tmsriram@google.com>
12448
12449 * icf.cc: New file.
12450 * icf.h: New file.
12451 * Makefile.am (CCFILES): Add icf.cc.
12452 (HFILES): Add icf.h
12453 * Makefile.in: Regenerate.
12454 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12455 * gc.h (gc_process_relocs): Populate lists used by icf to contain
12456 section, symbol and addend information for the relocs.
12457 * gold.cc (queue_middle_tasks): Call identical code folding.
12458 * gold.h: Add defines for multimap.
12459 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12460 to the call of finalize_local_symbols.
12461 * main.cc (main): Create object of class Icf.
12462 * object.cc (Sized_relobj::do_layout): Allow this function to be
12463 called twice during icf.
12464 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12465 to sections marked as identical by icf.
12466 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12467 when available.
12468 (Sized_relobj::do_section_entsize): New function.
12469 * object.h (Object::section_entsize): New function.
12470 (Object::do_section_entsize): New pure virtual function.
12471 (Relobj::finalize_local_symbols): Add new parameter.
12472 (Relobj::do_section_entsize): New function.
12473 * options.h (General_options::icf): New option.
12474 (General_options::icf_iterations): New option.
12475 (General_options::print_icf_sections): New option.
12476 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12477 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12478 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12479 icf.
12480 * symtab.cc (Symbol_table::is_section_folded): New function.
12481 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
12482 to sections marked as identical by icf.
12483 * symtab.h (Symbol_table::set_icf): New function.
12484 (Symbol_table::icf): New function.
12485 (Symbol_table::is_section_folded): New function.
12486 (Symbol_table::icf_): New data member.
12487 * target-reloc.h (relocate_section): Ignore sections folded by icf.
12488 * testsuite/Makefile.am: Add commands to build icf_test.
12489 * testsuite/Makefile.in: Regenerate.
12490 * testsuite/icf_test.sh: New file.
12491 * testsuite/icf_test.cc: New file.
12492
12493 2009-07-24 Chris Demetriou <cgd@google.com>
12494
12495 * layout.cc (is_compressible_debug_section): Fix incorrect
12496 comment about compressed section names.
12497
12498 2009-07-20 Ian Lance Taylor <ian@airs.com>
12499
12500 PR 10419
12501 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12502
12503 2009-07-16 Ian Lance Taylor <iant@google.com>
12504
12505 PR 10400
12506 * layout.h: #include <map>.
12507 (class Kept_section): Change from struct to class. Add accessors
12508 and setters. Add section size to Comdat_group mapping. Change
12509 Comdat_group to std::map. Add is_comdat_ field. Add
12510 linkonce_size field in union.
12511 (class Layout): Update declaration of find_or_add_kept_section.
12512 Don't declare find_kept_object.
12513 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12514 parameter. Add object, shndx, is_comdat, and is_group_name
12515 parameters. Change all callers. Adjust for new Kept_section.
12516 (Layout::find_kept_object): Remove.
12517 * object.cc (Sized_relobj::include_section_group): Update use of
12518 Kept_section. Rename secnum to shndx. Only record
12519 Kept_comdat_section if sections are the same size.
12520 (Sized_relobj::include_linkonce_section): Update use of
12521 Kept_section. Only record Kept_comdat_section if sections are the
12522 same size. Set size of linkonce section.
12523 (Sized_relobj::map_to_kept_section): Update call to
12524 get_kept_comdat_section.
12525 * object.h (class Sized_relobj): Rename fields in
12526 Kept_comdat_section to drop trailing underscores; change object
12527 field to Relobj*. Change Kept_comdat_section_table to store
12528 struct rather than pointer.
12529 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12530 Add kept_object and kept_shndx parameters. Change all callers.
12531 (Sized_relobj::get_kept_comdat_section): Change return type to
12532 bool. Add kept_object and kept_shndx parameters. Change all
12533 callers.
12534 * plugin.cc (Pluginobj::include_comdat_group): Update call to
12535 Layout::find_or_add_kept_section.
12536
12537 2009-07-09 Ian Lance Taylor <iant@google.com>
12538
12539 * merge.cc (Object_merge_map::initialize_input_to_output_map):
12540 Reserve space in the hash table.
12541
12542 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
12543
12544 * fileread.cc (File_read::get_mtime): New method.
12545 * fileread.h (Timespec): New structure.
12546 (File_read::get_mtime): New method.
12547 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12548 Renamed from timestamp_nsec.
12549 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12550 Elf_Xword.
12551 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12552 timestamp_nsec.
12553 (Incremental_inputs::report_archive): Save mtime; style fix.
12554 (Incremental_inputs::report_obejct): Save mtime; style fix.
12555 (Incremental_inputs::report_script): Save mtime; style fix.
12556 (Incremental_inputs::finalize_inputs): Style fix.
12557 (Incremental_inputs::finalize): Style fix.
12558 (Incremental_inputs::create_input_section_data): Store inputs
12559 mtime.
12560 * incremental.h (Incremental_inputs::report_script): Add mtime
12561 argument.
12562 (Incremental_inputs::Input_info::Input_info): Intialize only one
12563 union member.
12564 (Incremental_inputs::Input_info::archive): Move to nameless
12565 union.
12566 (Incremental_inputs::Input_info::obejct): Move to nameless union.
12567 (Incremental_inputs::Input_info::script): Move to nameless union.
12568 (Incremental_inputs::mtime): New field.
12569 * script.cc (read_input_script): Pass file mtime to
12570 Incremental_input.
12571 * script.h (Script_info::inputs): Style fix.
12572
12573 2009-07-01 Ian Lance Taylor <ian@airs.com>
12574
12575 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12576 instead of 32.
12577
12578 2009-06-24 Ian Lance Taylor <iant@google.com>
12579
12580 PR 10156
12581 * layout.cc (Layout::choose_output_section): If we find an
12582 existing section, update the flags.
12583 (Layout::create_notes): New function, broken out of
12584 Layout::finalize.
12585 (Layout::finalize): Don't create note sections.
12586 (Layout::create_note): Don't crash if linker script discards
12587 section.
12588 (Layout::create_gold_note): Likewise.
12589 (Layout::create_build_id): Likewise. Don't set
12590 after_input_sections on the section.
12591 (Layout::create_executable_stack_info): Remove target parameter.
12592 Change caller.
12593 * layout.h (class Layout): Declare create_notes. Update
12594 declaration of create_executable_stack_info.
12595 * gold.cc (queue_middle_tasks): Call create_notes.
12596 * output.cc (Output_section::update_flags_for_input_section): Move
12597 here from output.h. If SHF_ALLOC flag is newly set, mark address
12598 invalid.
12599 * output.h (Output_data::mark_address_invalid): New function.
12600 (class Output_section): Only declare, not define,
12601 update_flags_for_input_section. Remove set_flags.
12602
12603 2009-06-24 Ian Lance Taylor <iant@google.com>
12604
12605 * script-sections.cc (Output_section_definition::
12606 set_section_addresses): Rename shadowing local load_address to
12607 laddr.
12608
12609 2009-06-24 Ian Lance Taylor <iant@google.com>
12610
12611 PR 10244
12612 * reloc.cc (relocate_sections): Skip empty relocation sections.
12613
12614 2009-06-23 Ian Lance Taylor <iant@google.com>
12615
12616 PR 10156
12617 * layout.cc (Layout::create_note): Use choose_output_section
12618 rather than make_output_section.
12619
12620 2009-06-23 Ian Lance Taylor <iant@google.com>
12621
12622 PR 10237
12623 * options.cc (General_options::parse_V): Set printed_version_.
12624 (General_options::General_options): Initialize printed_version_.
12625 * options.h (class General_options): Add printed_version_ field.
12626 * gold.cc (queue_initial_tasks): If there are no input files,
12627 don't give a fatal error if we printed the version information.
12628 (queue_middle_tasks): If using -r with a shared object, give a
12629 fatal error rather than an ordinary error.
12630
12631 2009-06-23 Ian Lance Taylor <iant@google.com>
12632
12633 PR 10219
12634 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12635 (Layout::make_output_section): Set have_stabstr_section_ if we see
12636 a .stab*str section.
12637 (Layout::finalize): Call link_stabs_sections.
12638 (Layout::link_stabs_sections): New file.
12639 * layout.h (class Layout): Add have_stabstr_section_ field.
12640 Declare link_stabs_sections.
12641
12642 2009-06-23 Doug Kwan <dougkwan@google.com>
12643
12644 * Makefile.am (libgold_a_LIBADD): New.
12645 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12646 * Makefile.in: Regenerate.
12647 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12648 * configure: Regenerate.
12649 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12650 * fileread.cc: Include sys/state.h
12651 * gold.h: Declare memmem and strndup if found missing.
12652 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12653
12654 2009-06-23 Ian Lance Taylor <iant@google.com>
12655
12656 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12657 * configure: Rebuild.
12658
12659 2009-06-23 Ian Lance Taylor <iant@google.com>
12660
12661 PR 10147
12662 * object.cc (Object::section_contents): Don't try to get a view if
12663 the section has length zero.
12664 (Object::handle_gnu_warning_section): If the section is empty, use
12665 the name of the section as the warning.
12666
12667 2009-06-23 Ian Lance Taylor <iant@google.com>
12668
12669 PR 10133
12670 * stringpool.h (class Stringpool_template): Add optimize_ field.
12671 (Stringpool_template::set_optimize): New function.
12672 * stringpool.cc (Stringpool_template::Stringpool_template):
12673 Initialize optimize_ field.
12674 (Stringpool_template::set_string_offsets): Test local optimize
12675 fild rather than parameter.
12676 * layout.cc (Layout::Layout): Call set_optimize on the section
12677 name stringpool.
12678
12679 2009-06-22 Ian Lance Taylor <iant@google.com>
12680
12681 PR 10030
12682 * yyscript.y: Parse TARGET.
12683 * script.cc (script_set_target): New function.
12684 * script-c.h (script_set_target): Declare.
12685 * options.cc (General_options::string_to_object_format): Rename
12686 from string_to_object_format in anonymous namespace. Change
12687 callers.
12688 * options.h (class General_options): Declare
12689 string_to_object_format.
12690
12691 2009-06-22 Ian Lance Taylor <iant@google.com>
12692
12693 * script-sections.cc (Script_sections::create_segments): Don't put
12694 program headers in a PT_LOAD segment if -n or -N.
12695
12696 2009-06-22 Ian Lance Taylor <iant@google.com>
12697
12698 PR 10141
12699 * options.h (class General_options): Add -z lazy and -z now. Sort
12700 -z options into alphabetical order.
12701 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12702
12703 2009-06-21 Ian Lance Taylor <iant@google.com>
12704
12705 * layout.cc (Layout::make_output_section): Call
12706 Target::new_output_section.
12707 (Layout::attach_allocated_section_to_segment): Put large section
12708 sections in a separate load segment with the large segment flag
12709 set.
12710 (Layout::segment_precedes): Sort large data segments after other
12711 load segments.
12712 (align_file_offset): New static function.
12713 (Layout::set_segment_offsets): Use align_file_offset.
12714 * output.h (class Output_section): Add is_small_section_ and
12715 is_large_section_ fields.
12716 (Output_section::is_small_section): New function.
12717 (Output_section::set_is_small_section): New function.
12718 (Output_section::is_large_section): New function.
12719 (Output_section::set_is_large_section): New function.
12720 (Output_section::is_large_data_section): New function.
12721 (class Output_segment): Add is_large_data_segment_ field.
12722 (Output_segment::is_large_data_segment): New function.
12723 (Output_segment::set_is_large_data_segment): New function.
12724 * output.cc (Output_section::Output_section): Initialize new
12725 fields.
12726 (Output_segment::Output_segment): Likewise.
12727 (Output_segment::add_output_section): Add assertion that large
12728 data sections always go in large data segments. Force small data
12729 sections to the end of the list of data sections. Force small BSS
12730 sections to the start of the list of BSS sections. For large BSS
12731 sections to the end of the list of BSS sections.
12732 * symtab.h (class Symbol): Declare is_common_shndx.
12733 (Symbol::is_defined): Check Symbol::is_common_shndx.
12734 (Symbol::is_common): Likewise.
12735 (class Symbol_table): Define enum Commons_section_type. Update
12736 declarations. Add small_commons_ and large_commons_ fields.
12737 * symtab.cc (Symbol::is_common_shndx): New function.
12738 (Symbol_table::Symbol_table): Initialize new fields.
12739 (Symbol_table::add_from_object): Put small and large common
12740 symbols in the right list.
12741 (Symbol_table::sized_finalized_symbol): Check
12742 Symbol::is_common_shndx.
12743 (Symbol_table::sized_write_globals): Likewise.
12744 * common.cc (Symbol_table::do_allocate_commons): Allocate new
12745 common symbol lists. Don't call do_allocate_commons_list if the
12746 list is empty.
12747 (Symbol_table::do_allocate_commons_list): Remove is_tls
12748 parameter. Add comons_section_type parameter. Change all
12749 callers. Handle small and large common symbols.
12750 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12751 Symbol::is_common_shndx.
12752 * resolve.cc (symbol_to_bits): Likewise.
12753 * target.h (Target::small_common_shndx): New function.
12754 (Target::small_common_section_flags): New function.
12755 (Target::large_common_shndx): New function.
12756 (Target::large_common_section_flags): New function.
12757 (Target::new_output_section): New function.
12758 (Target::Target_info): Add small_common_shndx, large_common_shndx,
12759 small_common_section_flags, and large_common_section_flags
12760 fields.
12761 (Target::do_new_output_section): New virtual function.
12762 * arm.cc (Target_arm::arm_info): Initialize new fields.
12763 * i386.cc (Target_i386::i386_info): Likewise.
12764 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12765 Likewise.
12766 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12767 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12768 (Target_x86_64::do_new_output_section): New function.
12769 * configure.ac: Define conditional MCMODEL_MEDIUM.
12770 * testsuite/Makefile.am (check_PROGRAMS): Add large.
12771 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12772 (large_LDFLAGS): Define.
12773 * testsuite/large.c: New file.
12774 * testsuite/testfile.cc (Target_test::test_target_info):
12775 Initialize new fields.
12776 * configure, testsuite/Makefile.in: Rebuild.
12777
12778 2009-06-05 Doug Kwan <dougkwan@google.com>
12779
12780 * Makefile.am (CCFILES): Add target.cc.
12781 * Makefile.in: Regenerate.
12782 * i386.cc (class Target_i386): Define new virtual method to
12783 override do_is_local_label_name in parent.
12784 * object.cc (Sized_relobj::do_count_local_symbols): Discard
12785 local symbols if --discard-locals or -X is given.
12786 * options.h (class General_options): Declare new options
12787 '--discard-locals' and '-X' for discarding locals.
12788 * target.h (class Target): Define new methods is_local_label_name.
12789 Declare new virtual method do_is_local_label_name.
12790 * target.cc: New file.
12791 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12792 (check_SCRIPTS): Add discard_locals_test.sh.
12793 (check_DATA): Add discard_local_tests.syms.
12794 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12795 (discard_local_tests.syms, discard_locals_test.o): New make rules.
12796 * testsuite/Makefile.in: Regenerate.
12797 * testsuite/discard_locals_test.c: New file.
12798 * testsuite/discard_locals_test.sh: Same.
12799
12800 2009-06-05 Doug Kwan <dougkwan@google.com>
12801
12802 * object.cc (Sized_relobj::Sized_relobj): Initialize
12803 discarded_eh_frame_shndx_ to -1U.
12804 (Sized_relobj::do_layout): Record index of a discard .eh_frame
12805 section.
12806 (Sized_relobj::do_count_local_symbols): Skip local symbols in
12807 a discarded .eh_frame section.
12808 (Sized_relobj::do_finalize_local_symbols): Ditto.
12809 * object.h (class Sized_relobj): Declare new member
12810 discarded_eh_frame_shndx_.
12811 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12812 (local_labels_test.o, local_labels_test): New rules.
12813 * testsuite/Makefile.in: Regenerate.
12814
12815 2009-06-04 Doug Kwan <dougkwan@google.com>
12816
12817 * layout.cc (Layout::section_name_mapping): Add mapping for
12818 special ARM sections.
12819
12820 2009-06-03 Doug Kwan <dougkwan@google.com>
12821
12822 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12823 (utils::has_overflow): Same.
12824
12825 2009-06-03 Ian Lance Taylor <iant@google.com>
12826
12827 * layout.cc (Layout::section_name_mapping): New array, replacing
12828 Layout::linkonce_mapping.
12829 (Layout::section_name_mapping_count): New variable, replacing
12830 Layout::linkonce_mapping_count.
12831 (Layout::linkonce_output_name): Remove.
12832 (Layout::output_section_name): Rewrite.
12833 * layout.h (class Layout): Rename Linkonce_mapping to
12834 Section_name_mapping, linkonce_mapping to section_name_mapping,
12835 linkonce_mapping_count to section_name_mapping_count. Don't
12836 declare linkonce_output_name.
12837
12838 2009-06-03 Doug Kwan <dougkwan@google.com>
12839
12840 * gold/arm.cc (namespace utils): New.
12841 (Target_arm::reloc_is_non_pic): Define new method.
12842 (class Arm_relocate_functions): New.
12843 (Target_arm::Relocate::relocate): Handle relocation types used by
12844 Android.
12845
12846 2009-06-03 Ian Lance Taylor <iant@google.com>
12847
12848 * arm.cc (Target_arm::scan::global): Use || instead of |.
12849
12850 2009-06-02 Doug Kwan <dougkwan@google.com>
12851
12852 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
12853 issued_non_pic_error_.
12854 (class Target_arm::Scan): Declare new method check_non_pic.
12855 Define new method symbol_needs_plt_entry.
12856 Declare new data member issued_non_pic_error_.
12857 (class Target_arm::Relocate): Declare new method
12858 should_apply_static_reloc.
12859 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12860 (Target_arm::Scan::check_non_pic): Define new method.
12861 (Target_arm::Scan::local): Handle a small subset of reloc types used
12862 by Android.
12863 (Target_arm::Scan::local): Same.
12864 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12865
12866 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
12867
12868 * incremental.cc (Incremental_inputs::report_command_line): Filter
12869 out --incremental-* options.
12870
12871 2009-05-29 Doug Kwan <dougkwan@google.com>
12872
12873 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12874 template class.
12875 (class Target_arm): Update comment.
12876 (Target_arm::Target_arm): Initialize new data members GOT_,
12877 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12878 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12879 and Target_arm::rel_dyn_section.
12880 Declare new_enum Target_arm::Got_type.
12881 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12882 and DYNBSS_.
12883 Update commments for member do_dynsym_value.
12884 (Target_arm::got_size, Target_arm::plt_section,
12885 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12886 new methods inside class defintion.
12887 (Target_arm::got_section): Define new method.
12888 (Target_arm::rel_dyn_section): Same.
12889 (Output_data_plt_arm): New template class.
12890 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12891 (Output_data_plt_arm:do_adjust_output_section): Define new method.
12892 (Output_data_plt_arm::add_entry): Same.
12893 (Output_data_plt_arm::first_plt_entry): Define new
12894 static data member for PLT instruction template.
12895 (Output_data_plt_arm::plt_entry): Same.
12896 (Output_data_plt_arm::do_write): Define new method.
12897 (Target_arm::make_plt_entry): Same.
12898 (Target_arm::do_finalize_sections): Same.
12899 (Target_arm::do_dynsym_value): Same.
12900
12901 2009-05-28 Doug Kwan <dougkwan@google.com>
12902
12903 * Makefile.am (TARGETSOURCES): Add arm.cc.
12904 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12905 * Makefile.in: Regenerate.
12906 * arm.cc: New file.
12907 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12908
12909 2009-05-26 Doug Kwan <dougkwan@google.com>
12910
12911 * options.cc (General_options::parse_exclude_libs). Fix a comment.
12912 (General_options::check_excluded_libs): Strip off directories in
12913 archive name before matching like GNU ld does.
12914 * testsuite/Makefile.am (MOSTLYCLEANFILES,
12915 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12916 (exclude_libs_test_LDFLAGS): Add linker option
12917 -Wl,--exclude-libs,libexclude_libs_test_3
12918 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12919 an explicit archive without using -l.
12920 (alt/libexclude_libs_test_3.a): New make rule.
12921 * testsuite/Makefile.in: Regenerate.
12922 * testsuite/exclude_libs_test.c : Declare lib3_default().
12923 (main): Call it.
12924 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12925 * exclude_libs_test_3.c: New file.
12926
12927 2009-05-26 Nick Clifton <nickc@redhat.com>
12928
12929 * po/id.po: New Indonesian translation.
12930 * po/gold.pot: Updated template file.
12931
12932 2009-05-22 Sriraman Tallam <tmsriram@google.com>
12933
12934 * testsuite/Makefile.am: Add -ffunction-sections to compile
12935 gc_comdat_test files. Add -Wl,--gc-sections to build
12936 gc_comdat_test.
12937 * testsuite/Makefile.in: Regenerate.
12938 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12939
12940 2009-05-21 Sriraman Tallam <tmsriram@google.com>
12941
12942 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12943 kept comdat section was garbage collected.
12944 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12945 * testsuite/Makefile.in: Regenerate.
12946 * testsuite/gc_comdat_test.sh: New file.
12947 * testsuite/gc_comdat_test_1.cc: New file.
12948 * testsuite/gc_comdat_test_2.cc: New file.
12949
12950 2009-05-19 Doug Kwan <dougkwan@google.com>
12951
12952 * archive.cc (Archive::Archive): Move constructor from archive.h
12953 to here. Initialize no_export_.
12954 (Archive::get_elf_object_for_member): Set no_export flag of object.
12955 * archive.h (Archive::Archive): Move constructor body to
12956 archive.cc.
12957 (Archive::no_export): New method.
12958 (Archive::no_export_): New field.
12959 * object.h (Object::Object): Initialize no_export_ to false.
12960 (Object::no_export, Object::set_no_export): New methods.
12961 (Object::no_export_): New field.
12962 * options.cc (General_options::parse_exclude_libs): New method.
12963 (General_options::check_excluded_libs) Same.
12964 * options.h (exclude_libs): New option.
12965 (General_options::check_excluded_libs): New method declaration.
12966 (General_options::excluded_libs_): New field.
12967 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12968 default or protected visibility if an object has no-export flag set.
12969 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12970 (check_SCRIPTS): Add exclude_libs_test.sh.
12971 (check_DATA): Add exclude_libs_test.syms.
12972 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12973 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12974 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12975 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12976 (exclude_libs_test.syms, libexclude_libs_test_1.a,
12977 libexclude_libs_test_2.a): New rules.
12978 * testsuite/Makefile.in: Regenerate.
12979 * testsuite/exclude_libs_test.c: New file.
12980 * testsuite/exclude_libs_test.sh: Ditto.
12981 * testsuite/exclude_libs_test_1.c: Ditto.
12982 * testsuite/exclude_libs_test_2.c: Ditto.
12983
12984 2009-05-15 Ian Lance Taylor <iant@google.com>
12985
12986 * configure.ac: Check for declarations for cases where libiberty.h
12987 checks HAVE_DECL_xxx.
12988 * configure, config.in: Rebuild.
12989
12990 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
12991
12992 * gold.h (Incremental_argument_list): Remove (invalid) forward
12993 declaration.
12994 * incremental.cc (Incremental_inputs::report_achive): New method.
12995 (Incremental_inputs::report_object): New method.
12996 (Incremental_inputs::report_script): New method.
12997 (Incremental_inputs::finalize_inputs): New method.
12998 (Incremental_inputs::finalize): Call finalize_inputs().
12999 (Incremental_inputs::sized_create_incremental_inputs_section_data):
13000 Create inputs entries.
13001 * incremental.h (Incremental_input_type): New enum.
13002 (Incremental_inputs::Incremental_input): Initialize new fields.
13003 (Incremental_inputs::report_inputs): New method.
13004 (Incremental_inputs::report_achive): New method.
13005 (Incremental_inputs::report_object): New method.
13006 (Incremental_inputs::report_script): New method.
13007 (Incremental_inputs::finalize_inputs): New method.
13008 (Incremental_inputs::Input_info): New struct.
13009 (Incremental_inputs::Input_info_map): New typedef.
13010 (Incremental_inputs::lock_): New field.
13011 (Incremental_inputs::Inputs_): New field.
13012 (Incremental_inputs::Inputs_map): New field.
13013 * main.cc (main): Call Incremental_input::report_inputs.
13014 * options.h (Input_argument_list): Typedef moved from
13015 Input_arguments.
13016 (Input_file_group::Files): Remove, use ::Input_argument_list.
13017 (Input_file_group::Input_argument_list): Remove, use
13018 ::Input_argument_list.
13019 * plugin.cc (Plugin_manager::add_input_file): Add error in
13020 incremental build.
13021 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13022 functions.
13023 * script.cc (read_input_script): Call
13024 Incremental_input::report_script.
13025 * script.h (Script_info): New class.
13026
13027 2009-04-27 Ian Lance Taylor <iant@google.com>
13028
13029 * x86_64.cc (do_adjust_output_section): Set entsize to
13030 plt_entry_size.
13031
13032 2009-04-23 Elliott Hughes <enh@google.com>
13033
13034 * output.cc (Output_file::close): After short writes, continue
13035 writing from the correct offset in the buffer being written.
13036
13037 2009-04-23 Chris Demetriou <cgd@google.com>
13038
13039 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13040 * configure: Regenerate.
13041 * config.in: Regenerate.
13042 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13043 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13044
13045 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
13046
13047 * incremental.cc (Incremental_inputs_header_data): Renamed from
13048 Incremental_input_header_data.
13049 (Incremental_inputs_header_data::data_size): New field.
13050 (Incremental_inputs_header_data::put_input_file_count): Renamed
13051 from input_file_count.
13052 (Incremental_inputs_header_data::put_command_line_offset): Renamed
13053 from command_line_offset.
13054 (Incremental_inputs_header_data::put_reserved): Renamed from
13055 put_reserved.
13056 (Incremental_inputs_entry_data): Renamed from
13057 Incremental_input_entry_data.
13058 (Incremental_inputs_entry_data::data_size): New field.
13059 (Incremental_inputs::report_command_line): New method.
13060 (Incremental_inputs::finalize): New method.
13061 (Incremental_inputs::create_incremental_inputs_data): New method.
13062 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13063 * incremental.h: New file.
13064 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13065 (Layout::finalize): Create incremental inputs section in
13066 incremental builds.
13067 (Layout::create_incremental_info_sections): New method.
13068 * layout.h (Layout::incremental_inputs): New method.
13069 (Layout::create_incremental_info_sections): New method.
13070 (Layout::incremental_inputs_): New field.
13071 * main.cc (main): Notify Incremental_input of the command line.
13072
13073 2009-04-01 Ian Lance Taylor <iant@google.com>
13074 Mikolaj Zalewski <mikolajz@google.com>
13075
13076 * gold.h (reserve_unordered_map): Define, three versions, one for
13077 each version of Unordered_map.
13078 * layout.cc (Layout::Layout): Remove options parameter. Add
13079 number_of_input_files parameter. Don't initialize options_.
13080 Initialize number_of_input_files_ and resized_signatures_. Move
13081 sections_are_attached_.
13082 (Layout::layout_group): Reserve space for group_signatures_.
13083 (Layout::find_or_add_kept_section): Change name parameter to be a
13084 reference. Resize signatures_ map when it gets large enough.
13085 (Layout::layout_eh_frame): Use parameters->options() instead of
13086 this->options_.
13087 (Layout::make_output_section): Likewise.
13088 (Layout::attach_allocated_section_to_segment): Likewise.
13089 (Layout::finalize, Layout::create_executable_stack): Likewise.
13090 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13091 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13092 * layout.h (class Layout): Update declarations. Remove options_
13093 field. Add number_of_input_files_ and resized_signatures_
13094 fields. Move sections_are_attached_ field.
13095 * main.cc (main): Pass number of input files to Layout
13096 constructor. Don't pass options.
13097
13098 2009-03-30 Ian Lance Taylor <iant@google.com>
13099
13100 * ffsll.c (ffsll): Correct implementation.
13101
13102 2009-03-27 Ian Lance Taylor <iant@google.com>
13103
13104 * ffsll.c: New file.
13105 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13106 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13107 * ftruncate.c (ftruncate): Declare before definition.
13108 * mremap.c (mremap): Likewise.
13109 * pread.c (pread): Likewise.
13110 * configure, Makefile.in, config.in: Rebuild.
13111
13112 * mremap.c: New file.
13113 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13114 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13115 (mremap): Declare if HAVE_MREMAP is not defined.
13116 * configure, Makefile.in, config.in: Rebuild.
13117
13118 2009-03-27 Cary Coutant <ccoutant@google.com>
13119
13120 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13121 position independent.
13122 * sparc.cc (Target_sparc::check_non_pic): Likewise.
13123 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13124
13125 2009-03-24 Cary Coutant <ccoutant@google.com>
13126
13127 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13128 an executable.
13129 (needs_dynamic_reloc): Likewise.
13130
13131 2009-03-24 Ian Lance Taylor <iant@google.com>
13132
13133 * yyscript.y (file_cmd): Recognize EXTERN.
13134 (extern_name_list, extern_name_list_body): New nonterminals.
13135 * script.cc (script_add_extern): Define.
13136 * script-c.h (script_add_extern): Declare.
13137
13138 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
13139
13140 * object.cc (is_elf_object): Define.
13141 * object.h (is_elf_object): Declare.
13142 * archive.cc (Archive::get_elf_object_for_member): Call
13143 is_elf_object.
13144 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13145
13146 2009-03-24 Elliott Hughes <enh@google.com>
13147
13148 * output.cc (Output_file::map_anonymous): Define.
13149 (Output_file::map): Use map_anonymous. If the regular mmap fails,
13150 try an anonymous one. Report the size if the mmap fails.
13151 * output.h (class Output_file): Declare map_anonymous.
13152
13153 2009-03-24 Ian Lance Taylor <iant@google.com>
13154
13155 * target-select.cc (instantiate_target): Don't acquire the lock if
13156 the instantiated_target_ field has already been set.
13157
13158 2009-03-23 Ian Lance Taylor <iant@google.com>
13159
13160 * gold-threads.h (class Initialize_lock): Define.
13161 * gold-threads.cc (class Initialize_lock_once): Define.
13162 (initialize_lock_control): New static variable.
13163 (initialize_lock_pointer): New static variable.
13164 (initialize_lock_once): New static function.
13165 (Initialize_lock::Initialize_lock): Define.
13166 (Initialize_lock::initialize): Define.
13167 * target-select.h: Include "gold-threads.h".
13168 (class Target_selector): Add lock_ and initialize_lock_ fields.
13169 Don't define instantiate_target, just declare it.
13170 * target-select.cc (Target_selector::Target_selector): Initialize
13171 new fields.
13172 (Target_selector::instantiate_target): Define.
13173 * descriptors.h: Include "gold-threads.h".
13174 (class Descriptors): Add initialize_lock_ field.
13175 * descriptors.cc (Descriptors::Descriptors): Initialize new
13176 field.
13177 (Descriptors::open): Use initialize_lock_ field
13178 * errors.h (class Errors): Add initialize_lock_ field.
13179 * errors.cc (Errors::Errors): Initialize new field.
13180 (Errors::initialize_lock): Use initialize_lock_ field.
13181 * powerpc.cc (class Target_selector_powerpc): Remove
13182 instantiated_target_ field. In do_recognize call
13183 instantiate_target rather than do_instantiate_target. In
13184 do_instantiate_target just allocate a new target.
13185 * sparc.cc (class Target_selector_sparc): Likewise.
13186
13187 * freebsd.h: New file.
13188 * i386.cc: Include "freebsd.h".
13189 (Target_i386): Derive from Target_freebsd rather than
13190 Sized_target.
13191 (Target_selector_i386): Derive from Target_selector_freebsd rather
13192 than Target_selector.
13193 * x86_64.cc: Include "freebsd.h".
13194 (Target_x86_64): Derive from Target_freebsd rather than
13195 Sized_target.
13196 (Target_selector_x86_64): Derive from Target_selector_freebsd
13197 rather than Target_selector.
13198 * target.h (class Target): Add adjust_elf_header and
13199 do_adjust_elf_header.
13200 * output.cc (Output_file_header:: do_sized_write): Call target
13201 adjust_elf_header routine.
13202 * configure.tgt: Set targ_osabi.
13203 * configure.ac: Define GOLD_DEFAULT_OSABI.
13204 * parameters.cc (Parameters::default_target): Pass
13205 GOLD_DEFAULT_OSABI to select_target.
13206 * target-select.h (class Target_selector): Make instantiate_target
13207 protected rather than private.
13208 * Makefile.am (HFILES): Add freebsd.h.
13209 * configure, Makefile.in, config.in: Rebuild.
13210
13211 * merge.cc (do_add_input_section): Correct pend value. Change
13212 message about last entry not being null terminated from error to
13213 warning.
13214
13215 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
13216
13217 * incremental.cc: New file.
13218 * Makefile.am (CCFILES): Add incremental.cc.
13219 * Makefile.in: Rebuild.
13220
13221 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
13222
13223 * layout.cc (Layout::output_section_name): Preserve names
13224 of '.note.' sections.
13225
13226 2009-03-19 Ian Lance Taylor <iant@google.com>
13227
13228 * descriptors.cc (Descriptors::open): Check that the options are
13229 valid before using them.
13230
13231 2009-03-18 Ian Lance Taylor <iant@google.com>
13232
13233 * script-sections.h: Include <list>.
13234 (class Script_sections): Change Sections_elements from std::vector
13235 to std::list. Typedef public Elements_iterator. Add
13236 orphan_section_placement_, data_segment_align_start_, and
13237 saw_data_segment_align_ fields. Remove data_segment_align_index_
13238 field.
13239 * script-sections.cc (class Orphan_section_placement): New class.
13240 (class Sections_element): Add virtual functions is_relro and
13241 orphan_section_init. Remove virtual function place_orphan_here.
13242 (class Output_section_definition): Add is_relro and
13243 orphan_section_init. Remove place_orphan_here.
13244 (class Orphan_output_section): Likewise.
13245 (Script_sections::Script_sections): Update for field changes.
13246 (Script_sections::data_segment_align): Set saw_data_segment_align_
13247 and data_segment_align_start_, not data_segment_align_index.
13248 (Script_sections::data_segment_relro_end): Check
13249 saw_data_segment_align_. Use data_segment_align_start_ rather
13250 than data_segment_align_index_.
13251 (Script_sections::place_orphan): Rewrite to use
13252 Orphan_section_placement.
13253
13254 2009-03-17 Ian Lance Taylor <iant@google.com>
13255
13256 * archive.cc (Archive::add_symbols): Check for a version attached
13257 to the symbol name in the archive map.
13258 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13259 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13260 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13261 (ver_test_11.a): New target.
13262 * testsuite/Makefile.in: Rebuild.
13263
13264 * configure.ac: Check for chsize and posix_fallocate. Replace
13265 ftruncate.
13266 * ftruncate.c: New file, from gnulib.
13267 * output.cc (posix_fallocate): Define dummy version if not
13268 HAVE_POSIX_FALLOCATE.
13269 (Output_file::map): Call posix_fallocate rather than lseek and
13270 write.
13271 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13272 * configure, Makefile.in, config.in: Rebuild.
13273
13274 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
13275
13276 * layout.h (Layout::create_note): Add section_name parameter.
13277 * layout.cc (Layout::create_note): Likewise.
13278 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13279
13280 2009-03-17 Ian Lance Taylor <iant@google.com>
13281
13282 * descriptors.cc: Include "options.h".
13283 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13284 (Descriptors::open): Always use O_CLOEXEC when opening a new
13285 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
13286 then set FD_CLOEXEC.
13287
13288 * sparc.cc (class Target_sparc): Add has_got_section.
13289 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13290 make sure we have a GOT section.
13291
13292 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13293 (Target_sparc::Scan::local): Likewise.
13294 (Target_sparc::Scan::global): Likewise.
13295 (Target_sparc::Relocate::relocate): Likewise.
13296 (Target_sparc::Relocate::relocate_tls): Likewise.
13297
13298 * symtab.cc (Symbol_table::define_default_version): New function,
13299 broken out of add_from_object.
13300 (Symbol_table::add_from_object): Call define_default_version.
13301 (Symbol_table::define_special_symbol): Add resolve_oldsym
13302 parameter. Change all callers. If the version for a symbol comes
13303 from a version script, resolve it with the symbol with the same
13304 name with no version. Also add the symbol without a version if
13305 appropriate.
13306 (do_define_in_output_data): If resolving with oldsym, don't delete
13307 sym.
13308 (do_define_in_output_segment): Likewise.
13309 (do_define_as_constant): Likewise.
13310 * symtab.h (class Symbol_table): Update declarations.
13311
13312 2009-03-13 Ian Lance Taylor <iant@google.com>
13313
13314 * readsyms.cc (Read_symbols::incompatible_warning): New function.
13315 (Read_symbols::requeue): New function.
13316 (Read_symbols::do_read_symbols): If make_elf_object fails because
13317 the target type is not configured, and the file was searched for,
13318 issue a warning and retry with the next directory.
13319 (Add_symbols::run): If the file has an incompatible format, and
13320 it was searched for, requeue the Read_symbols task. On error,
13321 release the object.
13322 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
13323 dirindex parameter to constructor. Change all callers. Declare
13324 incompatible_warning and requeue.
13325 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13326 input_argument_ and input_group_ fields. Add them to
13327 constructor. Change all callers.
13328 (class Read_script): Add dirindex_ field. Add it to constructor.
13329 Change all callers.
13330 * archive.cc (Archive::setup): Remove input_objects parameter.
13331 Change all callers.
13332 (Archive::get_file_and_offset): Likewise.
13333 (Archive::read_all_symbols): Likewise.
13334 (Archive::read_symbols): Likewise.
13335 (Archive::get_elf_object_for_member): Remove input_objects
13336 parameter. Add punconfigured parameter. Change all callers.
13337 (Archive::add_symbols): Change return type to bool. Check return
13338 value of include_member.
13339 (Archive::include_all_members): Likewise.
13340 (Archive::include_member): Change return type to bool. Return
13341 false if first included object has incompatible target. Set
13342 included_member_ field.
13343 (Add_archive_symbols::run): If add_symbols returns false, requeue
13344 Read_symbols task.
13345 * archive.h (class Archive): Add included_member_ field.
13346 Initialize it in constructor. Add input_file and searched_for
13347 methods. Update declarations.
13348 (class Add_archive_symbols): Add dirpath_, dirindex_, and
13349 input_argument_ fields. Add them to constructor. Change all
13350 callers.
13351 * script.cc: Include "target-select.h".
13352 (class Parser_closure): Add skip_on_incompatible_target_ and
13353 found_incompatible_target_ fields. Add
13354 skip_on_incompatible_target parameter to constructor. Change all
13355 callers. Add methods skip_on_incompatible_target,
13356 clear_skip_on_incompatible_target, found_incompatible_target, and
13357 set_found_incompatible_target.
13358 (read_input_script): Add dirindex parameter. Change all callers.
13359 If parser finds an incompatible target, requeue Read_symbols
13360 task.
13361 (script_set_symbol): Clear skip_on_incompatible_target in
13362 closure.
13363 (script_add_assertion, script_parse_option): Likewise.
13364 (script_start_sections, script_add_phdr): Likewise.
13365 (script_check_output_format): New function.
13366 * script.h (read_input_script): Update declaration.
13367 * script-c.h (script_check_output_format): Declare.
13368 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13369 (ignore_cmd): Remove OUTPUT_FORMAT.
13370 * fileread.cc (Input_file::Input_file): Add explicit this.
13371 (Input_file::will_search_for): New function.
13372 (Input_file::open): Add pindex parameter. Change all callers.
13373 * fileread.h (class Input_file): Add input_file_argument method.
13374 Declare will_search_for. Update declarations.
13375 * object.cc (make_elf_object): Add punconfigured parameter.
13376 Change all callers.
13377 * object.h (class Object): Make input_file public. Add
13378 searched_for method.
13379 (make_elf_object): Update declaration.
13380 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
13381 restart search.
13382 * dirsearch.h (class Dirsearch): Update declaration.
13383 * options.h (class General_options): Add --warn-search-mismatch.
13384 * parameters.cc (Parameters::is_compatible_target): New function.
13385 * parameters.h (class Parameters): Declare is_compatible_target.
13386 * workqueue.cc (Workqueue::add_blocker): New function.
13387 * workqueue.h (class Workqueue): Declare add_blocker.
13388
13389 * fileread.cc (Input_file::open): Remove options parameter.
13390 Change all callers.
13391 (Input_file::open_binary): Likewise.
13392 * script.cc (read_input_script): Likewise.
13393 * readsyms.h (class Read_symbols): Remove options_ field. Remove
13394 options parameter from constructor. Change all callers.
13395 (class Read_script): Likewise.
13396 * fileread.h (class Input_file): Update declarations.
13397 * script.h (read_input_script): Update declaration.
13398
13399 2009-03-10 Nick Clifton <nickc@redhat.com>
13400
13401 * po/es.po: New Spanish translation.
13402
13403 2009-03-06 Cary Coutant <ccoutant@google.com>
13404
13405 * options.cc (parse_short_option): Keep dash_z from registering itself.
13406
13407 2009-03-03 Ian Lance Taylor <iant@google.com>
13408
13409 PR 9918
13410 * target-reloc.h (relocate_section): Pass output_section to
13411 relocate.
13412 * i386.cc (Target_i386::should_apply_static_reloc): Add
13413 output_section parameter. Change all callers.
13414 (Target_i386::Relocate::relocate): Add output_section parameter.
13415 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13416 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13417 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13418 * testsuite/two_file_shared.sh: New script.
13419 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13420 (check_DATA): Add two_file_shared.dbg.
13421 (two_file_shared.dbg): New target.
13422 * testsuite/Makefile.in: Rebuild.
13423
13424 2009-03-01 Ian Lance Taylor <iant@google.com>
13425
13426 * configure.ac: Check for byteswap.h.
13427 * configure: Rebuild.
13428 * config.in: Rebuild.
13429
13430 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
13431
13432 * layout.cc (Layout::find_or_add_kept_section): New function.
13433 (Layout::add_comdat): Removed.
13434 * layout.h (struct Kept_section): Move out of class Layout.
13435 Remove trailing underscores from field names. Add group_sections
13436 field. Rename group_ field to is_group. Change all uses.
13437 (class Layout): Declare find_or_add_kept_section, not add_comdat.
13438 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13439 comdat_groups_ field.
13440 (Sized_relobj::include_section_group): Use
13441 find_or_add_kept_section and Kept_section::group_sections.
13442 (Sized_relobj::include_linkonce_section): Likewise.
13443 * object.cc (class Sized_relobj): Don't define Comdat_group or
13444 Comdat_group_table. Remove find_comdat_group and
13445 add_comdat_group. Remove comdat_groups_ field.
13446 * plugin.cc (include_comdat_group): Use
13447 Layout::find_or_add_kept_section.
13448
13449 2009-02-28 Ian Lance Taylor <iant@google.com>
13450
13451 * README: --gc-sections and map files are now supported. Document
13452 some build requirements.
13453
13454 PR 6992
13455 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13456 relocatable link set the value of the section symbol to zero.
13457 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13458 relocatable link don't include the section address in the local
13459 symbol value.
13460
13461 2009-02-27 Ian Lance Taylor <iant@google.com>
13462
13463 PR 6811
13464 * options.h (class Search_directory): Add is_system_directory.
13465 (class General_options): Declare is_in_system_directory.
13466 * options.cc (get_relative_sysroot): Make static.
13467 (get_default_sysroot): Make static.
13468 (General_optoins::is_in_system_directory): New function.
13469 * fileread.cc (Input_file::is_in_system_directory): New function.
13470 * fileread.h (class Input_file): Declare is_in_system_directory.
13471 * object.h (class Object): Add is_in_system_directory.
13472 (class Input_objects): Remove system_library_directory_ field.
13473 * object.cc (Input_objects::add_object): Don't set
13474 system_library_directory_.
13475 (input_objects::found_in_system_library_directory): Remove.
13476 * symtab.cc (Symbol_table::write_globals): Remove input_objects
13477 parameter. Change all callers.
13478 (Symbol_table::sized_write_globals): Likewise.
13479 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13480 Call Object::is_in_system_directory.
13481 * symtab.h (class Symbol_table): Update declarations.
13482
13483 PR 5990
13484 * descriptors.h (Open_descriptor): Add is_on_stack field.
13485 * descriptors.cc (Descriptors::open): If the descriptor is on the
13486 top of the stack, remove it. Initialize is_on_stack field.
13487 (Descriptors::release): Only add pod to stack if it is not on the
13488 stack already.
13489 (Descriptors::close_some_descriptor): Clear stack_next and
13490 is_on_stack fields.
13491
13492 PR 7091
13493 * output.cc (Output_section::find_starting_output_address): Rename
13494 from starting_output_address; add PADDR parameter; change return
13495 type.
13496 * output.h (class Output_section): Declare
13497 find_starting_output_address instead of starting_output_address.
13498 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13499 section symbol for which we can't find a merge section.
13500
13501 PR 9836
13502 * symtab.cc (Symbol_table::add_from_object): If the visibility is
13503 hidden or internal, force the symbol to be local.
13504 * resolve.cc (Symbol::override_visibility): Define.
13505 (Symbol::override_base): Use override_visibility.
13506 (Symbol_table::resolve): Likewise.
13507 (Symbol::override_base_with_special): Likewise.
13508 (Symbol_table::override_with_special): If the visibility is hidden
13509 or internal, force the symbol to be local.
13510 * symtab.h (class Symbol): Add set_visibility and
13511 override_visibility.
13512 * testsuite/ver_test_1.sh: New file.
13513 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13514 (check_DATA): Add ver_test_1.syms.
13515 (ver_test_1.syms): New target.
13516 * testsuite/Makefile.in: Rebuild.
13517
13518 2009-02-25 Cary Coutant <ccoutant@google.com>
13519
13520 * layout.cc (Layout::choose_output_section): Don't rename sections
13521 when using a linker script that has a SECTIONS clause.
13522 * Makefile.in: Regenerate.
13523
13524 * testsuite/Makefile.am (script_test_5.sh): New test case.
13525 * testsuite/Makefile.in: Regenerate.
13526 * testsuite/script_test_5.cc: New file.
13527 * testsuite/script_test_5.sh: New file.
13528 * testsuite/script_test_5.t: New file.
13529
13530 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
13531
13532 * archive.cc (Archive::include_member): Update calls to add_symbols.
13533 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13534 the Layout argument.
13535 * dynobj.h (do_add_symbols): Add the Layout argument.
13536 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13537 Layout argument.
13538 * object.h (Object::add_symbols): Add the Layout argument.
13539 (Object::do_add_symbols): Add the Layout argument.
13540 (Sized_relobj::do_add_symbols): Add the Layout argument.
13541 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13542 Unify the two versions.
13543 (Add_plugin_symbols): Remove.
13544 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13545 (Sized_pluginobj::do_add_symbols): Unify the two versions.
13546 (Add_plugin_symbols): Remove.
13547 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13548 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13549 (Add_symbols::run): Make it work with Pulginobj.
13550
13551 2009-02-06 Ian Lance Taylor <iant@google.com>
13552
13553 * object.cc (Sized_relobj::do_layout): Make info message start
13554 with lower case letter.
13555
13556 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
13557
13558 * binary.cc: Fix file comment.
13559
13560 * options.h (enum Incremental_disposition): Define.
13561 (class General_options): Add new options: --incremental,
13562 --incremental_changed, --incremental_unchanged,
13563 --incremental_unknown. Add incremental_disposition_ and
13564 implicit_incremental_ fields.
13565 (General_options::incremental_disposition): New function.
13566 (class Position_dependent_options): Add incremental_disposition
13567 option.
13568 (Position_dependent_options::copy_from_options): Set incremental
13569 dispositions.
13570 * options.cc (General_options::parse_incremental_changed): New
13571 function.
13572 (General_options::parse_incremental_unchanged): New function.
13573 (General_options::parse_incremental_unknown): New function.
13574 (General_options::General_options): Initialize new fields
13575 incremental_disposition_ and implicit_incremental_.
13576 (General_options::finalize): Check for uasge of --incremental-*
13577 without --incremental.
13578
13579 2009-02-06 Chris Demetriou <cgd@google.com>
13580
13581 * gold.h (gold_undefined_symbol): Change to take only a Symbol
13582 pointer and to report location as the file name associated with
13583 the symbol.
13584 (gold_undefined_symbol_at_location): New function to replace the
13585 old gold_undefined_symbol functionality.
13586 * target-reloc.h (relocate_section): Update to use
13587 gold_undefined_symbol_at_location.
13588 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13589 Call gold_undefined_symbol function rather than gold_error.
13590 * errors.h (Errors::undefined_symbol): Take location as a
13591 string, rather than calculating it from a relocation.
13592 * errors.cc (Errors::fatal): Print "fatal error:" before the
13593 formatted message.
13594 (Errors::error, Errors::error_at_location): Print "error: "
13595 before the formatted message.
13596 (Errors::undefined_symbol): Take location as a string, rather
13597 than calculating it from a relocation.
13598 (gold_undefined_symbol_at_location): New function akin to
13599 old gold_undefined_symbol, calculates location from relocation.
13600 (gold_undefined_symbol): Change to take only a Symbol pointer
13601 and to report location as the file name associated with the symbol.
13602 * testsuite/debug_msg.sh: Update for changed error messages.
13603 * testsuite/undef_symbol.sh: Likewise.
13604
13605 2009-02-04 Duncan Sands <baldrick@free.fr>
13606
13607 PR 9812
13608 * reduced_debug_output.h
13609 (Output_reduced_debug_abbrev_section::failed): Use format for
13610 gold_warning.
13611 (Output_reduced_debug_info_section::faild): Likewise.
13612
13613 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
13614
13615 * script.cc (Lazy_demangler): New class.
13616 (Version_script_info::get_symbol_version_helper): Demangle a
13617 symbol only once.
13618
13619 2009-01-29 Cary Coutant <ccoutant@google.com>
13620
13621 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13622 to __tls_get_addr.
13623 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13624
13625 2009-01-28 Ian Lance Taylor <iant@google.com>
13626
13627 * version.cc (version_string): Bump to 1.9.
13628
13629 * gold.h: Include <cstring> and <stdint.h>.
13630 * version.cc: Include <cstdio>.
13631 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13632 warning.
13633 * reduced_debug_output.cc (insert_into_vector): Rename from
13634 Insert_into_vector; change all callers. Use Swap_unaligned to
13635 avoid aliasing issue; remove union since it is unnecessary.
13636
13637 2009-01-27 Sriraman Tallam <tmsriram@google.com>
13638
13639 * Makefile.am (CCFILES): Add gc.cc.
13640 (HFILES): Add gc.h.
13641 * Makefile.in: Regenerate.
13642 * gold.cc (Gc_runner): New class.
13643 (queue_initial_tasks): Call garbage collection related tasks
13644 when corresponding options are invoked.
13645 (queue_middle_gc_tasks): New function.
13646 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13647 processed early before laying out sections during garbage collection.
13648 * gold.h (queue_middle_gc_tasks): New function.
13649 (is_prefix_of): Move from "layout.cc".
13650 * i386.cc (Target_i386::gc_process_relocs): New function.
13651 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13652 * main.cc (main): Create object of class "Garbage_collection".
13653 * object.cc (Relobj::copy_symbols_data): New function.
13654 (Relobj::is_section_name_included): New function.
13655 (Sized_relobj::do_layout): Allow this function to be called twice
13656 during garbage collection and defer layout of section during the
13657 first call.
13658 * object.h (Relobj::get_symbols_data): New function.
13659 (Relobj::is_section_name_included): New function.
13660 (Relobj::copy_symbols_data): New function.
13661 (Relobj::set_symbols_data): New function.
13662 (Relobj::get_relocs_data): New function.
13663 (Relobj::set_relocs_data): New function.
13664 (Relobj::is_output_section_offset_invalid): New pure virtual function.
13665 (Relobj::gc_process_relocs): New function.
13666 (Relobj::do_gc_process_relocs): New pure virtual function.
13667 (Relobj::sd_): New data member.
13668 (Sized_relobj::is_output_section_offset_invalid): New function.
13669 (Sized_relobj::do_gc_process_relocs): New function.
13670 * options.h (General_options::gc_sections): Modify to not be a no-op.
13671 (General_options::print_gc_sections): New option.
13672 * plugin.cc (Plugin_finish::run): Remove function call to
13673 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
13674 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13675 * reloc.cc (Read_relocs::run): Add task to process relocs and
13676 determine unreferenced sections when doing garbage collection.
13677 (Gc_process_relocs): New class.
13678 (Sized_relobj::do_gc_process_relocs): New function.
13679 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13680 sections that are garbage collected.
13681 * reloc.h (Gc_process_relocs): New class.
13682 * sparc.cc (Target_sparc::gc_process_relocs): New function.
13683 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13684 symbols whose corresponding sections are garbage collected.
13685 (Symbol_table::Symbol_table): Add new parameter for the garbage
13686 collection object.
13687 (Symbol_table::gc_mark_undef_symbols): New function.
13688 (Symbol_table::gc_mark_symbol_for_shlib): New function.
13689 (Symbol_table::gc_mark_dyn_syms): New function.
13690 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13691 as garbage.
13692 (Symbol_table::add_from_object): Likewise.
13693 (Symbol_table::add_from_relobj): When building shared objects, do not
13694 treat externally visible symbols as garbage.
13695 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13696 table information for static and relocatable links.
13697 * symtab.h (Symbol_table::set_gc): New function.
13698 (Symbol_table::gc): New function.
13699 (Symbol_table::gc_mark_undef_symbols): New function.
13700 (Symbol_table::gc_mark_symbol_for_shlib): New function.
13701 (Symbol_table::gc_mark_dyn_syms): New function.
13702 (Symbol_table::gc_): New data member.
13703 * target.h (Sized_target::gc_process_relocs): New pure virtual
13704 function.
13705 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13706 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13707
13708 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
13709
13710 * options.h (General_options::gc_sections): Define as a no-op for now.
13711 (General_options::no_keep_memory): Ditto.
13712 (General_options::Bshareable): Define.
13713 * options.cc (General_options::finalize): Honor -Bshareable.
13714
13715 2009-01-20 Andreas Schwab <schwab@suse.de>
13716
13717 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13718 read the value in the contents, since we don't use it. Use the
13719 template endianness when writing.
13720 (Relocate::relocate): Use it for R_PPC_REL16_HA.
13721
13722 2009-01-19 Andreas Schwab <schwab@suse.de>
13723
13724 * configure.tgt (powerpc64-*): Fix targ_obj.
13725
13726 2009-01-15 Ian Lance Taylor <iant@google.com>
13727
13728 * object.cc (Sized_relobj::write_local_symbols): Don't write out
13729 local symbols when stripping all symbols.
13730
13731 2009-01-14 Cary Coutant <ccoutant@google.com>
13732
13733 * output.cc (Output_reloc): Add explicit instantiations.
13734
13735 2009-01-14 Cary Coutant <ccoutant@google.com>
13736
13737 * archive.cc (Archive::get_elf_object_for_member): Remove call
13738 to File_read::claim_for_plugin.
13739 * descriptors.cc (Descriptors::open): Remove reference to
13740 is_claimed.
13741 (Descriptors::claim_for_plugin): Remove.
13742 * descriptors.h (Descriptors::claim_for_plugin): Remove.
13743 (Descriptors::is_claimed): Remove.
13744 (claim_descriptor_for_plugin): Remove.
13745 * fileread.cc (File_read::claim_for_plugin): Remove.
13746 * fileread.h (File_read::claim_for_plugin): Remove.
13747 (File_read::descriptor): Reopen descriptor if necessary.
13748 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
13749 (Plugin_manager::all_symbols_read): Add task parameter. Change
13750 all callers.
13751 (Plugin_manager::get_input_file): New function.
13752 (Plugin_manager::release_input_file): New function.
13753 (Pluginobj::Pluginobj): Add filesize parameter and initialize
13754 corresponding data member.
13755 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13756 and pass to base constructor. Change all callers.
13757 (get_input_file, release_input_file): New functions.
13758 (make_sized_plugin_object): Add filesize parameter. Change all callers.
13759 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13760 (Plugin_manager::all_symbols_read): Add task parameter.
13761 (Plugin_manager::get_input_file): New function.
13762 (Plugin_manager::release_input_file): New function.
13763 (Plugin_manager::task_): New data member.
13764 (Pluginobj::Pluginobj): Add filesize parameter.
13765 (Pluginobj::filename): New function.
13766 (Pluginobj::descriptor): New function.
13767 (Pluginobj::filesize): New function.
13768 (Pluginobj::filesize_): New data member.
13769 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13770 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13771 File_read::claim_for_plugin; use Object::unlock to unlock the file.
13772
13773 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13774 with archive libraries.
13775 * testsuite/Makefile.in: Regenerate.
13776 * testsuite/plugin_test.c (struct sym_info): New type.
13777 (get_input_file, release_input_file): New static variables.
13778 (onload): Capture new transfer vector entries.
13779 (claim_file_hook): Stop reading at end of file according to filesize.
13780 Factor out parsing of readelf output into separate function.
13781 (all_symbols_read_hook): Exercise get_input_file and release_input_file
13782 APIs and get the source file name from the symbol table. Convert
13783 source file name to corresponding object file name. Print info
13784 message when adding new input files.
13785 (parse_readelf_line): New function.
13786 * testsuite/plugin_test_1.sh: Add checks for new info messages.
13787 * testsuite/plugin_test_2.sh: Likewise.
13788 * testsuite/plugin_test_3.sh: Likewise.
13789 * testsuite/plugin_test_4.sh: New test case.
13790
13791 2009-01-07 Ian Lance Taylor <iant@google.com>
13792
13793 * version.cc (version_string): Bump to 1.8.
13794
13795 2008-12-23 Cary Coutant <ccoutant@google.com>
13796
13797 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13798 * plugin.cc (Plugin_manager::finish): Rename as
13799 layout_deferred_objects. Move cleanup to separate function.
13800 (Plugin_manager::cleanup): New function.
13801 (Plugin_finish::run): Call layout_deferred_objects and cleanup
13802 separately.
13803 * plugin.h (Plugin_manager::finish): Rename as
13804 layout_deferred_objects.
13805 (Plugin_manager::cleanup): New function.
13806 (Plugin_manager::cleanup_done): New field.
13807
13808 2008-12-23 Cary Coutant <ccoutant@google.com>
13809
13810 * plugin.cc (is_visible_from_outside): New function.
13811 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13812 so we don't return "IR only" status for exported symbols or -r links.
13813
13814 * testsuite/Makefile.am (plugin_test_3): New test case.
13815 * testsuite/Makefile.in: Regenerate.
13816 * testsuite/plugin_test_3.sh: New file.
13817
13818 2008-12-22 Cary Coutant <ccoutant@google.com>
13819
13820 * object.cc (Sized_relobj::layout_section): New function.
13821 (Sized_relobj::do_layout): Defer layout of input sections until after
13822 plugin has provided replacement files.
13823 (Sized_relobj::do_layout_deferred_sections): New function.
13824 * object.h (Relobj::set_section_offset): Remove virtual keyword.
13825 (Relobj::layout_deferred_sections): New function.
13826 (Relobj::do_layout_deferred_sections): New function.
13827 (Sized_relobj::do_layout_deferred_sections): New function.
13828 (Sized_relobj::layout_section): New function.
13829 (Sized_relobj::Deferred_layout): New structure.
13830 (Sized_relobj::deferred_layout_): New field.
13831 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13832 Change all callers. Layout deferred sections.
13833 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
13834 references.
13835 (Plugin_hook::run): Move code from do_plugin_hook inline.
13836 (Plugin_hook::do_plugin_hook): Remove.
13837 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13838 (Plugin_manager::finish): Renamed, was cleanup.
13839 (Plugin_manager::should_defer_layout): New function.
13840 (Plugin_manager::add_deferred_layout_object): New function.
13841 (Plugin_manager::Deferred_layout_list): New type.
13842 (Plugin_manager::deferred_layout_objects_): New field.
13843 (Plugin_hook::do_plugin_hook): Remove.
13844
13845 2008-12-17 Ian Lance Taylor <iant@google.com>
13846
13847 * options.h (class General_options): Add --no case for
13848 --export-dynamic.
13849
13850 2008-12-16 Cary Coutant <ccoutant@google.com>
13851
13852 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13853 vector.
13854 (Plugin_manager::claim_file): Create plugin object even if
13855 plugin did not call the add_symbols callback.
13856 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13857 asking for more symbols than were added.
13858 * testsuite/Makefile.am (plugin_test_1): Add test case with
13859 no global symbols.
13860 (empty.syms): New target.
13861 * testsuite/Makefile.in: Regenerate.
13862 * testsuite/plugin_test.c (claim_file_hook): Add new debug
13863 message. Don't call add_symbols if no globals.
13864 (all_symbols_read_hook): Don't provide replacement for empty
13865 claimed file.
13866
13867 2008-12-12 Ian Lance Taylor <iant@google.com>
13868
13869 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13870 r_type == 0 for a local symbol with r_sym == 0.
13871 (scan_relocatable_relocs): Pass r_sym to
13872 local_non_section_strategy.
13873 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13874 r_sym parameter.
13875
13876 * configure.ac: Update test for TLS descriptors: they are
13877 supported as of glibc 2.9.
13878 * configure: Rebuild.
13879
13880 2008-12-11 Ian Lance Taylor <iant@google.com>
13881
13882 PR 7091
13883 * target-reloc.h (Default_scan_relocatable_relocs): For each
13884 function, map r_type == 0 to RELOC_DISCARD.
13885
13886 2008-12-10 Cary Coutant <ccoutant@google.com>
13887
13888 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13889 object to override a kept COMDAT group from a plugin object.
13890
13891 2008-12-09 Ian Lance Taylor <iant@google.com>
13892
13893 PR 7088
13894 * yyscript.y (file_cmd): Handle INPUT.
13895
13896 * testsuite/initpri1.c: Change all declarations to be full
13897 prototypes by adding void, to avoid compiler warnings.
13898
13899 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
13900
13901 * options.cc (General_options::parse_plugin_opt): New.
13902 (General_options::add_plugin): The argument now is just the filename.
13903 (General_options::add_plugin_option): New.
13904 * options.h (plugin_opt): New.
13905 (add_plugin): Change argument name.
13906 (add_plugin_option): New.
13907 * plugin.cc (Plugin::load): Don't parse the plugin option.
13908 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13909 (Plugin::add_option): New.
13910 (Plugin::args_): Change type.
13911 (Plugin::filename_): New.
13912 (Plugin_manager::add_plugin_option): New.
13913 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13914 * testsuite/Makefile.in: Regenerate.
13915
13916 2008-12-05 Cary Coutant <ccoutant@google.com>
13917
13918 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13919 Handle --strip-lto-sections option.
13920 * options.h (strip_lto_sections): New option.
13921
13922 2008-12-01 Cary Coutant <ccoutant@google.com>
13923
13924 * plugin.cc (ld_plugin_message): Change format parameter to const.
13925 Fix mismatch between new[] and delete.
13926
13927 2008-11-14 Cary Coutant <ccoutant@google.com>
13928
13929 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13930 instead of -1U.
13931
13932 2008-11-05 Craig Silverstein <csilvers@google.com>
13933
13934 * options.cc (General_options::parse_dynamic_list): New function.
13935 * options.h (General_options): New flags dynamic_list,
13936 dynamic_list_data, dynamic_list_cpp_new, and
13937 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
13938 (General_options::in_dynamic_list): New function.
13939 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13940 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13941 (Lex::can_continue_name): Likewise.
13942 (yylex): Likewise.
13943 (read_script_file): New parameter script_options.
13944 (read_dynamic_list): New function.
13945 (Script_options::define_dynamic_list): New function.
13946 (dynamic_list_keyword_parsecodes): New variable.
13947 (dynamic_list_keywords): New variable.
13948 * script.h (Script_options::define_dynamic_list): New function
13949 prototype.
13950 (read_dynamic_list): New function prototype.
13951 * symtab.cc (strprefix): New macro.
13952 (Symbol::should_add_dynsym_entry): Support dynamic_list,
13953 dynamic_list_data, dynamic_list_cpp_new, and
13954 dynamic_list_cpp_typeinfo.
13955 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13956 (dynamic_list_expr): New rule.
13957 (dynamic_list_nodes): Likewise.
13958 (dynamic_list_node): Likewise.
13959 * testsuite/Makefile.am (dynamic_list): New test.
13960 * testsuite/Makefile.in: Regenerated.
13961 * testsuite/dynamic_list.t: New file.
13962 * testsuite/dynamic_list.sh: New file.
13963
13964 2008-11-05 Craig Silverstein <csilvers@google.com>
13965
13966 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13967 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13968 (t11_last): Likewise.
13969 * testsuite/ver_test_6.c (main): Likewise.
13970
13971 2008-10-07 Cary Coutant <ccoutant@google.com>
13972
13973 * options.c (General_options::finalize): Add check for -static and
13974 -shared.
13975 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13976 is not empty.
13977
13978 2008-10-02 Cary Coutant <ccoutant@google.com>
13979
13980 * plugin.cc (make_sized_plugin_object): Fix conditional
13981 compilation to work when not all targets are enabled.
13982
13983 2008-09-29 Cary Coutant <ccoutant@google.com>
13984
13985 * archive.cc (Archive::get_file_and_offset): Use filename instead
13986 of name to get library path.
13987 (Archive::include_member): Unlock external member of a thin archive.
13988
13989 * testsuite/Makefile.am (TEST_AR): New variable.
13990 (thin_archive_test_1): New test.
13991 (thin_archive_test_2): New test.
13992 * testsuite/Makefile.in: Regenerate.
13993 * testsuite/thin_archive_main.cc: New file.
13994 * testsuite/thin_archive_test_1.cc: New file.
13995 * testsuite/thin_archive_test_2.cc: New file.
13996 * testsuite/thin_archive_test_3.cc: New file.
13997 * testsuite/thin_archive_test_4.cc: New file.
13998
13999 2008-09-29 Cary Coutant <ccoutant@google.com>
14000
14001 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14002 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14003 instead of -1U.
14004 (Sized_relobj::do_finalize_local_symbols): Likewise.
14005 (Sized_relobj::map_to_kept_section): Likewise.
14006 * object.h (Sized_relobj::invalid_address): New constant.
14007 (Sized_relobj::do_output_section_offset): Check for invalid_address
14008 and return -1ULL.
14009 * output.cc (Output_reloc::local_section_offset): Use constant
14010 invalid_address instead of -1U.
14011 (Output_reloc::get_address): Likewise.
14012 (Output_section::output_address): Change -1U to -1ULL.
14013 * output.h (Output_reloc::invalid_address): New constant.
14014 * reloc.cc (Sized_relobj::write_sections): Use constant
14015 invalid_address instead of -1U.
14016 (Sized_relobj::relocate_sections): Likewise.
14017 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14018 values for merge sections.
14019 * target-reloc.h (relocate_for_relocatable): Use constant
14020 invalid_address instead of -1U.
14021
14022 2008-09-19 Cary Coutant <ccoutant@google.com>
14023
14024 Add plugin functionality for link-time optimization (LTO).
14025 * configure.ac (plugins): Add --enable-plugins option.
14026 * configure: Regenerate.
14027 * config.in: Regenerate.
14028 * Makefile.am (LIBDL): New variable.
14029 (CCFILES): Add plugin.cc.
14030 (HFILES): Add plugin.h.
14031 (ldadd_var): Add LIBDL.
14032 * Makefile.in: Regenerate.
14033
14034 * archive.cc: Include "plugin.h".
14035 (Archive::setup): Don't preread archive symbols when using a plugin.
14036 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
14037 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14038 files.
14039 (Archive::include_member): Add symbols from plugin objects.
14040 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14041 * descriptors.cc (Descriptors::open): Check for file descriptors
14042 abandoned by plugins.
14043 (Descriptors::claim_for_plugin): New function.
14044 * descriptors.h (Descriptors::claim_for_plugin): New function.
14045 (Open_descriptor::is_claimed): New field.
14046 (claim_descriptor_for_plugin): New function.
14047 * fileread.cc (File_read::claim_for_plugin): New function.
14048 * fileread.h (File_read::claim_for_plugin): New function.
14049 (File_read::descriptor): New function.
14050 * gold.cc: Include "plugin.h".
14051 (queue_initial_tasks): Add task to call plugin hooks for generating
14052 new object files.
14053 * main.cc: Include "plugin.h".
14054 (main): Load plugin libraries.
14055 * object.h (Pluginobj): Declare.
14056 (Object::pluginobj): New function.
14057 (Object::do_pluginobj): New function.
14058 (Object::set_target): New function.
14059 * options.cc: Include "plugin.h".
14060 (General_options::parse_plugin): New function.
14061 (General_options::General_options): Initialize plugins_ field.
14062 (General_options::add_plugin): New function.
14063 * options.h (Plugin_manager): Declare.
14064 (General_options): Add --plugin option.
14065 (General_options::has_plugins): New function.
14066 (General_options::plugins): New function.
14067 (General_options::add_plugin): New function.
14068 (General_options::plugins_): New field.
14069 * plugin.cc: New file.
14070 * plugin.h: New file.
14071 * readsyms.cc: Include "plugin.h".
14072 (Read_symbols::do_read_symbols): Check for archive before checking
14073 for ELF file. Call plugin hooks to claim files.
14074 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14075 from a real object file; force override when processing replacement
14076 files.
14077 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14078 (Symbol::init_base_object): Likewise.
14079 (Symbol::init_base_output_data): Likewise.
14080 (Symbol::init_base_output_segment): Likewise.
14081 (Symbol::init_base_constant): Likewise.
14082 (Symbol::init_base_undefined): Likewise.
14083 (Symbol::output_section): Assert that object is not a plugin.
14084 (Symbol_table::add_from_pluginobj): New function.
14085 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14086 undefined.
14087 (Symbol_table::sized_write_globals): Likewise.
14088 (Symbol_table::add_from_pluginobj): Instantiate template.
14089 * symtab.h (Sized_pluginobj): Declare.
14090 (Symbol::in_real_elf): New function.
14091 (Symbol::set_in_real_elf): New function.
14092 (Symbol::in_real_elf_): New field.
14093 (Symbol_table::add_from_pluginobj): New function.
14094
14095 * testsuite/Makefile.am (AM_CFLAGS): New variable.
14096 (LIBDL): New variable.
14097 (LDADD): Add LIBDL.
14098 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14099 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14100 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14101 (MOSTLYCLEANFILES): Likewise.
14102 * testsuite/Makefile.in: Regenerate.
14103 * testsuite/plugin_test.c: New file.
14104 * testsuite/plugin_test_1.sh: New file.
14105 * testsuite/plugin_test_2.sh: New file.
14106
14107 2008-09-16 Ian Lance Taylor <iant@google.com>
14108
14109 * target-reloc.h (relocate_section): Check whether a symbol is
14110 defined by the ABI before reporting an undefined symbol error.
14111 * target.h (Target::is_defined_by_abi): Make parameter const.
14112 (Target::do_is_defined_by_abi): Likewise.
14113 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14114 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14115 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14116 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14117 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14118 * testsuite/Makefile.in: Rebuild.
14119
14120 * fileread.cc (make_view): Add casts to avoid warning.
14121
14122 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
14123
14124 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14125 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14126
14127 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
14128
14129 * options.h (General_options::output_is_executable): New.
14130 (General_options::output_is_pie): New.
14131 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14132 for shared libraries.
14133 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14134
14135 2008-09-11 Chris Demetriou <cgd@google.com>
14136
14137 * options.h (origin): New -z option.
14138 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14139 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14140 in DT_FLAGS_1.
14141
14142 2008-09-05 Cary Coutant <ccoutant@google.com>
14143
14144 * fileread.cc (File_read::make_view): Add check for attempt to map
14145 beyond end of file.
14146
14147 2008-09-05 Cary Coutant <ccoutant@google.com>
14148
14149 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14150 explicit instantiations.
14151
14152 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
14153
14154 PR gold/6858
14155 * options.cc (General_options::finalize): Allow undefined symbols
14156 in shlibs if linking -shared.
14157
14158 PR gold/6859
14159 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14160 symbols as not needing a dynsym entry.
14161
14162 2008-08-20 Craig Silverstein <csilvers@google.com>
14163
14164 * fileread.cc (File_read::open): Do not lock the file unless it
14165 was successfully opened.
14166
14167 2008-08-14 Cary Coutant <ccoutant@google.com>
14168
14169 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14170 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14171 * testsuite/tls_test.cc (struct int128): 128-bit struct
14172 for testing TLS relocs with non-zero addend.
14173 (v12): New TLS variable.
14174 (t12): New test.
14175 (t_last): Add check for v12.
14176 * testsuite/tls_test.h (t12): New function.
14177 * testsuite/tls_test_main.cc (thread_routine): Call new test.
14178
14179 2008-08-13 Ian Lance Taylor <iant@google.com>
14180
14181 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14182 set tls_segment_ or relro_segment_.
14183 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14184 when appropriate.
14185 * output.h (Output_section::clear_is_relro): New function.
14186 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14187 sections specially even when output_data_ is empty.
14188 (Output_segment::maximum_alignment): When first section is relro,
14189 only force alignment for PT_LOAD segments.
14190 * script.cc (script_data_segment_align): New function.
14191 (script_data_segment_relro_end): New function.
14192 * script-c.h (script_data_segment_align): Declare.
14193 (script_data_segment_relro_end): Declare.
14194 * script-sections.h (class Script_sections): Declare
14195 data_segment_align and data_segment_relro_end. Add fields
14196 segment_align_index_ and saw_relro_end_.
14197 * script-sections.cc (class Sections_element): Add set_is_relro
14198 virtual function. Add new bool* parameter to place_orphan_here.
14199 Add get_output_section virtual function.
14200 (class Output_section_definition): Add set_is_relro. Add new
14201 bool* parameter to place_orphan_here. Add get_output_section.
14202 Add is_relro_ field.
14203 (Output_section_definition::Output_section_definition): Initialize
14204 evaluated_address_, evaluated_load_address, evaluated_addralign_,
14205 and is_relro_ fields.
14206 (Output_section_definition::place_orphan_here): Add is_relro
14207 parameter.
14208 (Output_section_definition::set_section_addresses): Set relro for
14209 output section.
14210 (Output_section_definition::alternate_constraint): Likewise.
14211 (class Orphan_output_section): Add new bool* parameter to
14212 place_orphan_here. Add get_output_section.
14213 (Orphan_output_section::place_orphan_here): Add is_relro
14214 parameter.
14215 (Script_sections::Script_sections): Initialize
14216 data_segment_align_index_ and saw_relro_end_.
14217 (Script_sections::data_segment_align): New function.
14218 (Script_sections::data_segment_relro_end): New function.
14219 (Script_sections::place_orphan): Set or clear is_relro.
14220 (Script_sections::set_section_addresses): Force alignment of first
14221 TLS section.
14222 * yyscript.y (exp): Call script_data_segment_align and
14223 script_data_segment_relro_end.
14224 * testsuite/relro_script_test.t: New file.
14225 * testsuite/relro_test.cc (using_script): Declare.
14226 (t1, t2): Test using_script.
14227 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14228 (relro_script_test_SOURCES): Define.
14229 (relro_script_test_DEPENDENCIES): Define.
14230 (relro_script_test_LDFLAGS): Define.
14231 (relro_script_test_LDADD): Define.
14232 (relro_script_test.so): New target.
14233 * testsuite/Makefile.in: Rebuild.
14234
14235 2008-08-06 Cary Coutant <ccoutant@google.com>
14236
14237 * archive.cc (Archive::total_archives, Archive::total_members)
14238 (Archive::total_members_loaded): New variables.
14239 (Archive::setup): Add parameter. Add option to preread
14240 archive symbols.
14241 (Archive::read_armap): Add counter.
14242 (Archive::get_file_and_offset): New function.
14243 (Archive::get_elf_object_for_member): New function.
14244 (Archive::read_all_symbols): New function.
14245 (Archive::read_symbols): New function.
14246 (Archive::add_symbols): Add counters.
14247 (Archive::include_all_members): Use armap to find members if it's
14248 already built.
14249 (Archive::include_member): Skip reading symbols if already read.
14250 Factored code into Archive::get_file_and_offset and
14251 Archive::get_elf_object_for_member. Changed call to
14252 Mapfile::report_include_archive_member.
14253 (Archive::print_stats): New function.
14254 * archive.h: Declare Object and Read_symbols_data classes.
14255 (Archive::Archive): Add initializers for new members.
14256 (Archive::setup): Add parameter.
14257 (Archive::print_stats): New function.
14258 (Archive::total_archives, Archive::total_members)
14259 (Archive::total_members_loaded): New variables.
14260 (Archive::get_file_and_offset): New function.
14261 (Archive::get_elf_object_for_member): New function.
14262 (Archive::read_all_symbols): New function.
14263 (Archive::read_symbols): New function.
14264 (Archive::Archive_member): New class.
14265 (Archive::members_): New member.
14266 (Archive::num_members_): New member.
14267 * main.cc: Include archive.h.
14268 (main): Call Archive::print_stats.
14269 * mapfile.cc (Mapfile::report_include_archive_member): Delete
14270 archive parameter; member_name is now the fully-decorated name.
14271 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14272 * options.h: (General_options): Add --preread-archive-symbols option.
14273 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14274 Archive::setup.
14275
14276 2008-08-04 Ian Lance Taylor <iant@google.com>
14277
14278 * symtab.h (Symbol::use_plt_offset): New function.
14279 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14280 * powerpc.cc (Relocate::relocate): Likewise.
14281 * sparc.cc (Relocate::relocate): Likewise.
14282 * x86_64.cc (Relocate::relocate): Likewise.
14283 * testsuite/weak_plt.sh: New test.
14284 * testsuite/weak_plt_main.cc: New test.
14285 * testsuite/weak_plt_shared.cc: New test.
14286 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14287 (check_PROGRAMS): Add weak_plt.
14288 (check_DATA): Add weak_plt_shared.so.
14289 (weak_plt_main_pic.o, weak_plt): New targets.
14290 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14291 * testsuite/Makefile.in: Rebuild.
14292
14293 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14294 gcctestdir/ld.
14295 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14296 * testsuite/Makefile.in: Rebuild.
14297
14298 2008-08-04 Alan Modra <amodra@bigpond.net.au>
14299
14300 * Makefile.am (POTFILES.in): Set LC_ALL=C.
14301 * Makefile.in: Regenerate.
14302 * po/POTFILES.in: Regenerate.
14303
14304 2008-07-29 Ian Lance Taylor <iant@google.com>
14305
14306 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14307 symbols before other symbols.
14308 * testsuite/script_test_2.cc (test_addr): Declare.
14309 (test_addr_alias): Declare.
14310 (main): Check that test_addr and test_addr_alias have the right
14311 values.
14312 * testsuite/script_test_2.t: Define test_addr_alias and
14313 test_addr.
14314
14315 2008-07-24 Ian Lance Taylor <iant@google.com>
14316
14317 PR 5990
14318 * descriptors.cc: New file.
14319 * descriptors.h: New file.
14320 * gold-threads.h (class Hold_optional_lock): New class.
14321 * fileread.cc: Include "descriptors.h".
14322 (File_read::~File_read): Release descriptor rather than closing
14323 it.
14324 (File_read::open) [file]: Call open_descriptor rather than open.
14325 Set is_descriptor_opened_.
14326 (File_read::open) [memory]: Assert that descriptor is not open.
14327 (File_read::reopen_descriptor): New function.
14328 (File_read::release): Release descriptor.
14329 (File_read::do_read): Make non-const. Reopen descriptor.
14330 (File_read::read): Make non-const.
14331 (File_read::make_view): Reopen descriptor.
14332 (File_read::do_readv): Likewise.
14333 * fileread.h (class File_read): Add is_descriptor_opened_ field.
14334 Update declarations.
14335 * layout.cc: Include "descriptors.h".
14336 (Layout::create_build_id): Use open_descriptor rather than open.
14337 * output.cc: Include "descriptors.h".
14338 (Output_file::open): Use open_descriptor rather than open.
14339 * archive.cc (Archive::const_iterator): Change Archive to be
14340 non-const.
14341 (Archive::begin, Archive::end): Make non-const.
14342 (Archive::count_members): Likewise.
14343 * archive.h (class Archive): Update declarations.
14344 * object.h (Object::read): Make non-const.
14345 * Makefile.am (CCFILES): Add descriptors.cc.
14346 (HFILES): Add descriptors.h.
14347 * Makefile.in: Rebuild.
14348
14349 PR 6716
14350 * gold.h: Always include <clocale>. Add Solaris workarounds
14351 following code in binutils/sysdep.h.
14352
14353 PR 6048
14354 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14355 this->eh_frame_hdr_ is NULL before using it.
14356
14357 * dynobj.cc (Versions::Versions): Update comment.
14358
14359 * dynobj.cc (Versions::Versions): If there is an soname, use it as
14360 the base version name.
14361
14362 * stringpool.cc (Stringpool_template::add_with_length): Set key to
14363 array size plus one.
14364 (Stringpool_template::set_string_offsets): Subtract one from key
14365 before using it as an array index.
14366 (Stringpool_template::get_offset_with_length): Likewise.
14367 (Stringpool_template::write_to_buffer): Likewise.
14368 * stringpool.h (Stringpool_template::get_offset_from_key):
14369 Likewise.
14370
14371 2008-07-23 Ian Lance Taylor <iant@google.com>
14372
14373 PR 6658
14374 * object.h (Merged_symbol_value::value): Do our best to handle a
14375 negative addend.
14376
14377 PR 6647
14378 * script.cc (Version_script_info::get_versions): Don't add empty
14379 version tag to return value.
14380 (Version_script_info::get_symbol_version_helper): Change return
14381 type to bool. Add pversion parameter. Change all callers.
14382 (script_register_vers_node): Don't require a non-NULL tag.
14383 * script.h (class Version_script_info): Update declarations.
14384 (Version_script_info::get_symbol_version): Change return type to
14385 bool. Add version parameter. Change all callers.
14386 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14387 handling. Handle an empty version from a version script.
14388 (Symbol_table::define_special_symbol): Likewise.
14389 * testsuite/ver_test_10.script: New file.
14390 * testsuite/ver_test_10.sh: New file.
14391 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14392 (check_DATA): Add ver_test_10.syms.
14393 (ver_test_10.syms, ver_test_10.so): New target.
14394 * testsuite/Makefile.in: Rebuild.
14395
14396 2008-07-23 Simon Baldwin <simonb@google.com>
14397
14398 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14399 to zero for undefined symbols from dynamic libraries.
14400
14401 2008-07-23 Ian Lance Taylor <iant@google.com>
14402
14403 * symtab.cc (Symbol_table::resolve): Remove version parameter.
14404 Change all callers.
14405 * symtab.h (class Symbol_table): Update declaration.
14406 * testsuite/ver_test_9.cc: New file.
14407 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14408 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14409 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14410 (ver_test_9.so, ver_test_9.o): New targets.
14411 * testsuite/Makefile.in: Rebuild.
14412
14413 2008-07-22 Ian Lance Taylor <iant@google.com>
14414
14415 * options.h (class General_options): Define --check-sections.
14416 * layout.cc (Layout::set_segment_offsets): Handle
14417 --check-sections.
14418
14419 * options.h (class General_options): Define -n/--nmagic and
14420 -N/--omagic.
14421 * options.cc (General_options::finalize): For -n/--nmagic or
14422 -N/--omagic, set -static.
14423 * layout.cc (Layout::attach_allocated_section_to_segment): If
14424 -N/--omagic, don't put read-only and read-write sections in
14425 different segments.
14426 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14427 finding a read-only segment.
14428 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14429 don't set the minimum segment alignment to the common page size,
14430 and don't set the file offset to the address modulo the page size.
14431 * script-sections.cc (Script_sections::create_segments): If
14432 -n/--omagic, don't put read-only and read-write sections in
14433 different segments.
14434
14435 * cref.cc: New file.
14436 * cref.h: New file.
14437 * options.h (class General_options): Add --print-symbol-counts.
14438 * main.cc (main): Issue defined symbol report if requested.
14439 * archive.cc (Archive::interpret_header): Make into a const member
14440 function.
14441 (Archive::add_symbols): Call Input_objects::archive_start and
14442 archive_stop.
14443 (Archive::const_iterator): Define new class.
14444 (Archive::begin, Archive::end): New functions.
14445 (Archive::include_all_members): Rewrite to use iterator.
14446 (Archive::count_members): New function.
14447 * archive.h (class Archive): Update declarations.
14448 (Archive::filename): New function.
14449 * object.cc: Include "cref.h".
14450 (Sized_relobj::Sized_relobj): Initialize defined_count_.
14451 (Sized_relobj::do_get_global_symbol_counts): New function.
14452 (Input_objects::add_object): Add object to cross-referencer.
14453 (Input_objects::archive_start): New function.
14454 (Input_objects::archive_stop): New function.
14455 (Input_objects::print_symbol_counts): New function.
14456 * object.h: Declare Cref and Archive.
14457 (Object::get_global_symbol_counts): New function.
14458 (Object::do_get_global_symbol_counts): New pure virtual function.
14459 (class Sized_relobj): Add defined_count_ field. Update
14460 declarations.
14461 (class Input_objects): Add cref_ field. Update constructor.
14462 Update declarations.
14463 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14464 defined_count_.
14465 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14466 symbol counts.
14467 (Sized_dynobj::do_get_global_symbol_counts): New function.
14468 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14469 defined_count_. Update declarations. Define Symbols typedef.
14470 * symtab.cc (Symbol_table::add_from_relobj): Add defined
14471 parameter. Change all callers.
14472 (Symbol_table::add_from_dynobj): Add sympointers and defined
14473 parameters. Change all callers.
14474 * symtab.h (class Symbol_table): Update declarations.
14475 * Makefile.am (CCFILES): Add cref.cc.
14476 (HFILES): Add cref.h.
14477 * Makefile.in: Rebuild.
14478
14479 2008-07-22 Simon Baldwin <simonb@google.com>
14480
14481 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14482 to zero when writing undefined symbols.
14483
14484 2008-07-22 Ian Lance Taylor <iant@google.com>
14485
14486 * output.cc (Output_section::add_input_section): Don't try to
14487 merge empty merge sections.
14488
14489 2008-07-21 Craig Silverstein <csilvers@google.com>
14490
14491 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14492 Include symbol version in error message.
14493
14494 2008-07-20 Chris Demetriou <cgd@google.com>
14495
14496 * configure.ac (gold_cv_c_random_seed): New configured variable.
14497 (RANDOM_SEED_CFLAGS): New substituted variable.
14498 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14499 * configure: Rebuild.
14500 * Makefile.in: Likewise.
14501 * testsuite/Makefile.in: Likewise.
14502
14503 2008-07-18 Ian Lance Taylor <iant@google.com>
14504
14505 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14506 where we see NAME/NULL and NAME/VERSION as separate symbols.
14507 * testsuite/ver_test_main.cc (main): Call t4.
14508 (t4, t4_2a): Define.
14509 * testsuite/ver_test_2.cc (t4_2): Define.
14510 * testsuite/ver_test_2.script: Put t4_2a in VER2.
14511 * testsuite/ver_test_4.cc (t4_2a): Define.
14512 * testsuite/ver_test_4.script: Put t4_2a in VER2.
14513 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14514
14515 2008-07-17 Ian Lance Taylor <iant@google.com>
14516
14517 * dynobj.cc (Versions::add_def): If we give an error about a
14518 missing version, go ahead and create the version anyhow.
14519
14520 2008-07-10 Ian Lance Taylor <iant@google.com>
14521
14522 Handle output sections with more than 0x7fffffff bytes.
14523 * object.h (class Relobj): Change map_to_output_ to
14524 output_sections_, and just keep a section pointer. Change all
14525 uses. Move comdat group support to Sized_relobj.
14526 (Relobj::is_section_specially_mapped): Remove.
14527 (Relobj::output_section): Remove poff parameter. Change all
14528 callers.
14529 (Relobj::output_section_offset): New function.
14530 (Relobj::set_section_offset): Rewrite.
14531 (Relobj::map_to_output): Remove.
14532 (Relobj::output_sections): New function.
14533 (Relobj::do_output_section_offset): New pure virtual function.
14534 (Relobj::do_set_section_offset): Likewise.
14535 (class Sized_relobj): Add section_offsets_ field. Add comdat
14536 group support from Relobj. Update declarations.
14537 (Sized_relobj::get_output_section_offset): New function.
14538 (Sized_relobj::do_output_section_offset): New function.
14539 (Sized_relobj::do_set_section_offset): New function.
14540 * object.cc (Relobj::output_section_address): Remove.
14541 (Sized_relobj::Sized_relobj): Initialize new fields.
14542 (Sized_relobj::include_section_group): Cast find_kept_object to
14543 Sized_relobj.
14544 (Sized_relobj::include_linkonce_section): Likewise.
14545 (Sized_relobj::do_layout): Use separate arrays for output section
14546 and output offset.
14547 (Sized_relobj::do_count_local_symbols): Change map_to_output to
14548 output_sections.
14549 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14550 output_sections and section_offsets.
14551 (Sized_relobj::write_local_symbols): Likewise.
14552 (map_to_kept_section): Compute output address directly.
14553 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14554 output_sections and section_offsets.
14555 (Sized_relobj::write_sections): Likewise.
14556 (Sized_relobj::relocate_sections): Likewise.
14557 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14558 * output.h (class Output_reloc): Update declarations. Change
14559 u2_.relobj to Sized_relobj*.
14560 (class Output_data_reloc): Change add functions to use
14561 Sized_relobj*.
14562 * output.cc (Output_reloc::Output_reloc): Change relobj to
14563 Sized_relobj*.
14564 (Output_reloc::local_section_offset): Change return type to
14565 Elf_Addr. Use get_output_section_offset.
14566 (Output_reloc::get_address): Likewise.
14567 (Output_section::is_input_address_mapped): Don't call
14568 is_section_specially_mapped.
14569 (Output_section::output_offset): Likewise.
14570 (Output_section::output_address): Likewise.
14571 (Output_section::starting_output_address): Likewise.
14572 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14573 parameter to Sized_relobj*.
14574 (Copy_relocs::need_copy_reloc): Likewise.
14575 (Copy_relocs::save): Likewise.
14576 * copy-relocs.h (class Copy_relocs): Update declarations.
14577 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14578 Sized_relobj*. Change relobj_ field to Sized_relobj*.
14579 * target-reloc.h (relocate_for_relocatable): Change
14580 offset_in_output_section type to Elf_Addr. Change code that uses
14581 it as well.
14582 * layout.cc (Layout::layout): Always set *off.
14583 * mapfile.cc (Mapfile::print_input_section): Use
14584 output_section_offset.
14585 * i386.cc (Target_i386::copy_reloc): Change object parameter to
14586 Sized_relobj*.
14587 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14588 * sparc.cc (Target_sparc::copy_reloc): Likewise.
14589 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14590
14591 2008-07-03 Ian Lance Taylor <iant@google.com>
14592
14593 * layout.cc (Layout::include_section): Do not discard unrecognized
14594 SHT_STRTAB sections.
14595
14596 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
14597
14598 * script.cc (Lex::can_continue_name): Make '?' allowable in
14599 version-script names.
14600 * testsuite/version_script.map: Change glob pattern to use '?'
14601
14602 2008-06-30 Manish Singh <yosh@gimp.org>
14603
14604 PR 6585
14605 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14606 Correct typo.
14607
14608 2008-06-30 Ian Lance Taylor <iant@google.com>
14609
14610 PR 6660
14611 PR 6682
14612 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14613 versions]: Don't try to read the value in the contents, since we
14614 don't use it. Use the template endianness when writing.
14615
14616 2008-06-25 Cary Coutant <ccoutant@google.com>
14617
14618 * fileread.cc (File_read::make_view): Assert on zero-length view.
14619 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14620 symbol table when there are no symbols to read.
14621
14622 2008-06-23 Craig Silverstein <csilvers@google.com>
14623
14624 * version.cc (version_string): Bump to 1.7
14625
14626 2008-06-18 Craig Silverstein <csilvers@google.com>
14627
14628 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14629 constant 0xFFFF to type Valtype.
14630 (Powerpc_relocate_functions::rel16_ha): Likewise.
14631
14632 2008-06-17 Ian Lance Taylor <iant@google.com>
14633
14634 * output.h (Output_section::Input_section): Initialize p2align_ to
14635 zero for Output_section_data constructors.
14636 (Output_section::Input_section::addralign): If not an input
14637 section, return the alignment of the Output_section_data.
14638 * testsuite/copy_test.cc: New file.
14639 * testsuite/copy_test_1.cc: New file.
14640 * testsuite/copy_test_2.cc: New file.
14641 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14642 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14643 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14644 (copy_test_1_pic.o, copy_test_1.so): New targets.
14645 (copy_test_2_pic.o, copy_test_2.so): New targets.
14646 * testsuite/Makefile.in: Rebuild.
14647
14648 * script-sections.cc (Script_sections::place_orphan): Initialize
14649 local variable exact.
14650
14651 2008-06-13 David Edelsohn <edelsohn@gnu.org>
14652
14653 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14654
14655 2008-06-12 David Edelsohn <edelsohn@gnu.org>
14656 David S. Miller <davem@davemloft.net>
14657
14658 * powerpc.cc: New file.
14659 * Makefile.am (TARGETSOURCES): Add powerpc.cc
14660 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14661 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14662 * Makefile.in: Rebuild.
14663
14664 2008-06-09 Ian Lance Taylor <iant@google.com>
14665
14666 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14667 <exception>.
14668 (throwing, orig_terminate): New static variables.
14669 (terminate_handler): New static function.
14670 (t2): Set terminate handler.
14671
14672 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
14673
14674 PR 6584
14675 * binary.cc (Binary_to_elf::sized_convert): Fix .data
14676 alignment.
14677
14678 2008-05-30 Cary Coutant <ccoutant@google.com>
14679
14680 * archive.cc (Archive::include_all_members) Correct to step
14681 over symbol table and extended name table in thin archives.
14682
14683 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
14684
14685 PR 6407
14686 * target-reloc.h (relocate_for_relocatable): Fix new_offset
14687 calculation.
14688
14689 2008-05-28 Caleb Howe <cshowe@google.com>
14690
14691 * reduced_debug_output.cc: New file.
14692 * reduced_debug_output.h: New file.
14693 * options.h (class General_options): Add --strip-debug-non-line.
14694 * options.cc (General_options::finalize): Add strip_debug_non_line
14695 to the strip heirarchy.
14696 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14697 fields.
14698 * layout.cc: Include "reduced_debug_output.h".
14699 (Layout::Layout): Initialize new fields.
14700 (line_only_debug_sections): New static array.
14701 (is_lines_only_debug_sections): New static inline function.
14702 (Layout::include_section): Handle --strip-debug-non-line.
14703 (Layout::make_output_section): If --strip-debug-non-line, build
14704 new output sections for .debug_abbrev and .debug_info.
14705 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14706 gold. Warn about possible overflow.
14707 (read_signed_LEB_128): Likewise.
14708 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14709 (read_signed_LEB_128): Declare.
14710 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14711 (HFILES): Add reduced_debug_output.h.
14712 * Makefile.in: Rebuild.
14713
14714 2008-05-21 Ian Lance Taylor <iant@google.com>
14715
14716 * mapfile.cc: New file.
14717 * mapfile.h: New file.
14718 * options.h (class General_options): Add -M/--print-map and -Map.
14719 * options.cc (General_options::finalize): Make -M equivalent to
14720 -Map -.
14721 * main.cc: Include <cstdio> and "mapfile.h".
14722 (main): Open mapfile if requested.
14723 * gold.cc (class Middle_runner): Add mapfile_ field. Update
14724 constructor. Change caller.
14725 (queue_initial_tasks): Add mapfile parameter. Change caller.
14726 (queue_middle_tasks): Likewise.
14727 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14728 declarations.
14729 * archive.cc: Include "mapfile.h".
14730 (Archive::add_symbols): Add mapfile parameter. Change all
14731 callers. Pass mapfile, symbol, and reason to include_member.
14732 (Archive::include_all_members): Add mapfile parameter. Change all
14733 callers.
14734 (Archive::include_member): Add mapfile, sym, and why parameters.
14735 Change all callers. Report inclusion to map file.
14736 * archive.h: Include "fileread.h".
14737 (class Archive): Update declarations.
14738 (Archive::file): New const method.
14739 (class Add_archive_symbols): Add mapfile_ field. Update
14740 constructor. Change all callers.
14741 * readsyms.h (class Read_symbols): Likewise.
14742 (class Finish_group): Likewise.
14743 (class Read_script): Likewise.
14744 * common.cc: Include "mapfile.h".
14745 (Symbol_table::allocate_commons): Add mapfile parameter. Change
14746 all callers.
14747 (Symbol_table::do_allocate_commons): Likewise.
14748 (Symbol_table::do_allocate_commons_list): Likewise. Report common
14749 symbol allocation to mapfile.
14750 * common.h (class Allocate_commons_task): Add mapfile_ field.
14751 Update constructor. Change all callers.
14752 * symtab.h (class Symbol_table): Update declarations.
14753 * layout.cc: Include "mapfile.h".
14754 (Layout_task_runner::run): Print information to mapfile.
14755 (Layout::create_gold_note): Change Output_data_fixed_space to
14756 Output_data_zero_fill.
14757 (Layout::create_build_id): Likewise.
14758 (Layout::print_to_mapfile): New function.
14759 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
14760 constructor. Change caller.
14761 (class Layout): Declare print_to_mapfile.
14762 * output.cc (Output_section::Input_section::print_to_mapfile): New
14763 function.
14764 (Output_section::add_input_section): If producing a map, always
14765 add to input_sections_ list.
14766 (Output_section::do_print_to_mapfile): New function.
14767 (Output_segment::print_sections_to_mapfile): New function.
14768 (Output_segment::print_section_list_to_mapfile): New function.
14769 * output.h: Include "mapfile.h".
14770 (Output_data::print_to_mapfile): New function.
14771 (Output_data::do_print_to_mapfile): New virtual function.
14772 (Output_segment_headers::do_print_to_mapfile): New function.
14773 (Output_file_header::do_print_to_mapfile): New function.
14774 (Output_data_const::do_print_to_mapfile): New function.
14775 (class Output_data_const_buffer): Add map_name_ field. Update
14776 constructor. Change all callers. Add do_print_to_mapfile
14777 function.
14778 (class Output_data_fixed_space): Likewise.
14779 (class Output_data_space): Likewise.
14780 (class Output_data_zero_fill): New class.
14781 (Output_data_strtab::do_print_to_mapfile): New function.
14782 (Output_data_reloc_base::do_print_to_mapfile): New function.
14783 (Output_relocatable_relocs::do_print_to_mapfile): New function.
14784 (Output_data_group::do_print_to_mapfile): New function.
14785 (Output_data_got::do_print_to_mapfile): New function.
14786 (Output_data_dynamic::do_print_to_mapfile): New function.
14787 (Output_symtab_xindex::do_print_to_mapfile): New function.
14788 (class Output_section): Declare do_print_to_mapflie. Declare
14789 print_to_mapfile in Input_section.
14790 (class Output_segment): Declare new functions.
14791 * object.h (Sized_relobj::symbol_count): New function.
14792 * script-sections.cc
14793 (Output_section_element_dot_assignment::set_section_addresses):
14794 Change Output_data_fixed_space to Output_data_zero_fill.
14795 (Output_data_expression::do_print_to_mapfile): New function.
14796 * script.cc (read_input_script): Add mapfile parameter. Change
14797 all callers.
14798 * script.h (read_input_script): Update declaration.
14799 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14800 (Eh_frame::do_print_to_mapfile): New function.
14801 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14802 (Output_merge_string::do_print_to_mapfile): New function.
14803 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14804 function.
14805 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14806 function.
14807 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14808 function.
14809 * Makefile.am (CCFILES): Add mapfile.cc.
14810 (HFILES): Add mapfile.h.
14811 * Makefile.in: Rebuild.
14812
14813 2008-05-19 Ian Lance Taylor <iant@google.com>
14814
14815 * options.h (class General_options): Add -z relro.
14816 * layout.cc (Layout::Layout): Initialize relro_segment_.
14817 (Layout::add_output_section_data): Return the output section.
14818 (Layout::make_output_section): Rcognize relro sections and mark
14819 them appropriately.
14820 (Layout::attach_allocated_section_to_segment): Put relro sections
14821 in a PT_GNU_RELRO segment.
14822 (Layout::create_initial_dynamic_sections): Mark the .dynamic
14823 section as relro.
14824 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14825 PT_TLS segments.
14826 (Layout::linkonce_mapping): Map d.rel.ro.local to
14827 .data.rel.ro.local.
14828 (Layout::output_section_name): Us .data.rel.ro.local for any
14829 section which begins with that.
14830 * layout.h (class Layout): Update add_output_section_data
14831 declaration. Add relro_segment_ field.
14832 * output.cc (Output_section::Output_section): Initialize is_relro_
14833 and is_relro_local_ fields.
14834 (Output_segment::add_output_section): Group relro sections.
14835 (Output_segment::is_first_section_relro): New function.
14836 (Output_segment::maximum_alignment): If there is a relro section,
14837 align the segment to the common page size.
14838 (Output_segment::set_section_addresses): Track whether we are
14839 looking at relro sections. If the last section is a relro
14840 section, align to the common page size.
14841 (Output_segment::set_section_list_addresses): Add in_relro
14842 parameter. Change all callers. Align to the page size when
14843 moving from relro to non-relro section.
14844 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14845 segment.
14846 * output.h (class Output_section): Add is_relro_ and
14847 is_relro_local_ fields.
14848 (Output_section::is_relro): New function.
14849 (Output_section::set_is_relro): New function.
14850 (Output_section::is_relro_local): New function.
14851 (Output_section::set_is_relro_local): New function.
14852 (class Output_segment): Update declarations.
14853 * i386.cc (Target_i386::got_section): Mark .got section as relro.
14854 * sparc.cc (Target_sparc::got_section): Likewise.
14855 * x86_64.cc (Target_x86_64::got_section): Likewise.
14856 * testsuite/relro_test_main.cc: New file.
14857 * testsuite/relro_test.cc: New file.
14858 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14859 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14860 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14861 (relro_test.so, relro_test_pic.o): New targets.
14862 * testsuite/Makefile.in: Rebuild.
14863
14864 2008-05-16 Ian Lance Taylor <iant@google.com>
14865
14866 * output.cc (Output_segment::add_output_section): Remove front
14867 parameter.
14868 * output.h (class Output_segment): Remove
14869 add_initial_output_section and overloaded add_output_section.
14870 Update declaration of remaining add_output_section.
14871 * layout.cc (Layout::create_interp): Call add_output_section
14872 rather than add_initial_output_section.
14873 (Layout::finish_dynamic_section): Likewise.
14874
14875 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14876 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
14877 know the dynamic type.
14878 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14879 field. Initialize it in constructor.
14880 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14881 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14882 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14883 reloc.
14884
14885 * output.cc (Output_reloc::get_address): Change return type to
14886 Elf_Addr.
14887 * output.h (class Output_reloc): Update get_address declaration.
14888 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14889 for section addresses.
14890
14891 2008-05-09 Ian Lance Taylor <iant@google.com>
14892
14893 PR 6493
14894 * gold.cc (gold_nomem): Use return value of write.
14895
14896 2008-05-08 Ian Lance Taylor <iant@google.com>
14897
14898 * symtab.c (Symbol::init_base_output_data): Add version
14899 parameter. Change all callers.
14900 (Symbol::init_base_output_segment): Likewise.
14901 (Symbol::init_base_constant): Likewise.
14902 (Symbol::init_base_undefined): Likewise.
14903 (Sized_symbol::init_output_data): Likewise.
14904 (Sized_symbol::init_output_segment): Likewise.
14905 (Sized_symbol::init_constant): Likewise.
14906 (Sized_symbol::init_undefined): Likewise.
14907 (Symbol_table::do_define_in_output_data): If the new symbol has a
14908 version, mark it as the default.
14909 (Symbol_table::do_define_in_output_segment): Likewise.
14910 (Symbol_table::do_define_as_constant): Likewise.
14911 * symtab.h (class Symbol): Update declarations.
14912 (class Sized_symbol): Likewise.
14913 * resolve.cc (Symbol::override_version): New function.
14914 (Symbol::override_base): Call override_version.
14915 (Symbol::override_base_with_special): Likewise.
14916 * testsuite/ver_script_8.script: New file.
14917 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14918 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14919 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14920 (ver_test_8_1.so, ver_test_8_2.so): New targets.
14921
14922 2008-05-06 Ian Lance Taylor <iant@google.com>
14923
14924 PR 6049
14925 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14926 functions.
14927 (class General_options): Remove existing --undefined, and add
14928 --no-undefined instead. Add new --undefined as synonym for -u.
14929 * archive.cc (Archive::add_symbols): Check whether symbol was
14930 named with -u.
14931 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14932 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14933 all uses. Add IS_UNDEFINED. Update declarations to split
14934 different versions of init_base. Declare init_base_undefined.
14935 (Symbol::is_defined): Handle IS_UNDEFINED.
14936 (Symbol::is_undefined): Likewise.
14937 (Symbol::is_weak_undefined): Call is_undefined.
14938 (Symbol::is_absolute): Handle IS_CONSTANT.
14939 (class Sized_symbol): Update declarations to split different
14940 versions of init. Declare init_undefined.
14941 (class Symbol_table): Declare new functions.
14942 * symtab.cc (Symbol::init_base_object): Rename from init_base.
14943 Change all callers.
14944 (Symbol::init_base_output_data): Likewise.
14945 (Symbol::init_base_output_segment): Likewise.
14946 (Symbol::init_base_constant): Likewise.
14947 (Symbol::init_base_undefined): New function.
14948 (Sized_symbol::init_object): Rename from init. Change all
14949 callers.
14950 (Sized_symbol::init_output_data): Likewise.
14951 (Sized_symbol::init_output_segment): Likewise.
14952 (Sized_symbol::init_constant): Likewise.
14953 (Sized_symbol::init_undefined): New function.
14954 (Symbol_table::add_undefined_symbols_from_command_line): New
14955 function.
14956 (Symbol_table::do_add_undefined_symbols_from_command_line): New
14957 function.
14958 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14959 (Symbol::output_section): Likewise.
14960 (Symbol::set_output_section): Likewise.
14961 (Symbol_table::sized_finalize_symbol): Likewise.
14962 (Symbol_table::sized_write_globals): Likewise.
14963 * resolve.cc (Symbol_table::should_override): Likewise.
14964 (Symbol::override_base_with_special): Likewise.
14965
14966 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14967 symbol, change it to have default visibility.
14968 * testsuite/protected_1.cc: New file.
14969 * testsuite/protected_2.cc: New file.
14970 * testsuite/protected_3.cc: New file.
14971 * testsuite/protected_main_1.cc: New file.
14972 * testsuite/protected_main_2.cc: New file.
14973 * testsuite/protected_main_3.cc: New file.
14974 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14975 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14976 (protected_1_LDFLAGS, protected_1_LDADD): Define.
14977 (protected_1.so): New target.
14978 (protected_1_pic.o, protected_2_pic.o): New targets.
14979 (protected_3_pic.o): New target.
14980 (check_PROGRAMS): Add protected_2.
14981 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14982 (protected_2_LDFLAGS, protected_2_LDADD): Define.
14983 * testsuite/Makefile.in: Rebuild.
14984
14985 * options.h (DEFINE_var): Add set_user_set_##varname__.
14986 (DEFINE_bool_alias): New macro.
14987 (class General_options): Define -Bstatic using DEFINE_bool_alias
14988 rather than DEFINE_special. Add --undefined as an alias for -z
14989 defs.
14990 * options.cc (General_options::parse_Bstatic): Remove.
14991
14992 * options.h (class General_options): Add --fatal-warnings.
14993 * main.cc (main): Implement --fatal-warnings.
14994 * errors.h (Errors::warning_count): New function.
14995
14996 * options.h (class General_options): Add -Bsymbolic-functions.
14997 * symtab.h (Symbol::is_preemptible): Check for
14998 -Bsymbolic-functions.
14999
15000 2008-05-05 Ian Lance Taylor <iant@google.com>
15001
15002 * options.h (DEFINE_bool): For DASH_Z, create the negative option
15003 as noVARNAME rather than no-VARNAME.
15004 (class General_options): Add option -z combreloc.
15005 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15006 get_address.
15007 (Output_reloc::sort_before) [SHT_REL]: New function.
15008 (Output_reloc::sort_before) [SHT_RELA]: New function.
15009 (class Output_data_reloc_base): Add sort_relocs_ field. Define
15010 Sort_relocs_comparison.
15011 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15012 parameter. Change all callers.
15013 (Output_data_reloc::Output_data_reloc) [both versions]: Add
15014 sort_relocs parameter. Change all callers.
15015 * output.cc (Output_reloc::get_address): New function, broken out
15016 of write_rel.
15017 (Output_reloc::write_rel): Call it.
15018 (Output_reloc::compare): New function.
15019 (Output_data_reloc_base::do_write): Optionally sort relocs.
15020
15021 * configure.ac: If targ_extra_obj is set, link it in.
15022 * configure.tgt: Initialize all variables.
15023 (x86_64*): Set targ_extra_obj and targ_extra_size.
15024 * configure: Rebuild.
15025
15026 * object.cc (Sized_relobj::include_section_group): Adjust section
15027 indexes read from group data. Build vector to pass to
15028 layout_group.
15029 * layout.cc (Layout::layout_group): Add flags and shndxes
15030 parameters. Remove contents parameter. Change caller. Update
15031 explicit instantiations.
15032 * layout.h (class Layout): Update layout_group declaration.
15033 * output.cc (Output_data_group::Output_data_group): Add flags and
15034 input_shndxes parameters. Remove contents parameter. Change
15035 caller.
15036 (Output_data_group::do_write): Change input_sections_ to
15037 input_shndxes_.
15038 * output.h (class Output_data_group): Update constructor
15039 declaration. Rename input_sections_ to input_shndxes_.
15040 * testsuite/many_sections_test.cc: Add template.
15041
15042 2008-04-30 Cary Coutant <ccoutant@google.com>
15043
15044 * target-reloc.h (relocate_section): Fix dead-pointer bug.
15045
15046 * layout.cc (Layout::include_section): Refactored check for debug
15047 info section.
15048 (Layout::add_comdat): Add new parameters. Change type
15049 of signature parameter. Add object and shndx to signatures table.
15050 (Layout::find_kept_object): New function.
15051 * layout.h: Include <cstring>.
15052 (Layout::is_debug_info_section): New function.
15053 (Layout::add_comdat): Add new parameters.
15054 (Layout::find_kept_object): New function.
15055 (Layout::Kept_section): New struct.
15056 (Layout::Signatures): Change type of map range.
15057 * object.cc (Relobj::output_section_address): New function.
15058 (Sized_relobj::include_section_group): Add new parameters. Change
15059 calls to Layout::add_comdat. Change to build table of kept comdat
15060 groups and table mapping discarded sections to kept sections.
15061 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
15062 (Sized_relobj::do_layout): Change calls to include_section_group and
15063 include_linkonce_section.
15064 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15065 value to zero when section is discarded.
15066 (Sized_relobj::map_to_kept_section): New function.
15067 * object.h (Relobj::output_section_address): New function.
15068 (Relobj::Comdat_group): New type.
15069 (Relobj::find_comdat_group): New function.
15070 (Relobj::Comdat_group_table): New type.
15071 (Relobj::Kept_comdat_section): New type.
15072 (Relobj::Kept_comdat_section_table): New type.
15073 (Relobj::add_comdat_group): New function.
15074 (Relobj::set_kept_comdat_section): New function.
15075 (Relobj::get_kept_comdat_section): New function.
15076 (Relobj::comdat_groups_): New field.
15077 (Relobj::kept_comdat_sections_): New field.
15078 (Symbol_value::input_value): Update comment.
15079 (Sized_relobj::map_to_kept_section) New function.
15080 (Sized_relobj::include_linkonce_section): Add new parameter.
15081 * target-reloc.h (Comdat_behavior): New type.
15082 (get_comdat_behavior): New function.
15083 (relocate_section): Add code to map a discarded section to the
15084 corresponding kept section when applying a relocation.
15085
15086 2008-04-30 Craig Silverstein <csilvers@google.com>
15087
15088 * dwarf_reader.cc (next_generation_count): New static var.
15089 (Addr2line_cache_entry): New struct.
15090 (addr2line_cache): New static var.
15091 (Dwarf_line_info::one_addr2line): Added caching.
15092 (Dwarf_line_info::clear_addr2line_cache): New function.
15093 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15094 cache-size parameter.
15095 (Dwarf_line_info::one_addr2line_cache): New function.
15096 * symtab.cc (Symbol_table::detect_odr_violations): Pass
15097 new cache-size argument to one_addr2line(), and clear cache.
15098
15099 2008-04-28 Cary Coutant <ccoutant@google.com>
15100
15101 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15102 R_386_PC8 relocations.
15103
15104 2008-04-23 Ian Lance Taylor <iant@google.com>
15105
15106 * object.cc (Sized_relobj::include_section_group): Check for
15107 invalid section group.
15108
15109 * object.cc (make_elf_object): Correct test for 64-bit ELF file
15110 header size.
15111
15112 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15113 than read for file header.
15114 * archive.cc (Archive::include_member): Likewise.
15115
15116 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
15117
15118 * aclocal.m4: Regenerate.
15119 * configure: Regenerate.
15120
15121 2008-04-19 Ian Lance Taylor <iant@google.com>
15122
15123 * version.cc (version_string): Bump to 1.6.
15124
15125 * testsuite/Makefile.am (many_sections_r_test): New target.
15126 (many_sections_r_test_SOURCES): Remove.
15127 (many_sections_r_test_DEPENDENCIES): Remove.
15128 (many_sections_r_test_LDFLAGS): Remove.
15129 (many_sections_r_test_LDADD): Remove.
15130
15131 * object.cc (Sized_relobj::do_add_symbols): Always pass
15132 local_symbol_count_ to add_from_relobj.
15133
15134 * testsuite/Makefile.am (many_sections_check.h): Only check one in
15135 every thousand variables.
15136 * testsuite/Makefile.in: Rebuild.
15137
15138 * object.cc (Xindex::initialize_symtab_xindex): New function.
15139 (Xindex::read_symtab_xindex): New function.
15140 (Xindex::sym_xindex_to_shndx): New function.
15141 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15142 available.
15143 (Sized_relobj::do_initialize_xindex): New function.
15144 (Sized_relobj::do_read_symbols): Adjust section links.
15145 (Sized_relobj::symbol_section_and_value): Add is_ordinary
15146 parameter. Change all callers.
15147 (Sized_relobj::include_section_group): Adjust section links and
15148 symbol section indexes.
15149 (Sized_relobj::do_layout): Adjust section links.
15150 (Sized_relobj::do_count_local_symbols): Adjust section links and
15151 symbol section indexes.
15152 (Sized_relobj::do_finalize_local_symbols): Distinguish between
15153 ordinary and special symbols.
15154 (Sized_relobj::write_local_symbols): Add symtab_xindex and
15155 dynsym_xindex parameters. Change all callers. Adjust section
15156 links. Use SHN_XINDEX when needed.
15157 (Sized_relobj::get_symbol_location_info): Adjust section links.
15158 Don't get fooled by special symbols.
15159 * object.h (class Xindex): Define.
15160 (class Object): Add xindex_ parameter. Declare virtual functoin
15161 do_initialize_xindex.
15162 (Object::adjust_sym_shndx): New function.
15163 (Object::set_xindex): New protected function.
15164 (class Symbol_value): Add is_ordinary_shndx_ field.
15165 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15166 (Symbol_value::value): Assert ordinary section.
15167 (Symbol_value::initialize_input_to_output_map): Likewise.
15168 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15169 Change all callers.
15170 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
15171 all callers.
15172 (class Sized_relobj): Update declarations.
15173 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15174 parameter. Change all callers.
15175 (Sized_relobj::adjust_shndx): New function.
15176 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15177 field.
15178 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15179 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
15180 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
15181 (Sized_dynobj::read_dynsym_section): Adjust section links.
15182 (Sized_dynobj::read_dynamic): Likewise.
15183 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
15184 section links.
15185 (Sized_dynobj::do_initialize_xindex): New function.
15186 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
15187 do_initialize_xindex.
15188 (Sized_dynobj::adjust_shndx): New function.
15189 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15190 dynsym_xindex_ fields.
15191 (Layout::finalize): Add a call to set_section_indexes before
15192 creating the symtab sections.
15193 (Layout::set_section_indexes): Don't do anything if the section
15194 already has a section index.
15195 (Layout::create_symtab_sections): Add shnum parameter. Change
15196 caller. Create .symtab_shndx section if needed.
15197 (Layout::create_shdrs): Add shstrtab_section parameter. Change
15198 caller.
15199 (Layout::allocated_output_section_count): New function.
15200 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15201 needed.
15202 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15203 fields. Update declarations.
15204 (Layout::symtab_xindex): New function.
15205 (Layout::dynsym_xindex): New function.
15206 (class Write_symbols_task): Add layout_ field.
15207 (Write_symbols_task::Write_symbols_task): Add layout parameter.
15208 Change caller.
15209 * output.cc (Output_section_headers::Output_section_headers): Add
15210 shstrtab_section parameter. Change all callers.
15211 (Output_section_headers::do_sized_write): Store overflow values
15212 for section count and section string table section index in
15213 section header zero.
15214 (Output_file_header::do_sized_write): Check for overflow of
15215 section count and section string table section index.
15216 (Output_symtab_xindex::do_write): New function.
15217 (Output_symtab_xindex::endian_do_write): New function.
15218 * output.h (class Output_section_headers): Add shstrtab_section_.
15219 Update declarations.
15220 (class Output_symtab_xindex): Define.
15221 (Output_section::has_out_shndx): New function.
15222 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15223 field.
15224 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15225 Change all callers.
15226 (Sized_symbol::init): Likewise.
15227 (Symbol::output_section): Check for ordinary symbol.
15228 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
15229 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
15230 callers.
15231 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15232 Change all callers. Simplify handling of symbols from sections
15233 not included in the link.
15234 (Symbol_table::add_from_dynobj): Handle ordinary symbol
15235 distinction.
15236 (Weak_alias_sorter::operator()): Assert that symbols are
15237 ordinary.
15238 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15239 distinction.
15240 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15241 parameters. Change all callers.
15242 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
15243 symbol distinction. Use SHN_XINDEX when needed.
15244 (Symbol_table::write_section_symbol): Add symtab_xindex
15245 parameter. Change all callers.
15246 (Symbol_table::sized_write_section_symbol): Likewise. Use
15247 SHN_XINDEX when needed.
15248 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
15249 declarations.
15250 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
15251 (Symbol::is_defined): Check is_ordinary.
15252 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15253 (Symbol::is_absolute, Symbol::is_common): Likewise.
15254 (class Sized_symbol): Update declarations.
15255 (class Symbol_table): Update declarations.
15256 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15257 parameters. Change all callers.
15258 (Sized_symbol::override): Likewise.
15259 (Symbol_table::override): Likewise.
15260 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
15261 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
15262 is_ordinary, and orig_st_shndx parameters. Change all callers.
15263 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15264 to be in an ordinary section.
15265 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15266 object and is_ordinary parameters. Change all callers.
15267 (Sized_dwarf_line_info::read_relocs): Add object parameter.
15268 Change all callers. Don't add undefined or non-ordinary symbols
15269 to reloc_map_.
15270 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15271 Change all callers.
15272 * dwarf_reader.h (class Sized_dwarf_line_info): Update
15273 declarations.
15274 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15275 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15276 (Sized_relobj::relocate_sections): Likewise.
15277 * target-reloc.h (scan_relocs): Adjust section symbol index.
15278 (scan_relocatable_relocs): Likewise.
15279 * i386.cc (Scan::local): Check for ordinary symbols.
15280 * sparc.cc (Scan::local): Likewise.
15281 * x86_64.cc (Scan::local): Likewise.
15282 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15283 to symbol_section_and_value.
15284 * testsuite/many_sections_test.cc: New file.
15285 * testsuite/Makefile.am (BUILT_SOURCES): Define.
15286 (check_PROGRAMS): Add many_sections_test.
15287 (many_sections_test_SOURCES): Define.
15288 (many_sections_test_DEPENDENCIES): Define.
15289 (many_sections_test_LDFLAGS): Define.
15290 (BUILT_SOURCES): Add many_sections_define.h.
15291 (many_sections_define.h): New target.
15292 (BUILT_SOURCES): Add many_sections_check.h.
15293 (many_sections_check.h): New target.
15294 (check_PROGRAMS): Add many_sections_r_test.
15295 (many_sections_r_test_SOURCES): Define.
15296 (many_sections_r_test_DEPENDENCIES): Define.
15297 (many_sections_r_test_LDFLAGS): Define.
15298 (many_sections_r_test_LDADD): Define.
15299 (many_sections_r_test.o): New target.
15300 * testsuite/Makefile.in: Rebuild.
15301
15302 2008-04-17 Cary Coutant <ccoutant@google.com>
15303
15304 * errors.cc (Errors::info): New function.
15305 (gold_info): New function.
15306 * errors.h (Errors::info): New function.
15307 * gold.h (gold_info): New function.
15308 * object.cc (Input_objects::add_object): Print trace output.
15309 * options.cc (options::parse_set): New function.
15310 (General_options::parse_wrap): Deleted.
15311 (General_options::General_options): Deleted initializer.
15312 * options.h (options::String_set): New typedef.
15313 (options::parse_set): New function.
15314 (DEFINE_set): New macro.
15315 (General_options::wrap): Changed to use DEFINE_set. Changed
15316 callers of any_wrap_symbols and is_wrap_symbol.
15317 (General_options::trace, General_options::trace_symbol):
15318 New options.
15319 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15320 (General_options::wrap_symbols_): Deleted.
15321 * symtab.cc (Symbol_table::add_from_object): Print trace output.
15322
15323 2008-04-17 David S. Miller <davem@davemloft.net>
15324
15325 * options.cc (General_options::parse_V): New function.
15326 * options.h: Add entries for -V and -Qy.
15327
15328 2008-04-17 Ian Lance Taylor <iant@google.com>
15329
15330 * common.cc (Symbol_table::allocate_commons): Remove options
15331 parameter. Change caller.
15332 (Symbol_table::do_allocate_commons): Remove options parameter.
15333 Change caller. Just call do_allocate_commons_list twice.
15334 (Symbol_table::do_allocate_commons_list): New function, broken out
15335 of do_allocate_commons.
15336 * common.h (class Allocate_commons_task): Remove options_ field.
15337 Update constructor.
15338 * symtab.cc (Symbol_table::Symbol_table): Initialize
15339 tls_commons_.
15340 (Symbol_table::add_from_object): Put TLS common symbols on
15341 tls_commons_ list.
15342 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15343 which are IN_OUTPUT_DATA.
15344 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
15345 allocate_commons and do_allocate_commons declarations. Declare
15346 do_allocate_commons_list.
15347 * gold.cc (queue_middle_tasks): Update creation of
15348 Allocate_commons_task to not pass options.
15349 * testsuite/Makefile.am (INCLUDES): Add -I.. .
15350 (TLS_TEST_C_FLAGS): New variable.
15351 (tls_test_c_pic.o): New target.
15352 (tls_test_shared.so): Link in tls_test_c_pic.o.
15353 (tls_test_c_pic_ie.o): New target.
15354 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15355 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15356 (tls_test_c.o): New target.
15357 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15358 (tls_pic_test_LDADD): Likewise.
15359 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15360 (tls_shared_gd_to_ie_test_LDADD): Likewise.
15361 (tls_test_c_gnu2.o): New target.
15362 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15363 tls_test_c_gnu2.o.
15364 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15365 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15366 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15367 * testsuite/tls_test.cc: Include "config.h".
15368 (t_last): Call t11_last.
15369 * testsuite/tls_test.h (t11, t11_last): Declare.
15370 * testsuite/tls_test_c.c: New file.
15371 * testsuite/tls_test_main.cc (thread_routine): Call t11.
15372 * configure.ac: Check for OpenMP support.
15373 * configure, config.in, Makefile.in: Rebuild.
15374 * testsuite/Makefile.in: Rebuild.
15375
15376 2008-04-16 Cary Coutant <ccoutant@google.com>
15377
15378 * i386.cc (Target_i386::define_tls_base_symbol): New function.
15379 (Target_i386::tls_base_symbol_defined_): New field.
15380 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15381 (Target_i386::Scan::global): Likewise.
15382 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15383 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15384 (Target_x86_64::tls_base_symbol_defined_): New field.
15385 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15386 (Target_x86_64::Scan::global): Likewise.
15387
15388 2008-04-16 Cary Coutant <ccoutant@google.com>
15389
15390 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15391 (Symbol::needs_plt_entry): Allow weak undefined symbols.
15392 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15393 building shared libraries.
15394 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15395 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15396 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15397 * testsuite/Makefile.in: Rebuild.
15398 * testsuite/weak_undef.h: New file.
15399 * testsuite/weak_undef_file1.cc: Add extra test cases.
15400 * testsuite/weak_undef_file2.cc: Likewise.
15401 * testsuite/weak_undef_test.cc: Likewise.
15402
15403 2008-04-16 David S. Miller <davem@davemloft.net>
15404
15405 * sparc.cc (Target_sparc::Scan): Change from struct to class.
15406 Add issued_non_pic_error_ field. Declare check_non_pic.
15407 (Target_sparc::Scan::check_non_pic): New function.
15408 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15409 (Target_sparc::Scan::global): Likewise.
15410
15411 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15412 * configure: Rebuild.
15413
15414 * options.h (DEFINE_enable): New macro.
15415 (new_dtags): New enable option.
15416 (initfirst, interpose, loadfltr, nodefaultlib,
15417 nodelete, nodlopen, nodump): New -z options.
15418 * layout.cc (Layout:finish_dynamic_section): If new
15419 dtags enabled, emit DT_RUNPATH. Also, emit a
15420 DT_FLAGS_1 containing any specified -z flags.
15421
15422 2008-04-16 Ian Lance Taylor <iant@google.com>
15423
15424 * copy-relocs.cc: New file.
15425 * copy-relocs.h: New file.
15426 * reloc.cc: Remove Copy_relocs code.
15427 * reloc.h: Likewise.
15428 * reloc-types.h (struct Reloc_types) [both versions]: Add
15429 get_reloc_addend_noerror.
15430 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15431 variants of add_global which take an addend which must be zero.
15432 * i386.cc: Include "copy-relocs.h".
15433 (class Target_i386): Change type of copy_relocs_ to variable,
15434 update initializer.
15435 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15436 Change all callers.
15437 (Target_i386::do_finalize_sections): Change handling of
15438 copy_relocs_.
15439 * sparc.cc: Include "copy-relocs.h".
15440 (class Target_sparc): Change type of copy_relocs_ to variable,
15441 update initializer.
15442 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15443 Change all callers.
15444 (Target_sparc::do_finalize_sections): Change handling of
15445 copy_relocs_.
15446 * x86_64.cc: Include "copy-relocs.h".
15447 (class Target_x86_64): Change type of copy_relocs_ to variable,
15448 update initializer.
15449 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15450 class. Change all callers.
15451 (Target_x86_64::do_finalize_sections): Change handling of
15452 copy_relocs_.
15453 * Makefile.am (CCFILES): Add copy-relocs.cc.
15454 (HFILES): Add copy-relocs.h.
15455
15456 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15457
15458 * testsuite/script_test_4.sh: Permit leading zeroes.
15459
15460 2008-04-15 Ian Lance Taylor <iant@google.com>
15461
15462 * script-sections.cc (Script_sections::create_segments): Use
15463 header_size_adjustment even when there is enough room for the
15464 headers.
15465 * testsuite/script_test_4.sh: New file.
15466 * testsuite/script_test_4.t: New file.
15467 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15468 (check_DATA): Add script_test_4.stdout.
15469 (MOSTLYCLEANFILES): Likewise.
15470 (script_test_4): New target.
15471 (script_test_4.stdout): New target.
15472 * testsuite/Makefile.in: Rebuild.
15473
15474 * sparc.cc: Add definitions for Output_data_plt_sparc class
15475 constants.
15476
15477 2008-04-14 David S. Miller <davem@davemloft.net>
15478
15479 * sparc.cc: New file.
15480 * Makefile.am (TARGETSOURCES): Add sparc.cc
15481 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15482 * configure.tgt: Document targ_extra_size and
15483 targ_extra_big_endian. Add entries for sparc-* and
15484 sparc64-*.
15485 * configure.ac: Handle targ_extra_size and
15486 targ_extra_big_endian.
15487 * Makefile.in: Rebuild.
15488 * configure: Likewise.
15489 * po/POTFILES.in: Likewise.
15490 * po/gold.pot: Likewise.
15491
15492 2008-04-14 Ian Lance Taylor <iant@google.com>
15493
15494 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15495 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15496 in the name/type/flags to section mapping. Don't call
15497 allocate_output_section.
15498 (Layout::choose_output_section): Change parameter from adjust_name
15499 to is_input_section. Don't permit input sections after sections
15500 are attached to segments. Don't call allocate_output_section.
15501 (Layout::layout_eh_frame): Call update_flags_for_input_section,
15502 not write_enable_output_section.
15503 (Layout::make_output_section): Don't push to
15504 unattached_section_list_ nor call attach_to_segment. Call
15505 attach_section_to_segment if sections are attached.
15506 (Layout::attach_sections_to_segments): New function.
15507 (Layout::attach_section_to_segment): New function.
15508 (Layout::attach_allocated_section_to_segment): Rename from
15509 attach_to_segment. Remove flags parameter.
15510 (Layout::allocate_output_section): Remove function.
15511 (Layout::write_enable_output_section): Remove function.
15512 * layout.h (class Layout): Update for above changes. Add new
15513 field sections_are_attached_.
15514 * output.h (Output_section::update_flags_for_input_section): New
15515 function.
15516 * output.cc (Output_section::add_input_section): Call
15517 update_flags_for_input_section.
15518 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15519
15520 2008-04-11 Cary Coutant <ccoutant@google.com>
15521
15522 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15523 thought unnecessary.
15524 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15525
15526 2008-04-11 Ian Lance Taylor <iant@google.com>
15527
15528 * output.h (class Output_section_data): Remove inline definition
15529 of set_addralign.
15530 * output.cc (Output_section_data::set_addralign): New function.
15531
15532 2008-04-11 Cary Coutant <ccoutant@google.com>
15533
15534 Add support for TLS descriptors for i386 and x86_64.
15535 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15536 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15537 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15538 GOT_TYPE_TLS_DESC.
15539 (Target_i386::got_mod_index_entry): Remove unnecessary code.
15540 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15541 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
15542 relocations.
15543 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15544 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15545 Fix problem with initial-exec relocations.
15546 (Target_i386::Relocate::relocate_tls): Likewise.
15547 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15548 relaxation.
15549 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15550 support for section-plus-offset dynamic table entries.
15551 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15552 (Output_data_dynamic::Dynamic_entry): Add support for
15553 section-plus-offset dynamic table entries.
15554 (Output_data_dynamic::Classification): Likewise.
15555 (Output_data_dynamic::classification_): Renamed offset_.
15556 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15557 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15558 (Target_x86_64::make_plt_section): New function.
15559 (Target_x86_64::reserve_tlsdesc_entries): New function.
15560 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15561 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15562 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15563 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15564 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15565 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15566 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15567 add extra PLT entry for TLS descriptors.
15568 (Output_data_plt_x86_64::got_): New field.
15569 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15570 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15571 fields.
15572 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15573 descriptors.
15574 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15575 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15576 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15577 R_386_TLS_DESC_CALL relocations.
15578 (Target_x86_64::Scan::global): Likewise.
15579 (Target_x86_64::do_finalize_sections): Add dynamic table entries
15580 for TLS descriptors.
15581 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15582 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15583 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15584 GD-to-IE relaxation.
15585 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15586 and TLS_DESCRIPTORS.
15587 * Makefile.in: Rebuild.
15588 * configure: Rebuild.
15589 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15590 (tls_test_shared2.so): New target.
15591 (tls_shared_gd_to_ie_test_SOURCES): New variable.
15592 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15593 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15594 (tls_shared_gd_to_ie_test_LDADD): New variable.
15595 (tls_shared_gnu2_gd_to_ie_test): New target.
15596 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15597 New targets.
15598 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15599 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15600 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15601 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15602 (tls_shared_gnu2_test): New target.
15603 (tls_test_gnu2_shared.so): New target.
15604 (tls_shared_gnu2_test_SOURCES): New variable.
15605 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15606 (tls_shared_gnu2_test_LDFLAGS): New variable.
15607 (tls_shared_gnu2_test_LDADD): New variable.
15608 * testsuite/Makefile.in: Rebuild.
15609 * testsuite/Makefile.
15610
15611 2008-04-11 Ian Lance Taylor <iant@google.com>
15612
15613 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15614 justsyms.t.
15615 * testsuite/Makefile.in: Rebuild.
15616
15617 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15618 long.
15619 * testsuite/script_test_2.cc (main): Adjust test.
15620
15621 2008-04-11 David S. Miller <davem@davemloft.net>
15622 Ian Lance Taylor <iant@google.com>
15623
15624 * options.h (General_options): Add entries for '-Y' and
15625 '-relax'.
15626 * options.cc (General_options:finalize): If -Y was used, add those
15627 entries to the library path instead of the default "/lib" and
15628 "/usr/lib".
15629
15630 2008-04-11 David S. Miller <davem@davemloft.net>
15631
15632 * testsuite/justsyms.t: Start at 0x100.
15633 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15634 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15635 long.
15636 * testsuite/script_test_2.cc: Adjust string and section length
15637 checks.
15638
15639 2008-04-09 Ian Lance Taylor <iant@google.com>
15640
15641 PR gold/5996
15642 * script-sections.cc (Sections_element::allocate_to_segment): Add
15643 orphan parameter.
15644 (Output_section_definition::allocate_to_segment): Likewise.
15645 (Orphan_output_section::allocate_to_segment): Likewise.
15646 (Script_sections::attach_sections_using_phdrs_clause): Don't
15647 propagate non-PT_LOAD segments to orphan sections.
15648 * testsuite/Makefile.am (script_test_3.stdout): Generate using
15649 readelf rather than objdump.
15650 * testsuite/script_test_3.sh: Adjust accordingly. Test that
15651 .interp section and PT_INTERP segment are the same size.
15652 * testsuite/Makefile.in: Rebuild.
15653
15654 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15655 aliases for symbols defined in the same object.
15656 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15657 (weak_alias_test_SOURCES): New variable.
15658 (weak_alias_test_DEPENDENCIES): New variable.
15659 (weak_alias_test_LDFLAGS): New variable.
15660 (weak_alias_test_LDADD): New variable.
15661 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15662 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15663 (weak_alias_test_3.o): New target.
15664 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15665 * testsuite/weak_alias_test_main.cc: New file.
15666 * testsuite/weak_alias_test_1.cc: New file.
15667 * testsuite/weak_alias_test_2.cc: New file.
15668 * testsuite/weak_alias_test_3.cc: New file.
15669
15670 2008-04-08 Ian Lance Taylor <iant@google.com>
15671
15672 * options.h (class General_options): Add --noinhibit-exec option.
15673 * main.cc (main): Check --noinhibit-exec.
15674
15675 * options.h (class General_options): Define --wrap as a special
15676 option. Add wrap_symbols_ field.
15677 (General_options::any_wrap_symbols): New function.
15678 (General_options::is_wrap_symbol): New function.
15679 * options.cc (General_options::parse_wrap): New function.
15680 (General_options::General_options): Initialize wrap_symbols_.
15681 * symtab.cc (Symbol_table::wrap_symbol): New function.
15682 (Symbol_table::add_from_object): Handle --wrap.
15683 * symtab.h (class Symbol_table): Declare wrap_symbol.
15684 * target.h (Target::wrap_char): New function.
15685 (Target::Target_info): Add wrap_char field.
15686 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15687 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15688 * testsuite/testfile.cc (Target_test::test_target_info):
15689 Likewise.
15690
15691 * errors.cc (Errors::undefined_symbol): Mention symbol version if
15692 there is one.
15693
15694 * layout.h (class Layout): Add added_eh_frame_data_ field.
15695 * layout.cc (Layout::Layout): Initialize new field.
15696 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15697 output section until we find a section we merged successfully.
15698 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15699 that the size be non-zero.
15700
15701 * merge.cc (Object_merge_map::get_output_offset): Remove inline
15702 qualifier.
15703
15704 2008-04-08 Craig Silverstein <csilvers@google.com>
15705
15706 * configure.ac: Export new conditional variable HAVE_ZLIB.
15707 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15708 on HAVE_ZLIB.
15709 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15710 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15711
15712 2008-04-07 Ian Lance Taylor <iant@google.com>
15713
15714 * version.cc (version_string): Set to "1.5".
15715
15716 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15717 Add issued_non_pic_error_ field. Declare check_non_pic.
15718 (Target_x86_64::Scan::check_non_pic): New function.
15719 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15720 (Target_x86_64::Scan::global): Likewise.
15721
15722 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15723 addend parameter. Change caller. Handle merge sections.
15724 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15725 Address to Addend. Don't add in the result of
15726 local_section_offset, pass down the addend and use the returned
15727 value.
15728 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15729 Update declarations of local_section_offset and symbol_value.
15730 * testsuite/two_file_test_1.cc (t18): New function.
15731 * testsuite/two_file_test_2.cc (f18): New function.
15732 * testsuite/two_file_test_main.cc (main): Call t18.
15733 * testsuite/two_file_test.h (t18, f18): Declare.
15734
15735 * configure.ac: Don't test for objdump, c++filt, or readelf.
15736 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15737 conditionals.
15738 (TEST_READELF): New variable.
15739 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15740 (check_PROGRAMS): Add two_file_strip_test.
15741 (two_file_strip_test): New target.
15742 (check_PROGRAMS): Add two_file_same_shared_strip_test.
15743 (two_file_same_shared_strip_test_SOURCES): New variable.
15744 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15745 (two_file_same_shared_strip_test_LDFLAGS): New variable.
15746 (two_file_same_shared_strip_test_LDADD): New variable.
15747 (two_file_shared_strip.so): New target.
15748 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15749 (ver_test_5.syms, ver_test_7.syms): Likewise.
15750 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15751 (strip_test_3.stdout): Use TEST_OBJDUMP.
15752 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15753
15754 2008-04-04 Cary Coutant <ccoutant@google.com>
15755
15756 * symtab.h (Symbol::is_weak_undefined): New function.
15757 (Symbol::is_strong_undefined): New function.
15758 (Symbol::is_absolute): New function.
15759 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15760 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15761 absolute symbols.
15762 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15763 (weak_undef_test): New target.
15764 * testsuite/Makefile.in: Rebuild.
15765 * testsuite/weak_undef_file1.cc: New file.
15766 * testsuite/weak_undef_file2.cc: New file.
15767 * testsuite/weak_undef_test.cc: New file.
15768
15769 2008-04-03 Craig Silverstein <csilvers@google.com>
15770
15771 * compressed_output.h (class Output_compressed_section): Use
15772 unsigned buffer.
15773 * compressed_output.cc (zlib_compress): Use unsigned buffers,
15774 add zlib header.
15775 (zlib_compressed_suffix): Removed.
15776 (Output_compressed_section::set_final_data_size): Use unsigned
15777 buffers.
15778 * testsuite/Makefile.am (flagstest_compress_debug_sections):
15779 Fix linker invocation.
15780 (flagstest_o_specialfile_and_compress_debug_sections):
15781 Likewise.
15782 * testsuite/Makefile.in: Regenerated.
15783
15784 2008-04-02 David S. Miller <davem@davemloft.net>
15785
15786 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15787 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15788
15789 2008-04-02 Craig Silverstein <csilvers@google.com>
15790
15791 * TODO: New file.
15792
15793 2008-04-02 Ian Lance Taylor <iant@google.com>
15794
15795 * fileread.cc (File_read::find_view): Add byteshift and vshifted
15796 parameters. Update for new key type to views_. Change all
15797 callers.
15798 (File_read::read): Adjust for byteshift in returned view.
15799 (File_read::add_view): New function, broken out of
15800 find_and_make_view.
15801 (File_read::make_view): New function, broken out of
15802 find_and_make_view.
15803 (File_read::find_or_make_view): Add offset and aligned
15804 parameters. Rewrite accordingly. Change all callers.
15805 (File_read::get_view): Add offset and aligned parameters. Adjust
15806 for byteshift in return value.
15807 (File_read::get_lasting_view): Likewise.
15808 * fileread.h (class File_read): Update declarations.
15809 (class File_read::View): Add byteshift_ field. Add byteshift to
15810 constructor. Add byteshift method.
15811 * archive.h (Archive::clear_uncached_views): New function.
15812 (Archive::get_view): Add aligned parameter. Change all callers.
15813 * object.h (Object::get_view): Add aligned parameter. Change all
15814 callers.
15815 (Object::get_lasting_view): Likewise.
15816
15817 * fileread.cc (File_read::release): Don't call clear_views if
15818 there are multiple objects.
15819 * fileread.h (File_read::clear_uncached_views): New function.
15820 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15821 on the archive.
15822
15823 2008-03-31 Cary Coutant <ccoutant@google.com>
15824
15825 Add thin archive support.
15826 * archive.cc (Archive::armagt): New const.
15827 (Archive::setup): Remove task parameter and calls to unlock.
15828 (Archive::unlock_nested_archives): New function.
15829 (Archive::read_header): Add nested_off parameter. Change
15830 all callers.
15831 (Archive::interpret_header): Likewise.
15832 (Archive::include_all_members): Change to handle thin
15833 archives.
15834 (Archive::include_member): Likewise.
15835 * archive.h (Archive::Archive): Add new parameters and
15836 initializers.
15837 (Archive::armagt): New const.
15838 (Archive::setup): Remove task parameter.
15839 (Archive::unlock_nested_archives): New function.
15840 (Archive::read_header): Add nested_off parameter.
15841 (Archive::interpret_header): Likewise.
15842 (Archive::Nested_archive_table): New typedef.
15843 (Archive::is_thin_archive_): New field.
15844 (Archive::nested_archives_): New field.
15845 (Archive::options_): New field.
15846 (Archive::dirpath_): New field.
15847 (Archive::task_): New field.
15848 * readsyms.cc (Read_symbols::do_read_symbols): Add check
15849 for thin archives. Pass additional parameters to
15850 Archive::Archive. Unlock the archive file after calling
15851 Archive::setup.
15852
15853 2008-03-29 Ian Lance Taylor <iant@google.com>
15854
15855 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15856 version symbol to be local.
15857 * testsuite/ver_test_4.sh: New file.
15858 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15859 (check_DATA): Add ver_test_4.syms.
15860 (ver_test_4.syms): New target.
15861 * testsuite/Makefile.in: Rebuild.
15862
15863 * output.cc
15864 (Output_section::Input_section_sort_entry::has_priority): New
15865 function.
15866 (Output_section::Input_section_sort_entry::match_file_name): New
15867 function.
15868 (Output_section::Input_section_sort_entry::match_section_name):
15869 Remove.
15870 (Output_section::Input_section_sort_entry::match_section_name_prefix):
15871 Remove.
15872 (Output_section::Input_section_sort_entry::match_section_file):
15873 Remove.
15874 (Output_section::Input_section_sort_compare::operator()): Rewrite
15875 using new Input_section_sort_entry functions. Sort crtbegin and
15876 crtend first. Sort sections with no priority before sections with
15877 a priority.
15878 * testsuite/initpri1.c (d3): Check j != 4.
15879 (cd5): New constructor/destructor function.
15880 (main): Check j != 2.
15881
15882 * symtab.cc (Symbol_table::add_from_object): If we don't use the
15883 new symbol when resolving, don't call set_is_default.
15884 * testsuite/ver_test_7.cc: New file.
15885 * testsuite/ver_test_7.sh: New file.
15886 * testsuite/Makefile.am (ver_test_7.so): New target.
15887 (ver_test_7.o): New target.
15888 (check_SCRIPTS): Add ver_test_7.sh.
15889 (check_DATA): Add ver_test_7.syms.
15890 (ver_test_7.syms): New target.
15891
15892 2008-03-28 Ian Lance Taylor <iant@google.com>
15893
15894 * layout.cc (Layout::layout): If we see an input section with a
15895 name that needs sorting, set the must_sort flag for the output
15896 section.
15897 (Layout::make_output_section): If the name of the output section
15898 indicates that it might require sorting, set the may_sort flag.
15899 * output.h (Output_section::may_sort_attached_input_sections): New
15900 function.
15901 (Output_section::set_may_sort_attached_input_sections): New
15902 function.
15903 (Output_section::must_sort_attached_input_sections): New
15904 function.
15905 (Output_section::set_must_sort_attached_input_sections): New
15906 function.
15907 (class Output_section): Declare Input_section_sort_entry. Define
15908 Input_section_sort_compare. Declare
15909 sort_attached_input_sections. Add new fields:
15910 may_sort_attached_input_sections_,
15911 must_sort_attached_input_sections_,
15912 attached_input_sections_are_sorted_.
15913 * output.cc (Output_section::Output_section): Initialize new
15914 fields.
15915 (Output_section::add_input_section): Add an entry to
15916 input_sections_ if may_sort or must_sort are true.
15917 (Output_section::set_final_data_size): Call
15918 sort_attached_input_sections if necessary.
15919 (Output_section::Input_section_sort_entry): Define new class.
15920 (Output_section::Input_section_sort_compare::operator()): New
15921 function.
15922 (Output_section::sort_attached_input_sections): New function.
15923 * configure.ac: Check whether the compiler supports constructor
15924 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
15925 * testsuite/initpri1.c: New file.
15926 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15927 CONSTRUCTOR_PRIORITY.
15928 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15929 (initpri1_LDFLAGS): New variable.
15930 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15931
15932 2008-03-27 Ian Lance Taylor <iant@google.com>
15933
15934 * common.cc (Sort_commons::operator): Correct sorting algorithm.
15935 * testsuite/common_test_1.c: New file.
15936 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15937 (common_test_1_SOURCES): New variable.
15938 (common_test_1_DEPENDENCIES): New variable.
15939 (common_test_1_LDFLAGS): New variable.
15940
15941 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15942 and commons_ correctly when NAME/VERSION does not override
15943 NAME/NULL.
15944 * testsuite/ver_test_6.c: New file.
15945 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15946 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15947 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15948
15949 2008-03-26 Ian Lance Taylor <iant@google.com>
15950
15951 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15952 of an undefined symbol from a version script.
15953 * testsuite/Makefile.am (ver_test_5.so): New target.
15954 (ver_test_5.o): New target.
15955 (check_SCRIPTS): Add ver_test_5.sh.
15956 (check_DATA): Add ver_test_5.syms.
15957 (ver_test_5.syms): New target.
15958 * testsuite/ver_test_5.cc: New file.
15959 * testsuite/ver_test_5.script: New file.
15960 * testsuite/ver_test_5.sh: New file.
15961 * Makefile.in, testsuite/Makefile.in: Rebuild.
15962
15963 PR gold/5986
15964 Fix problems building gold with gcc 4.3.0.
15965 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15966 (gold_error_at_location, gold_warning_at_location): Use it.
15967 * configure.ac: Check whether we can compile and use a template
15968 function with a printf attribute.
15969 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15970 when jumping over bytes.
15971 * object.cc: Instantiate Object::read_section_data.
15972 * debug.h: Include <cstring>
15973 * dwarf_reader.cc: Include <algorithm>
15974 * main.cc: Include <cstring>.
15975 * options.cc: Include <cstring>.
15976 * output.cc: Include <cstring>.
15977 * script.cc: Include <cstring>.
15978 * script.h: Include <string>.
15979 * symtab.cc: Include <cstring> and <algorithm>.
15980 * target-select.cc: Include <cstring>.
15981 * version.cc: Include <string>.
15982 * testsuite/testmain.cc: Include <cstdlib>.
15983 * configure, config.in: Rebuild.
15984
15985 2008-03-25 Ian Lance Taylor <iant@google.com>
15986
15987 * options.cc: Include "../bfd/bfdver.h".
15988 (options::help): Print bug reporting address.
15989
15990 * version.cc (print_version): Adjust output for current value of
15991 BFD_VERSION_STRING.
15992
15993 * NEWS: New file.
15994
15995 * options.cc (options::help): Print list of supported targets.
15996 * target-select.h: Include <vector>.
15997 (class Target_selector): Make machine_, size_, and is_big_endian_
15998 fields const. Add bfd_name_ and instantiated_target_ fields.
15999 (Target_selector::Target_selector): Add bfd_name parameter.
16000 (Target_selector::recognize): Make non-virtual, call
16001 do_recognize.
16002 (Target_selector::recognize_by_name): Make non-virtual, call
16003 do_recognize_by_name.
16004 (Target_selector::supported_names): New function.
16005 (Target_selector::bfd_name): New function.
16006 (Target_selector::do_instantiate_target): New pure virtual
16007 function.
16008 (Target_selector::do_recognize): New virtual function.
16009 (Target_selector::do_recognize_by_name): New virtual function.
16010 (Target_selector::instantiate_target): New private function.
16011 (supported_target_names): Declare.
16012 * target-select.cc (Target_selector::Target_selector): Update for
16013 new parameter and fields.
16014 (select_target_by_name): Check that the name matches before
16015 calling recognize_by_name.
16016 (supported_target_names): New function.
16017 * i386.cc (class Target_selector_i386): Update Target_selector
16018 constructor call. Remove recognize and recognize_by_name. Add
16019 do_instantiate_target.
16020 * x86_64.cc (class Target_selector_x86_64): Likewise.
16021 * testsuite/testfile.cc (class Target_selector_test): Update for
16022 changes to Target_selector.
16023
16024 * README: Rewrite, with some notes on unsupported features.
16025
16026 2008-03-24 Cary Coutant <ccoutant@google.com>
16027
16028 * i386.cc (Target_i386::Got_type): New enum declaration.
16029 (Target_i386::Scan::local): Updated callers of Output_data_got
16030 member functions.
16031 (Target_i386::Scan::global): Likewise.
16032 (Target_i386::Relocate::relocate): Likewise.
16033 (Target_i386::Relocate::relocate_tls): Likewise.
16034 * object.h (Got_offset_list): New class.
16035 (Sized_relobj::local_has_got_offset): Added got_type parameter.
16036 (Sized_relobj::local_got_offset): Likewise.
16037 (Sized_relobj::set_local_got_offset): Likewise.
16038 (Sized_relobj::local_has_tls_got_offset): Removed.
16039 (Sized_relobj::local_tls_got_offset): Removed.
16040 (Sized_relobj::set_local_tls_got_offset): Removed.
16041 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16042 * output.cc (Output_data_got::add_global): Added got_type parameter.
16043 (Output_data_got::add_global_with_rel): Likewise.
16044 (Output_data_got::add_global_with_rela): Likewise.
16045 (Output_data_got::add_global_pair_with_rel): New function.
16046 (Output_data_got::add_global_pair_with_rela): New function.
16047 (Output_data_got::add_local): Added got_type parameter.
16048 (Output_data_got::add_local_with_rel): Likewise.
16049 (Output_data_got::add_local_with_rela): Likewise.
16050 (Output_data_got::add_local_pair_with_rel): New function.
16051 (Output_data_got::add_local_pair_with_rela): New function.
16052 (Output_data_got::add_global_tls): Removed.
16053 (Output_data_got::add_global_tls_with_rel): Removed.
16054 (Output_data_got::add_global_tls_with_rela): Removed.
16055 (Output_data_got::add_local_tls): Removed.
16056 (Output_data_got::add_local_tls_with_rel): Removed.
16057 (Output_data_got::add_local_tls_with_rela): Removed.
16058 * output.h (Output_data_got::add_global): Added got_type parameter.
16059 (Output_data_got::add_global_with_rel): Likewise.
16060 (Output_data_got::add_global_with_rela): Likewise.
16061 (Output_data_got::add_global_pair_with_rel): New function.
16062 (Output_data_got::add_global_pair_with_rela): New function.
16063 (Output_data_got::add_local): Added got_type parameter.
16064 (Output_data_got::add_local_with_rel): Likewise.
16065 (Output_data_got::add_local_with_rela): Likewise.
16066 (Output_data_got::add_local_pair_with_rel): New function.
16067 (Output_data_got::add_local_pair_with_rela): New function.
16068 (Output_data_got::add_global_tls): Removed.
16069 (Output_data_got::add_global_tls_with_rel): Removed.
16070 (Output_data_got::add_global_tls_with_rela): Removed.
16071 (Output_data_got::add_local_tls): Removed.
16072 (Output_data_got::add_local_tls_with_rel): Removed.
16073 (Output_data_got::add_local_tls_with_rela): Removed.
16074 * resolve.cc (Symbol::override_base_with_special): Removed
16075 reference to has_got_offset_ field.
16076 * symtab.cc (Symbol::init_fields): Replaced initialization
16077 of got_offset_ with got_offsets_. Removed initialization
16078 of has_got_offset_
16079 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16080 (Symbol::got_offset): Likewise.
16081 (Symbol::set_got_offset): Likewise.
16082 (Symbol::has_tls_got_offset): Removed.
16083 (Symbol::tls_got_offset): Removed.
16084 (Symbol::set_tls_got_offset): Removed.
16085 (Symbol::got_offset_): Removed.
16086 (Symbol::tls_mod_got_offset_): Removed.
16087 (Symbol::tls_pair_got_offset_): Removed.
16088 (Symbol::got_offsets_): New field.
16089 (Symbol::has_got_offset): Removed.
16090 (Symbol::has_tls_mod_got_offset): Removed.
16091 (Symbol::has_tls_pair_got_offset): Removed.
16092 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16093 (Target_x86_64::Scan::local): Updated callers of Output_data_got
16094 member functions.
16095 (Target_x86_64::Scan::global): Likewise.
16096 (Target_x86_64::Relocate::relocate): Likewise.
16097 (Target_x86_64::Relocate::relocate_tls): Likewise.
16098
16099 2008-03-25 Ben Elliston <bje@au.ibm.com>
16100
16101 * yyscript.y: Fix spelling error in comment.
16102
16103 2008-03-24 Ian Lance Taylor <iant@google.com>
16104
16105 * options.h (class General_options): Define build_id option.
16106 * layout.h (class Layout): Declare write_build_id, create_note,
16107 create_build_id. Add build_id_note_ member.
16108 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16109 "libiberty.h", "md5.h", "sha1.h".
16110 (Layout::Layout): Initialize eh_frame_data_,
16111 eh_frame_hdr_section_, and build_id_note_.
16112 (Layout::finalize): Call create_build_id.
16113 (Layout::create_note): New function, broken out of
16114 Layout::create_gold_note.
16115 (Layout::create_gold_note): Call create_note.
16116 (Layout::create_build_id): New function.
16117 (Layout::write_build_id): New function.
16118 (Close_task_runner::run): Call write_build_id.
16119
16120 * x86_64.cc: Correct license to GPLv3.
16121
16122 2008-03-23 Ian Lance Taylor <iant@google.com>
16123
16124 * options.cc: Include "demangle.h".
16125 (parse_optional_string): New function.
16126 (parse_long_option): Handle takes_optional_argument.
16127 (parse_short_option): Update dash_z initializer. Handle
16128 takes_optional_argument.
16129 (General_options::General_options): Initialize do_demangle_.
16130 (General_options::finalize): Set do_demangle_. Handle demangling
16131 style.
16132 * options.h (parse_optional_string): Declare.
16133 (struct One_option): Add optional_arg field. Update constructor.
16134 Update call constructor calls. Add takes_optional_argument
16135 function.
16136 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
16137 (DEFINE_optional_string): Define.
16138 (General_options::demangle): Change from DEFINE_bool to
16139 DEFINE_optional_string.
16140 (General_options::no_demangle): New function.
16141 (General_options::do_demangle): New function.
16142 (General_options::set_do_demangle): New function.
16143 (General_options::execstack_status_): Move definition to end of
16144 class definition.
16145 (General_options::static_): Likewise.
16146 (General_options::do_demangle_): New field.
16147 * object.cc (big_endian>::get_symbol_location_info): Call
16148 Options::do_demangle, not Options::demangle.
16149 * symtab.cc (demangle): Likewise.
16150
16151 2008-03-22 Ian Lance Taylor <iant@google.com>
16152
16153 * gold.h: Include <cstddef> and <sys/types.h>
16154 * options.h: Include <cstring>.
16155
16156 2008-03-21 Ian Lance Taylor <iant@google.com>
16157
16158 * Added source code to GNU binutils.
16159 \f
16160 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16161
16162 Copying and distribution of this file, with or without modification,
16163 are permitted in any medium without royalty provided the copyright
16164 notice and this notice are preserved.
16165
16166 Local Variables:
16167 mode: change-log
16168 left-margin: 8
16169 fill-column: 74
16170 version-control: never
16171 End: