gold/
[binutils-gdb.git] / gold / ChangeLog
1 2013-10-07 Cary Coutant <ccoutant@google.com>
2
3 PR gold/16010
4 * testsuite/Makefile.am (icf_test): Fix dependencies.
5 (icf_safe_test): Likewise.
6 (icf_safe_so_test): Likewise.
7 (large_symbol_alignment): Add empty _LDADD rule.
8 * testsuite/Makefile.in: Regenerate.
9
10 2013-09-03 Pavel Chupin <pavel.v.chupin@intel.com>
11
12 PR gold/15927
13 * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
14 relocation for R_X86_64_32 on x32.
15
16 2013-08-27 Roland McGrath <mcgrathr@google.com>
17
18 * output.cc (Output_segment::set_section_addresses): Take new
19 Target* argument. If target->isolate_execinstr() and the segment
20 is executable and starts at a target->abi_pagesize() boundary,
21 pad its end out to a target->abi_pagesize() boundary with code fill.
22 * output.h (Output_segment::set_section_addresses): Update decl.
23 * layout.h (Layout::check_output_data_for_reset_values): Take new
24 argument RELAX_OUTPUTS.
25 (Layout): New member relax_output_list_.
26 (Layout::add_relax_output): New method.
27 * layout.cc (Layout::Layout): Update constructor.
28 (Layout::reset_relax_output): New method.
29 (Layout::clean_up_after_relaxation): Call it.
30 (Layout::prepare_for_relaxation): Update caller.
31 (Layout::set_segment_offsets): Update callers of set_section_addresses.
32 Call reset_relax_output before re-processing segments for
33 isolate_execinstr case.
34 (Layout::write_data): Handle relax_output_list_.
35 (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
36 Take new argument RELAX_OUTPUTS. Assert it's an empty collection.
37
38 2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
39
40 PR binutils/15834
41 * object.h: Fix typos.
42
43 2013-08-16 Roland McGrath <mcgrathr@google.com>
44
45 * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
46 * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
47
48 2013-08-07 Cary Coutant <ccoutant@google.com>
49
50 Revert support for v2 DWP files:
51
52 2013-03-01 Cary Coutant <ccoutant@google.com>
53
54 Add dwp support for v2 DWARF package file format.
55 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
56 tu_length parameter. Adjust all callers.
57 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
58 * dwp.cc: Include dwarf.h.
59 (Section_bounds): New struct type.
60 (Unit_set): New struct type.
61 (Dwo_file::Dwo_file): Initialize new data member.
62 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
63 Combine and rename to...
64 (Dwo_file::read_unit_index): ...this.
65 (Dwo_file::sized_read_compunit_index)
66 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
67 (Dwo_file::sized_read_unit_index): ...this.
68 (Dwo_file::copy_section): Remove section_name, is_str_offsets
69 parameters; add section_id parameter.
70 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
71 (Dwo_file::add_unit_set): ...this.
72 (Dwo_file::shndx_map_): Remove.
73 (Dwo_file::sect_offsets_): New data member.
74 (Dwp_output_file::Dwp_output_file): Initialize new data members.
75 (Dwp_output_file::add_section): Rename to...
76 (Dwp_output_file::add_contribution): ...this.
77 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
78 (Dwp_output_file::add_tu_set): Likewise.
79 (Dwp_output_file::Contribution): New type.
80 (Dwp_output_file::Section::contributions): New data member.
81 (Dwp_output_file::Cu_or_tu_set): Remove.
82 (Dwp_output_file::Section::Section): New ctor.
83 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
84 (Dwp_output_file::Dwp_index::Section_table): New type.
85 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
86 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
87 parameter.
88 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
89 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
90 (Dwp_output_file::Dwp_index::section_table): New member function.
91 (Dwp_output_file::Dwp_index::section_table_end): New member function.
92 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
93 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
94 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
95 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
96 (Dwp_output_file::Dwp_index::section_table_): New data member.
97 (Dwp_output_file::Dwp_index::section_mask_): New data member.
98 (Dwp_output_file::add_output_section): New member function.
99 (Dwp_output_file::write_new_section): New member function.
100 (Dwp_output_file::write_contributions): New member function.
101 (Dwp_output_file::section_id_map_): New data member.
102 (class Dwo_id_info_reader): Remove.
103 (class Unit_reader): New class.
104 (get_dwarf_section_name): New function.
105 (Dwo_file::read_executable): Adjust initializations of class data.
106 (Dwo_file::read): Add support for v2 package file format.
107 (Dwo_file::read_unit_index): Likewise.
108 (Dwo_file::sized_read_unit_index): Likewise.
109 (Dwo_file::copy_section): Likewise.
110 (Dwo_file::add_unit_set): Likewise.
111 (Dwp_output_file::add_output_section): Likewise.
112 (Dwp_output_file::add_contribution): Likewise.
113 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
114 for empty slot.
115 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
116 file format.
117 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
118 slot.
119 (Dwp_output_file::initialize): Remove unused function.
120 (Dwp_output_file::finalize): Add support for v2 package file format.
121 (Dwp_output_file::write_index): Likewise.
122 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
123 function prototype.
124
125 2013-07-31 Cary Coutant <ccoutant@google.com>
126
127 * object.cc (Sized_relobj::do_output_section_address): New function.
128 (Sized_relobj): Instantiate explicitly.
129 * object.h (Object::output_section_address): New function.
130 (Object::do_output_section_address): New function.
131 (Sized_relobj::do_output_section_address): New function.
132 * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
133
134 2013-07-30 Cary Coutant <ccoutant@google.com>
135 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
136
137 * parameters.cc (Parameters::entry): Return target-specific entry
138 symbol name.
139 * target.h (Target::entry_symbol_name): New function.
140 (Target_info::entry_symbol_name): New data member.
141
142 * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
143 * i386.cc (Target_i386::i386_info): Likewise.
144 (Target_i386_nacl::i386_nacl_info): Likewise.
145 * sparc.cc (Target_sparc::sparc_info): Likewise.
146 * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
147 * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
148 (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
149 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
150
151 2013-07-22 Sterling Augustine <saugustine@google.com>
152
153 * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
154 Convert parameter shndx to local variable. Add parameters symtab
155 and symtab_size. Scan over section names. Find relocation
156 section corresponding to current section. Create and initialize
157 reloc_mapper_ and reloc_type_.
158 (Dwarf_pubnames_table::read_header): Add assertion. Change
159 unit_length to off_t. Initialize member unit_length_. Fill in field
160 cu_offset_.
161 * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
162 Initialize new fields unit_length_ and cu_offset_.
163 (Dwarf_pubnames_table::read_section): Update prototype.
164 (Dwarf_pubnames_table::cu_offset): New member function.
165 (Dwarf_pubnames_table::subsection_size): Likewise.
166 (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
167 New fields.
168 (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
169 member functions public.
170 * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
171 Update comment. Rework logic. Move repeated parts to...
172 (Gdb_index_info_reader::read_pubtable): ...here. New function.
173 (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
174 pubtypes_table_, and stmt_list_offset.
175 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
176 Gdb_index::find_pubtype_offset,
177 Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
178 (Gdb_index::pubnames_read): Update prototype and rework logic.
179 * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
180 Forward declare.
181 (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
182 Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
183 Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
184 Gdb_index::map_pubtable_to_dies):
185 Declare functions.
186 (Gdb_index::pubnames_read): Update declaration.
187 (Gdb_index::Pubname_offset_map): New type.
188 (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
189 Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
190 Gdb_index::stmt_list_offset): Declare.
191 (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
192 Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
193 Gdb_index::pubtypes_offset_): Remove.
194
195 2013-07-19 Roland McGrath <mcgrathr@google.com>
196
197 * options.h (General_options): Add -Trodata-segment option.
198 * parameters.cc (Parameters::check_rodata_segment): New function.
199 (Parameters::set_target_once): Call it.
200 * parameters.h (Parameters): Declare it (private member function).
201 * layout.cc (load_seg_unusable_for_headers): New function, broken
202 out of Layout::relaxation_loop_body. If TARGET->isolate_execinstr()
203 then validate rodata segment rather than text segment.
204 (relaxation_loop_body): Call that.
205 (is_text_segment): New function. Don't admit a non-executable
206 segment if TARGET->isolate_execinstr().
207 (set_segment_offsets): Call it. Honor -Trodata-segment option.
208
209 2013-07-15 Shawn Landden <shawnlandden@gmail.com>
210
211 PR gold/15070
212 * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
213 * nacl.h (Sniff_file::View::View): Request aligned view.
214
215 2013-07-11 Cary Coutant <ccoutant@google.com>
216
217 * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
218 correct BRLT entry size.
219
220 2013-07-03 Alan Modra <amodra@gmail.com>
221
222 * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
223 comment.
224
225 2013-07-01 Cary Coutant <ccoutant@google.com>
226
227 * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
228 reloc_type_.
229 (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
230 (Dwarf_ranges_table::lookup_reloc): New function.
231 * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
232 reloc_type_.
233 (Dwarf_ranges_table::lookup_reloc): New function.
234 (Dwarf_ranges_table::reloc_type_): New data member.
235
236 2013-06-27 Jing Yu <jingyu@google.com>
237
238 PR gold/15662
239 * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
240 function.
241 (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
242 (Target_powerpc::do_relax): Call the above.
243
244 2013-06-27 Cary Coutant <ccoutant@google.com>
245
246 * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
247 on garbage collected .opd section.
248
249 2013-06-27 Alan Modra <amodra@gmail.com>
250
251 * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
252 is non-zero.
253 (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
254 (Target_powerpc::do_function_location): Likewise for loc->shndx.
255
256 2013-06-14 Cary Coutant <ccoutant@google.com>
257
258 * resolve.cc (Symbol::override_base): Don't override st_type
259 from plugin placeholder symbols.
260 (Symbol_table::resolve): Likewise.
261 (Symbol_table::should_override): Don't complain about TLS mismatch
262 if the TO symbol is a plugin placeholder.
263 * testsuite/Makefile.am (plugin_test_tls): New test.
264 * testsuite/Makefile.in: Regenerate.
265 * testsuite/plugin_test_tls.sh: New test script.
266 * testsuite/two_file_test_2_tls.cc: New test source.
267 * testsuite/two_file_test_tls.cc: New test source.
268
269 2013-06-05 Alexander Ivchenko <alexander.ivchenko@intel.com>
270
271 * layout.cc (Layout::set_segment_offsets): Taking care of the case when
272 the maximum segment alignment is larger than the page size.
273 * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
274 correctly aligns the symbols with large alignemnt.
275 * testsuite/Makefile.in: Regenerate.
276 * testsuite/large_symbol_alignment.cc: New file.
277
278 2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
279 Sriraman Tallam <tmsriram@google.com>
280
281 * options.h (sort_section): New option.
282 * output.h (Input_section_sort_section_prefix_special_ordering_compare):
283 Rename from Input_section_sort_section_name_special_ordering_compare.
284 (Input_section_sort_section_name_compare): New struct.
285 * output.cc (Output_section::Input_section_sort_section_name_compare::
286 operator()): New function.
287 (Output_section::sort_attached_input_sections): Use new sort function
288 for .text if --sort-section=name is specified.
289 * layout.cc (Layout::make_output_section):
290 Add sorting by name when --sort-section=name is specified.
291 * testsuite/Makefile.am (text_section_grouping): Test option
292 --sort-section=name.
293 * testsuite/Makefile.in: Regenerate.
294 * testsuite/section_sorting_name.cc: New file.
295 * testsuite/section_sorting_name.sh: New file.
296
297 2013-05-21 Cary Coutant <ccoutant@google.com>
298
299 * symtab.h (Symbol::is_cxx_vtable): New function.
300 * target-reloc.h (relocate_section): Check for vtable symbol.
301 * testsuite/Makefile.am (missing_key_func.sh): New test case.
302 * testsuite/Makefile.in: Regenerate.
303 * testsuite/missing_key_func.cc: New test source.
304 * testsuite/missing_key_func.sh: New test script.
305
306 2013-05-21 Cary Coutant <ccoutant@google.com>
307
308 * object.cc (Sized_relobj_file::get_symbol_location_info): Set
309 type of enclosing symbol.
310 (Relocate_info::location): Check symbol type when describing symbol.
311 * object.h (Symbol_location_info): Remove unused line_number;
312 add enclosing_symbol_type.
313 * testsuite/debug_msg.sh: Adjust expected output.
314
315 2013-05-13 Cary Coutant <ccoutant@google.com>
316
317 * configure.ac: Export DEFAULT_TARGET.
318 * configure: Regenerate.
319 * Makefile.in: Regenerate.
320 * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
321 * testsuite/Makefile.in: Regenerate.
322 * testsuite/debug_msg.sh: Delete duplicate tests.
323 Don't check undef_int error message match for powerpc where the
324 source file and line number aren't available.
325
326 2013-05-10 Roland McGrath <mcgrathr@google.com>
327
328 * options.h (General_options): Add --rosegment-gap option.
329 * options.cc (finalize): --rosegment-gap implies --rosegment.
330 * layout.cc (set_segment_offsets): Let user option override
331 target->rosegment_gap().
332
333 2013-05-10 Roland McGrath <mcgrathr@google.com>
334
335 * options.h (General_options): Remove leading space from help
336 messages for -nostdlib and --rosegment.
337
338 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
339
340 PR ld/15365
341 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
342
343 2013-05-03 Alan Modra <amodra@gmail.com>
344
345 * merge.cc (Output_merge_string::do_add_input_section): Correct
346 scan for number of strings. Rename vars to avoid shadowing.
347 Include missing terminator in input_size_.
348
349 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
350
351 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
352 Restore empty string handling.
353
354 2013-05-01 Cary Coutant <ccoutant@google.com>
355
356 * stringpool.cc (Stringpool_template::new_key_offset): Fix
357 uninitialized warning.
358
359 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
360
361 * output.cc (Output_section::add_merge_input_section): Allow
362 to merge sections if the alignment is more than character size.
363 * merge.h (Output_merge_string::Output_merge_string): Remove
364 assert.
365 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
366 only not-null strings. Check the alignment of strings.
367 * stringpool.h
368 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
369 alignment as the argument.
370 (Stringpool_template<Stringpool_char>::addralign_): New class member.
371 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
372 Align non-zero length strings according to the addralign_.
373 (Stringpool_template<Stringpool_char>::set_string_offsets):
374 Updating offsets according to the given alignment.
375 * testsuite/Makefile.am (text_section_grouping): Test if string
376 literals are getting merged.
377 * testsuite/Makefile.in: Regenerate.
378 * testsuite/merge_string_literals_1.c: New file.
379 * testsuite/merge_string_literals_2.c: Ditto.
380 * testsuite/merge_string_literals.sh: Ditto.
381
382 2013-04-26 Ian Lance Taylor <iant@google.com>
383
384 * target-reloc.h (relocate_section): If the reloc offset is out of
385 range, pass VIEW as NULL to relocate.relocate.
386 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
387 * i386.cc (Target_i386::Relocate::relocate): Likewise.
388 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
389 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
390 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
391 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
392
393 2013-04-26 Geoff Pike <gpike@chromium.org>
394
395 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
396 * layout.cc (Hash_task): New class.
397 (Layout::queue_build_id_tasks): New function.
398 (Layout::write_build_id): Handle single-thread portion of build ID
399 computation. (In some cases, all of it is single-threaded.) Replace
400 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
401 functionality in fewer lines of code.
402 * layout.h (Layout::queue_build_id_tasks): New function declaration.
403 * options.h (General_options): make "--build-id" default to tree
404 rather than sha1. Add two new options related to --build-id=tree:
405 --build-id-chunk-size-for-treehash and
406 --build-id-min-file-size-for-treehash.
407 * Makefile.am: add testing of --build-id=tree and related new options
408 (these tests will be invoked by "make check").
409 * Makefile.in: Regenerate.
410
411 2013-04-25 Alan Modra <amodra@gmail.com>
412
413 * configure.tgt: Add powerpcle and powerpc64le.
414
415 2013-04-22 Alan Modra <amodra@gmail.com>
416
417 PR gold/15355
418 * layout.cc (Layout::segment_precedes): Allow more than one
419 segment with the same type and flags.
420
421 2013-04-15 Cary Coutant <ccoutant@google.com>
422
423 * layout.cc (Layout::set_relocatable_section_offsets): Don't
424 allocate space in file for BSS sections.
425
426 2013-04-15 Cary Coutant <ccoutant@google.com>
427
428 * script-sections.cc (Orphan_output_section): Reset address
429 to zero after each orphaned section for relocatable links.
430
431 2013-04-15 Cary Coutant <ccoutant@google.com>
432
433 * symtab.cc (Symbol_table::sized_write_globals): Subtract
434 section starting address for relocatable link.
435 * testsuite/Makefile.am (script_test_11): New test.
436 * testsuite/Makefile.in: Regenerate.
437 * testsuite/script_test_11.c: New source file.
438 * testsuite/script_test_11.t: New linker script.
439
440 2013-04-13 Alan Modra <amodra@gmail.com>
441
442 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
443 owner when sections are not adjacent and exceed group size.
444 (Target_powerpc::group_sections): Handle corner case.
445 (Target_powerpc::Branch_info::make_stub): Handle case where
446 stub table doesn't exist due to branches in non-exec sections.
447 (Target_powerpc::Relocate::relocate): Likewise.
448
449 2013-04-11 Alan Modra <amodra@gmail.com>
450
451 PR gold/15354
452 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
453 .branch_lt to match bfd ld. Adjust comments throughout file.
454
455 2013-04-04 Ian Lance Taylor <iant@google.com>
456
457 GCC PR c++/56840
458 * object.cc (do_layout_deferred_sections): Handle .eh_frame
459 sections before checking whether they are included in the link.
460
461 2013-03-29 Sriraman Tallam <tmsriram@google.com>
462
463 * archive.cc (Archive::get_elf_object_for_member): Create the elf
464 object before calling the plugin claim_file handler. Pass the elf
465 object of the archive to the plugin. Delete the elf object if the
466 plugin claims the file.
467
468 2013-03-21 Alan Modra <amodra@gmail.com>
469
470 * layout.cc (Layout::set_segment_offsets): Accept writable .text
471 segment when omagic.
472
473 2013-03-21 Alan Modra <amodra@gmail.com>
474
475 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
476 comparison warning.
477 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
478 uninitialized" warning.
479
480 2013-03-20 Alan Modra <amodra@gmail.com>
481
482 * symtab.h (Symbol::clear_version): New function.
483 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
484 is_needed by weak references. Clear version for symbols defined
485 in as-needed objects that are not needed.
486
487 2013-03-15 Alan Modra <amodra@gmail.com>
488
489 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
490 static and public. Add report_err param. Return false for data refs.
491 (Target_powerpc::rela_dyn_section): New overloaded function.
492 (Target_powerpc::plt_, iplt_): Elucidate.
493 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
494 (Output_data_plt_powerpc::do_write): Don't write .iplt.
495 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
496 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
497 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
498 push_branch and make_plt_entry for ifunc syms when
499 reloc_needs_plt_for_ifunc.
500 (Target_powerpc::Relocate::relocate): Don't use plt entry value
501 for ifunc unless reloc_needs_plt_for_ifunc.
502
503 2013-03-15 Alan Modra <amodra@gmail.com>
504
505 * gc.h (gc_process_relocs): Don't look through function descriptors.
506 * icf.cc (get_section_contents): Do so here instead.
507
508 2013-03-13 Alan Modra <amodra@gmail.com>
509
510 * powerpc.cc (is_branch_reloc): Forward declare.
511 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
512 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
513 false for 64-bit, true for 32-bit non-branch relocs.
514 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
515 * testsuite/Makefile.am (icf_test): Use linker map file instead of
516 nm output.
517 (icf_safe_test): Generate linker map file as well as nm output.
518 (icf_safe_so_test): Likewise.
519 * testsuite/Makefile.in: Regenerate.
520 * testsuite/icf_test.sh: Parse linker map file to determine
521 section folding.
522 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
523 * testsuite/icf_safe_so_test.sh: Likewise.
524 (X86_32_or_ARM_specific_safe_fold): Merge into..
525 (arch_specific_safe_fold): ..this.
526 (X86_64_specific_safe_fold): Delete unused function.
527
528 2013-03-12 Alan Modra <amodra@gmail.com>
529
530 * gc.h (gc_process_relocs): Look through function descriptors
531 to determine shndx, symvalue and addend used by ICF. Tidy
532 variable duplication.
533
534 2013-03-11 Alan Modra <amodra@gmail.com>
535
536 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
537 * layout.cc (Layout_task_runner::run): ..to here.
538 * symtab.h (struct Symbol_location): Extract from..
539 (class Symbol_table): ..here.
540 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
541 * target.h (class Target): Add function_location and
542 do_function_location functions.
543 (class Sized_target): Add do_function_location.
544 * object.h (class Sized_relobj_file): Move find_shdr..
545 (class Object): ..to here.
546 * object.cc: Likewise. Update to suit. Instantiate.
547 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
548 * powerpc.cc (class Powerpc_dynobj): New.
549 (Target_powerpc::do_function_location): New function.
550 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
551 (Powerpc_dynobj::do_read_symbols): New function.
552 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
553
554 2013-03-08 Ian Lance Taylor <iant@google.com>
555
556 * options.cc (General_options::string_to_object_format): Accept
557 "default".
558
559 2013-03-08 Alan Modra <amodra@gmail.com>
560
561 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
562 pointer to Post_fde.
563 (struct Post_fde): Move definition to here..
564 * ehframe.cc (struct Post_fde): ..from here.
565 (Cie::write): Don't alloc Post_fde.
566 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
567
568 2013-03-07 Alan Modra <amodra@gmail.com>
569
570 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
571 relocation referencing .LC0.
572 * testsuite/discard_locals_test.sh: Remove FIXMEs.
573
574 2013-03-07 Alan Modra <amodra@gmail.com>
575
576 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
577 always_inline. Add assembly for powerpc to avoid GOT.
578
579 2013-03-07 Alan Modra <amodra@gmail.com>
580
581 * testsuite/script_test_10.sh: Don't test .bss section
582 header number.
583
584 2013-03-06 Alan Modra <amodra@gmail.com>
585
586 * powerpc.cc (class Powerpc_relobj): Move some member functions.
587 (Target_powerpc::symval_for_branch): Add symtab param. Update
588 all callers. Handle folded sections.
589 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
590 to Powerpc_relobj.
591 (Global_symbol_visitor_opd::operator()): Likewise.
592
593 2013-03-04 Alan Modra <amodra@gmail.com>
594
595 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
596 * testsuite/Makefile.in: Regenerate.
597
598 2013-03-01 Cary Coutant <ccoutant@google.com>
599
600 Add dwp support for v2 DWARF package file format.
601 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
602 tu_length parameter. Adjust all callers.
603 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
604 * dwp.cc: Include dwarf.h.
605 (Section_bounds): New struct type.
606 (Unit_set): New struct type.
607 (Dwo_file::Dwo_file): Initialize new data member.
608 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
609 Combine and rename to...
610 (Dwo_file::read_unit_index): ...this.
611 (Dwo_file::sized_read_compunit_index)
612 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
613 (Dwo_file::sized_read_unit_index): ...this.
614 (Dwo_file::copy_section): Remove section_name, is_str_offsets
615 parameters; add section_id parameter.
616 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
617 (Dwo_file::add_unit_set): ...this.
618 (Dwo_file::shndx_map_): Remove.
619 (Dwo_file::sect_offsets_): New data member.
620 (Dwp_output_file::Dwp_output_file): Initialize new data members.
621 (Dwp_output_file::add_section): Rename to...
622 (Dwp_output_file::add_contribution): ...this.
623 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
624 (Dwp_output_file::add_tu_set): Likewise.
625 (Dwp_output_file::Contribution): New type.
626 (Dwp_output_file::Section::contributions): New data member.
627 (Dwp_output_file::Cu_or_tu_set): Remove.
628 (Dwp_output_file::Section::Section): New ctor.
629 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
630 (Dwp_output_file::Dwp_index::Section_table): New type.
631 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
632 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
633 parameter.
634 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
635 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
636 (Dwp_output_file::Dwp_index::section_table): New member function.
637 (Dwp_output_file::Dwp_index::section_table_end): New member function.
638 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
639 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
640 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
641 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
642 (Dwp_output_file::Dwp_index::section_table_): New data member.
643 (Dwp_output_file::Dwp_index::section_mask_): New data member.
644 (Dwp_output_file::add_output_section): New member function.
645 (Dwp_output_file::write_new_section): New member function.
646 (Dwp_output_file::write_contributions): New member function.
647 (Dwp_output_file::section_id_map_): New data member.
648 (class Dwo_id_info_reader): Remove.
649 (class Unit_reader): New class.
650 (get_dwarf_section_name): New function.
651 (Dwo_file::read_executable): Adjust initializations of class data.
652 (Dwo_file::read): Add support for v2 package file format.
653 (Dwo_file::read_unit_index): Likewise.
654 (Dwo_file::sized_read_unit_index): Likewise.
655 (Dwo_file::copy_section): Likewise.
656 (Dwo_file::add_unit_set): Likewise.
657 (Dwp_output_file::add_output_section): Likewise.
658 (Dwp_output_file::add_contribution): Likewise.
659 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
660 for empty slot.
661 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
662 file format.
663 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
664 slot.
665 (Dwp_output_file::initialize): Remove unused function.
666 (Dwp_output_file::finalize): Add support for v2 package file format.
667 (Dwp_output_file::write_index): Likewise.
668 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
669 function prototype.
670
671 2013-03-01 Cary Coutant <ccoutant@google.com>
672
673 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
674 function into class definition in header file.
675 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
676 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
677 New function.
678 (Dwarf_info_reader::check_buffer): Move here from .cc file.
679
680 2013-02-28 Alan Modra <amodra@gmail.com>
681
682 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
683 * target.cc (Target::do_plt_fde_location): New function.
684 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
685 accessor function, and constructor param.
686 (struct Post_fde, Post_fdes): Declare.
687 (Cie::write): Add post_fdes param.
688 * ehframe.cc (Fde::write): Use plt_fde_location.
689 (struct Post_fde): Define.
690 (Cie::write): Stash FDEs added post merge mapping.
691 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
692 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
693 (Eh_frame::do_sized_write): Arrange to write post map FDES after
694 other FDEs.
695 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
696 (Target_powerpc::has_glink): New function.
697 (Target_powerpc::do_relax): Add eh_frame info for stubs.
698 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
699 glink_eh_frame_fde_32, default_fde): New data.
700 (Stub_table::eh_frame_added_): New var.
701 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
702 Make const.
703 (Stub_table::add_eh_frame): New function.
704 (Output_data_glink::add_eh_frame): New function.
705 (Target_powerpc::make_glink_section): Call add_eh_frame.
706
707 2013-02-15 Ian Lance Taylor <iant@google.com>
708
709 * options.h (DEFINE_uint64_alias): Define.
710 (class General_options): Add -Ttext-segment as an alias for
711 -Ttext.
712
713 2013-02-15 Alan Modra <amodra@gmail.com>
714
715 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
716 (Stub_table::do_write): ..here, two places.
717 (Stub_table::plt_call_size): Use it here too.
718
719 2013-02-11 Ian Lance Taylor <iant@google.com>
720
721 * descriptors.cc (Descriptors::close_all): New function.
722 * descriptors.h (class Descriptors): Declare close_all.
723 (close_all_descriptors): New inline function.
724 * plugin.cc: Include "descriptors.h".
725 (Plugin_manager::cleanup): Call close_all_descriptors.
726
727 2013-02-06 Alan Modra <amodra@gmail.com>
728
729 * README: Update coding style link.
730
731 2013-01-28 Cary Coutant <ccoutant@google.com>
732
733 * dwp.cc (File_list): New typedef.
734 (Dwo_name_info_reader): New class.
735 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
736 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
737 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
738 (Dwo_file::read_executable): New function.
739 (Dwo_file::read): Move common setup code to ...
740 (Dwo_file::make_object): ... here.
741 (dwp_options): Add --exec/-e.
742 (usage): Likewise.
743 (main): Likewise.
744
745 2013-01-24 Sriraman Tallam <tmsriram@google.com>
746
747 * layout.cc (Layout::layout): Check for option text_reorder.
748 (Layout::make_output_section): Ditto.
749 * options.h (text_reorder): New option.
750 * output.cc (Input_section_sort_compare): Remove special ordering
751 of section names.
752 (Output_section::
753 Input_section_sort_section_name_special_ordering_compare::
754 operator()): New function.
755 (Output_section::sort_attached_input_sections): Use new sort function
756 for .text.
757 * output.h (Input_section_sort_section_name_special_ordering_compare):
758 New struct.
759 * testsuite/Makefile.am (text_section_grouping): Test option
760 --no-text-reorder
761 * testsuite/Makefile.in: Regenerate.
762 * testsuite/text_section_grouping.sh: Check order of functions without
763 default text reordering.
764
765 2013-01-18 Mike Frysinger <vapier@gentoo.org>
766
767 * options.h (General_options): Change default to true for new_dtags.
768
769 2013-01-18 Mike Frysinger <vapier@gentoo.org>
770
771 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
772 when enable_new_dtags is false. Only add DT_RUNPATH when
773 enable_new_dtags is true.
774
775 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
776
777 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
778 used in declaration and definition consistent.
779 (Target_powerpc::symval_for_branch): Ditto.
780
781 2013-01-16 Sriraman Tallam <tmsriram@google.com>
782
783 * testsuite/plugin_final_layout.cc: Fix comment.
784
785 2013-01-16 Sriraman Tallam <tmsriram@google.com>
786
787 * layout.cc (Layout::layout): Do not do default sorting for
788 text sections when section ordering is specified.
789 (make_output_section): Ditto.
790 * testsuite/plugin_final_layout.cc: Name the function sections
791 to catch reordering issues.
792
793 2013-01-15 Alan Modra <amodra@gmail.com>
794
795 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
796 plt-thread-safe.
797
798 2013-01-15 Alan Modra <amodra@gmail.com>
799
800 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
801 * testsuite/Makefile.in: Regenerate.
802
803 2013-01-14 Alan Modra <amodra@gmail.com>
804
805 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
806 * testsuite/Makefile.in: Regenerate.
807
808 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
809
810 PR bfd/14430
811 Fix mingw gold build with plugins enabled
812 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
813 * configure.ac: Export DLOPEN_LIBS and add headers check.
814 * plugin.cc: Handle non-dlfcn case.
815 * Makefile.in: Regenerate.
816 * config.in: Regenerate.
817 * configure: Regenerate.
818 * testsuite/Makefile.in: Regenerate.
819
820 2013-01-09 Sriraman Tallam <tmsriram@google.com>
821
822 * output.h (sort_attached_input_sections): Change to be public.
823 * script-sections.cc
824 (Output_section_definition::set_section_addresses): Sort
825 attached input sections according to section order before linker
826 script assigns section addresses.
827 (Orphan_output_section::set_section_addresses): Sort
828 attached input sections according to section order before linker
829 script assigns section addresses.
830 * Makefile.am (final_layout.sh): Use a simple linker script to
831 check if section ordering still works.
832 * Makefile.in: Regenerate.
833
834 2013-01-09 Ben Cheng <bccheng@google.com>
835
836 * arm.cc (Target_arm::attributes_accept_div): New function.
837 (Target_arm::attributes_forbid_div): New function.
838 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
839 attribute using the same new functions as what bfd/elf32_arm.c
840 does.
841
842 2013-01-07 Cary Coutant <ccoutant@google.com>
843
844 PR gold/14993
845 * output.cc (Output_section::add_input_section): For incremental
846 updates, don't track input sections that are allocated from patch
847 space.
848
849 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
850 Ian Lance Taylor <iant@google.com>
851
852 PR gold/14897
853 * configure.ac (--enable-ld): Removed.
854 (install_as_default): Set to yes only for --enable-gold=default
855 or --disable-ld.
856 * configure: Regenerated.
857
858 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
859
860 * options.h (General_options): Add -fuse-ld= for GCC linker
861 option compatibility.
862
863 2013-01-04 Cary Coutant <ccoutant@google.com>
864
865 * configure.ac: Fix typo restoring CXXFLAGS.
866 * configure: Regenerate.
867
868 2013-01-04 Cary Coutant <ccoutant@google.com>
869
870 * testsuite/Makefile.am (CXXLINK_S): New macro.
871 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
872 * testsuite/Makefile.in: Regenerate.
873
874 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
875
876 * version.cc (print_version): Update copyright year to 2013.
877
878 2012-12-20 Ian Lance Taylor <iant@google.com>
879
880 * layout.cc (Layout::special_ordering_of_input_section): New
881 function.
882 (Layout::layout): If input section requires special ordering, must
883 sort input sections.
884 (Layout::make_output_section): May sort .text input sections.
885 (Layout::is_section_name_prefix_grouped): Remove.
886 * layout.h (class Layout): Declare
887 special_ordering_of_input_section. Don't declare
888 is_section_name_prefix_grouped.
889 * output.cc (Output_section::add_input_section): Revert last
890 change.
891 (Output_section::Input_section_sort::match_file_name): Don't crash
892 if called on output section data.
893 (Output_section::Input_section_sort_compare): Sort based on
894 special ordering.
895 (Output_section::Input_section_sort_section_order_index_compare):
896 Revert last patch.
897 (Output_section::sort_attached_input_sections): Likewise.
898
899 2012-12-18 Sriraman Tallam <tmsriram@google.com>
900
901 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
902 * layout.h (Layout::is_section_name_prefix_grouped): New function.
903 * output.cc (Output_section::add_input_section): Check if section
904 name contains special prefix. Keep input sections to sort such
905 sections.
906 (Output_section::Input_section_sort_section_order_index_compare
907 ::operator()): Group sections according to prefixes.
908 (Output_section::sort_attached_input_sections): Add condition to
909 Input_section_entry constructor call.
910 * testsuite/Makefile.am (text_section_grouping): New test.
911 * testsuite/Makefile.in: Regenerate.
912 * testsuite/text_section_grouping.cc: New file.
913 * testsuite/text_section_grouping.sh: New file.
914
915 2012-12-17 Nick Clifton <nickc@redhat.com>
916
917 * Makefile.am: Add copyright notice.
918 * NEWS: Likewise.
919 * README: Likewise.
920 * configure.ac: Likewise.
921 * ftruncate.c: Likewise.
922 * Makefile.in: Regenerate.
923
924 2012-12-14 Cary Coutant <ccoutant@google.com>
925
926 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
927 --no-as-needed flag.
928 (exception_separate_shared_12_test): Likewise.
929 (incremental_copy_test): Likewise.
930 * testsuite/Makefile.in: Regenerate.
931
932 2012-12-14 Cary Coutant <ccoutant@google.com>
933
934 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
935 (Dwp_output_file::Dwp_index::enter_set): Add assert.
936
937 2012-12-12 Alan Modra <amodra@gmail.com>
938
939 * powerpc.cc (class Track_tls): New.
940 (class Relocate, class Scan): Inherit Track_tls.
941 (Target_powerpc::Scan::local, global): Track tls optimization
942 and avoid creating plt entry for __tls_get_addr if all uses
943 are optimized away.
944 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
945
946 2012-12-12 Alan Modra <amodra@gmail.com>
947
948 * options.h (General_options): Add --toc-sort/--no-toc-sort.
949 Replace no_toc_optimize with toc_optimize.
950 * output.h (Output_section::input_sections): Provide non-const variant.
951 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
952 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
953 accessors.
954 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
955 (class Sort_toc_sections): New.
956 (Target_powerpc::do_finalize_sections): Sort toc sections.
957 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
958
959 2012-12-10 Roland McGrath <mcgrathr@google.com>
960
961 * testsuite/binary_unittest.cc (read_all): New function.
962 (Sized_binary_test): Use it instead of ::read.
963 * fileread.cc (do_read): Don't assume pread always reads the whole
964 amount in a single call.
965
966 2012-12-10 Alan Modra <amodra@gmail.com>
967
968 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
969 Set EM_PPC64 or EM_PPC here.
970 (Target_selector_powerpc::do_recognize): Delete.
971
972 2012-12-10 Alan Modra <amodra@gmail.com>
973
974 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
975 stub_table_.
976 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
977
978 2012-12-07 Roland McGrath <mcgrathr@google.com>
979
980 * testsuite/binary_unittest.cc (Sized_binary_test):
981 Use open_descriptor rather than ::open.
982
983 2012-12-07 Alan Modra <amodra@gmail.com>
984
985 * powerpc.cc (Stub_table::do_write): Delete redundant Address
986 typedef and invalid_address constant.
987 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
988 instantiate constants.
989
990 2012-12-06 Roland McGrath <mcgrathr@google.com>
991
992 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
993 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
994 * aclocal.m4: Regenerate.
995 * configure: Regenerate.
996 * Makefile.in: Regenerate.
997 * testsuite/Makefile.in: Regenerate.
998
999 2012-12-07 Alan Modra <amodra@gmail.com>
1000
1001 * options.h (General_options): Add no_toc_optimize.
1002 * powerpc.cc (ok_lo_toc_insn): New function.
1003 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1004
1005 2012-12-06 Alan Modra <amodra@gmail.com>
1006
1007 * options.h (General_options): Add plt_align, plt_static_chain,
1008 plt_thread_safe. Update stub_group_size help text.
1009 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1010 for new plt_thread_safe_ var.
1011 (use_plt_offset): Correct comments.
1012 (Target_powerpc::do_relax): Look for thread creation symbols to
1013 determine default plt_thread_safe value. Clear plt call stubs
1014 as well as branch stubs each iteration.
1015 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1016 insn constants.
1017 (l, hi, ha, write_insn): Move earlier.
1018 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1019 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1020 plt stubs too.
1021 (Stub_table::update_size): Adjust.
1022 (Stub_table::prev_size, set_prev_size): Delete.
1023 (Stub_table::stub_align): Let --plt-align affect result.
1024 (Stub_table::plt_call_size): Calculate sizes for various stubs.
1025 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1026 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1027 (Stub_table::do_write): Support more stub variants.
1028
1029 2012-12-04 Alan Modra <amodra@gmail.com>
1030
1031 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1032 (Target_powerpc::do_define_standard_symbols): New function.
1033
1034 2012-12-03 Alan Modra <amodra@gmail.com>
1035
1036 * output.h: Formatting, whitespace.
1037
1038 2012-12-03 Alan Modra <amodra@gmail.com>
1039
1040 * layout.h (Layout::get_executable_sections): Declare.
1041 * layout.cc (Layout::get_executable_sections): New function.
1042 * arm.cc (Target_arm::group_sections): Use it.
1043 (Arm_output_section::group_sections): Delete now redundant test.
1044 * output.cc (Output_reloc::Output_reloc): Add is_relative.
1045 param to handle relative relocs.
1046 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1047 (Output_data_reloc::add_absolute): Adjust.
1048 (Output_data_reloc::add_relative): New function.
1049 (Output_data::reset_data_size): New function.
1050 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1051 (Output_section::set_addralign): New function.
1052 (Output_section::checkpoint_set_addralign): New function.
1053 (Output_section::clear_section_offsets_need_adjustment): New function.
1054 (Output_section::input_sections): Make public.
1055 * powerpc.cc (class Output_data_brlt_powerpc): New.
1056 (class Stub_table, class Stub_control): New.
1057 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1058 stub_table_, set_stub_table, stub_table): New vectors and accessor
1059 functions.
1060 (Target_powerpc::do_may_relax, do_relax, push_branch,
1061 new_stub_table, stub_tables, brlt_section, group_sections,
1062 add_branch_lookup_table, find_branch_lookup_table,
1063 write_branch_lookup_table, make_brlt_section): New functions.
1064 (Target_powerpc::struct Sort_sections, class Branch_info): New.
1065 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1066 branch_info_): New vars.
1067 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1068 make call stubs here.
1069 (Output_data_glink): Remove all call stub handling from this class.
1070 (Target_powerpc::Scan::local, global): Save interesting branch
1071 relocs and relocs for ifunc. Adjust calls to plt entry functions.
1072 (Target_powerpc::do_finalize_sections): Only make reg save/restore
1073 functions on final link.
1074 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1075 Handle long branch destinations too.
1076 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1077 do_plt_address_for_local): Adjust lookup of plt call stubs.
1078
1079 2012-11-30 Alan Modra <amodra@gmail.com>
1080
1081 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1082 relocs against protected symbols when building 32-bit shared libs.
1083
1084 2012-11-30 Alan Modra <amodra@gmail.com>
1085
1086 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1087 param. Call got_section() to make .got. Update all callers
1088 and their callers and so on.
1089
1090 2012-11-30 Alan Modra <amodra@gmail.com>
1091
1092 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1093 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1094 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1095 value if it already exists.
1096
1097 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
1098
1099 PR gold/14858
1100 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1101
1102 2012-11-14 Roland McGrath <mcgrathr@google.com>
1103
1104 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1105 than bfc instruction for data sandboxing.
1106
1107 2012-11-08 Alan Modra <amodra@gmail.com>
1108
1109 * po/POTFILES.in: Regenerate.
1110
1111 2012-11-05 Alan Modra <amodra@gmail.com>
1112
1113 * configure.ac: Apply 2012-09-10 change to config.in here.
1114 * configure: Regenerate.
1115
1116 2012-11-05 Alan Modra <amodra@gmail.com>
1117
1118 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1119 (struct Opd_ent): Use "Address" rather than "Offset".
1120 (Output_data_got_powerpc::got_base_offset): Return Valtype.
1121 (Target_powerpc::got_section): Make public.
1122 (Target_powerpc::scan_relocs): Move code setting symbols..
1123 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1124 Create _SDA_BASE_ only when referenced.
1125
1126 2012-11-02 Roland McGrath <mcgrathr@google.com>
1127
1128 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1129 from last change.
1130
1131 2012-11-01 Roland McGrath <mcgrathr@google.com>
1132
1133 * target.h (Sized_target::relocate_relocs): Use Elf_Off
1134 for offset_in_output_section parameter.
1135 (Sized_target::relocate_special_relocatable): Likewise.
1136 * arm.cc (Target_arm::relocate_relocs): Likewise.
1137 (Target_arm::relocate_special_relocatable): Likewise.
1138 * i386.cc (Target_i386::relocate_relocs): Likewise.
1139 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1140 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1141 * target-reloc.h (relocate_relocs): Likewise.
1142 * testsuite/testfile.cc (Target_test): Likewise.
1143 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1144 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1145
1146 * system.h: Move inclusion of <clocale> to after <libintl.h> in
1147 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1148
1149 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1150 parameter, which is unused in the [!F_SETFD] case.
1151
1152 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1153 SYMNDX to off_t before comparing it to this->data_size().
1154 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1155 * incremental.cc (Output_section_incremental_inputs::do_write):
1156 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1157
1158 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1159
1160 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
1161
1162 * gold.cc (Target_arm::do_adjust_elf_header): Add the
1163 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1164 in EABI_VER5.
1165
1166 2012-10-29 Cary Coutant <ccoutant@google.com>
1167
1168 * dwp.cc (usage): Add file and exit status parameters;
1169 add --help and --version options.
1170 (print_version): New function.
1171 (main): Add --help and --version options.
1172
1173 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1174
1175 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1176 final_layout_sequence.txt.
1177 * testsuite/Makefile.in: Regenerated.
1178
1179 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1180
1181 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1182 COMPILE generated by automake.
1183 (LINK1): Likewise.
1184 (CXXCOMPILE1): Likewise.
1185 (CXXLINK1): Likewise.
1186 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1187 (LINK): Likewise.
1188 (CXXCOMPILE): Likewise.
1189 (CXXLINK): Likewise.
1190 * testsuite/Makefile.in: Regenerated.
1191
1192 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1193
1194 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1195 on bad fwrite return.
1196
1197 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
1198
1199 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1200 on val.
1201
1202 2012-10-23 Cary Coutant <ccoutant@google.com>
1203
1204 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1205 * testsuite/Makefile.in: Regenerate.
1206 * testsuite/dwp_test.h: New source file.
1207 * testsuite/dwp_test_1.cc: New source file.
1208 * testsuite/dwp_test_1.s: New source file.
1209 * testsuite/dwp_test_1.sh: New source file.
1210 * testsuite/dwp_test_1b.cc: New source file.
1211 * testsuite/dwp_test_1b.s: New source file.
1212 * testsuite/dwp_test_2.cc: New source file.
1213 * testsuite/dwp_test_2.s: New source file.
1214 * testsuite/dwp_test_2.sh: New source file.
1215 * testsuite/dwp_test_main.cc: New source file.
1216 * testsuite/dwp_test_main.s: New source file.
1217
1218 2012-10-23 Cary Coutant <ccoutant@google.com>
1219
1220 * dwp.h: New header file.
1221 * dwp.cc: New source file.
1222 * gold.h: Move shared declarations to system.h.
1223 * system.h: New header file.
1224 * Makefile.am: Add dwp.
1225 * Makefile.in: Regenerate.
1226
1227 2012-10-23 Cary Coutant <ccoutant@google.com>
1228
1229 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1230 Dwarf_info_reader::read_from_pointer.
1231 (Dwarf_pubnames_table::read_header): Likewise.
1232 (Dwarf_pubnames_table::next_name): Likewise.
1233 (Dwarf_die::read_attributes): Likewise.
1234 (Dwarf_die::skip_attributes): Likewise.
1235 (Dwarf_info_reader::read_from_pointer): New function template.
1236 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1237 (Dwarf_pubnames_table): Likewise.
1238 (Dwarf_info_reader::read_from_pointer): New function template.
1239 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1240 Dwarf_pubnames_table ctor.
1241
1242 2012-10-23 Cary Coutant <ccoutant@google.com>
1243
1244 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1245 abbrev_shndx.
1246 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1247 abbrev_shndx_.
1248 (Dwarf_info_reader::set_abbrev_shndx): New method.
1249 (Dwarf_info_reader::abbrev_shndx_): New data member.
1250
1251 2012-10-23 Cary Coutant <ccoutant@google.com>
1252
1253 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1254 from object, not parameters.
1255 (Dwarf_info_reader::parse): Likewise.
1256 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1257 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1258 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1259 methods.
1260
1261 2012-10-23 Cary Coutant <ccoutant@google.com>
1262
1263 * fileread.cc (Input_file::Input_file): New constructor.
1264 * fileread.h (class Input_file): Add new constructor.
1265
1266 2012-10-18 Alan Modra <amodra@gmail.com>
1267
1268 PR gold/14727
1269 * object.cc (Relobj::is_section_name_included): Also match
1270 .sdata personality section.
1271
1272 2012-10-18 Alan Modra <amodra@gmail.com>
1273
1274 * target-reloc.h (class Default_comdat_behavior): New, package up..
1275 (get_comdat_behaviour): ..this.
1276 (relocate_section): Add Relocate_comdat_behavior template arg,
1277 adjust code to suit.
1278 * arm.cc (Target_arm::relocate_section): Adjust to suit.
1279 (Target_arm::scan_reloc_section): Likewise.
1280 * i386.cc (Target_i386::relocate_section): Likewise.
1281 * sparc.cc (Target_sparc::relocate_section): Likewise.
1282 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1283 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1284 * powerpc.cc (class Relocate_comdat_behavior): New.
1285 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
1286 gold::relocate_section with new template arg.
1287
1288 2012-10-18 Alan Modra <amodra@gmail.com>
1289
1290 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1291 dynamic relocs for GOT_TPREL got entries, without symbol if
1292 resolving locally.
1293 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1294 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1295 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1296
1297 2012-10-17 Alan Modra <amodra@gmail.com>
1298
1299 PR gold/14726
1300 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1301
1302 2012-10-16 Sriraman Tallam <tmsriram@google.com>
1303
1304 * layout.cc (Layout::include_section): Keep sections marked
1305 SHF_EXCLUDE when doing relocatable links.
1306
1307 2012-10-16 Alan Modra <amodra@gmail.com>
1308
1309 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1310 (Target_powerpc::do_finalize_sections): Call it.
1311 (Output_data_save_res): New class and supporting functions.
1312 (Target_powerpc::symval_for_branch): Only look up .opd entry for
1313 normal symbols defined in object files.
1314
1315 2012-10-12 Alan Modra <amodra@gmail.com>
1316
1317 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1318 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
1319 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1320 section if scan_opd_relocs not yet called.
1321 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1322
1323 2012-10-12 Alan Modra <amodra@gmail.com>
1324
1325 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1326 add_local_ifunc_entry): Revert last change.
1327 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1328
1329 2012-10-05 Alan Modra <amodra@gmail.com>
1330
1331 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1332 do_plt_address_for_global): New functions.
1333 (Output_data_got_powerpc::do_write): Don't segfault when linking
1334 statically.
1335 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1336 add_local_ifunc_entry): Return true on adding entry..
1337 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1338 glink->add_entry call. Remove unused symtab param. Adjust calls.
1339 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1340 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
1341 set up symbols here.
1342 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1343 syms here. Do so even when no .iplt. Don't segfault when linking
1344 statically.
1345 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
1346 new variants without reloc param.
1347 (Glink_sym_ent::Glink_sym_ent): Likewise.
1348 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1349 reloc when refs will resolve to plt call stub.
1350 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
1351 R_PPC_PLTREL24 to resolve locally.
1352 (Target_powerpc::Scan::global): Correct ifunc handling.
1353 (Target_powerpc::Relocate::relocate): Correct local sym glink
1354 lookup. Don't destroy "value" when we have a plt call stub,
1355 and when checking plt call validity.
1356 (Target_powerpc::do_dynsym_value): Simplify.
1357
1358 2012-10-05 Alan Modra <amodra@gmail.com>
1359
1360 * i386.cc (Output_data_plt_i386::address_for_global,
1361 address_for_local): Add plt offset to returned value. Adjust uses.
1362 * sparc.cc (Output_data_plt_sparc::address_for_global,
1363 address_for_local): Likewise.
1364 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1365 address_for_local): Likewise.
1366 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1367 address_for_local): Likewise.
1368 * target.h (Target::plt_address_for_global, plt_address_for_local):
1369 Update comment.
1370 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1371 (Output_data_got::Got_entry::write): Nor here.
1372 * output.h: Comment fix.
1373
1374 2012-10-02 Jiong Wang <jiwang@tilera.com>
1375
1376 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1377 global_offset_table_ value for larget got.
1378 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1379
1380 2012-09-29 Alan Modra <amodra@gmail.com>
1381
1382 * powerpc.cc (Target_powerpc::iplt_): New output section.
1383 (Target_powerpc::iplt_section, make_iplt_section,
1384 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1385 (Target_powerpc::make_plt_entry): Handle ifunc syms.
1386 Target_powerpc::plt_entry_count): Count iplt entries too.
1387 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1388 reloc section in constructor. New params.
1389 (Target_powerpc::make_plt_section): Create reloc section here instead.
1390 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1391 functions.
1392 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1393 (Output_data_glink::add_entry, find_entry): New functions to
1394 deal with local syms.
1395 (Glink_sym_ent): Add support for local syms.
1396 (Output_data_glink::do_write): Handle ifunc plt entries.
1397 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1398 (Target_powerpc::Scan::local, global): Handle ifunc syms.
1399 (Target_powerpc::Relocate::relocate): Likewise.
1400 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1401
1402 2012-09-25 Alan Modra <amodra@gmail.com>
1403
1404 * object.h (Sized_relobj_file::adjust_local_symbol,
1405 do_adjust_local_symbol): New functions.
1406 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1407 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1408 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1409 and irregular opd entry spacing.
1410 (Powerpc_relobj::do_read_relocs): Add opd size checks.
1411 (Global_symbol_visitor_opd): New functor.
1412 (Target_powerpc::do_finalize_sections): Omit global symbols defined
1413 on deleted opd entries.
1414
1415 2012-09-15 Jiong Wang <jiwang@tilera.com>
1416
1417 * tilegx.cc: New file.
1418 * Makefile.am (TARGETSOURCES): Add tilegx.cc
1419 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1420 * configure.tgt: Add entries for tilegx*.
1421 * configure.ac: Likewise.
1422 * Makefile.in: Rebuild.
1423 * configure: Likewise.
1424 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1425 tilegx.
1426
1427 2012-09-13 Alan Modra <amodra@gmail.com>
1428
1429 * target-reloc.h (scan_relocs): Call scan.local for relocs
1430 against symbols in discarded sections. Pass is_discarded
1431 param.
1432 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1433 Add is_discarded param.
1434 * powerpc (Target_powerpc::Scan::local): Likewise. Use
1435 is_discarded to flag opd entry as discarded. Don't emit dyn
1436 relocs on such entries.
1437 (Target_powerpc::Scan::global): Similarly detect and handle
1438 such opd entries.
1439 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1440 opd_ent_. Update all uses.
1441 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1442 (Target_powerpc::relocate_section): Zero out discarded opd
1443 entry relocs.
1444
1445 2012-09-12 Ian Lance Taylor <iant@google.com>
1446
1447 PR gold/14570
1448 * output.cc: Rename Output_data_got template parameter from size
1449 to got_size for all functions. Compile all variants of
1450 Output_data_got.
1451 (Output_data_got::Got_entry::write): Correct use of size for
1452 symbol value. Use local_is_tls rather than casting to
1453 Sized_relobj_file.
1454 * object.h (class Object): Add local_is_tls and do_local_is_tls.
1455 (class Sized_relobj_file): Add do_local_is_tls.
1456 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1457
1458 2012-09-11 Alan Modra <amodra@gmail.com>
1459
1460 PR gold/14566
1461 * layout.cc (Layout::set_segment_offsets): When using
1462 common-page-size alignment, ensure we are on a new max-page-size
1463 page.
1464 * output.cc (Output_segment::set_section_addresses): Use
1465 abi_pagesize, not common_pagesize for relro boundary.
1466 (Output_segment::set_offset): Likewise.
1467
1468 2012-09-11 Alan Modra <amodra@gmail.com>
1469
1470 * output.h (Output_data_got::add_global_tls, add_local_tls,
1471 add_local_tls_pair): New functions.
1472 (Output_data_got::add_local_pair_with_rel): Remove second
1473 reloc param. Expand comment.
1474 (Output_data_got::Got_entry): Rename use_plt_offset_ to
1475 use_plt_or_tls_offset_, similarly for constructor param.
1476 (Output_data_got::Got_entry::write): Add got_index param.
1477 * output.cc (Output_data_got::add_global_tls, add_local_tls,
1478 add_local_tls_pair): New functions.
1479 (Output_data_got::Got_entry::write): Handle tls symbols
1480 with use_plt_or_tls_offset_ set specially.
1481 (Output_data_got::add_local_pair_with_rel): Only one reloc.
1482 (Output_data_got::do_write): Replace iterator with index, pass
1483 index to entry write function.
1484 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1485 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1486 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1487 call.
1488 * i386.cc (Target_i386::Scan::local): Likewise.
1489 * sparc.cc (Target_sparc::Scan::local): Likewise.
1490 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1491 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1492 do_tls_offset_for_global): New functions.
1493 (Target_powerpc::Scan::local): Correct TLS relocations and got
1494 entry values.
1495 (Target_powerpc::Scan::global): Don't emit unnecessary
1496 dynamic relocations on TLS GOT entries.
1497
1498 2012-09-10 Matthias Klose <doko@ubuntu.com>
1499
1500 * config.in: Disable sanity check for kfreebsd.
1501
1502 2012-09-10 Sterling Augustine <saugustine@google.com>
1503
1504 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1505 (Gdb_index::pubtypes_read): New parameter.
1506 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1507 to calls.
1508 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1509 pubtypes_object_.
1510
1511 2012-09-09 Alan Modra <amodra@gmail.com>
1512
1513 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1514 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1515 * gc.h (gc_process_relocs): Call target gc_add_reference.
1516 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1517 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1518 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1519 unnecessary cast.
1520 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1521 to cater for when we don't need code offset. Update use.
1522 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1523 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1524 set_opd_valid): New functions.
1525 (Target_powerpc::do_gc_add_reference): New function.
1526 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1527 stashed refs.
1528 (Target_powerpc::do_gc_mark_symbol): New function.
1529
1530 2012-09-06 Cary Coutant <ccoutant@google.com>
1531
1532 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1533 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1534 (Dwarf_die::skip_attributes): Likewise.
1535 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1536 * testsuite/gdb_index_test.cc (inline_func_1): New function.
1537 (main): Call it.
1538 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1539
1540 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
1541
1542 * testsuite/script_test_3.t: Add .got.plt output section
1543 statement.
1544 * testsuite/script_test_4.t: Likewise.
1545
1546 2012-09-05 Alan Modra <amodra@gmail.com>
1547
1548 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1549 update all uses and lose "enum" when using type.
1550
1551 2012-09-05 Alan Modra <amodra@gmail.com>
1552
1553 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1554 * configure: Regenerate.
1555 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1556 (plugin_final_layout.stdout): Likewise.
1557 (memory_test): Set page sizes to 0x1000.
1558 * testsuite/Makefile.in: Regenerate.
1559 * testsuite/discard_locals_test.sh: Add FIXME comment.
1560 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1561 * testsuite/pr14265.t: Add .got output section statement.
1562 * testsuite/script_test_2.t: Likewise.
1563 * testsuite/script_test_3.t: Likewise.
1564 * testsuite/script_test_4.t: Likewise.
1565 * testsuite/script_test_5.t: Likewise.
1566 * testsuite/script_test_6.t: Likewise.
1567 * testsuite/script_test_7.t: Likewise.
1568 * testsuite/script_test_9.t: Likewise.
1569
1570 2012-09-05 Alan Modra <amodra@gmail.com>
1571
1572 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1573 (Powerpc_relocate_functions::Status): New typedef.
1574 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1575 (Target_powerpc::Scan::local): Handle REL64.
1576 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1577 for REL32 and REL64.
1578 (Target_powerpc::symval_for_branch): New function, extracted from..
1579 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
1580 checks. Report overflow errors.
1581
1582 2012-09-05 Alan Modra <amodra@gmail.com>
1583
1584 * object.h (Sized_relobj_file::emit_relocs): Delete.
1585 (Sized_relobj_file::emit_relocs_reltype): Delete.
1586 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1587 relocate_relocs for --emit-relocs.
1588 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1589 * output.h: Update comment.
1590 (Output_segment::first_section): New function.
1591 (Output_segment::first_section_load_address): Use first_section.
1592 * output.cc (Output_segment::first_section): New function extracted..
1593 (Output_segment::first_section_load_address): ..from here. Delete.
1594 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1595 * target.h (Sized_target::relocate_for_relocatable): Likewise.
1596 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1597 adjust call to target.h function.
1598 * i386.cc (Target_i386): Likewise.
1599 * sparc.cc (Target_sparc): Likewise.
1600 * x86_64.cc (Target_x86_64): Likewise.
1601 * powerpc.cc (Target_powerpc): Likewise.
1602 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
1603 first tls section has section symbol for optimised local dynamic
1604 output relocs.
1605 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1606 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1607 optimised tls code.
1608 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1609 Rename to relocate_relocs. Update error message.
1610
1611 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
1612
1613 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1614 --just-symbols.
1615
1616 2012-08-31 Alan Modra <amodra@gmail.com>
1617
1618 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1619 (Powerpc_relobj::toc_base_offset): New stub function.
1620 (Target_powerpc): Add tp_offset, dtp_offset. Rename
1621 got_mod_index_offset to tlsld_got_offset. Update all refs.
1622 (Target_powerpc::Relocate::enum skip_tls): New.
1623 (Target_powerpc::call_tls_get_addr_): New var.
1624 (Target_powerpc::is_branch_reloc): Move to file scope.
1625 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1626 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1627 New functions.
1628 (Target_powerpc::enum Got_type): Delete old values, add new ones.
1629 (powerpc_info): Correct common_pagesize for ppc64.
1630 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1631 (Powerpc_relocate_functions): Add overflow check enums and functions.
1632 Add non-shift version of rela, rela_ua. Delete all rel public
1633 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
1634 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1635 addr16_ha3, addr14 functions.
1636 (Output_data_got_powerpc::add_constant_pair): New function.
1637 (Output_data_got_powerpc::got_base_offset): Likewise.
1638 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1639 (instruction constants): Sort, add some more.
1640 (Output_data_glink::do_write): Add and use Address typedef. Use
1641 object->toc_base_offset() stub for 64-bit.
1642 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1643 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1644 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1645 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
1646 Always treat .opd relocs as against locally defined symbol.
1647 Correct condition for RELATIVE relocs.
1648 (Target_powerpc::do_finalize_sections): Test for NULL sections.
1649 (Target_powerpc::Relocate::relocate): Use plt call stub as value
1650 for 32-bit syms with a plt entry. Correct ppc64 toc base
1651 calculations. Handle TLS relocs, and more. Add overflow
1652 checking and adjust for Powerpc_relocate_functions changes.
1653 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1654 Reinstate --emit-relocs code with FIXME.
1655
1656 2012-08-30 Alan Modra <amodra@gmail.com>
1657
1658 * layout.cc (Layout::set_segment_offsets): Set p_align to
1659 abi_pagesize, not common_pagesize.
1660 (Layout::relaxation_loop_body): Similarly use abi_pagesize
1661 to determine whether file header can go in segment.
1662
1663 2012-08-30 Alan Modra <amodra@gmail.com>
1664
1665 * output.h (Output_reloc::Output_reloc <output section>): Add
1666 is_relative param. Adjust calls.
1667 (Output_reloc::add_output_section_relative): New functions.
1668 * output.cc (Output_reloc::Output_reloc <output section>): Handle
1669 is_relative.
1670 (Output_reloc::symbol_value): Handle SECTION_CODE.
1671
1672 2012-08-24 Sriraman Tallam <tmsriram@google.com>
1673
1674 * gold.cc (queue_middle_tasks): Call layout again when unique
1675 segments for sections is desired.
1676 * layout.cc (Layout::Layout): Initialize new members.
1677 (Layout::get_output_section_flags): New function.
1678 (Layout::choose_output_section): Call get_output_section_flags.
1679 (Layout::layout): Make output section for mapping to a unique segment.
1680 (Layout::insert_section_segment_map): New function.
1681 (Layout::attach_allocated_section_to_segment): Make unique segment for
1682 output sections marked so.
1683 (Layout::segment_precedes): Check for unique segments when sorting.
1684 * layout.h (Layout::Unique_segment_info): New struct.
1685 (Layout::Section_segment_map): New typedef.
1686 (Layout::insert_section_segment_map): New function.
1687 (Layout::get_output_section_flags): New function.
1688 (Layout::is_unique_segment_for_sections_specified): New function.
1689 (Layout::set_unique_segment_for_sections_specified): New function.
1690 (Layout::unique_segment_for_sections_specified_): New member.
1691 (Layout::section_segment_map_): New member.
1692 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1693 Rename is_gc_pass_one to is_pass_one.
1694 Rename is_gc_pass_two to is_pass_two.
1695 Rename is_gc_or_icf to is_two_pass.
1696 Check for which pass based on whether symbols data is present.
1697 Make it two pass when unique segments for sections is desired.
1698 * output.cc (Output_section::Output_section): Initialize new
1699 members.
1700 * output.h (Output_section::is_unique_segment): New function.
1701 (Output_section::set_is_unique_segment): New function.
1702 (Output_section::is_unique_segment_): New member.
1703 (Output_section::extra_segment_flags): New function.
1704 (Output_section::set_extra_segment_flags): New function.
1705 (Output_section::extra_segment_flags_): New member.
1706 (Output_section::segment_alignment): New function.
1707 (Output_section::set_segment_alignment): New function.
1708 (Output_section::segment_alignment_): New member.
1709 (Output_segment::Output_segment): Initialize is_unique_segment_.
1710 (Output_segment::is_unique_segment): New function.
1711 (Output_segment::set_is_unique_segment): New function.
1712 (Output_segment::is_unique_segment_): New member.
1713 * plugin.cc (allow_unique_segment_for_sections): New function.
1714 (unique_segment_for_sections): New function.
1715 (Plugin::load): Add new functions to transfer vector.
1716 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1717 * Makefile.in: Regenerate.
1718 * testsuite/plugin_final_layout.sh: Check if unique segment
1719 functionality works.
1720 * testsuite/plugin_section_order.c (onload): Check if new interfaces
1721 are available.
1722 (allow_unique_segment_for_sections): New global.
1723 (unique_segment_for_sections): New global.
1724 (claim_file_hook): Call allow_unique_segment_for_sections.
1725 (all_symbols_read_hook): Call unique_segment_for_sections.
1726
1727 2012-08-22 Cary Coutant <ccoutant@google.com>
1728
1729 * layout.cc (Layout::include_section): Don't assert on GROUP
1730 sections with --emit-relocs.
1731
1732 2012-08-21 Cary Coutant <ccoutant@google.com>
1733
1734 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1735 if --export-dynamic-symbol names an undef symbol.
1736
1737 2012-08-18 Alan Modra <amodra@gmail.com>
1738
1739 * powerpc.cc: Formatting and white space.
1740 (Powerpc_relobj): Rename got2_section_ to special_.
1741 Add opd_ent_shndx_ and opd_ent_off_ vectors.
1742 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1743 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1744 (Target_powerpc): Add Address typedef and invalid_address. Use
1745 throughout.
1746 (Target_powerpc::is_branch_reloc): New function.
1747 (Powerpc_relocate_functions): Add Address typedef, use throughout.
1748 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1749 for dst_mask, value and addend.
1750 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1751 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1752 (Output_data_glink::do_write): Correct toc base. Don't try to use
1753 uint16_t for 24-bit offset. Use get_output_section_offset and
1754 check return.
1755 (Target_powerpc::Scan::local): Handle more relocs.
1756 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1757 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1758 Plug in toc restoring insn after plt calls. Translate branches
1759 to function descriptor symbols to corresponding entry point.
1760 (Target_powerpc::relocate_for_relocatable): Check return from
1761 get_output_section_offset.
1762 * symtab.h: Comment typo.
1763
1764 2012-08-14 Ian Lance Taylor <iant@google.com>
1765
1766 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1767 unsupported_relocal_local to call unsupported_reloc_global.
1768
1769 2012-08-14 Nick Clifton <nickc@redhat.com>
1770
1771 PR ld/14265
1772 * script-sections.cc (Sections_element::output_section_name): Add
1773 keep return parameter.
1774 (Output_section_element::match_name): Add keep return parameter.
1775 Return the value of the keep_ member.
1776 * script-sections.h (class Output_section): Update
1777 output_section_name prototype.
1778 * layout.cc (Layout::keep_input_section): New public member
1779 function.
1780 (Layout::choose_output_section): Pass keep parameter to
1781 output_section_name.
1782 * layout.h (class Layout): Add keep_input_section.
1783 * object.cc (Sized_relobj_file::do_layout): Check for kept input
1784 sections.
1785 * testsuite/Makefile.am: Add a test.
1786 * testsuite/Makefile.in: Regenerate.
1787 * testsuite/pr14265.c: Source file for the test.
1788 * testsuite/pr14265.t: Linker script for the test.
1789 * testsuite/pr14265.sh: Shell script for the test.
1790
1791 2012-08-14 Alan Modra <amodra@gmail.com>
1792
1793 * target.h (Target::output_section_name): New function.
1794 (Target::do_output_section_name): New function.
1795 * layout.cc (Layout::choose_output_section): Call the above.
1796 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1797
1798 2012-08-14 Alan Modra <amodra@gmail.com>
1799
1800 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1801 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1802 for replace_constant call.
1803 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1804 (Output_data_glink::do_print_to_mapfile): New function.
1805 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1806 (Target_powerpc::Relocate::relocate): Likewise.
1807
1808 2012-08-14 Alan Modra <amodra@gmail.com>
1809
1810 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1811 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1812 (Output_data_glink::add_entry,find_entry): Remove shndx param.
1813 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
1814 all references to shndx_. Handle special case for R_PPC_PLTREL24
1815 here.
1816 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1817 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1818 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1819 here.
1820 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1821 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1822
1823 2012-08-12 Alan Modra <amodra@gmail.com>
1824
1825 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
1826 (glink insn constants): Use uint32_t.
1827 (Output_data_glink::add_entry): Use insert, not [] operator.
1828
1829 2012-08-11 Alan Modra <amodra@gmail.com>
1830
1831 * object.h (Sized_relobj_file::find_shdr): New function.
1832 (Sized_relobj_file::find_special_sections): New function.
1833 * object.cc (Sized_relobj_file::find_shdr): New function.
1834 (Sized_relobj_file::find_eh_frame): Use find_shdr.
1835 (Sized_relobj_file::find_special_sections): New function, split out..
1836 (Sized_relobj_file::do_read_symbols): ..from here.
1837 * output.h (Output_data_got::replace_constant): New function.
1838 (Output_data_got::num_entries): New function.
1839 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1840 (Output_data_got::got_offset): Protected rather than private.
1841 (Output_data_got::replace_got_entry): New function.
1842 * output.cc (Output_data_got::replace_got_entry): New function.
1843 * powerpc.cc (class Powerpc_relobj): New.
1844 (class Powerpc_relocate_functions): Delete all psymval variants or
1845 convert to value,addend type. Delete pcrela, pcrela_unaligned.
1846 Implement _ha functions using corresponding _hi function.
1847 (Powerpc_relobj::find_special_sections): New function.
1848 (Target_powerpc::do_make_elf_object): New function.
1849 (class Output_data_got_powerpc): New.
1850 (class Output_data_glink): New.
1851 (class Powerpc_scan_relocatable_reloc): New.
1852 Many more changes througout file.
1853
1854 2012-08-09 Nick Clifton <nickc@redhat.com>
1855
1856 * po/vi.po: Updated Vietnamese translation.
1857
1858 2012-08-07 Ian Lance Taylor <iant@google.com>
1859
1860 * layout.cc (Layout::add_target_dynamic_tags): If
1861 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1862 plt_rel.
1863
1864 2012-07-30 Nick Clifton <nickc@redhat.com>
1865
1866 * po/gold.pot: Updated template.
1867 * po/es.po: Updated Spanish translation.
1868
1869 2012-07-18 Cary Coutant <ccoutant@google.com>
1870
1871 PR gold/14344
1872 * configure.ac: Add check for -gpubnames support.
1873 * configure: Regenerate.
1874 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1875 support; force -gno-pubnames.
1876 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1877 support.
1878 (gdb_index_test_4): New test.
1879 * testsuite/Makefile.in: Regenerate.
1880 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1881 * testsuite/gdb_index_test_2.sh: Likewise.
1882 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1883 * testsuite/gdb_index_test_4.sh: New script.
1884 * testsuite/gdb_index_test_comm.sh: New script with common code;
1885 don't look for space after colon.
1886
1887 2012-07-16 Sriraman Tallam <tmsriram@google.com>
1888
1889 * gold.cc (queue_middle_tasks): Update function order only after
1890 deferred objects due to plugins are processed.
1891
1892 2012-07-11 Ian Lance Taylor <iant@google.com>
1893
1894 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1895 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1896 (Target_arm::scan_reloc_for_stub): Likewise.
1897 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1898 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1899 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1900 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1901 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1902
1903 2012-07-10 Dodji Seketeli <dodji@redhat.com>
1904 Ian Lance Taylor <iant@google.com>
1905
1906 PR gold/14309
1907 * configure.ac: Test whether std::tr1::hash<off_t> works.
1908 * gold.h: Add a specialization for std::tr1::hash<off_t> if
1909 needed.
1910 * output.h (class Output_fill): Add virtual destructor.
1911 * configure, config.in: Rebuild.
1912
1913 2012-06-22 Roland McGrath <mcgrathr@google.com>
1914
1915 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1916
1917 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
1918
1919 * plugin.cc (Plugin::load): Handle position independent executables.
1920
1921 2012-06-06 Cary Coutant <ccoutant@google.com>
1922
1923 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1924 add .debug_macro.
1925 (lines_only_debug_sections): Likewise.
1926 (gdb_fast_lookup_sections): New static array.
1927 (is_gdb_debug_section): Rename formal parameter.
1928 (is_lines_only_debug_section): Likewise.
1929 (is_gdb_fast_lookup_section): New function.
1930 (Layout::include_section): Check for ".zdebug_" prefix; pass
1931 section name suffix to is_gdb_debug_section, et al.; check for
1932 fast-lookup sections when building .gdb_index.
1933 * options.h (--strip-debug-gdb): Update GDB version number.
1934
1935 2012-06-06 Cary Coutant <ccoutant@google.com>
1936
1937 * configure.ac: Add check for fallocate.
1938 * configure: Regenerate.
1939 * config.in: Regenerate.
1940
1941 * options.h (class General_options): Add --mmap-output-file and
1942 --posix-fallocate options.
1943 * output.cc: (posix_fallocate): Remove; replace with...
1944 (gold_fallocate): New function.
1945 (Output_file::map_no_anonymous): Call gold_fallocate.
1946 (Output_file::map): Check --mmap-output-file option.
1947
1948 2012-06-05 Jing Yu <jingyu@google.com>
1949
1950 * gold.h (textdomain): Add do {} to empty while(0).
1951 (bindtextdomain): Likewise.
1952
1953 2012-06-04 Cary Coutant <ccoutant@google.com>
1954
1955 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1956 has_dynsym_index.
1957
1958 2012-05-25 Sriraman Tallam <tmsriram@google.com>
1959
1960 * symtab.cc (Symbol_table::define_special_symbol):
1961 Initialize *poldsym to prevent uninitialized variable errors.
1962
1963 2012-05-23 Cary Coutant <ccoutant@google.com>
1964
1965 * layout.cc (Layout::section_name_mapping): Add rules to handle
1966 exact match on .data.rel.ro.local or .data.rel.ro.
1967 (Layout::output_section_name): Check for exact matches.
1968
1969 2012-05-23 Cary Coutant <ccoutant@google.com>
1970
1971 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1972 more carefully.
1973
1974 2012-05-22 Cary Coutant <ccoutant@google.com>
1975
1976 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1977 object before exporting symbol.
1978
1979 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
1980
1981 * testsuite/tls_test.cc: Include "config.h" first.
1982 * testsuite/tls_test_c.c: Likewise.
1983
1984 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
1985 Nick Clifton <nickc@redhat.com>
1986
1987 PR 14072
1988 * configure.in: Add check that sysdep.h has been included before
1989 any system header files.
1990 * configure: Regenerate.
1991 * config.in: Regenerate.
1992
1993 2012-05-14 Cary Coutant <ccoutant@google.com>
1994
1995 * layout.cc (Layout::make_output_section): Mark .tdata section
1996 as RELRO.
1997 * testsuite/relro_test.cc: Add a TLS variable.
1998
1999 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
2000
2001 PR gold/14091
2002 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2003 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2004 R_X86_64_64.
2005
2006 2012-05-08 Cary Coutant <ccoutant@google.com>
2007
2008 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2009 (lines_only_debug_sections): Likewise.
2010
2011 2012-05-02 Roland McGrath <mcgrathr@google.com>
2012
2013 * nacl.cc: New file.
2014 * nacl.h: New file.
2015 * Makefile.am (CCFILES, HFILES): Add them.
2016 * Makefile.in: Regenerate.
2017 * i386.cc (Output_data_plt_i386_nacl): New class.
2018 (Output_data_plt_i386_nacl_exec): New class.
2019 (Output_data_plt_i386_nacl_dyn): New class.
2020 (Target_i386_nacl): New class.
2021 (Target_selector_i386_nacl): New class.
2022 (target_selector_i386): Use it instead of Target_selector_i386.
2023 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2024 (Target_x86_64_nacl): New class.
2025 (Target_selector_x86_64_nacl): New class.
2026 (target_selector_x86_64, target_selector_x32): Use it instead of
2027 Target_selector_x86_64.
2028 * arm.cc (Output_data_plt_arm_nacl): New class.
2029 (Target_arm_nacl): New class.
2030 (Target_selector_arm_nacl): New class.
2031 (target_selector_arm, target_selector_armbe): Use it instead of
2032 Target_selector_arm.
2033
2034 * target-select.cc (select_target): Take new Input_file* and off_t
2035 arguments, pass them on to recognize method of selector.
2036 * object.cc (make_elf_sized_object): Update caller.
2037 * parameters.cc (parameters_force_valid_target): Likewise.
2038 * incremental.cc (make_sized_incremental_binary): Likewise.
2039 * target-select.h: Update decl.
2040 (Target_selector::recognize): Take new Input_file* argument,
2041 pass it on to do_recognize.
2042 (Target_selector::do_recognize): Take new Input_file* argument.
2043 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2044 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2045 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2046 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2047
2048 * target.h (Target::Target_info): New members isolate_execinstr
2049 and rosegment_gap.
2050 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2051 * arm.cc (Target_arm::arm_info): Update initializer.
2052 * i386.cc (Target_i386::i386_info): Likewise.
2053 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2054 * sparc.cc (Target_sparc::sparc_info): Likewise.
2055 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2056 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2057 * layout.cc (Layout::attach_allocated_section_to_segment):
2058 Take new const Target* argument. If target->isolate_execinstr(), act
2059 like --rosegment.
2060 (Layout::find_first_load_seg): Take new const Target* argument;
2061 if target->isolate_execinstr(), reject PF_X segments.
2062 (Layout::relaxation_loop_body): Update caller.
2063 (Layout::set_segment_offsets): If target->isolate_execinstr(),
2064 reset file offset to zero when we hit LOAD_SEG, and then do a second
2065 loop over the segments before LOAD_SEG to reassign offsets after
2066 addresses have been determined. Handle target->rosegment_gap().
2067 (Layout::attach_section_to_segment): Take new const Target* argument;
2068 pass it to attach_allocated_section_to_segment.
2069 (Layout::make_output_section): Update caller.
2070 (Layout::attach_sections_to_segments): Take new const Target* argument;
2071 pass it to attach_section_to_segment.
2072 * gold.cc (queue_middle_tasks): Update caller.
2073 * layout.h (Layout): Update method decls with new arguments.
2074
2075 * arm.cc (Target_arm::Target_arm): Take optional argument for the
2076 Target_info pointer to use.
2077 (Target_arm::do_make_data_plt): New virtual method.
2078 (Target_arm::make_data_plt): New method that calls it.
2079 (Target_arm::make_plt_entry): Use it.
2080 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2081 for the section alignment.
2082 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2083 method.
2084 (Output_data_plt_arm::first_plt_entry_offset): Call it.
2085 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2086 method.
2087 (Output_data_plt_arm::get_plt_entry_size): Call it.
2088 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2089 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2090 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2091 method.
2092 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2093 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2094 method instead of sizeof(plt_entry).
2095 (Output_data_plt_arm::add_entry): Likewise.
2096 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2097 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2098 than static method.
2099 (Target_arm::plt_entry_size): Likewise.
2100 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2101 Move to ...
2102 (Output_data_plt_arm_standard): ... here, new class.
2103 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2104 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2105 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2106
2107 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2108 Take additional argument for the PLT entry size.
2109 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2110 Use get_plt_entry_size method rather than plt_entry_size variable.
2111 (Output_data_plt_x86_64::reserve_slot): Likewise.
2112 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2113 (Output_data_plt_x86_64::add_entry): Likewise.
2114 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2115 (Output_data_plt_x86_64::address_for_global): Likewise.
2116 (Output_data_plt_x86_64::address_for_local): Likewise.
2117 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2118 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2119 Make method non-static.
2120 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2121 method.
2122 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2123 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2124 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2125 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2126 virtual method.
2127 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2128 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2129 virtual method.
2130 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2131 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2132 virtual method.
2133 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2134 (Output_data_plt_x86_64::plt_entry_size)
2135 (Output_data_plt_x86_64::first_plt_entry)
2136 (Output_data_plt_x86_64::plt_entry)
2137 (Output_data_plt_x86_64::tlsdesc_plt_entry)
2138 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2139 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2140 (Output_data_plt_x86_64_standard): ... here, new class.
2141 (Target_x86_64::Target_x86_64): Take optional argument for the
2142 Target_info pointer to use.
2143 (Target_x86_64::do_make_data_plt): New virtual method.
2144 (Target_x86_64::make_data_plt): New method to call it.
2145 (Target_x86_64::init_got_plt_for_update): Use that.
2146 Call this->plt_->add_eh_frame method here.
2147 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2148 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2149 rather than static method.
2150 (Target_x86_64::plt_entry_size): Likewise.
2151 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2152 rather than plt_entry_size variable. Move guts of PLT filling to...
2153 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2154 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2155 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2156
2157 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2158 additional argument for the section alignment.
2159 Don't do add_eh_frame_for_plt here.
2160 (Output_data_plt_i386::first_plt_entry_offset): Make the method
2161 non-static. Use get_plt_entry_size method rather than plt_entry_size
2162 variable.
2163 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2164 method.
2165 (Output_data_plt_i386::get_plt_entry_size): Call it.
2166 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2167 (Output_data_plt_i386::add_eh_frame): New method to call it.
2168 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2169 method.
2170 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2171 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2172 method.
2173 (Output_data_plt_i386::fill_plt_entry): New method to call it.
2174 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2175 method instead of plt_entry_size.
2176 (Output_data_plt_i386::plt_entry_size)
2177 (Output_data_plt_i386::plt_eh_frame_fde_size)
2178 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2179 (Output_data_plt_i386_standard): ... here, new class.
2180 (Output_data_plt_i386_exec): New class.
2181 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2182 (Output_data_plt_i386_exec::first_plt_entry): ... here.
2183 (Output_data_plt_i386::exec_plt_entry): Move to ...
2184 (Output_data_plt_i386_exec::plt_entry): ... here.
2185 (Output_data_plt_i386_dyn): New class.
2186 (Output_data_plt_i386::first_plt_entry): Move to ...
2187 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2188 (Output_data_plt_i386::dyn_plt_entry): Move to ...
2189 (Output_data_plt_i386_dyn::plt_entry): ... here.
2190 (Target_i386::Target_i386): Take optional argument for the Target_info
2191 pointer to use.
2192 (Target_i386::do_make_data_plt): New virtual method.
2193 (Target_i386::make_data_plt): New method to call it.
2194 (Target_i386::make_plt_section): Use that.
2195 Call this->plt_->add_eh_frame method here.
2196 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2197 rather than plt_entry_size variable.
2198 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2199 (Output_data_plt_i386::address_for_local): Likewise.
2200 (Output_data_plt_i386::do_write): Likewise.
2201 Move guts of PLT filling to...
2202 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2203 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2204 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2205 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2206
2207 2012-05-01 Cary Coutant <ccoutant@google.com>
2208
2209 * dwarf_reader.cc (Dwarf_die::read_attributes)
2210 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2211 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2212 * reduced_debug_output.cc
2213 (Output_reduced_debug_info_section::get_die_end): Remove
2214 DW_FORM_GNU_ref_index. Add default case.
2215
2216 2012-04-26 Mark Wielaard <mjw@redhat.com>
2217
2218 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2219 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2220 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2221 DW_AT_high_pc as offset from DW_AT_low_pc.
2222
2223 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2224 * testsuite/Makefile.in: Regenerate.
2225 * testsuite/gdb_index_test_3.c: New test source file.
2226 * testsuite/gdb_index_test_3.sh: New test source file.
2227
2228 2012-04-25 Ian Lance Taylor <iant@google.com>
2229
2230 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2231 pointer.
2232 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2233 as a class, not a struct.
2234 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2235 (Target_arm::apply_cortex_a8_workaround): Likewise.
2236 * gc.h: Declare Reloc_types as a struct, not a class.
2237 * object.h: Declare Symbols_data as a struct.
2238 * reloc.h: Declare Read_relocs_data as a struct.
2239 * target.h: Declare Relocate_info as a struct.
2240
2241 2012-04-24 David S. Miller <davem@davemloft.net>
2242
2243 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2244 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2245 and R_SPARC_WPLT30.
2246
2247 2012-04-24 Cary Coutant <ccoutant@google.com>
2248
2249 * incremental-dump.cc (find_input_containing_global): Replace
2250 magic number with symbolic constant.
2251 (dump_incremental_inputs): Update version number.
2252 * incremental.cc (Output_section_incremental_inputs): Update version
2253 number; import symbolic constants from Incremental_inputs_reader.
2254 (Incremental_inputs::create_data_sections): Align relocations
2255 section correctly for 64-bit targets.
2256 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2257 constants; add padding.
2258 (Output_section_incremental_inputs::write_header): Add assert for
2259 header_size.
2260 (Output_section_incremental_inputs::write_input_files): Add assert
2261 for input_entry_size.
2262 (Output_section_incremental_inputs::write_info_blocks): Add padding;
2263 add assert for object_info_size, input_section_entry_size,
2264 global_sym_entry_size.
2265 * incremental.h (Incremental_inputs_reader): Add symbolic constants
2266 for data structure sizes; use them.
2267 (Incremental_input_entry_reader): Import symbolic constants from
2268 Incremental_inputs_reader; use them.
2269
2270 2012-04-23 David S. Miller <davem@davemloft.net>
2271
2272 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2273 and elf_flags_set_.
2274 (Target_sparc::Target_sparc): Initialize new fields.
2275 (Target_sparc::do_make_elf_object): New function.
2276 (Target_sparc::do_adjust_elf_header): New function.
2277
2278 2012-04-23 Cary Coutant <ccoutant@google.com>
2279
2280 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2281 CU range table of gdb index.
2282
2283 2012-04-20 David S. Miller <davem@davemloft.net>
2284
2285 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2286 instead of false.
2287
2288 2012-04-16 David S. Miller <davem@davemloft.net>
2289
2290 * sparc.cc (Target_sparc::got_address): New function.
2291 (Sparc_relocate_functions::gdop_hix22): New function.
2292 (Sparc_relocate_functions::gdop_lox10): New function.
2293 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2294 relocs.
2295 (Target_sparc::Scan::local): Likewise if the global symbol is not
2296 preemptible and is not IFUNC.
2297 (Target_sparc::Relocate::relocate): Perform GOTDATA code
2298 transformations for local and non-preemptible non-IFUNC global
2299 symbols.
2300
2301 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2302 writing out 64-bit part of ranges.
2303
2304 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2305 -fpic and -fpie respectively.
2306 * Makefile.in: Regenerate.
2307
2308 * sparc.cc (class Target_sparc): Add rela_ifunc_.
2309 (Target_sparc::Target_sparc): Initialize new field.
2310 (Target_sparc::do_plt_section_for_global): New function.
2311 (Target_sparc::do_plt_section_for_local): New function.
2312 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2313 (Target_sparc::make_plt_section): New function, broken out of
2314 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
2315 (Target_sparc::make_plt_entry): Call make_plt_section.
2316 (Target_sparc::make_local_ifunc_plt_entry): New function.
2317 (Target_sparc::rela_ifunc_section): New function.
2318 (Target_sparc::plt_section): Remove const.
2319 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
2320 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2321 and ifunc_count_ fields.
2322 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2323 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2324 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2325 (Output_data_plt_sparc::rela_ifunc): New function.
2326 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2327 (Output_data_plt_sparc::has_ifunc_section): New function.
2328 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2329 (Output_data_plt_sparc::address_for_global): New function.
2330 (Output_data_plt_sparc::address_for_local): New function.
2331 (Output_data_plt_sparc::plt_index_to_offset): New function.
2332 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2333 and entry_count.
2334 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2335 entry_count.
2336 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2337 R_SPARC_JMP_IREL to switch.
2338 (Target_sparc::Scan::check_non_pic): Likewise.
2339 (Target_sparc::Scan::local): Handle IFUNC symbols.
2340 (Target_sparc::Scan::local): Likewise.
2341 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2342 and plt_address_for_local.
2343 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2344 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2345
2346 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2347 (class Output_data_reloc): Adjust calls to Output_reloc_type.
2348 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2349 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2350 global relocs too.
2351 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2352 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2353 calls.
2354 * sparc.cc (Target_sparc::Scan::global): Likewise.
2355 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2356
2357 2012-04-16 Cary Coutant <ccoutant@google.com>
2358
2359 * archive.cc (Library_base::should_include_member): Check for
2360 --export-dynamic-symbol.
2361 * options.h (class General_options): Add --export-dynamic-symbol.
2362 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2363 --export-dynamic-symbol.
2364 (Symbol_table::gc_mark_undef_symbols): Likewise.
2365 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2366
2367 2012-04-12 David S. Miller <davem@davemloft.net>
2368
2369 * sparc.cc (Reloc::wdisp10): New relocation method.
2370 (Reloc::h34): Likewise.
2371 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2372 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2373 R_SPARC_WDISP10.
2374 (Target_sparc::Scan::local): Likewise.
2375 (Target_sparc::Scan::global): Likewise.
2376 (Target_sparc::Relocate::relocate): Likewise.
2377
2378 2012-04-09 Cary Coutant <ccoutant@google.com>
2379
2380 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2381 low_pc == 0.
2382
2383 2012-04-06 Ian Lance Taylor <iant@google.com>
2384
2385 * timer.cc: #include <unistd.h>.
2386
2387 2012-04-06 Roland McGrath <mcgrathr@google.com>
2388
2389 * configure.in (AC_CHECK_HEADERS): Add locale.h.
2390 * config.in: Regenerate.
2391 * configure: Regenerate.
2392
2393 2012-04-05 Nick Clifton <nickc@redhat.com>
2394
2395 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2396 (AM_LC_MESSAGES): Add.
2397 * aclocal.m4: Regenerate.
2398 * config.in: Regenerate.
2399 * configure: Regenerate.
2400
2401 2012-03-21 Cary Coutant <ccoutant@google.com>
2402
2403 * Makefile.am: Add gdb-index.cc, gdb-index.h.
2404 * Makefile.in: Regenerate.
2405 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2406 (Sized_elf_reloc_mapper::symbol_section): New function.
2407 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2408 (make_elf_reloc_mapper): New function.
2409 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2410 (Dwarf_abbrev_table::do_read_abbrevs): New function.
2411 (Dwarf_abbrev_table::do_get_abbrev): New function.
2412 (Dwarf_ranges_table::read_ranges_table): New function.
2413 (Dwarf_ranges_table::read_range_list): New function.
2414 (Dwarf_pubnames_table::read_section): New function.
2415 (Dwarf_pubnames_table::read_header): New function.
2416 (Dwarf_pubnames_table::next_name): New function.
2417 (Dwarf_die::Dwarf_die): New function.
2418 (Dwarf_die::read_attributes): New function.
2419 (Dwarf_die::skip_attributes): New function.
2420 (Dwarf_die::set_name): New function.
2421 (Dwarf_die::set_linkage_name): New function.
2422 (Dwarf_die::attribute): New function.
2423 (Dwarf_die::string_attribute): New function.
2424 (Dwarf_die::int_attribute): New function.
2425 (Dwarf_die::uint_attribute): New function.
2426 (Dwarf_die::ref_attribute): New function.
2427 (Dwarf_die::child_offset): New function.
2428 (Dwarf_die::sibling_offset): New function.
2429 (Dwarf_info_reader::check_buffer): New function.
2430 (Dwarf_info_reader::parse): New function.
2431 (Dwarf_info_reader::do_parse): New function.
2432 (Dwarf_info_reader::do_read_string_table): New function.
2433 (Dwarf_info_reader::lookup_reloc): New function.
2434 (Dwarf_info_reader::get_string): New function.
2435 (Dwarf_info_reader::visit_compilation_unit): New function.
2436 (Dwarf_info_reader::visit_type_unit): New function.
2437 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2438 Sized_elf_reloc_mapper.
2439 (Sized_dwarf_line_info::symbol_section): Remove function.
2440 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2441 (Sized_dwarf_line_info::read_line_mappings): Remove object
2442 parameter, adjust callers.
2443 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2444 * dwarf_reader.h: Include <sys/types.h>.
2445 (class Track_relocs): Remove forward declaration.
2446 (class Elf_reloc_mapper): New class.
2447 (class Sized_elf_reloc_mapper): New class.
2448 (class Dwarf_abbrev_table): New class.
2449 (class Dwarf_range_list): New class.
2450 (class Dwarf_ranges_table): New class.
2451 (class Dwarf_pubnames_table): New class.
2452 (class Dwarf_die): New class.
2453 (class Dwarf_info_reader): New class.
2454 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2455 (Sized_dwarf_line_info::symbol_section): Remove member function.
2456 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2457 base class.
2458 * gdb-index.cc: New source file.
2459 * gdb-index.h: New source file.
2460 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2461 and .debug_types sections, call Layout::add_to_gdb_index.
2462 (Sized_relobj_incr::do_section_name): Implement.
2463 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2464 return type; Implement.
2465 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2466 return type.
2467 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2468 parameter list and return type.
2469 (Sized_incr_dynobj::do_section_contents): Likewise.
2470 * layout.cc: Include gdb-index.h.
2471 (Layout::Layout): Initialize gdb_index_data_.
2472 (Layout::init_fixed_output_section): Check for .gdb_index section.
2473 (Layout::add_to_gdb_index): New function. Instantiate.
2474 * layout.h: Add forward declaration for class Gdb_index.
2475 (Layout::add_to_gdb_index): New member function.
2476 (Layout::gdb_index_data_): New data member.
2477 * main.cc: Include gdb-index.h.
2478 (main): Print statistics for gdb index.
2479 * object.cc (Object::section_contents): Move code into
2480 do_section_contents.
2481 (need_decompressed_section): Check for sections needed when building
2482 gdb index.
2483 (build_compressed_section_map): Likewise.
2484 (Sized_relobj_file::do_read_symbols): Need local symbols when building
2485 gdb index.
2486 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2487 sections; call Layout::add_to_gdb_index.
2488 (Sized_relobj_file::do_decompressed_section_contents): Call
2489 do_section_contents directly.
2490 * object.h (Object::do_section_contents): Adjust parameter list and
2491 return type.
2492 (Object::do_decompressed_section_contents): Call do_section_contents
2493 directly.
2494 (Sized_relobj_file::do_section_contents): Adjust parameter list and
2495 return type.
2496 * options.h (class General_options): Add --gdb-index option.
2497 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2498 list and return type.
2499 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2500 * reloc.h (Track_relocs::checkpoint): New function.
2501 (Track_relocs::reset): New function.
2502
2503 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2504 New test cases.
2505 * testsuite/Makefile.in: Regenerate.
2506 * testsuite/gdb_index_test.cc: New test source file.
2507 * testsuite/gdb_index_test_1.sh: New test source file.
2508 * testsuite/gdb_index_test_2.sh: New test source file.
2509
2510 2012-03-19 Doug Kwan <dougkwan@google.com>
2511
2512 * arm.cc (Target_arm::do_define_standard_symbols): New method.
2513 (Target_arm::do_finalize_sections): Remove code which defines
2514 __exidx_start and __exidx_end. Make symbol table parameter
2515 anonymous as it is not used.
2516 * gold.cc (queue_middle_tasks): Call target hook to define any
2517 target-specific symbols.
2518 * target.h (Target::define_standard_symbols): New method.
2519 (Target::do_define_standard_symbols): Same.
2520 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2521 * testsuite/Makefile.in: Regenerate.
2522 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2523 and __exidx_end.
2524 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2525 relocations are generated for __exidx_start and __exidx_end.
2526
2527 2012-03-16 Doug Kwan <dougkwan@google.com>
2528
2529 * testsuite/Makefile.am: Disable test initpri3b.
2530 * testsuite/Makefile.in: Regenerate.
2531
2532 2012-03-15 Doug Kwan <dougkwan@google.com>
2533
2534 * arm.cc (Target_arm::got_section): Make .got section read-only
2535 if -z now is given.
2536
2537 2012-03-15 Ian Lance Taylor <iant@google.com>
2538
2539 PR gold/13850
2540 * layout.cc (Layout::make_output_section): Correctly mark
2541 SHT_INIT_ARRAY, et. al., as relro.
2542
2543 2012-03-14 Doug Kwan <dougkwan@google.com>
2544
2545 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2546 dynamic relocations for protected symbols in shared objects.
2547
2548 2012-03-13 Ian Lance Taylor <iant@google.com>
2549
2550 * resolve.cc (Symbol_table::resolve): When merging common symbols,
2551 keep the larger alignment.
2552
2553 2012-03-12 Cary Coutant <ccoutant@google.com>
2554
2555 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2556 handling of DW_LNE_define_file.
2557
2558 2012-03-12 Cary Coutant <ccoutant@google.com>
2559
2560 * reduced_debug_output.cc
2561 (Output_reduced_debug_info_section::get_die_end): Add new FORM
2562 codes to switch.
2563
2564 2012-02-29 Cary Coutant <ccoutant@google.com>
2565
2566 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2567
2568 2012-02-29 Cary Coutant <ccoutant@google.com>
2569
2570 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2571 Call Object::decompressed_section_contents.
2572 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2573 New dtor.
2574 (Sized_dwarf_line_info::buffer_start_): New data member.
2575 * merge.cc (Output_merge_data::do_add_input_section): Call
2576 Object::decompressed_section_contents.
2577 (Output_merge_string::do_add_input_section): Likewise.
2578 * object.cc (need_decompressed_section): New function.
2579 (build_compressed_section_map): Decompress sections needed later.
2580 (Sized_relobj_file::do_decompressed_section_contents): New function.
2581 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2582 * object.h (Object::decompressed_section_contents): New function.
2583 (Object::discard_decompressed_sections): New function.
2584 (Object::do_decompressed_section_contents): New function.
2585 (Object::do_discard_decompressed_sections): New function.
2586 (Compressed_section_info): New type.
2587 (Compressed_section_map): Include decompressed section contents.
2588 (Sized_relobj_file::do_decompressed_section_contents): New function.
2589 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2590
2591 2012-02-16 Cary Coutant <ccoutant@google.com>
2592
2593 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2594 * testsuite/Makefile.in: Regenerate.
2595
2596 2012-02-14 Cary Coutant <ccoutant@google.com>
2597
2598 * options.cc (General_options::finalize): Disallow -pie and -static.
2599
2600 2012-02-03 Doug Kwan <dougkwan@google.com>
2601
2602 * arm.cc (Arm_relocate_functions::abs8,
2603 Arm_relocate_functions::abs16): Use
2604 Bits::has_signed_unsigned_overflow32.
2605 (Arm_relocate_functions::thm_abs8): Correct range of
2606 overflow check.
2607 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2608 in assertions.
2609
2610 2012-02-02 Doug Kwan <dougkwan@google.com>
2611
2612 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2613 position independent outputs, not just shared objects.
2614
2615 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
2616
2617 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2618 * configure: Regenerated.
2619
2620 2012-01-27 Ian Lance Taylor <iant@google.com>
2621
2622 * reloc.h (Bits): New class with static functions, copied from
2623 namespace utils in arm.cc.
2624 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
2625 instead.
2626
2627 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2628
2629 * incremental.cc (write_info_blocks): Correct relocation offset.
2630
2631 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2632
2633 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2634 (Relocate::tls_gd_to_le): Likewise.
2635
2636 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2637
2638 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2639
2640 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2641
2642 * configure.ac: Check if -mcmodel=medium works.
2643 * configure: Regenerated.
2644
2645 2012-01-24 Cary Coutant <ccoutant@google.com>
2646
2647 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2648 definition and ...
2649 (read_unsigned_LEB_128_x): ... this new function.
2650 (read_signed_LEB_128): Replaced with inline definition and ...
2651 (read_signed_LEB_128_x): ... this new function.
2652 * int_encoding.h (read_unsigned_LEB_128_x): New function.
2653 (read_unsigned_LEB_128): Add inline definition.
2654 (read_signed_LEB_128_x): New function.
2655 (read_signed_LEB_128): Add inline definition.
2656 * testsuite/Makefile.am (leb128_unittest): New unit test.
2657 * testsuite/Makefile.in: Regenerate.
2658 * testsuite/leb128_unittest.cc: New unit test.
2659
2660 2012-01-23 Ian Lance Taylor <iant@google.com>
2661
2662 PR gold/13617
2663 * i386.cc (Target_i386::do_code_fill): When using a jmp
2664 instruction, pad with nop instructions.
2665 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2666
2667 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
2668
2669 * x86_64.cc (gc_process_relocs): Add typename on types used in
2670 template.
2671 (scan_relocs): Likewise.
2672 (relocate_section): Likewise.
2673 (apply_relocation): Likewise.
2674
2675 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
2676
2677 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2678 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2679 under x32.
2680
2681 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
2682
2683 * x86_64.cc: Initial support for x32.
2684
2685 2012-01-03 Cary Coutant <ccoutant@google.com>
2686
2687 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2688 Use abstract base class for GOT.
2689 * gold/output.h (class Output_data_got_base): New abstract base class.
2690 (class Output_data_got): Derive from new base class, adjust ctors.
2691 (Output_data_got::reserve_slot): Make virtual; rename to
2692 do_reserve_slot; Adjust callers.
2693 * gold/target.h (Sized_target::init_got_plt_for_update): Return
2694 pointer to abstract base class.
2695 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2696
2697 2011-12-18 Ian Lance Taylor <iant@google.com>
2698
2699 * object.h (Relobj::local_symbol_value): New function.
2700 (Relobj::local_plt_offset): New function.
2701 (Relobj::local_has_got_offset): New function.
2702 (Relobj::local_got_offset): New function.
2703 (Relobj::set_local_got_offset): New function.
2704 (Relobj::do_local_symbol_value): New pure virtual function.
2705 (Relobj::do_local_plt_offset): Likewise.
2706 (Relobj::do_local_has_got_offset): Likewise.
2707 (Relobj::do_local_got_offset): Likewise.
2708 (Relobj::do_set_local_got_offset): Likewise.
2709 (Sized_relobj::do_local_has_got_offset): Rename from
2710 local_has_got_offset.
2711 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2712 (Sized_relobj::do_set_local_got_offset): Rename from
2713 set_local_got_offset.
2714 (Sized_relobj_file::do_local_plt_offset): Rename from
2715 local_plt_offset.
2716 (Sized_relobj_file::do_local_symbol_value): New function.
2717 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2718 local_plt_offset.
2719 * output.cc (Output_data_got::Got_entry::write): Change object to
2720 Relobj. Use local_symbol_value.
2721 (Output_data_got::add_global_with_rel): Change rel_dyn to
2722 Output_data_reloc_generic*. Use add_global_generic.
2723 (Output_data_got::add_global_with_rela): Remove. Change all
2724 callers to use add_global_with_rel.
2725 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2726 Output_data_reloc_generic*. Use add_global_generic.
2727 (Output_data_got::add_global_pair_with_rela): Remove. Change all
2728 callers to use add_global_pair_with_rel.
2729 (Output_data_got::add_local): Change object to Relobj*.
2730 (Output_data_got::add_local_plt): Likewise.
2731 (Output_data_got::add_local_with_rel): Change object to Relobj*,
2732 change rel_dyn to Output_data_reloc_generic*. Use
2733 add_local_generic.
2734 (Output_data_got::add_local_with_rela): Remove. Change all
2735 callers to use all_local_with_rel.
2736 (Output_data_got::add_local_pair_with_rel): Change object to
2737 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
2738 add_output_section_generic.
2739 (Output_data_got::add_local_pair_with_rela): Remove. Change all
2740 callers to use add_local_pair_with_rel.
2741 (Output_data_got::reserve_local): Change object to Relobj*.
2742 * output.h: (class Output_data_reloc_generic): Add pure virtual
2743 declarations for add_global_generic, add_local_generic,
2744 add_output_section_generic.
2745 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2746 functions for Output_data_reloc_generic. Update declarations for
2747 changes listed in output.cc.
2748 (class Output_data_got): Change template parameter to got_size.
2749 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
2750 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2751 function.
2752 (Sized_relobj_incr::do_local_plt_offset): New function.
2753 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2754 add_global_generic.
2755
2756 2011-12-17 Cary Coutant <ccoutant@google.com>
2757
2758 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2759 * resolve.cc (Symbol_table::resolve): Likewise.
2760 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2761 arrays.
2762 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2763
2764 2011-12-16 Ian Lance Taylor <iant@google.com>
2765
2766 * output.h (Output_data_reloc_generic::add): Only call
2767 add_dynamic_reloc if this is a dynamic reloc section.
2768
2769 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
2770
2771 PR gold/13505
2772 * target-reloc.h (apply_relocation): Replace <64, false> with
2773 <size, big_endian>.
2774
2775 2011-11-25 Nick Clifton <nickc@redhat.com>
2776
2777 * po/it.po: New Italian translation.
2778
2779 2011-11-17 Sterling Augustine <saugustine@google.com>
2780
2781 * script.cc (script_include_directive): Implement.
2782 (read_script_file): New local variables name and search_path. Update
2783 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2784 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2785 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2786
2787 2011-11-11 Sterling Augustine <saugustine@google.com>
2788
2789 * yyscript.y (section_cmd): Add support for INCLUDE directive.
2790 (file_or_sections_cmd): Likewise.
2791
2792 2011-11-11 Doug Kwan <dougkwan@google.com>
2793
2794 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2795 if --just-symbols is given.
2796
2797 2011-11-10 Doug Kwan <dougkwan@google.com>
2798
2799 PR gold/13362
2800 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2801 when processing data relocs.
2802 * reloc.h (Relocate_functions::rel_unaligned): New method.
2803 (Relocate_functions::pcrel_unaligned): Ditto.
2804 (Relocate_functions::rel32_unaligned): Ditto.
2805 (Relocate_functions::pcrel32_unaligned): Ditto.
2806
2807 2011-11-09 Doug Kwan <dougkwan@google.com>
2808
2809 PR gold/13362
2810 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2811 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2812 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2813 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2814 (Relocate_functions::rel_unaligned): New.
2815 (Relocate_functions::rel32_unaligned): New.
2816 * target-reloc.h (relocate_for_relocatable): Add code to handle
2817 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2818 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2819 arm_unaligned_reloc_r): New targets.
2820 * testsuite/Makefile.in: Regenerate.
2821 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2822 linking.
2823
2824 2011-11-02 Ian Lance Taylor <iant@google.com>
2825
2826 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
2827 NATIVE_LINKER.
2828 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2829 * options.cc (General_options::finalize): Use library search path
2830 from configure script if specified. If not native and no sysroot,
2831 only search TOOLLIBDIR.
2832 * options.h (Search_directory::Search_directory): Change name to
2833 const std::string&.
2834 (General_options::add_to_library_path_with_sysroot): Change arg to
2835 const std::string&.
2836 * configure, Makefile.in, config.in: Rebuild.
2837
2838 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2839
2840 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2841 we are working around the ARM1176 Erratum.
2842 * options.h (General_options::fix_arm1176): Add option.
2843 * testsuite/Makefile.am: Add testcases, and keep current ones
2844 working.
2845 * testsuite/Makefile.in: Regenerate.
2846 * testsuite/arm_fix_1176.s: New file.
2847 * testsuite/arm_fix_1176.sh: Likewise.
2848
2849 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2850
2851 * arm.cc (Target_arm::Target_arm): Remove initialisation of
2852 may_use_blx_.
2853 (Target_arm::may_use_blx): Remove method.
2854 (Target_arm::set_may_use_blx): Likewise.
2855 (Target_arm::may_use_v4t_interworking): New method.
2856 (Target_arm::may_use_v5t_interworking): Likewise.
2857 (Target_arm::may_use_blx_): Remove member variable.
2858 (Arm_relocate_functions::arm_branch_common): Check for v5T
2859 interworking.
2860 (Arm_relocate_functions::thumb_branch_common): Likewise.
2861 (Reloc_stub::stub_type_for_reloc): Likewise.
2862 (Target_arm::do_finalize_sections): Correct interworking checks.
2863 * testsuite/Makefile.am: Add new tests.
2864 * testsuite/Makefile.in: Regenerate.
2865 * testsuite/arm_farcall_arm_arm.s: New test.
2866 * testsuite/arm_farcall_arm_arm.sh: Likewise.
2867 * testsuite/arm_farcall_arm_thumb.s: Likewise.
2868 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2869 * testsuite/arm_farcall_thumb_arm.s: Likewise.
2870 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2871 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2872 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2873
2874 2011-10-31 Cary Coutant <ccoutant@google.com>
2875
2876 PR gold/13023
2877 * expression.cc (Expression::eval_with_dot): Add
2878 is_section_dot_assignment parameter.
2879 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
2880 absolute and assigning to dot within a section.
2881 * script-sections.cc
2882 (Output_section_element_assignment::set_section_addresses): Pass
2883 dot_section to set_if_absolute.
2884 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2885 as is_section_dot_assignment flag to eval_with_dot.
2886 (Output_section_element_dot_assignment::set_section_addresses):
2887 Likewise.
2888 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2889 parameter. Also set value if relative to dot_section; set the
2890 symbol's output_section.
2891 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2892 parameter. Adjust all callers.
2893 (Expression::eval_maybe_dot): Likewise.
2894 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2895 Adjust all callers.
2896 * testsuite/script_test_2.t: Test assignment of an absolute value
2897 to dot within an output section element.
2898
2899 2011-10-31 Cary Coutant <ccoutant@google.com>
2900
2901 * options.h (class General_options): Add --[no-]gnu-unique options.
2902 * symtab.cc (Symbol_table::sized_write_globals): Convert
2903 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2904
2905 2011-10-31 Cary Coutant <ccoutant@google.com>
2906
2907 PR gold/13359
2908 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2909 unnecessary assertion.
2910 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2911
2912 2011-10-31 Sriraman Tallam <tmsriram@google.com>
2913
2914 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2915 gc_mark_symbol.
2916 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2917 gc_mark_symbol.
2918 Change to just keep the section associated with symbol.
2919 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2920 they are externally visible and --export-dynamic is turned on.
2921 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2922
2923 2011-10-19 Ian Lance Taylor <iant@google.com>
2924
2925 PR gold/13163
2926 * script-sections.cc
2927 (Output_section_element_dot_assignment::needs_output_section): New
2928 function.
2929
2930 2011-10-19 Ian Lance Taylor <iant@google.com>
2931
2932 PR gold/13204
2933 * layout.cc (Layout::segment_precedes): Don't assert failure if a
2934 --section-start option was seen.
2935 * options.h (General_options::any_section_start): New function.
2936
2937 2011-10-18 David S. Miller <davem@davemloft.net>
2938
2939 PR binutils/13301
2940 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2941 member to track relocation locations that have moved during TLS
2942 reloc optimizations.
2943 (Target_sparc::Relocate::Relocate): Initialize to NULL.
2944 (Target_sparc::Relocate::relocate): Adjust view down by 4
2945 bytes if it matches reloc_adjust_addr_.
2946 (Target_sparc::Relocate::relocate_tls): Always move the
2947 __tls_get_addr call delay slot instruction forward 4 bytes when
2948 performing relaxation.
2949
2950 2011-10-18 Cary Coutant <ccoutant@google.com>
2951
2952 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2953 (Output_file::map_no_anonymous): Check for non-zero
2954 return code from posix_fallocate.
2955
2956 2011-10-17 Cary Coutant <ccoutant@google.com>
2957
2958 PR gold/13245
2959 * plugin.cc (is_visible_from_outside): Check for symbols
2960 referenced from dynamic objects.
2961 * resolve.cc (Symbol_table::resolve): Don't count references
2962 from dynamic objects as references from real ELF files.
2963 * testsuite/plugin_test_2.sh: Adjust expected result.
2964
2965 2011-10-17 Cary Coutant <ccoutant@google.com>
2966
2967 * gold.cc: Include timer.h.
2968 (queue_middle_tasks): Stamp time.
2969 (queue_final_tasks): Likewise.
2970 * main.cc (main): Store timer in parameters. Print timers
2971 for each pass.
2972 * parameters.cc (Parameters::Parameters): Initialize timer_.
2973 (Parameters::set_timer): New function.
2974 (set_parameters_timer): New function.
2975 * parameters.h (Parameters::set_timer): New function.
2976 (Parameters::timer): New function.
2977 (Parameters::timer_): New data member.
2978 (set_parameters_timer): New function.
2979 * timer.cc (Timer::stamp): New function.
2980 (Timer::get_pass_time): New function.
2981 * timer.h (Timer::stamp): New function.
2982 (Timer::get_pass_time): New function.
2983 (Timer::pass_times_): New data member.
2984
2985 2011-10-17 Cary Coutant <ccoutant@google.com>
2986
2987 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2988 task for members of lib groups.
2989
2990 2011-10-17 Cary Coutant <ccoutant@google.com>
2991
2992 PR gold/13288
2993 * fileread.cc (File_read::find_view): Add assert.
2994 (File_read::make_view): Move bounds check (replace with assert)...
2995 (File_read::find_or_make_view): ... to here.
2996
2997 2011-10-12 Cary Coutant <ccoutant@google.com>
2998
2999 * output.cc (Output_file::open_base_file): Handle case where
3000 ::read returns less than requested size.
3001
3002 2011-10-10 Cary Coutant <ccoutant@google.com>
3003
3004 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3005 Initialize defined_count_.
3006 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3007 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3008 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3009 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3010 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3011 * incremental.h (Sized_relobj_incr::defined_count_): New data
3012 member.
3013 (Sized_incr_dynobj::defined_count_): New data member.
3014 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3015 Return zeroes instead of internal error.
3016
3017 2011-10-10 Cary Coutant <ccoutant@google.com>
3018
3019 PR gold/13249
3020 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3021 (Output_reloc::symbol_value): Return PLT offset if flag is set.
3022 * output.h (class Output_reloc): Add use_plt_offset flag.
3023 (Output_reloc::type_): Adjust size of bit field.
3024 (Output_reloc::use_plt_offset_): New bit field.
3025 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3026 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3027 flag. Adjust all callers.
3028 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3029 creating RELATIVE relocations.
3030
3031 2011-10-10 Nick Clifton <nickc@redhat.com>
3032
3033 * po/es.po: Updated Spanish translation.
3034 * po/fi.po: Updated Finnish translation.
3035
3036 2011-10-03 Diego Novillo <dnovillo@google.com>
3037
3038 * options.cc (parse_uint): Fix dereference of RETVAL.
3039
3040 2011-09-29 Sriraman Tallam <tmsriram@google.com>
3041
3042 * layout.h (section_order_map_): New member.
3043 (get_section_order_map): New member function.
3044 * output.cc (Output_section::add_input_section): Check for patterns
3045 only when --section-ordering-file is specified.
3046 * gold.cc (queue_middle_tasks): Delay updating order of sections till
3047 output_sections have been formed.
3048 * layout.cc (Layout_Layout): Initialize section_order_map_.
3049 * plugin.cc (update_section_order): Store order in order_map. Do not
3050 update the order.
3051 * testsuite/Makefile.am: Add test case for plugin_final_layout.
3052 * testsuite/Makefile.in: Regenerate.
3053 * testsuite/plugin_section_order.c: New file.
3054 * testsuite/plugin_final_layout.cc: New file.
3055 * testsuite/plugin_final_layout.sh: New file.
3056
3057 2011-09-29 Cary Coutant <ccoutant@google.com>
3058
3059 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3060 Check for NULL.
3061 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3062 symbols during incremental update.
3063 (Symbol_table::add_from_dynobj): Likewise.
3064
3065 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3066 Ian Lance Taylor <iant@google.com>
3067
3068 * symtab.cc (Symbol_table::define_special_symbol): Always
3069 canonicalize version string.
3070
3071 2011-09-26 Cary Coutant <ccoutant@google.com>
3072
3073 * gold.cc (queue_initial_tasks): Move option checks ...
3074 * options.cc (General_options::finalize): ... to here. Disable
3075 some options; make others fatal.
3076
3077 2011-09-26 Cary Coutant <ccoutant@google.com>
3078
3079 gcc PR lto/47247
3080 * plugin.cc (get_symbols_v2): New function.
3081 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3082 (is_referenced_from_outside): New function.
3083 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3084 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3085 (get_symbols): Pass version parameter.
3086 (get_symbols_v2): New function.
3087 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3088 parameter.
3089 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3090 (onload): Add LDPT_GET_SYMBOLS_V2.
3091 (all_symbols_read_hook): Use get_symbols_v2; check for
3092 LDPR_PREVAILING_DEF_IRONLY_EXP.
3093 * testsuite/plugin_test_3.sh: Update expected results.
3094
3095 2011-09-23 Simon Baldwin <simonb@google.com>
3096
3097 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3098 configuration options.
3099 * configure: Regenerate.
3100 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3101 * Makefile.in: Regenerate.
3102 * testsuite/Makefile.in: Regenerate.
3103
3104 2011-09-19 Sriraman Tallam <tmsriram@google.com>
3105
3106 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3107
3108 2011-09-19 Cary Coutant <ccoutant@google.com>
3109
3110 * incremental.cc (can_incremental_update): Fix typo in comment.
3111 * incremental.h (can_incremental_update): Likewise.
3112
3113 2011-09-18 Cary Coutant <ccoutant@google.com>
3114
3115 * incremental.cc (can_incremental_update): New function.
3116 * incremental.h (can_incremental_update): New function.
3117 * layout.cc (Layout::init_fixed_output_section): Call it.
3118 (Layout::make_output_section): Don't allow patch space in .eh_frame.
3119 * object.cc (Sized_relobj_file::do_layout): Call
3120 can_incremental_update.
3121
3122 2011-09-13 Cary Coutant <ccoutant@google.com>
3123
3124 * configure.ac: Check for glibc support for gnu_indirect_function
3125 support with static linking, setting automake conditional
3126 IFUNC_STATIC.
3127 * Makefile.in: Regenerate.
3128 * configure: Regenerate.
3129
3130 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3131 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3132 for IFUNC_STATIC.
3133 * testsuite/Makefile.in: Regenerate.
3134
3135 2011-09-13 Cary Coutant <ccoutant@google.com>
3136
3137 * incremental.cc (Sized_relobj_incr::do_layout): Call
3138 report_comdat_group for kept comdat sections.
3139 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3140 * testsuite/Makefile.in: Regenerate.
3141 * testsuite/incr_comdat_test_1.cc: New source file.
3142 * testsuite/incr_comdat_test_2_v1.cc: New source file.
3143 * testsuite/incr_comdat_test_2_v2.cc: New source file.
3144 * testsuite/incr_comdat_test_2_v3.cc: New source file.
3145
3146 2011-09-13 Ian Lance Taylor <iant@google.com>
3147
3148 * object.cc (Sized_relobj_file::do_layout): Remove unused local
3149 variable external_symbols_offset.
3150
3151 2011-09-12 Ian Lance Taylor <iant@google.com>
3152
3153 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3154 triggered if object has no symbols.
3155
3156 2011-09-09 David S. Miller <davem@davemloft.net>
3157
3158 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3159 (Output_fill_debug_line::do_write): Likewise.
3160
3161 2011-08-29 Cary Coutant <ccoutant@google.com>
3162
3163 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3164 casts to match formatting specs.
3165 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3166
3167 2011-08-26 Cary Coutant <ccoutant@google.com>
3168
3169 * layout.cc (Free_list::allocate): Provide guarantee of minimum
3170 remaining hole size when allocating.
3171 (Layout::make_output_section): Set fill methods for debug sections.
3172 * layout.h (Free_list::Free_list_node): Move from private to
3173 public.
3174 (Free_list::set_min_hole_size): New function.
3175 (Free_list::begin, Free_list::end): New functions.
3176 (Free_list::min_hole_): New data member.
3177 * output.cc: Include dwarf.h.
3178 (Output_fill_debug_info::do_minimum_hole_size): New function.
3179 (Output_fill_debug_info::do_write): New function.
3180 (Output_fill_debug_line::do_minimum_hole_size): New function.
3181 (Output_fill_debug_line::do_write): New function.
3182 (Output_section::Output_section): Initialize new data member.
3183 (Output_section::set_final_data_size): Ensure patch space is larger
3184 than minimum hole size.
3185 (Output_section::do_write): Fill holes in debug sections.
3186 * output.h (Output_fill): New class.
3187 (Output_fill_debug_info): New class.
3188 (Output_fill_debug_line): New class.
3189 (Output_section::set_free_space_fill): New function.
3190 (Output_section::free_space_fill_): New data member.
3191 * testsuite/Makefile.am (incremental_test_3): Add
3192 --incremental-patch option.
3193 (incremental_test_4): Likewise.
3194 (incremental_test_5): Likewise.
3195 (incremental_test_6): Likewise.
3196 (incremental_copy_test): Likewise.
3197 (incremental_common_test_1): Likewise.
3198 * testsuite/Makefile.in: Regenerate.
3199
3200 2011-08-26 Nick Clifton <nickc@redhat.com>
3201
3202 * po/es.po: Updated Spanish translation.
3203
3204 2011-08-01 Cary Coutant <ccoutant@google.com>
3205
3206 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3207 * gold/testsuite/Makefile.in: Regenerate.
3208 * gold/testsuite/justsyms_exec.c: New source file.
3209 * gold/testsuite/justsyms_lib.c: New source file.
3210
3211 2011-08-01 Cary Coutant <ccoutant@google.com>
3212
3213 * layout.cc (Layout::set_segment_offsets): Don't realign text
3214 segment if -Ttext was specified.
3215 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3216 file type.
3217 * object.h (Sized_relobj_file::e_type): New function.
3218 (Sized_relobj_file::e_type_): New data member.
3219 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3220 base address for ET_EXEC files.
3221 * target.cc (Target::do_make_elf_object_implementation): Allow
3222 ET_EXEC files with --just-symbols option.
3223
3224 2011-07-28 Cary Coutant <ccoutant@google.com>
3225
3226 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3227 Add thread_number parameter.
3228 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3229 * workqueue-threads.cc
3230 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3231 current thread if its thread number is greater than desired thread
3232 count.
3233 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3234 Add thread_number parameter.
3235 (Workqueue::should_cancel_thread): Likewise.
3236 (Workqueue::find_runnable_or_wait): Pass thread_number to
3237 should_cancel_thread.
3238 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3239 parameter.
3240
3241 2011-07-22 Sriraman Tallam <tmsriram@google.com>
3242
3243 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3244 only after checking if it cannot be forced local.
3245 * symtab.h (is_externally_visible): Check if the symbol is not forced
3246 local.
3247
3248 2011-07-15 Ian Lance Taylor <iant@google.com>
3249
3250 * options.h (class General_options): Add --print-output-format.
3251 Move -EL next to -EB, for better --help output.
3252 * target-select.cc: Include <cstdio>, "options.h", and
3253 "parameters.h".
3254 (Target_selector::do_target_bfd_name): New function.
3255 (print_output_format): New function.
3256 * target-select.h (class Target_selector): Update declarations.
3257 (Target_selector::target_bfd_name): New function.
3258 (print_output_format): Declare.
3259 * main.cc: Include "target-select.h".
3260 (main): Handle --print-output-format.
3261 * gold.cc: Include "target-select.h".
3262 (queue_initial_tasks): Handle --print-output-format when there are
3263 no input files.
3264 * parameters.cc (parameters_force_valid_target): Give a better
3265 error message if -EB/-EL does not match target.
3266 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3267 function.
3268
3269 2011-07-15 Ian Lance Taylor <iant@google.com>
3270
3271 * i386.cc (class Output_data_plt_i386): Add layout_ field.
3272 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3273 (Output_data_plt_i386::do_write): Write address of .dynamic
3274 section to first entry in .got.plt section.
3275 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3276 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3277 Initialize layout_.
3278 (Output_data_plt_x86_64::do_write): Write address of .dynamic
3279 section to first entry in .got.plt section.
3280 * layout.h (Layout::dynamic_section): New function.
3281
3282 2011-07-13 Sriraman Tallam <tmsriram@google.com>
3283
3284 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3285 to claim_file call.
3286 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3287 input_section_position_, and input_section_glob_.
3288 (read_layout_from_file): Call function section_ordering_specified.
3289 * layout.h (is_section_ordering_specified): New function.
3290 (section_ordering_specified): New function.
3291 (section_ordering_specified_): New boolean member.
3292 * main.cc(main): Call load_plugins after layout object is defined.
3293 * output.cc (Output_section::add_input_section): Use
3294 function section_ordering_specified to check if section ordering is
3295 needed.
3296 * output.cc (Output_section::add_relaxed_input_section): Use
3297 function section_ordering_specified to check if section ordering is
3298 needed.
3299 (Output_section::update_section_layout): New function.
3300 (Output_section::sort_attached_input_sections): Check if input section
3301 must be reordered.
3302 * output.h (Output_section::update_section_layout): New function.
3303 * plugin.cc (get_section_count): New function.
3304 (get_section_type): New function.
3305 (get_section_name): New function.
3306 (get_section_contents): New function.
3307 (update_section_order): New function.
3308 (allow_section_ordering): New function.
3309 (Plugin::load): Add the new interfaces to the transfer vector.
3310 (Plugin_manager::load_plugins): New parameter.
3311 (Plugin_manager::all_symbols_read): New parameter.
3312 (Plugin_manager::claim_file): New parameter. Save the elf object for
3313 unclaimed objects.
3314 (Plugin_manager::get_elf_object): New function.
3315 (Plugin_manager::get_view): Change to directly use the bool to check
3316 if get_view is called from claim_file_hook.
3317 * plugin.h (input_objects): New function
3318 (Plugin__manager::load_plugins): New parameter.
3319 (Plugin_manager::claim_file): New parameter.
3320 (Plugin_manager::get_elf_object): New function.
3321 (Plugin_manager::in_claim_file_handler): New function.
3322 (Plugin_manager::in_claim_file_handler_): New member.
3323 (layout): New function.
3324 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3325 handler with an extra parameter. Make the elf object before calling
3326 claim_file handler.
3327 * testsuite/plugin_test.c (get_section_count): New function pointer.
3328 (get_section_type): New function pointer.
3329 (get_section_name): New function pointer.
3330 (get_section_contents): New function pointer.
3331 (update_section_order): New function pointer.
3332 (allow_section_ordering): New function pointer.
3333 (onload): Check if the new interfaces exist.
3334
3335 2011-07-13 Ian Lance Taylor <iant@google.com>
3336
3337 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3338 relro section.
3339 * x86_64.cc (Target_x86_64::got_section): Likewise.
3340 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3341 (relro_now_test_SOURCES): New variable.
3342 (relro_now_test_DEPENDENCIES): New variable.
3343 (relro_now_test_LDFLAGS): New variable.
3344 (relro_now_test_LDADD): New variable.
3345 (relro_now_test.so): New target.
3346 * testsuite/Makefile.in: Rebuild.
3347
3348 2011-07-12 Ian Lance Taylor <iant@google.com>
3349
3350 PR gold/12980
3351 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3352 GLOB_DAT relocation rather than a RELATIVE relocation for a
3353 protected symbol when creating a shared library.
3354 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3355 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3356 * testsuite/protected_main_1.cc (main): Test that protected
3357 function has same address.
3358
3359 2011-07-11 Ian Lance Taylor <iant@google.com>
3360
3361 PR gold/12979
3362 * options.h (class General_options): Add -Bgroup.
3363 * options.cc (General_options::finalize): If -Bgroup is set,
3364 default to --unresolved-symbols=report-all.
3365 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3366 * target-reloc.h (issue_undefined_symbol_error): Handle
3367 --unresolved-symbols=report-all.
3368
3369 2011-07-08 Ian Lance Taylor <iant@google.com>
3370
3371 PR gold/11985
3372 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3373 if linker script discards key sections.
3374 (Layout::create_dynamic_symtab): Likewise.
3375 (Layout::assign_local_dynsym_offsets): Likewise.
3376 (Layout::sized_create_version_sections): Likewise.
3377 (Layout::create_interp): Likewise.
3378 (Layout::finish_dynamic_section): Likewise.
3379 (Layout::set_dynamic_symbol_size): Likewise.
3380
3381 2011-07-08 Ian Lance Taylor <iant@google.com>
3382
3383 PR gold/12386
3384 * options.h (class General_options): Add --unresolved-symbols.
3385 * target-reloc.h (issue_undefined_symbol_error): Check
3386 --unresolved-symbols. Add comments.
3387
3388 2011-07-08 Ian Lance Taylor <iant@google.com>
3389
3390 * testsuite/odr_violation2.cc (Ordering::operator()): Make
3391 expression more complex.
3392
3393 2011-07-08 Ian Lance Taylor <iant@google.com>
3394
3395 PR gold/11317
3396 * target-reloc.h (issue_undefined_symbol_error): New inline
3397 function, broken out of relocate_section.
3398 (relocate_section): Call issue_undefined_symbol_error.
3399 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3400 there is no TLS segment if we are about to issue an undefined
3401 symbol error.
3402 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3403
3404 2011-07-08 Ian Lance Taylor <iant@google.com>
3405
3406 PR gold/12279
3407 * resolve.cc (Symbol_table::should_override): Add fromtype
3408 parameter. Change all callers. Give error when linking together
3409 TLS and non-TLS symbol.
3410 (Symbol_table::should_override_with_special): Add fromtype
3411 parameter. Change all callers.
3412 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3413 there is no TLS segment if we have reported some errors.
3414 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3415
3416 2011-07-08 Ian Lance Taylor <iant@google.com>
3417
3418 PR gold/12372
3419 * target.h (Target::plt_address_for_global): New function.
3420 (Target::plt_address_for_local): New function.
3421 (Target::plt_section_for_global): Remove.
3422 (Target::plt_section_for_local): Remove.
3423 (Target::do_plt_address_for_global): New virtual function.
3424 (Target::do_plt_address_for_local): New virtual function.
3425 (Target::do_plt_section_for_global): Remove.
3426 (Target::do_plt_section_for_local): Remove.
3427 (Target::register_global_plt_entry): Add Symbol_table and Layout
3428 parameters.
3429 * output.cc (Output_data_got::Got_entry::write): Use
3430 plt_address_for_global and plt_address_for_local.
3431 * layout.cc (Layout::add_target_dynamic_tags): Use size and
3432 address of output section.
3433 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3434 got_irelative_, and irelative_count_ fields. Update
3435 declarations.
3436 (Output_data_plt_i386::has_irelative_section): New function.
3437 (Output_data_plt_i386::entry_count): Add irelative_count_.
3438 (Output_data_plt_i386::set_final_data_size): Likewise.
3439 (class Target_i386): Add got_irelative_ and rel_irelative_
3440 fields. Update declarations.
3441 (Target_i386::Target_i386): Initialize new fields.
3442 (Target_i386::do_plt_address_for_global): New function replacing
3443 do_plt_section_for_global.
3444 (Target_i386::do_plt_address_for_local): New function replacing
3445 do_plt_section_for_local.
3446 (Target_i386::got_section): Create got_irelative_.
3447 (Target_i386::rel_irelative_section): New function.
3448 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3449 fields. Don't define __rel_iplt_{start,end}.
3450 (Output_data_plt_i386::add_entry): Add symtab and layout
3451 parameters. Change all callers. Use different PLT and GOT for
3452 IFUNC symbols.
3453 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3454 layout parameters. Change all callers. Use different PLT and
3455 GOT.
3456 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3457 (Output_data_plt_i386::rel_irelative): New function.
3458 (Output_data_plt_i386::address_for_global): New function.
3459 (Output_data_plt_i386::address_for_local): New function.
3460 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
3461 IRELATIVE GOT when changing IFUNC GOT entries.
3462 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3463 reloc.
3464 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3465 if we didn't create an IRELATIVE GOT.
3466 (Target_i386::Relocate::relocate): Use plt_address_for_global and
3467 plt_address_for_local.
3468 (Target_i386::do_dynsym_value): Use plt_address_for_global.
3469 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3470 got_irelative_, and irelative_count_ fields. Update
3471 declarations.
3472 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3473 Initialize new fields. Remove symtab parameter. Change all
3474 callers.
3475 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3476 irelative_count_.
3477 (Output_data_plt_x86_64::has_irelative_section): New function.
3478 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3479 (class Target_x86_64): Add got_irelative_ and rel_irelative_
3480 fields. Update declarations.
3481 (Target_x86_64::Target_x86_64): Initialize new fields.
3482 (Target_x86_64::do_plt_address_for_global): New function replacing
3483 do_plt_section_for_global.
3484 (Target_x86_64::do_plt_address_for_local): New function replacing
3485 do_plt_section_for_local.
3486 (Target_x86_64::got_section): Create got_irelative_.
3487 (Target_x86_64::rela_irelative_section): New function.
3488 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
3489 all callers. Don't create __rel_iplt_{start,end}.
3490 (Output_data_plt_x86_64::add_entry): Add symtab and layout
3491 parameters. Change all callers. Use different PLT and GOT for
3492 IFUNC symbols.
3493 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3494 layout parameters. Change all callers. Use different PLT and
3495 GOT.
3496 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3497 parameters. Change all callers. Use different PLT and GOT for
3498 IFUNC symbols.
3499 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3500 (Output_data_plt_x86_64::rela_irelative): New function.
3501 (Output_data_plt_x86_64::address_for_global): New function.
3502 (Output_data_plt_x86_64::address_for_local): New function.
3503 (Output_data_plt_x86_64::set_final_data_size): Likewise.
3504 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3505 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3506 (Target_x86_64::register_global_plt_entry): Add symtab and layout
3507 parameters.
3508 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3509 reloc.
3510 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3511 symbols if we didn't create an IRELATIVE GOT.
3512 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3513 plt_address_for_local.
3514 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3515 * testsuite/ifuncvar1.c: New test file.
3516 * testsuite/ifuncvar2.c: New test file.
3517 * testsuite/ifuncvar3.c: New test file.
3518 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3519 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3520 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3521 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3522 * testsuite/Makefile.in: Rebuild.
3523
3524 2011-07-07 Cary Coutant <ccoutant@google.com>
3525
3526 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3527 (two_file_test_1_ndebug.o): Likewise.
3528 (two_file_test_1b_ndebug.o): Likewise.
3529 (two_file_test_2_ndebug.o): Likewise.
3530 (two_file_test_main_ndebug.o): Likewise.
3531 (incremental_test_2): Link with no-debug versions.
3532
3533 2011-07-06 Cary Coutant <ccoutant@google.com>
3534
3535 * gold/incremental.cc
3536 (Output_section_incremental_inputs::write_info_blocks): Check for
3537 hidden and internal symbols.
3538
3539 2011-07-06 Cary Coutant <ccoutant@google.com>
3540
3541 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3542 Check disposition for startup file.
3543 (Incremental_inputs::report_command_line): Ignore
3544 --incremental-startup-unchanged option.
3545 * options.cc (General_options::parse_incremental_startup_unchanged):
3546 New function.
3547 (General_options::General_options): Initialize new data member.
3548 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3549 (General_options): Add --incremental-startup-unchanged option.
3550 (General_options::incremental_startup_disposition): New function.
3551 (General_options::incremental_startup_disposition_): New data member.
3552
3553 2011-07-06 Cary Coutant <ccoutant@google.com>
3554
3555 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3556 input file index to Script_info ctor.
3557 (Sized_incremental_binary::do_file_has_changed): Find the
3558 command-line argument for files named in scripts.
3559 * incremental.h (Script_info::Script_info): New ctor
3560 with input file index.
3561 (Script_info::input_file_index): New function.
3562 (Script_info::input_file_index_): New data member.
3563 (Incremental_binary::get_library): Add const.
3564 (Incremental_binary::get_script_info): Add const.
3565 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3566 * testsuite/Makefile.am (incremental_test_5): New test case.
3567 (incremental_test_6): New test case.
3568 * testsuite/Makefile.in: Regenerate.
3569
3570 2011-07-06 Cary Coutant <ccoutant@google.com>
3571
3572 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3573 debug output when command lines differ.
3574
3575 2011-07-06 Cary Coutant <ccoutant@google.com>
3576
3577 * incremental.cc (Incremental_inputs::report_command_line): Ignore
3578 --incremental-patch option.
3579 * layout.cc (Free_list::allocate): Extend allocation beyond original
3580 end if enabled.
3581 (Layout::make_output_section): Mark sections that should get
3582 patch space.
3583 * options.cc (parse_percent): New function.
3584 * options.h (parse_percent): New function.
3585 (DEFINE_percent): New macro.
3586 (General_options): Add --incremental-patch option.
3587 * output.cc (Output_section::Output_section): Initialize new data
3588 members.
3589 (Output_section::add_input_section): Print section name when out
3590 of patch space.
3591 (Output_section::add_output_section_data): Likewise.
3592 (Output_section::set_final_data_size): Add patch space when
3593 doing --incremental-full.
3594 (Output_section::do_reset_address_and_file_offset): Remove patch
3595 space.
3596 (Output_segment::set_section_list_addresses): Print debug output
3597 only if --incremental-update.
3598 * output.h (Output_section::set_is_patch_space_allowed): New function.
3599 (Output_section::is_patch_space_allowed_): New data member.
3600 (Output_section::patch_space_): New data member.
3601 * parameters.cc (Parameters::incremental_full): New function.
3602 * parameters.h (Parameters::incremental_full): New function
3603 * testsuite/Makefile.am (incremental_test_2): Add test for
3604 --incremental-patch option.
3605 * testsuite/Makefile.in: Regenerate.
3606 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3607 (t18): Remove function body.
3608
3609 2011-07-05 Doug Kwan <dougkwan@google.com>
3610
3611 PR gold/12771
3612 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3613 Arm_Address type for relocation result.
3614 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
3615 overflow check.
3616 (Arm_relocate_functions::abs32): Use unaligned access.
3617 (Arm_relocate_functions::rel32): Ditto.
3618 (Arm_relocate_functions::prel31): Ditto.
3619 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3620 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3621 static data relocations.
3622 * testsuite/Makefile.in: Regnerate.
3623 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3624
3625 2011-07-05 Ian Lance Taylor <iant@google.com>
3626
3627 PR gold/12392
3628 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3629 symbols if necessary.
3630 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3631
3632 2011-07-05 Ian Lance Taylor <iant@google.com>
3633
3634 PR gold/12952
3635 * resolve.cc (Symbol::override_base_with_special): Simply override
3636 version with special symbol version, ignoring previous version.
3637
3638 2011-07-05 Ian Lance Taylor <iant@google.com>
3639
3640 * object.cc (Sized_relobj_file::include_section_group): Add
3641 information to comment about signature location.
3642
3643 2011-07-02 Ian Lance Taylor <iant@google.com>
3644
3645 PR gold/12957
3646 * options.h (class General_options): Add -f and -F.
3647 * options.cc (General_options::finalize): Fatal error if -f/-F
3648 are used without -shared.
3649 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3650
3651 2011-07-02 Ian Lance Taylor <iant@google.com>
3652
3653 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3654
3655 2011-07-01 Ian Lance Taylor <iant@google.com>
3656
3657 PR gold/12525
3658 PR gold/12952
3659 * resolve.cc (Symbol::override_base_with_special): Don't override
3660 the version if the overriding symbol has a different name.
3661 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
3662 all callers. If we give an error about an undefined version,
3663 define the base version if necessary.
3664 * dynobj.h (class Versions): Update declaration.
3665 * testsuite/weak_alias_test_5.cc: New file.
3666 * testsuite/weak_alias_test.script: New file.
3667 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3668 and versioned_alias have the right value, and call t2.
3669 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3670 weak_alias_test_5.so.
3671 (weak_alias_test_LDADD): Likewise.
3672 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3673 * testsuite/Makefile.in: Rebuild.
3674
3675 2011-07-01 Ian Lance Taylor <iant@google.com>
3676
3677 PR gold/12525
3678 * options.h (class General_options): Support -z notext.
3679 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3680 -Wl,-z,notext.
3681 (two_file_shared_nonpic.so): Likewise.
3682 (two_file_shared_mixed.so): Likewise.
3683 (two_file_shared_mixed_1.so): Likewise.
3684 (weak_undef_lib_nonpic.so): Likewise.
3685 (alt/weak_undef_lib_nonpic.so): Likewise.
3686 (tls_test_shared_nonpic.so): Likewise.
3687 * testsuite/Makefile.in: Rebuild.
3688
3689 2011-07-01 Ian Lance Taylor <iant@google.com>
3690
3691 PR gold/12525
3692 * configure.ac: Test whether static linking works, setting
3693 the automake conditional HAVE_STATIC.
3694 * testsuite/Makefile.am: Disable tests using -static if
3695 HAVE_STATIC is not true.
3696 * configure, testsuite/Makefile.in: Rebuild.
3697
3698 2011-07-01 Ian Lance Taylor <iant@google.com>
3699
3700 PR gold/12525
3701 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3702 Assert if we see DW_EH_PE_indirect.
3703 * target.h (Target::ehframe_datarel_base): New function.
3704 (Target::do_ehframe_datarel_base): New target function.
3705 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3706 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3707 function.
3708
3709 2011-07-01 Ian Lance Taylor <iant@google.com>
3710
3711 PR gold/12571
3712 * options.h (class General_options): Add
3713 --ld-generated-unwind-info.
3714 * ehframe.cc (Fde::write): Add address parameter. Change all
3715 callers. If associated with PLT, fill in address and size.
3716 (Cie::set_output_offset): Only add merge mapping if there is an
3717 object.
3718 (Cie::write): Add address parameter. Change all callers.
3719 (Eh_frame::add_ehframe_for_plt): New function.
3720 * ehframe.h (class Fde): Update declarations. Move shndx_ and
3721 input_offset_ fields into union u_, with new plt field.
3722 (Fde::Fde): Adjust for new union field.
3723 (Fde::Fde) [Output_data version]: New constructor.
3724 (Fde::add_mapping): Only add merge mapping if there is an object.
3725 (class Cie): Update declarations.
3726 (class Eh_frame): Declare add_ehframe_for_plt.
3727 * layout.cc (Layout::layout_eh_frame): Break out code into
3728 make_eh_frame_section, and call it.
3729 (Layout::make_eh_frame_section): New function.
3730 (Layout::add_eh_frame_for_plt): New function.
3731 * layout.h (class Layout): Update declarations.
3732 * merge.cc (Merge_map::add_mapping): Add assertion.
3733 * i386.cc: Include "dwarf.h".
3734 (class Output_data_plt_i386): Make first_plt_entry,
3735 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
3736 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3737 and plt_eh_frame_fde.
3738 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3739 boundary. Call add_eh_frame_for_plt if appropriate.
3740 * x86_64.cc: Include "dwarf.h".
3741 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
3742 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
3743 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3744 and plt_eh_frame_fde.
3745 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3746 appropriate.
3747
3748 2011-06-29 Ian Lance Taylor <iant@google.com>
3749
3750 PR gold/12629
3751 * object.cc (Sized_relobj_file::layout_section): Change shdr
3752 parameter to be const.
3753 (Sized_relobj_file::layout_eh_frame_section): New function, broken
3754 out of do_layout.
3755 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3756 appropriate. Call layout_eh_frame_section.
3757 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3758 sections.
3759 * object.h (class Sized_relobj_file): Update declarations.
3760
3761 2011-06-29 Ian Lance Taylor <iant@google.com>
3762
3763 PR gold/12652
3764 * script.cc (Token::integer_value): Accept trailing M/m/K/k
3765 modifier.
3766 (Lex::gather_token): Accept trailing M/m/K/k for integers.
3767
3768 2011-06-29 Ian Lance Taylor <iant@google.com>
3769
3770 PR gold/12675
3771 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3772 SHT_X86_64_UNWIND.
3773 * layout.cc (Layout::layout_eh_frame): Likewise.
3774
3775 2011-06-29 Ian Lance Taylor <iant@google.com>
3776
3777 PR gold/12695
3778 * layout.cc (Layout::symtab_section_shndx): New function.
3779 * layout.h (class Layout): Declare symtab_section_shndx.
3780 * output.cc (Output_section::write_header): Call it.
3781
3782 2011-06-29 Ian Lance Taylor <iant@google.com>
3783
3784 PR gold/12818
3785 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3786 symbols which are not used in a relocation.
3787
3788 2011-06-28 Ian Lance Taylor <iant@google.com>
3789
3790 PR gold/12898
3791 * layout.cc (Layout::segment_precedes): Don't crash if a linker
3792 script create indistinguishable segments.
3793 (Layout::set_segment_offsets): Use stable_sort when sorting
3794 segments. Pass this to Compare_segments constructor.
3795 * layout.h (class Layout): Make segment_precedes non-static.
3796 (class Compare_segments): Change from struct to class. Add
3797 layout_ field. Add constructor.
3798 * script-sections.cc
3799 (Script_sections::attach_sections_using_phdrs_clause): Rename
3800 local orphan to is_orphan. Don't report failure to put empty
3801 section in segment. On attachment failure, report name of
3802 section, and attach to first PT_LOAD segment.
3803
3804 2011-06-28 Ian Lance Taylor <iant@google.com>
3805
3806 PR gold/12934
3807 * target-select.cc (Target_selector::Target_selector): Add
3808 emulation parameter. Change all callers.
3809 (select_target_by_bfd_name): Rename from select_target_by_name.
3810 Change all callers.
3811 (select_target_by_emulation): New function.
3812 (supported_emulation_names): New function.
3813 * target-select.h (class Target_selector): Add emulation_ field.
3814 Update declarations.
3815 (Target_selector::recognize_by_bfd_name): Rename from
3816 recognize_by_name. Change all callers.
3817 (Target_selector::supported_bfd_names): Rename from
3818 supported_names. Change all callers.
3819 (Target_selector::recognize_by_emulation): New function.
3820 (Target_selector::supported_emulations): New function.
3821 (Target_selector::emulation): New function.
3822 (Target_selector::do_recognize_by_bfd_name): Rename from
3823 do_recognize_by_name. Change all callers.
3824 (Target_selector::do_supported_bfd_names): Rename from
3825 do_supported_names. Change all callers.
3826 (Target_selector::do_recognize_by_emulation): New function.
3827 (Target_selector::do_supported_emulations): New function.
3828 (select_target_by_bfd_name): Change name in declaration.
3829 (select_target_by_emulation): Declare.
3830 (supported_emulation_names): Declare.
3831 * parameters.cc (parameters_force_valid_target): Try to find
3832 target based on emulation from -m option.
3833 * options.h (class General_options): Change doc string for -m.
3834 * options.cc (help): Print emulations.
3835 (General_options::parse_V): Likewise.
3836 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3837 Add emulation parameter. Change all callers.
3838
3839 2011-06-28 Ian Lance Taylor <iant@google.com>
3840
3841 * target.h (class Target): Add osabi_ field.
3842 (Target::osabi): New function.
3843 (Target::set_osabi): New function.
3844 (Target::Target): Initialize osabi_.
3845 (Target::do_adjust_elf_header): Make pure virtual.
3846 (Sized_target::do_adjust_elf_header): Declare.
3847 * target.cc (Sized_target::do_adjust_elf_header): New function.
3848 (class Sized_target): Instantiate all versions.
3849 * freebsd.h (class Target_freebsd): Remove.
3850 (Target_selector_freebsd::do_recognize): Call set_osabi on
3851 Target.
3852 (Target_selector_freebsd::do_recognize_by_name): Likewise.
3853 (Target_selector_freebsd::set_osabi): Remove.
3854 * i386.cc (class Target_i386): Inherit from Sized_target rather
3855 than Target_freebsd.
3856 * x86_64.cc (class Target_x86_64): Likewise.
3857
3858 2011-06-28 Ian Lance Taylor <iant@google.com>
3859
3860 * target.h (Target::can_check_for_function_pointers): Rewrite.
3861 Make non-virtual.
3862 (Target::can_icf_inline_merge_sections): Likewise.
3863 (Target::section_may_have_icf_unsafe_poineters): Likewise.
3864 (Target::Target_info): Add can_icf_inline_merge_sections field.
3865 (Target::do_can_check_for_function_pointers): New virtual
3866 function.
3867 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3868 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3869 from can_check_for_function_pointers, move in file.
3870 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3871 section_may_have_icf_unsafe_poineters, move in file.
3872 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3873 * i386.cc (Target_i386::do_can_check_for_function_pointers):
3874 Rename from can_check_for_function_pointers, move in file.
3875 (Target_i386::can_icf_inline_merge_sections): Remove.
3876 (Target_i386::i386_info): Initialize
3877 can_icf_inline_merge_sections.
3878 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3879 Initialize can_icf_inline_merge_sections.
3880 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3881 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3882 Rename from can_check_for_function_pointers, move in file.
3883 (Target_x86_64::can_icf_inline_merge_sections): Remove.
3884 (Target_x86_64::x86_64_info): Initialize
3885 can_icf_inline_merge_sections.
3886 * testsuite/testfile.cc (Target_test::test_target_info):
3887 Likewise.
3888 * icf.cc (get_section_contents): Correct formatting.
3889
3890 2011-06-27 Ian Lance Taylor <iant@google.com>
3891
3892 * symtab.cc (Symbol::versioned_name): New function.
3893 (Symbol_table::add_to_final_symtab): Use versioned_name when
3894 appropriate.
3895 (Symbol_table::sized_write_symbol): Likewise.
3896 * symtab.h (class Symbol): Declare versioned_name.
3897 * stringpool.h (class Stringpool_template): Add variant of add
3898 which takes a std::basic_string.
3899 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3900 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3901 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3902 (ver_test_12.o): New target.
3903 * testsuite/Makefile.in: Rebuild.
3904
3905 2011-06-27 Doug Kwan <dougkwan@google.com>
3906
3907 * arm.cc (Arm_relocate_functions::thm_jump8,
3908 Arm_relocate_functions::thm_jump11): Use a wider signed
3909 type to compute offset.
3910 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3911 arm_thm_jump8.
3912 * testsuite/Makefile.in: Regenerate.
3913 * testsuite/arm_branch_in_range.sh: Check test results of
3914 arm_thm_jump11 and arm_thm_jump8.
3915 * testsuite/arm_thm_jump11.s: New test source file.
3916 * testsuite/arm_thm_jump11.t: New linker script.
3917 * testsuite/arm_thm_jump8.s: New test source file.
3918 * testsuite/arm_thm_jump8.t: New linker script.
3919
3920 2011-06-24 Ian Lance Taylor <iant@google.com>
3921
3922 * layout.cc: Include "object.h".
3923 (ctors_sections_in_init_array): New static variable.
3924 (Layout::is_ctors_in_init_array): New function.
3925 (Layout::layout): Add entry to ctors_sections_in_init_array if
3926 appropriate.
3927 * layout.h (class Layout): Declare is_ctors_in_init_array.
3928 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3929 is_ctors_reverse_view is set.
3930 (Sized_relobj_file::write_sections): Add layout parameter. Change
3931 all callers. Set is_ctors_reverse_view field of View_size.
3932 (Sized_relobj_file::reverse_words): New function.
3933 * object.h (Sized_relobj_file::View_size): Add
3934 is_ctors_reverse_view field.
3935 (class Sized_relobj_file): Update declarations.
3936 * testsuite/initpri3.c: New test.
3937 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3938 initpri3b.
3939 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3940 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3941 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3942 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3943 * testsuite/Makefile.in: Rebuild.
3944
3945 2011-06-24 Cary Coutant <ccoutant@google.com>
3946
3947 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3948 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3949 (debug_msg_cdebug.err): New targets.
3950 * testsuite/Makefile.in: Regenerate.
3951 * testsuite/debug_msg.sh: Check output of link with compressed debug.
3952 Fix checks for link with shared library.
3953
3954 2011-06-24 Doug Kwan <dougkwan@google.com>
3955
3956 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3957 skip empty text sections.
3958 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3959
3960 2011-06-22 Ian Lance Taylor <iant@google.com>
3961
3962 PR gold/12910
3963 * options.h (class General_options): Add --ctors-in-init-array.
3964 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3965 friends as SHT_PROGBITS for merging sections.
3966 (Layout::layout): Remove special handling of .init_array and
3967 friends. Don't sort if doing relocatable link. Sort for .ctors
3968 and .dtors if ctors_in_init_array.
3969 (Layout::make_output_section): Force correct section types for
3970 .init_array and friends. Don't sort if doing relocatable link,
3971 Don't sort .ctors and .dtors if ctors_in_init_array.
3972 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3973 (Layout::output_section_name): Add relobj parameter. Change all
3974 callers. Handle .ctors. and .dtors. in code rather than table.
3975 Handle .ctors and .dtors if ctors_in_init_array.
3976 (Layout::match_file_name): New function, moved from output.cc.
3977 * layout.h (class Layout): Update declarations.
3978 * output.cc: Include "layout.h".
3979 (Input_section_sort_entry::get_priority): New function.
3980 (Input_section_sort_entry::match_file_name): Just call
3981 Layout::match_file_name.
3982 (Output_section::Input_section_sort_init_fini_compare::operator()):
3983 Handle .ctors and .dtors. Sort by explicit priority rather than
3984 by name.
3985 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3986 * testsuite/initpri2.c: New test.
3987 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3988 (check_PROGRAMS): Add initpri2.
3989 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3990 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3991 * configure, testsuite/Makefile.in: Rebuild.
3992
3993 2011-06-19 Ian Lance Taylor <iant@google.com>
3994
3995 PR gold/12880
3996 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3997 .interp section to a PT_INTERP segment even if we have seen a
3998 --dynamic-linker option. Don't do it if we have seen a PHDRS
3999 clause in a linker script.
4000 (Layout::finalize): Don't create a .interp section if we've
4001 already create a PT_INTERP segment.
4002 (Layout::create_interp): Always call choose_output_section (revert
4003 patch of 2011-06-17). Don't create PT_INTERP segment.
4004 * script-sections.cc
4005 (Script_sections::create_note_and_tls_segments): Add a .interp
4006 section to a PT_INTERP segment even if we have seen a
4007 --dynamic-linker option.
4008
4009 2011-06-18 Ian Lance Taylor <iant@google.com>
4010
4011 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4012 merely because a non-PT_LOAD segment has a dynamic reloc.
4013
4014 2011-06-18 Ian Lance Taylor <iant@google.com>
4015
4016 * layout.cc (Layout::finish_dynamic_section): Don't create
4017 DT_FLAGS entry if not needed.
4018
4019 2011-06-18 Ian Lance Taylor <iant@google.com>
4020
4021 PR gold/12745
4022 * layout.cc (Layout::layout_eh_frame): Correct handling of
4023 writable .eh_frame section.
4024
4025 2011-06-17 Ian Lance Taylor <iant@google.com>
4026
4027 PR gold/12893
4028 * resolve.cc (Symbol_table::resolve): Don't give an error if a
4029 symbol is redefined with the exact same object and value.
4030
4031 2011-06-17 Ian Lance Taylor <iant@google.com>
4032
4033 PR gold/12880
4034 * layout.h (class Layout): Add interp_segment_ field.
4035 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4036 (Layout::attach_allocated_section_to_segment): If making shared
4037 library, put .interp section in PT_INTERP segment.
4038 (Layout::finalize): Also call create_interp if -dynamic-linker
4039 option was used.
4040 (Layout::create_interp): Assert that there is no PT_INTERP
4041 segment. If not using a SECTIONS clause, use make_output_section.
4042 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4043 * script-sections.cc
4044 (Script_sections::create_note_and_tls_segments): If making shared
4045 library, put .interp section in PT_INTERP segment.
4046
4047 2011-06-17 Ian Lance Taylor <iant@google.com>
4048
4049 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4050 when making a shared library.
4051
4052 2011-06-17 Ian Lance Taylor <iant@google.com>
4053
4054 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4055 parameter. Change all callers. Don't issue warning about PC32
4056 against locally defined symbol.
4057
4058 2011-06-16 Ian Lance Taylor <iant@google.com>
4059
4060 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4061 occurs in same object.
4062
4063 2011-06-14 Alan Modra <amodra@gmail.com>
4064
4065 * po/POTFILES.in: Regenerate.
4066
4067 2011-06-09 Ian Lance Taylor <iant@google.com>
4068
4069 * script-sections.cc
4070 (Orphan_output_section::set_section_addresses): For a relocatable
4071 link set address to 0.
4072
4073 2011-06-09 Cary Coutant <ccoutant@google.com>
4074
4075 PR gold/12804
4076 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4077 used with --compress-debug-sections.
4078 * gold/object.cc (Sized_relobj_file::do_layout): Report
4079 uncompressed size of compressed input sections.
4080
4081 2011-06-08 Cary Coutant <ccoutant@google.com>
4082
4083 PR gold/12804
4084 * testsuite/two_file_test_2_v1.cc: Change initialization of
4085 v2 to keep it in .data.
4086
4087 2011-06-07 Cary Coutant <ccoutant@google.com>
4088
4089 * common.cc (Symbol_table::do_allocate_commons_list): Call
4090 gold_fallback.
4091 * errors.cc (Errors::fatal): Adjust call to gold_exit.
4092 (Errors::fallback): New function.
4093 (gold_fallback): New function.
4094 * errors.h (Errors::fallback): New function.
4095 * gold.cc (gold_exit): Change status parameter to enum; adjust
4096 all callers.
4097 (queue_initial_tasks): Call gold_fallback.
4098 * gold.h: Include cstdlib.
4099 (Exit_status): New enum type.
4100 (gold_exit): Change status parameter to enum.
4101 (gold_fallback): New function.
4102 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4103 (Layout::create_symtab_sections): Likewise.
4104 (Layout::create_shdrs): Likewise.
4105 * main.cc (main): Adjust call to gold_exit.
4106 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4107 (Output_data_got::add_got_entry_pair): Likewise.
4108 (Output_section::add_input_section): Likewise.
4109 (Output_section::add_output_section_data): Likewise.
4110 (Output_segment::set_section_list_addresses): Likewise.
4111 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4112
4113 2011-06-07 Cary Coutant <ccoutant@google.com>
4114
4115 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4116 for incremental links.
4117 * output.cc (Output_segment::set_section_list_addresses): Remove
4118 FIXME and test for TLS or BSS.
4119
4120 2011-06-07 Cary Coutant <ccoutant@google.com>
4121
4122 * testsuite/Makefile.am: Add incremental_copy_test,
4123 incremental_common_test_1.
4124 * testsuite/Makefile.in: Regenerate.
4125 * testsuite/common_test_1_v1.c: New source file.
4126 * testsuite/common_test_1_v2.c: New source file.
4127 * testsuite/copy_test_v1.cc: New source file.
4128
4129 2011-06-07 Cary Coutant <ccoutant@google.com>
4130
4131 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4132 update, allocate common from bss section's free list.
4133 * incremental-dump.cc (dump_incremental_inputs): Print flag for
4134 linker-defined symbols.
4135 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4136 Skip GOT and PLT entries that are no longer referenced.
4137 (Output_section_incremental_inputs::write_info_blocks): Mark
4138 linker-defined symbols.
4139 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4140 * output.cc (Output_section::allocate): New function.
4141 * output.h (Output_section::allocate): New function.
4142 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4143 linker-defined symbols.
4144 (Symbol::override_base_with_special): Copy is_predefined_ flag.
4145 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4146 (Symbol::init_base_output_data): Likewise.
4147 (Symbol::init_base_output_segment): Likewise.
4148 (Symbol::init_base_constant): Likewise.
4149 (Sized_symbol::init_output_data): Likewise.
4150 (Sized_symbol::init_output_segment): Likewise.
4151 (Sized_symbol::init_constant): Likewise.
4152 (Symbol_table::do_define_in_output_data): Likewise.
4153 (Symbol_table::do_define_in_output_segment): Likewise.
4154 (Symbol_table::do_define_as_constant): Likewise.
4155 * symtab.h (Symbol::is_predefined): New function.
4156 (Symbol::init_base_output_data): Add is_predefined parameter.
4157 (Symbol::init_base_output_segment): Likewise.
4158 (Symbol::init_base_constant): Likewise.
4159 (Symbol::is_predefined_): New data member.
4160 (Sized_symbol::init_output_data): Add is_predefined parameter.
4161 (Sized_symbol::init_output_segment): Likewise.
4162 (Sized_symbol::init_constant): Likewise.
4163 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4164
4165 2011-06-07 Cary Coutant <ccoutant@google.com>
4166
4167 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4168 instead of emit_copy_reloc.
4169 (Copy_relocs::emit_copy_reloc): Refactor.
4170 (Copy_relocs::make_copy_reloc): New function.
4171 (Copy_relocs::add_copy_reloc): Remove.
4172 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4173 section.
4174 (Copy_relocs::make_copy_reloc): New function.
4175 (Copy_relocs::add_copy_reloc): Remove.
4176 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4177 unchanged input files.
4178 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4179 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4180 Reserve BSS space for COPY relocations.
4181 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4182 (Output_section_incremental_inputs::write_info_blocks): Record
4183 whether a symbol is copied from a shared object.
4184 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4185 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4186 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4187 (Incremental_input_entry_reader::get_output_symbol_index): Add
4188 is_copy parameter.
4189 (Incremental_binary::emit_copy_relocs): New function.
4190 (Incremental_binary::do_emit_copy_relocs): New function.
4191 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4192 new data member.
4193 (Sized_incremental_binary::add_copy_reloc): New function.
4194 (Sized_incremental_binary::do_emit_copy_relocs): New function.
4195 (Sized_incremental_binary::Copy_reloc): New struct.
4196 (Sized_incremental_binary::Copy_relocs): New typedef.
4197 (Sized_incremental_binary::copy_relocs_): New data member.
4198 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4199 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4200 * target.h (Sized_target::emit_copy_reloc): New function.
4201 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4202
4203 2011-06-02 Cary Coutant <ccoutant@google.com>
4204
4205 PR gold/12163
4206 * gold/archive.cc (Archive::Archive): Initialize new data member.
4207 (Archive::include_all_members): Return if archive has already been
4208 included.
4209 * gold/archive.h (Archive::include_all_members_): New data member.
4210
4211 2011-06-02 Nick Clifton <nickc@redhat.com>
4212
4213 * dynobj.h: Fix spelling mistake in comment.
4214 * output.cc: Likewise.
4215
4216 2011-05-31 Doug Kwan <dougkwan@google.com>
4217 Asier Llano
4218
4219 PR gold/12826
4220 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4221 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4222 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
4223 redundant arm_exidx_test.so.
4224 * testsuite/Makefile.in: Regenerate.
4225 (check_SCRIPTS): Add pr12826.sh
4226 (check_DATA): Add pr12826.stdout
4227 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4228 * testsuite/pr12826.sh: New file.
4229 * testsuite/pr12826_1.s: Ditto.
4230 * testsuite/pr12826_1.s: Ditto.
4231
4232 2011-05-30 Ian Lance Taylor <iant@google.com>
4233
4234 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4235 sections.
4236
4237 2011-05-29 Ian Lance Taylor <iant@google.com>
4238
4239 PR gold/12804
4240 * testsuite/Makefile.am: Use different file name for two_file_test
4241 temporary file for each incremental test.
4242 * testsuite/Makefile.in: Rebuild.
4243
4244 2011-05-29 Ian Lance Taylor <iant@google.com>
4245
4246 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4247 binary input file is empty.
4248
4249 2011-05-27 Ian Lance Taylor <iant@google.com>
4250
4251 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4252 (ver_test_9.so): Likewise.
4253 * testsuite/Makefile.in: Rebuild.
4254
4255 2011-05-26 Cary Coutant <ccoutant@google.com>
4256
4257 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4258 * incremental.cc (Incremental_inputs::report_input_section): Fix
4259 comment, indentation.
4260 (Incremental_inputs::report_comdat_group): New function.
4261 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4262 of data for incremental input file entry.
4263 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4264 group count, COMDAT group signatures.
4265 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4266 an unchanged input file.
4267 * incremental.h (Incremental_object_entry::Incremental_object_entry):
4268 Initialize new data member.
4269 (Incremental_object_entry::add_comdat_group): New function.
4270 (Incremental_object_entry::get_comdat_group_count): New function.
4271 (Incremental_object_entry::get_comdat_signature_key): New function.
4272 (Incremental_object_entry::groups_): New data member.
4273 (Incremental_inputs::report_comdat_group): New function.
4274 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4275 data for incremental input file entry.
4276 (Incremental_input_entry_reader::get_comdat_group_count): New function.
4277 (Incremental_input_entry_reader::get_input_section): Adjust size of
4278 data for incremental input file entry.
4279 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4280 (Incremental_input_entry_reader::get_comdat_group_signature): New
4281 function.
4282 * object.cc (Sized_relobj::include_section_group): Report kept
4283 COMDAT groups for incremental links.
4284
4285 2011-05-24 David Meyer <pdox@google.com>
4286
4287 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4288 with name parameter. Add found_name parameter.
4289 * fileread.cc (Input_file::find_file): Adjust code accordingly.
4290 * dirsearch.h (class Dirsearch): Update declaration.
4291
4292 2011-05-24 Ian Lance Taylor <iant@google.com>
4293
4294 * archive.cc (Library_base::should_include_member): Pull in object
4295 from archive if it defines the entry symbol.
4296 * parameters.cc (Parameters::entry): New function.
4297 * parameters.h (class Parameters): Declare entry.
4298 * output.h (class Output_file_header): Remove entry_ field.
4299 * output.cc (Output_file_header::Output_file_header): Remove entry
4300 parameter. Change all callers.
4301 (Output_file_header::entry): Use parameters->entry.
4302 * gold.cc (queue_middle_tasks): Likewise.
4303 * plugin.cc (Plugin_hook::run): Likewise.
4304
4305 2011-05-24 Cary Coutant <ccoutant@google.com>
4306
4307 * gold.cc (queue_initial_tasks): Pass incremental base filename
4308 to Output_file::open_base_file; don't print error message.
4309 * incremental-dump.cc (main): Adjust call to
4310 Output_file::open_for_modification.
4311 * incremental-dump.cc (main): Likewise.
4312 * incremental.cc (Incremental_inputs::report_command_line):
4313 Ignore --incremental-base option when comparing command lines.
4314 Ignore parameter when given as separate argument.
4315 * options.h (class General_options): Add --incremental-base.
4316 * output.cc (Output_file::Output_file):
4317 (Output_file::open_base_file): Add base_name and writable parameters;
4318 read base file into new file; print error message here.
4319 (Output_file::map_no_anonymous): Add writable parameter; adjust all
4320 callers.
4321 * output.h (Output_file::open_for_modification): Rename to...
4322 (Output_file::open_base_file): ...this; add base_name and
4323 writable parameters; adjust all callers.
4324 (Output_file::map_no_anonymous): Add writable parameter; adjust all
4325 callers.
4326 * testsuite/Makefile.am (incremental_test_4): Test
4327 --incremental-base.
4328 * testsuite/Makefile.in: Regenerate.
4329
4330 2011-05-24 Cary Coutant <ccoutant@google.com>
4331
4332 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4333 incremental_test_4.
4334 * testsuite/Makefile.in: Regenerate.
4335 * testsuite/two_file_test_1_v1.cc: New test source file.
4336 * testsuite/two_file_test_1b_v1.cc: New test source file.
4337 * testsuite/two_file_test_2_v1.cc: New test source file.
4338
4339 2011-05-24 Cary Coutant <ccoutant@google.com>
4340
4341 * dynobj.h (Dynobj::do_dynobj): New function.
4342 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4343 flag and soname for shared objects.
4344 * incremental.cc (Incremental_inputs::report_object): Make
4345 either Incremental_object_entry or Incremental_dynobj_entry; add
4346 soname to string table.
4347 (Incremental_inputs::report_input_section): Add assertion.
4348 (Output_section_incremental_inputs::set_final_data_size): Adjust
4349 type of input file entry for shared libraries; adjust size of
4350 shared library info entry.
4351 (Output_section_incremental_inputs::write_input_files): Write
4352 as_needed flag for shared libraries.
4353 (Output_section_incremental_inputs::write_info_blocks): Adjust type
4354 of input file entry for shared libraries; write soname.
4355 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4356 soname from incremental info.
4357 * incremental.h (enum Incremental_input_flags): Add
4358 INCREMENTAL_INPUT_AS_NEEDED.
4359 (Incremental_input_entry::Incremental_input_entry): Initialize new
4360 data member.
4361 (Incremental_input_entry::set_as_needed): New function.
4362 (Incremental_input_entry::as_needed): New function.
4363 (Incremental_input_entry::do_dynobj_entry): New function.
4364 (Incremental_input_entry::as_needed_): New data member.
4365 (Incremental_object_entry::Incremental_object_entry): Don't check
4366 for shared library.
4367 (Incremental_object_entry::do_type): Likewise.
4368 (class Incremental_dynobj_entry): New class.
4369 (Incremental_input_entry_reader::as_needed): New function.
4370 (Incremental_input_entry_reader::get_soname): New function.
4371 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4372 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4373 size of shared library info entry.
4374 * layout.cc (Layout::finish_dynamic_section): Don't test for
4375 incremental link when adding DT_NEEDED entries.
4376 * object.h (Object::Object): Initialize new data member.
4377 (Object::dynobj): New function.
4378 (Object::set_as_needed): New function.
4379 (Object::as_needed): New function.
4380 (Object::do_dynobj): New function.
4381 (Object::as_needed_): New data member.
4382
4383 2011-05-24 Cary Coutant <ccoutant@google.com>
4384
4385 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4386 info; adjust display of GOT entries.
4387 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4388 vector of input objects; remove file_status_.
4389 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4390 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4391 got_plt reader; call target hooks to reserve GOT entries.
4392 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4393 of input file info header and GOT info entry.
4394 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4395 relocation info.
4396 (Got_plt_view_info::got_descriptor): Remove.
4397 (Got_plt_view_info::sym_index): New data member.
4398 (Got_plt_view_info::input_index): New data member.
4399 (Local_got_offset_visitor::visit): Write input file index.
4400 (Global_got_offset_visitor::visit): Write 0 for input file index.
4401 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4402 with sym_index and input_index.
4403 (Output_section_incremental_inputs::write_got_plt): Adjust size of
4404 incremental info GOT entry; replace got_descriptor with input_index.
4405 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4406 map from input file index to object.
4407 (Sized_relobj_incr::do_layout): Replace direct data member reference
4408 with accessor function.
4409 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4410 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4411 Adjust size of input file info header.
4412 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4413 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4414 (Incremental_input_entry_reader::get_input_section): Adjust size of
4415 input file info header.
4416 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4417 of incremental info GOT entry.
4418 (Incremental_got_plt_reader::get_got_desc): Remove.
4419 (Incremental_got_plt_reader::get_got_symndx): New function.
4420 (Incremental_got_plt_reader::get_got_input_index): New function.
4421 (Sized_incremental_binary::Sized_incremental_binary): Remove
4422 file_status_; add input_objects_.
4423 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4424 (Sized_incremental_binary::set_file_is_unchanged): Remove.
4425 (Sized_incremental_binary::file_is_unchanged): Remove.
4426 (Sized_incremental_binary::set_input_object): New function.
4427 (Sized_incremental_binary::input_object): New function.
4428 (Sized_incremental_binary::file_status_): Remove.
4429 (Sized_incremental_binary::input_objects_): New data member.
4430 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4431 references.
4432 (Sized_relobj_incr::invalid_address): Move to base class.
4433 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4434 class.
4435 (Sized_relobj_incr::do_output_section_offset): Likewise.
4436 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4437 (Sized_relobj_incr::section_offsets_): Likewise.
4438 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4439 function.
4440 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4441 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4442 with accessor function.
4443 (Sized_relobj_file::do_layout): Likewise.
4444 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4445 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4446 (Sized_relobj_file::compute_final_local_value): Replace refs to
4447 section_offsets_ with accessor function.
4448 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4449 * object.h (Relobj::Relobj): Initialize new data members.
4450 (Relobj::add_dyn_reloc): New function.
4451 (Relobj::first_dyn_reloc): New function.
4452 (Relobj::dyn_reloc_count): New function.
4453 (Relobj::first_dyn_reloc_): New data member.
4454 (Relobj::dyn_reloc_count_): New data member.
4455 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4456 references.
4457 (Sized_relobj::Address): New typedef.
4458 (Sized_relobj::invalid_address): Move here from child class.
4459 (Sized_relobj::Sized_relobj): Initialize new data members.
4460 (Sized_relobj::sized_relobj): New function.
4461 (Sized_relobj::is_output_section_offset_invalid): Move here from
4462 child class.
4463 (Sized_relobj::get_output_section_offset): Likewise.
4464 (Sized_relobj::local_has_got_offset): Likewise.
4465 (Sized_relobj::local_got_offset): Likewise.
4466 (Sized_relobj::set_local_got_offset): Likewise.
4467 (Sized_relobj::do_for_all_local_got_entries): Likewise.
4468 (Sized_relobj::clear_got_offsets): New function.
4469 (Sized_relobj::section_offsets): Move here from child class.
4470 (Sized_relobj::do_output_section_offset): Likewise.
4471 (Sized_relobj::do_set_section_offset): Likewise.
4472 (Sized_relobj::Local_got_offsets): Likewise.
4473 (Sized_relobj::local_got_offsets_): Likewise.
4474 (Sized_relobj::section_offsets_): Likewise.
4475 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4476 references.
4477 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4478 class.
4479 (Sized_relobj_file::sized_relobj): New function
4480 (Sized_relobj_file::local_has_got_offset): Move to base class.
4481 (Sized_relobj_file::local_got_offset): Likewise.
4482 (Sized_relobj_file::set_local_got_offset): Likewise.
4483 (Sized_relobj_file::get_output_section_offset): Likewise.
4484 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4485 (Sized_relobj_file::do_output_section_offset): Likewise.
4486 (Sized_relobj_file::do_set_section_offset): Likewise.
4487 (Sized_relobj_file::Local_got_offsets): Likewise.
4488 (Sized_relobj_file::local_got_offsets_): Likewise.
4489 (Sized_relobj_file::section_offsets_): Likewise.
4490 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4491 (all constructors).
4492 (set_needs_dynsym_index): Convert relobj to derived class pointer.
4493 (Output_reloc::get_symbol_index): Likewise.
4494 (Output_reloc::local_section_offset): Likewise.
4495 (Output_reloc::get_address): Likewise.
4496 (Output_reloc::symbol_value): Likewise.
4497 (Output_data_got::reserve_slot): Move to class definition.
4498 (Output_data_got::reserve_local): New function.
4499 (Output_data_got::reserve_slot_for_global): Remove.
4500 (Output_data_got::reserve_global): New function.
4501 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4502 (all constructors, two instantiations).
4503 (Output_reloc::get_relobj): New function (two instantiations).
4504 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4505 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4506 (Output_data_reloc::add_global): Adjust type of relobj.
4507 (Output_data_reloc::add_global_relative): Likewise.
4508 (Output_data_reloc::add_symbolless_global_addend): Likewise.
4509 (Output_data_reloc::add_local): Likewise.
4510 (Output_data_reloc::add_local_relative): Likewise.
4511 (Output_data_reloc::add_symbolless_local_addend): Likewise.
4512 (Output_data_reloc::add_local_section): Likewise.
4513 (Output_data_reloc::add_output_section): Likewise.
4514 (Output_data_reloc::add_absolute): Likewise.
4515 (Output_data_reloc::add_target_specific): Likewise.
4516 (Output_data_got::reserve_slot): Move definition here.
4517 (Output_data_got::reserve_local): New function.
4518 (Output_data_got::reserve_global): New function.
4519 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4520 section_offsets_ with accessor function.
4521 (Sized_relobj_file::write_sections): Likewise.
4522 (Sized_relobj_file::do_relocate_sections): Likewise.
4523 * target.h (Sized_target::reserve_local_got_entry): New function.
4524 (Sized_target::reserve_global_got_entry): New function.
4525 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4526 (Target_x86_64::reserve_global_got_entry): New function.
4527 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4528
4529 2011-05-23 Cary Coutant <ccoutant@google.com>
4530
4531 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4532 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4533 bit when checking got_type.
4534 * incremental.cc (Sized_incremental_binary::setup_readers):
4535 Store symbol table and string table locations; initialize bit vector
4536 of file status flags.
4537 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4538 unchanged files.
4539 (Sized_incremental_binary::do_process_got_plt): New function.
4540 (Sized_incremental_binary::get_symtab_view): Use stored locations.
4541 (Output_section_incremental_inputs::set_final_data_size): Record
4542 file index for each input file.
4543 (Output_section_incremental_inputs::write_got_plt): Store file index
4544 instead of input entry offset for each GOT entry.
4545 * incremental.h
4546 (Incremental_input_entry::Incremental_input_entry): Initialize new
4547 data member.
4548 (Incremental_input_entry::set_offset): Store file index.
4549 (Incremental_input_entry::get_file_index): New function.
4550 (Incremental_input_entry::file_index_): New data member.
4551 (Incremental_binary::process_got_plt): New function.
4552 (Incremental_binary::do_process_got_plt): New function.
4553 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4554 data members.
4555 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4556 (Sized_incremental_binary::set_file_is_unchanged): New function.
4557 (Sized_incremental_binary::file_is_unchanged): New function.
4558 (Sized_incremental_binary::do_process_got_plt): New function.
4559 (Sized_incremental_binary::file_status_): New data member.
4560 (Sized_incremental_binary::main_symtab_loc_): New data member.
4561 (Sized_incremental_binary::main_strtab_loc_): New data member.
4562 * output.cc (Output_data_got::Got_entry::write): Add case
4563 RESERVED_CODE.
4564 (Output_data_got::add_global): Call add_got_entry.
4565 (Output_data_got::add_global_plt): Likewise.
4566 (Output_data_got::add_global_with_rel): Likewise.
4567 (Output_data_got::add_global_with_rela): Likewise.
4568 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4569 (Output_data_got::add_global_pair_with_rela): Likewise.
4570 (Output_data_got::add_local): Call add_got_entry.
4571 (Output_data_got::add_local_plt): Likewise.
4572 (Output_data_got::add_local_with_rel): Likewise.
4573 (Output_data_got::add_local_with_rela): Likewise.
4574 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4575 (Output_data_got::add_local_pair_with_rela): Likewise.
4576 (Output_data_got::reserve_slot): New function.
4577 (Output_data_got::reserve_slot_for_global): New function.
4578 (Output_data_got::add_got_entry): New function.
4579 (Output_data_got::add_got_entry_pair): New function.
4580 (Output_section::add_output_section_data): Edit FIXME.
4581 * output.h
4582 (Output_section_data_build::Output_section_data_build): New
4583 constructor with size parameter.
4584 (Output_data_space::Output_data_space): Likewise.
4585 (Output_data_got::Output_data_got): Initialize new data member; new
4586 constructor with size parameter.
4587 (Output_data_got::add_constant): Call add_got_entry.
4588 (Output_data_got::reserve_slot): New function.
4589 (Output_data_got::reserve_slot_for_global): New function.
4590 (class Output_data_got::Got_entry): Add RESERVED_CODE.
4591 (Output_data_got::add_got_entry): New function.
4592 (Output_data_got::add_got_entry_pair): New function.
4593 (Output_data_got::free_list_): New data member.
4594 * target.h (Sized_target::init_got_plt_for_update): New function.
4595 (Sized_target::register_global_plt_entry): New function.
4596 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4597 Initialize new data member; call init; add constructor with PLT count.
4598 (Output_data_plt_x86_64::init): New function.
4599 (Output_data_plt_x86_64::add_relocation): New function.
4600 (Output_data_plt_x86_64::reserve_slot): New function.
4601 (Output_data_plt_x86_64::free_list_): New data member.
4602 (Target_x86_64::init_got_plt_for_update): New function.
4603 (Target_x86_64::register_global_plt_entry): New function.
4604 (Output_data_plt_x86_64::add_entry): Allocate from free list for
4605 incremental updates.
4606 (Output_data_plt_x86_64::add_relocation): New function.
4607 * testsuite/object_unittest.cc (Object_test): Set default options.
4608
4609 2011-05-16 Ian Lance Taylor <iant@google.com>
4610
4611 * options.h (class General_options): Make -i a synonym for -r.
4612
4613 2011-05-16 Ian Lance Taylor <iant@google.com>
4614
4615 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4616
4617 2011-05-10 Cary Coutant <ccoutant@google.com>
4618
4619 * object.cc (Sized_relobj::do_count_local_symbols): Check for
4620 strip_all (-s).
4621
4622 2011-05-06 Ian Lance Taylor <iant@google.com>
4623
4624 * layout.cc (Layout::layout): If the output section flags change,
4625 update the ordering.
4626
4627 2011-04-25 Cary Coutant <ccoutant@google.com>
4628
4629 * incremental-dump.cc (dump_incremental_inputs): Print local
4630 symbol info for each input file.
4631 * incremental.cc
4632 (Output_section_incremental_inputs::set_final_data_size): Add local
4633 symbol info to input file entries in incremental info.
4634 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4635 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4636 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4637 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4638 implementation.
4639 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4640 (Sized_incr_relobj::do_relocate): Write the local symbols.
4641 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4642 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4643 Adjust size of input file header.
4644 (Incremental_inputs_reader::get_local_symbol_offset): New function.
4645 (Incremental_inputs_reader::get_local_symbol_count): New function.
4646 (Incremental_inputs_reader::get_input_section): Adjust size of input
4647 file header.
4648 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4649 (Sized_incr_relobj::This): New typedef.
4650 (Sized_incr_relobj::sym_size): New const data member.
4651 (Sized_incr_relobj::Local_symbol): New struct.
4652 (Sized_incr_relobj::do_output_local_symbol_count): New function.
4653 (Sized_incr_relobj::do_local_symbol_offset): New function.
4654 (Sized_incr_relobj::local_symbol_count_): New data member.
4655 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4656 (Sized_incr_relobj::local_symbol_index_): New data member.
4657 (Sized_incr_relobj::local_symbol_offset_): New data member.
4658 (Sized_incr_relobj::local_dynsym_offset_): New data member.
4659 (Sized_incr_relobj::local_symbols_): New data member.
4660 * object.h (Relobj::output_local_symbol_count): New function.
4661 (Relobj::local_symbol_offset): New function.
4662 (Relobj::do_output_local_symbol_count): New function.
4663 (Relobj::do_local_symbol_offset): New function.
4664 (Sized_relobj::do_output_local_symbol_count): New function.
4665 (Sized_relobj::do_local_symbol_offset): New function.
4666
4667 2011-04-22 Vladimir Simonov <sv@sw.ru>
4668
4669 * descriptors.cc (set_close_on_exec): New function.
4670 (Descriptors::open): Use set_close_on_exec.
4671 * output.cc (S_ISLNK): Define if not defined.
4672
4673 2011-04-22 Cary Coutant <ccoutant@google.com>
4674
4675 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4676 global symbol map.
4677 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4678 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4679 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4680 relocations.
4681 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4682 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4683 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4684 * incremental.h
4685 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4686 function.
4687 (Incremental_binary::apply_incremental_relocs): New function.
4688 (Incremental_binary::do_apply_incremental_relocs): New function.
4689 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4690 data member.
4691 (Sized_incremental_binary::add_global_symbol): New function.
4692 (Sized_incremental_binary::global_symbol): New function.
4693 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4694 (Sized_incremental_binary::symbol_map_): New data member.
4695 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4696 * target.h (Sized_target::apply_relocation): New function.
4697 * target-reloc.h (apply_relocation): New function.
4698 * x86_64.cc (Target_x86_64::apply_relocation): New function.
4699
4700 2011-04-22 Doug Kwan <dougkwan@google.com>
4701
4702 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4703 flag of a SHT_ARM_EXIDX section.
4704 * testsuite/Makefile.am (arm_exidx_test): New test rules.
4705 * testsuite/Makefile.in: Regenerate.
4706 * testsuite/arm_exidx_test.s: New file.
4707 * testsuite/arm_exidx_test.sh: Same.
4708
4709 2011-04-20 Cary Coutant <ccoutant@google.com>
4710
4711 PR gold/12689
4712 * archive.h (Incremental_archive_entry::Archive_member):
4713 Initialize arg_serial_ (second constructor).
4714
4715 2011-04-17 Ian Lance Taylor <iant@google.com>
4716
4717 * object.cc (Relocate_info::location): Simplify location string.
4718 * errors.cc (Errors::error_at_location): Don't print program
4719 name.
4720 (Errors::warning_at_location): Likewise.
4721 (Errors::undefined_symbol): Likewise.
4722 * testsuite/debug_msg.sh: Update accordingly.
4723
4724 2011-04-14 Cary Coutant <ccoutant@google.com>
4725
4726 * gold/layout.cc (Layout::symtab_section_offset): New function.
4727 * gold/layout.h (Layout::symtab_section_offset): New function.
4728 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4729
4730 2011-04-12 Ian Lance Taylor <iant@google.com>
4731
4732 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
4733 with MREMAP_MAYMOVE.
4734 * output.h (class Output_file): Add map_is_allocated_ field.
4735 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
4736 not available, provide stubs. If mremap is not available, #define
4737 it to gold_mremap.
4738 (MREMAP_MAYMOVE): Define if not defined.
4739 (Output_file::Output_file): Initialize map_is_allocated_.
4740 (Output_file::resize): Check map_is_allocated_.
4741 (Output_file::map_anonymous): If mmap fails, use malloc.
4742 (Output_file::unmap): Don't do anything for an anonymous map.
4743 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
4744 is not available, provide stubs.
4745 (File_read::View::~View): Use free rather than delete[].
4746 (File_read::make_view): Use malloc rather than new[]. If mmap
4747 fails, use malloc.
4748 (File_read::find_or_make_view): Use malloc rather than new[].
4749 * gold.h: Remove HAVE_REMAP code.
4750 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
4751 exists. Rename mremap to gold_mremap. If mmap is not available
4752 don't do anything.
4753 * configure, config.in: Rebuild.
4754
4755 2011-04-11 Ian Lance Taylor <iant@google.com>
4756
4757 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4758 initialize local variable v.
4759
4760 2011-04-11 Cary Coutant <ccoutant@google.com>
4761
4762 * archive.cc (Archive::include_member): Adjust call to
4763 report_object.
4764 (Add_archive_symbols::run): Track argument serial numbers.
4765 (Lib_group::include_member): Likewise.
4766 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4767 * archive.h (Incremental_archive_entry::Archive_member):
4768 Initialize arg_serial_.
4769 (Archive_member::arg_serial_): New data member.
4770 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4771 (Sized_dynobj::do_add_symbols): Track symbols when doing an
4772 incremental link.
4773 (Sized_dynobj::do_for_all_local_got_entries): New function.
4774 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4775 function.
4776 * fileread.cc (get_mtime): New function.
4777 * fileread.h (get_mtime): New function.
4778 * gold.cc (queue_initial_tasks): Check for incremental update.
4779 (process_incremental_input): New function.
4780 (queue_middle_tasks): Don't force valid target for incremental
4781 update.
4782 * incremental-dump.cc (find_input_containing_global): Adjust
4783 size of symbol info entry.
4784 (dump_incremental_inputs): Dump argument serial number and
4785 in_system_directory flag; bias shndx by 1; print symbol names
4786 when dumping per-file symbol lists; use new symbol info readers.
4787 * incremental.cc
4788 (Output_section_incremental_inputs:update_data_size): New function.
4789 (Sized_incremental_binary::setup_readers): Setup input readers
4790 for each input file; build maps for files added from libraries
4791 and scripts.
4792 (Sized_incremental_binary::check_input_args): New function.
4793 (Sized_incremental_binary::do_check_inputs): Build map of argument
4794 serial numbers to input arguments.
4795 (Sized_incremental_binary::do_file_has_changed): Rename
4796 do_file_is_unchanged to this; compare file modification times.
4797 (Sized_incremental_binary::do_init_layout): New function.
4798 (Sized_incremental_binary::do_reserve_layout): New function.
4799 (Sized_incremental_binary::do_get_input_reader): Remove.
4800 (Sized_incremental_binary::get_symtab_view): New function.
4801 (Incremental_checker::can_incrementally_link_output_file): Remove.
4802 (Incremental_inputs::report_command_line): Exclude --debug options.
4803 (Incremental_inputs::report_archive_begin): Add parameter; track
4804 argument serial numbers; don't put input file entry for archive
4805 before archive members.
4806 (Incremental_inputs::report_archive_end): Put input file entry
4807 for archive after archive members.
4808 (Incremental_inputs::report_object): Add parameter; track argument
4809 serial numbers and in_system_directory flag.
4810 (Incremental_inputs::report_script): Add parameter; track argument
4811 serial numbers.
4812 (Output_section_incremental_inputs::set_final_data_size): Adjust
4813 size of symbol info entry; check for forwarding symbols.
4814 (Output_section_incremental_inputs::write_input_files): Write
4815 in_system_directory flag and argument serial number.
4816 (Output_section_incremental_inputs::write_info_blocks): Map section
4817 indices between incremental info and original input file; store
4818 input section index for each symbol.
4819 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4820 change operator() to visit().
4821 (class Global_got_offset_visitor): Likewise.
4822 (class Global_symbol_visitor_got_plt):
4823 (Output_section_incremental_inputs::write_got_plt): Use new visitor
4824 classes.
4825 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4826 (Sized_incr_relobj::do_read_symbols): New function.
4827 (Sized_incr_relobj::do_layout): New function.
4828 (Sized_incr_relobj::do_layout_deferred_sections): New function.
4829 (Sized_incr_relobj::do_add_symbols): New function.
4830 (Sized_incr_relobj::do_should_include_member): New function.
4831 (Sized_incr_relobj::do_for_all_global_symbols): New function.
4832 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4833 (Sized_incr_relobj::do_section_size): New function.
4834 (Sized_incr_relobj::do_section_name): New function.
4835 (Sized_incr_relobj::do_section_contents): New function.
4836 (Sized_incr_relobj::do_section_flags): New function.
4837 (Sized_incr_relobj::do_section_entsize): New function.
4838 (Sized_incr_relobj::do_section_address): New function.
4839 (Sized_incr_relobj::do_section_type): New function.
4840 (Sized_incr_relobj::do_section_link): New function.
4841 (Sized_incr_relobj::do_section_info): New function.
4842 (Sized_incr_relobj::do_section_addralign): New function.
4843 (Sized_incr_relobj::do_initialize_xindex): New function.
4844 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4845 (Sized_incr_relobj::do_read_relocs): New function.
4846 (Sized_incr_relobj::do_gc_process_relocs): New function.
4847 (Sized_incr_relobj::do_scan_relocs): New function.
4848 (Sized_incr_relobj::do_count_local_symbols): New function.
4849 (Sized_incr_relobj::do_finalize_local_symbols): New function.
4850 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4851 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4852 (Sized_incr_relobj::do_relocate): New function.
4853 (Sized_incr_relobj::do_set_section_offset): New function.
4854 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4855 (Sized_incr_dynobj::do_read_symbols): New function.
4856 (Sized_incr_dynobj::do_layout): New function.
4857 (Sized_incr_dynobj::do_add_symbols): New function.
4858 (Sized_incr_dynobj::do_should_include_member): New function.
4859 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4860 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4861 (Sized_incr_dynobj::do_section_size): New function.
4862 (Sized_incr_dynobj::do_section_name): New function.
4863 (Sized_incr_dynobj::do_section_contents): New function.
4864 (Sized_incr_dynobj::do_section_flags): New function.
4865 (Sized_incr_dynobj::do_section_entsize): New function.
4866 (Sized_incr_dynobj::do_section_address): New function.
4867 (Sized_incr_dynobj::do_section_type): New function.
4868 (Sized_incr_dynobj::do_section_link): New function.
4869 (Sized_incr_dynobj::do_section_info): New function.
4870 (Sized_incr_dynobj::do_section_addralign): New function.
4871 (Sized_incr_dynobj::do_initialize_xindex): New function.
4872 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4873 (make_sized_incremental_object): New function.
4874 (Incremental_library::copy_unused_symbols): New function.
4875 (Incremental_library::do_for_all_unused_symbols): New function.
4876 * incremental.h (enum Incremental_input_flags): New type.
4877 (class Incremental_checker): Remove.
4878 (Incremental_input_entry::Incremental_input_entry): Add argument
4879 serial number.
4880 (Incremental_input_entry::arg_serial): New function.
4881 (Incremental_input_entry::set_is_in_system_directory): New function.
4882 (Incremental_input_entry::is_in_system_directory): New function.
4883 (Incremental_input_entry::arg_serial_): New data member.
4884 (Incremental_input_entry::is_in_system_directory_): New data member.
4885 (class Script_info): Move here from script.h.
4886 (Script_info::Script_info): Add filename parameter.
4887 (Script_info::filename): New function.
4888 (Script_info::filename_): New data member.
4889 (Incremental_script_entry::Incremental_script_entry): Add argument
4890 serial number.
4891 (Incremental_object_entry::Incremental_object_entry): Likewise.
4892 (Incremental_object_entry::add_input_section): Build list of input
4893 sections with map to original shndx.
4894 (Incremental_object_entry::get_input_section_index): New function.
4895 (Incremental_object_entry::shndx_): New data member.
4896 (Incremental_object_entry::name_key_): Rename; adjust all refs.
4897 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4898 (Incremental_archive_entry::Incremental_archive_entry): Add argument
4899 serial number.
4900 (Incremental_inputs::report_archive_begin): Likewise.
4901 (Incremental_inputs::report_object): Likewise.
4902 (Incremental_inputs::report_script): Likewise.
4903 (class Incremental_global_symbol_reader): New class.
4904 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4905 and store flags and input file type.
4906 (Incremental_input_entry_reader::arg_serial): New function.
4907 (Incremental_input_entry_reader::type): Extract type from flags.
4908 (Incremental_input_entry_reader::is_in_system_directory): New function.
4909 (Incremental_input_entry_reader::get_input_section_count): Call
4910 accessor function for type.
4911 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4912 function for type; adjust size of global symbol entry.
4913 (Incremental_input_entry_reader::get_global_symbol_count): Call
4914 accessor function for type.
4915 (Incremental_input_entry_reader::get_object_count): Likewise.
4916 (Incremental_input_entry_reader::get_object_offset): Likewise.
4917 (Incremental_input_entry_reader::get_member_count): Likewise.
4918 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4919 (Incremental_input_entry_reader::get_member_offset): Likewise.
4920 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4921 (Incremental_input_entry_reader::Global_symbol_info): Remove.
4922 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4923 (Incremental_input_entry_reader::get_global_symbol_reader): New
4924 function.
4925 (Incremental_input_entry_reader::get_output_symbol_index): New
4926 function.
4927 (Incremental_input_entry_reader::type_): Remove.
4928 (Incremental_input_entry_reader::flags_): New data member.
4929 (Incremental_inputs_reader::input_file_offset): New function.
4930 (Incremental_inputs_reader::input_file_index): New function.
4931 (Incremental_inputs_reader::input_file): Call input_file_offset.
4932 (Incremental_inputs_reader::input_file_at_offset): New function.
4933 (Incremental_relocs_reader::get_r_type): Reformat.
4934 (Incremental_relocs_reader::get_r_shndx): Reformat.
4935 (Incremental_relocs_reader::get_r_offset): Reformat.
4936 (Incremental_relocs_reader::data): New function.
4937 (Incremental_binary::Incremental_binary): Initialize new data members.
4938 (Incremental_binary::check_inputs): Add cmdline parameter.
4939 (Incremental_binary::file_is_unchanged): Remove.
4940 (Input_reader::arg_serial): New function.
4941 (Input_reader::get_unused_symbol_count): New function.
4942 (Input_reader::get_unused_symbol): New function.
4943 (Input_reader::do_arg_serial): New function.
4944 (Input_reader::do_get_unused_symbol_count): New function.
4945 (Input_reader::do_get_unused_symbol): New function.
4946 (Incremental_binary::input_file_count): New function.
4947 (Incremental_binary::get_input_reader): Change signature to use
4948 index instead of filename.
4949 (Incremental_binary::file_has_changed): New function.
4950 (Incremental_binary::get_input_argument): New function.
4951 (Incremental_binary::get_library): New function.
4952 (Incremental_binary::get_script_info): New function.
4953 (Incremental_binary::init_layout): New function.
4954 (Incremental_binary::reserve_layout): New function.
4955 (Incremental_binary::output_file): New function.
4956 (Incremental_binary::do_check_inputs): New function.
4957 (Incremental_binary::do_file_is_unchanged): Remove.
4958 (Incremental_binary::do_file_has_changed): New function.
4959 (Incremental_binary::do_init_layout): New function.
4960 (Incremental_binary::do_reserve_layout): New function.
4961 (Incremental_binary::do_input_file_count): New function.
4962 (Incremental_binary::do_get_input_reader): Change signature.
4963 (Incremental_binary::input_args_map_): New data member.
4964 (Incremental_binary::library_map_): New data member.
4965 (Incremental_binary::script_map_): New data member.
4966 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4967 new data members.
4968 (Sized_incremental_binary::output_section): New function.
4969 (Sized_incremental_binary::inputs_reader): Add const.
4970 (Sized_incremental_binary::symtab_reader): Add const.
4971 (Sized_incremental_binary::relocs_reader): Add const.
4972 (Sized_incremental_binary::got_plt_reader): Add const.
4973 (Sized_incremental_binary::get_symtab_view): New function.
4974 (Sized_incremental_binary::Inputs_reader): New typedef.
4975 (Sized_incremental_binary::Input_entry_reader): New typedef.
4976 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4977 (Sized_incremental_binary::do_file_is_unchanged): Remove.
4978 (Sized_incremental_binary::do_file_has_changed): New function.
4979 (Sized_incremental_binary::do_init_layout): New function.
4980 (Sized_incremental_binary::do_reserve_layout): New function.
4981 (Sized_input_reader::Inputs_reader): Remove.
4982 (Sized_input_reader::Input_entry_reader): Remove.
4983 (Sized_input_reader::do_arg_serial): New function.
4984 (Sized_input_reader::do_get_unused_symbol_count): New function.
4985 (Sized_input_reader::do_get_unused_symbol): New function.
4986 (Sized_incremental_binary::do_input_file_count): New function.
4987 (Sized_incremental_binary::do_get_input_reader): Change signature;
4988 use index instead of filename.
4989 (Sized_incremental_binary::section_map_): New data member.
4990 (Sized_incremental_binary::input_entry_readers_): New data member.
4991 (class Sized_incr_relobj): New class.
4992 (class Sized_incr_dynobj): New class.
4993 (make_sized_incremental_object): New function.
4994 (class Incremental_library): New class.
4995 * layout.cc (Free_list::num_lists): New static data member.
4996 (Free_list::num_nodes): New static data member.
4997 (Free_list::num_removes): New static data member.
4998 (Free_list::num_remove_visits): New static data member.
4999 (Free_list::num_allocates): New static data member.
5000 (Free_list::num_allocate_visits): New static data member.
5001 (Free_list::init): New function.
5002 (Free_list::remove): New function.
5003 (Free_list::allocate): New function.
5004 (Free_list::dump): New function.
5005 (Free_list::print_stats): New function.
5006 (Layout_task_runner::run): Resize output file for incremental updates.
5007 (Layout::Layout): Initialize new data members.
5008 (Layout::set_incremental_base): New function.
5009 (Layout::init_fixed_output_section): New function.
5010 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5011 incremental updates.
5012 (Layout::create_gold_note): Do not create gold note section for
5013 incremental updates.
5014 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5015 for incremental updates.
5016 (Layout::set_section_offsets): For incremental updates, allocate space
5017 from free list.
5018 (Layout::create_symtab_sections): Layout with offsets relative to
5019 start of section; for incremental updates, allocate space from free
5020 list.
5021 (Layout::create_shdrs): For incremental updates, allocate space from
5022 free list.
5023 (Layout::finish_dynamic_section): For incremental updates, do not
5024 check --as-needed (fixed in subsequent patch).
5025 * layout.h (class Free_list): New class.
5026 (Layout::set_incremental_base): New function.
5027 (Layout::incremental_base): New function.
5028 (Layout::init_fixed_output_section): New function.
5029 (Layout::allocate): New function.
5030 (Layout::incremental_base_): New data member.
5031 (Layout::free_list_): New data member.
5032 * main.cc (main): Print Free_list statistics.
5033 * object.cc (Relobj::finalize_incremental_relocs): Add
5034 clear_counts parameter; clear counts only when clear_counts is set.
5035 (Sized_relobj::Sized_relobj): Initialize new base class.
5036 (Sized_relobj::do_layout): Don't report special sections.
5037 (Sized_relobj::do_for_all_local_got_entries): New function.
5038 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5039 symtab_off to all symbol table offsets.
5040 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5041 * object.h (class Got_offset_list): Move to top of file.
5042 (Object::Object): Allow case where input_file == NULL.
5043 (Object::~Object): Likewise.
5044 (Object::input_file): Assert that input_file != NULL.
5045 (Object::lock): Allow case where input_file == NULL.
5046 (Object::unlock): Likewise.
5047 (Object::is_locked): Likewise.
5048 (Object::token): Likewise.
5049 (Object::release): Likewise.
5050 (Object::is_incremental): New function.
5051 (Object::get_mtime): New function.
5052 (Object::for_all_local_got_entries): New function.
5053 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5054 (Object::set_is_in_system_directory): New function.
5055 (Object::is_in_system_directory): New function.
5056 (Object::do_is_incremental): New function.
5057 (Object::do_get_mtime): New function.
5058 (Object::do_for_all_local_got_entries): New function.
5059 (Object::is_in_system_directory_): New data member.
5060 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5061 (class Sized_relobj_base): New class.
5062 (class Sized_relobj): Derive from Sized_relobj_base.
5063 (class Sized_relobj::Symbols): Redeclare from base class.
5064 (class Sized_relobj::local_got_offset_list): Remove.
5065 (class Sized_relobj::Output_sections): Redeclare from base class.
5066 (class Sized_relobj::do_for_all_local_got_entries): New function.
5067 (class Sized_relobj::write_local_symbols): Add offset parameter.
5068 (class Sized_relobj::local_symbol_offset_): Update comment.
5069 (class Sized_relobj::local_dynsym_offset_): Update comment.
5070 * options.cc (Input_arguments::add_file): Remove const.
5071 * options.h (Input_file_argument::Input_file_argument):
5072 Initialize arg_serial_ (all constructors).
5073 (Input_file_argument::set_arg_serial): New function.
5074 (Input_file_argument::arg_serial): New function.
5075 (Input_file_argument::arg_serial_): New data member.
5076 (Input_arguments::Input_arguments): Initialize file_count_.
5077 (Input_arguments::add_file): Remove const.
5078 (Input_arguments::number_of_input_files): New function.
5079 (Input_arguments::file_count_): New data member.
5080 (Command_line::number_of_input_files): Call
5081 Input_arguments::number_of_input_files.
5082 * output.cc (Output_segment_headers::Output_segment_headers):
5083 Set current size.
5084 (Output_section::Input_section::current_data_size): New function.
5085 (Output_section::Output_section): Initialize new data members.
5086 (Output_section::add_input_section): Don't do merge sections for
5087 an incremental link; allocate space from free list for an
5088 incremental update.
5089 (Output_section::add_output_section_data): Allocate space from
5090 free list for an incremental update.
5091 (Output_section::update_data_size): New function.
5092 (Output_section::set_fixed_layout): New function.
5093 (Output_section::reserve): New function.
5094 (Output_segment::set_section_addresses): Remove const.
5095 (Output_segment::set_section_list_addresses): Remove const; allocate
5096 space from free list for an incremental update.
5097 (Output_segment::set_offset): Adjust size of RELRO segment for an
5098 incremental update.
5099 * output.h (Output_data::current_data_size): Move here from
5100 child classes.
5101 (Output_data::pre_finalize_data_size): New function.
5102 (Output_data::update_data_size): New function.
5103 (Output_section_headers::update_data_size): new function.
5104 (Output_section_data_build::current_data_size): Move to Output_data.
5105 (Output_data_strtab::update_data_size): New function.
5106 (Output_section::current_data_size): Move to Output_data.
5107 (Output_section::set_fixed_layout): New function.
5108 (Output_section::has_fixed_layout): New function.
5109 (Output_section::reserve): New function.
5110 (Output_section::update_data_size): New function.
5111 (Output_section::has_fixed_layout_): New data member.
5112 (Output_section::free_list_): New data member.
5113 (Output_segment::set_section_addresses): Remove const.
5114 (Output_segment::set_section_list_addresses): Remove const.
5115 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5116 New function.
5117 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5118 New function.
5119 * readsyms.cc (Read_symbols::do_read_symbols): Add library
5120 parameter when calling Add_symbols constructor; store argument
5121 serial number for members of a lib group.
5122 (Add_symbols::locks): Allow case where token == NULL.
5123 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5124 (Read_member::~Read_member): New function.
5125 (Read_member::is_runnable): New function.
5126 (Read_member::locks): New function.
5127 (Read_member::run): New function.
5128 (Check_script::~Check_script): New function.
5129 (Check_script::is_runnable): New function.
5130 (Check_script::locks): New function.
5131 (Check_script::run): New function.
5132 (Check_library::~Check_library): New function.
5133 (Check_library::is_runnable): New function.
5134 (Check_library::locks): New function.
5135 (Check_library::run): New function.
5136 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5137 (Add_symbols::library_): New data member.
5138 (class Read_member): New class.
5139 (class Check_script): New class.
5140 (class Check_library): New class.
5141 * reloc.cc (Read_relocs::is_runnable): Allow case where
5142 token == NULL.
5143 (Read_relocs::locks): Likewise.
5144 (Scan_relocs::locks): Likewise.
5145 (Relocate_task::locks): Likewise.
5146 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5147 to clear counters.
5148 (Sized_relobj::incremental_relocs_scan): Fix comment.
5149 (Sized_relobj::do_relocate): Pass output file offset to
5150 write_local_symbols.
5151 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5152 from class declaration.
5153 * script.cc (read_input_script): Allocate Script_info; pass
5154 argument serial number to report_script.
5155 * script.h (class Script_info): Move to incremental.h.
5156 * symtab.cc (Symbol_table::add_from_incrobj): New function.
5157 * symtab.h (Symbol_table::add_from_incrobj): New function.
5158 (Symbol_table::set_file_offset): New function.
5159
5160 2011-04-05 Cary Coutant <ccoutant@google.com>
5161
5162 * incremental-dump.cc (dump_incremental_inputs): Change signature
5163 to take a Sized_incremental_binary; change caller. Use readers
5164 in Sized_incremental_binary.
5165 * incremental.cc
5166 (Sized_incremental_binary::find_incremental_inputs_sections):
5167 Rename do_find_incremental_inputs_sections to this.
5168 (Sized_incremental_binary::setup_readers): New function.
5169 (Sized_incremental_binary::do_check_inputs): Check
5170 has_incremental_info_ flag; move setup code to setup_readers;
5171 use input readers.
5172 (Sized_incremental_binary::do_file_is_unchanged): New function.
5173 (Sized_incremental_binary::do_get_input_reader): New function.
5174 * incremental.h (class Incremental_binary): Move to end of file.
5175 (Incremental_binary::file_is_unchanged): New function.
5176 (Incremental_binary::do_file_is_unchanged): New function.
5177 (Incremental_binary::Input_reader): New class.
5178 (Incremental_binary::get_input_reader): New function.
5179 (class Sized_incremental_binary): Move to end of file.
5180 (Sized_incremental_binary::Sized_incremental_binary): Setup the
5181 input section reader classes.
5182 (Sized_incremental_binary::has_incremental_info): New function.
5183 (Sized_incremental_binary::inputs_reader): New function.
5184 (Sized_incremental_binary::symtab_reader): New function.
5185 (Sized_incremental_binary::relocs_reader): New function.
5186 (Sized_incremental_binary::got_plt_reader): New function.
5187 (Sized_incremental_binary::do_file_is_unchanged): New function.
5188 (Sized_incremental_binary::Sized_input_reader): New class.
5189 (Sized_incremental_binary::get_input_reader): New function.
5190 (Sized_incremental_binary::find_incremental_inputs_sections):
5191 Rename do_find_incremental_inputs_sections to this.
5192 (Sized_incremental_binary::setup_readers): New function.
5193 (Sized_incremental_binary::has_incremental_info_): New data member.
5194 (Sized_incremental_binary::inputs_reader_): New data member.
5195 (Sized_incremental_binary::symtab_reader_): New data member.
5196 (Sized_incremental_binary::relocs_reader_): New data member.
5197 (Sized_incremental_binary::got_plt_reader_): New data member.
5198 (Sized_incremental_binary::current_input_file_): New data member.
5199
5200 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
5201
5202 PR gold/12640
5203 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5204 violation.
5205
5206 2011-03-30 Cary Coutant <ccoutant@google.com>
5207
5208 * archive.cc (Archive::include_member): Adjust call to report_object.
5209 (Add_archive_symbols::run): Add script_info to call to
5210 report_archive_begin.
5211 (Lib_group::include_member): Adjust call to report_object.
5212 (Add_lib_group_symbols::run): Adjust call to report_object.
5213 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5214 blocks. Add object count for script input files.
5215 * incremental.cc (Incremental_inputs::report_archive_begin): Add
5216 script_info parameter; change all callers.
5217 (Incremental_inputs::report_object): Add script_info parameter;
5218 change all callers.
5219 (Incremental_inputs::report_script): Store backpointer to
5220 incremental info entry.
5221 (Output_section_incremental_inputs::set_final_data_size): Record
5222 additional information for scripts.
5223 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5224 * incremental.h (Incremental_script_entry::add_object): New function.
5225 (Incremental_script_entry::get_object_count): New function.
5226 (Incremental_script_entry::get_object): New function.
5227 (Incremental_script_entry::objects_): New data member; adjust
5228 constructor.
5229 (Incremental_inputs::report_archive_begin): Add script_info parameter.
5230 (Incremental_inputs::report_object): Add script_info parameter.
5231 (Incremental_inputs_reader::get_object_count): New function.
5232 (Incremental_inputs_reader::get_object_offset): New function.
5233 * options.cc (Input_arguments::add_file): Return reference to
5234 new input argument.
5235 * options.h (Input_argument::set_script_info): New function.
5236 (Input_argument::script_info): New function.
5237 (Input_argument::script_info_): New data member; adjust all
5238 constructors.
5239 (Input_file_group::add_file): Return reference to new input argument.
5240 (Input_file_lib::add_file): Likewise.
5241 (Input_arguments::add_file): Likewise.
5242 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5243 * script.cc (Parser_closure::Parser_closure): Add script_info
5244 parameter; adjust all callers.
5245 (Parser_closure::script_info): New function.
5246 (Parser_closure::script_info_): New data member.
5247 (read_input_script): Report scripts earlier to incremental info.
5248 (script_add_file): Set script_info in Input_argument.
5249 (script_add_library): Likewise.
5250 * script.h (Script_options::Script_info): Rewrite class.
5251
5252 2011-03-29 Cary Coutant <ccoutant@google.com>
5253
5254 * archive.cc (Library_base::should_include_member): Move
5255 method here from class Archive.
5256 (Archive::Archive): Initialize base class.
5257 (Archive::should_include_member): Move to base class.
5258 (Archive::do_for_all_unused_symbols): New function.
5259 (Add_archive_symbols::run): Remove redundant access to
5260 incremental_inputs.
5261 (Lib_group::Lib_group): Initialize base class.
5262 (Lib_group::do_filename): New function.
5263 (Lib_group::include_member): Pass pointer to Lib_group to
5264 report_object.
5265 (Lib_group::do_for_all_unused_symbols): New function.
5266 (Add_lib_group_symbols::run): Report archive information for
5267 incremental links.
5268 * archive.h (class Library_base): New base class.
5269 (class Archive): Derive from Library_base.
5270 (Archive::filename): Move to base class.
5271 (Archive::set_incremental_info): Likewise.
5272 (Archive::incremental_info): Likewise.
5273 (Archive::Should_include): Likewise.
5274 (Archive::should_include_member): Likewise.
5275 (Archive::Armap_entry): Remove.
5276 (Archive::Unused_symbol_iterator): Remove.
5277 (Archive::unused_symbols_begin): Remove.
5278 (Archive::unused_symbols_end): Remove.
5279 (Archive::do_filename): New function.
5280 (Archive::do_get_mtime): New function.
5281 (Archive::do_for_all_unused_symbols): New function.
5282 (Archive::task_): Move to base class.
5283 (Archive::incremental_info_): Likewise.
5284 (class Lib_group): Derive from Library_base.
5285 (Lib_group::do_filename): New function.
5286 (Lib_group::do_get_mtime): New function.
5287 (Lib_group::do_for_all_unused_symbols): New function.
5288 (Lib_group::task_): Move to base class.
5289 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5290 function.
5291 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5292 function.
5293 * incremental.cc (Incremental_inputs::report_archive_begin):
5294 Use Library_base; call library's get_mtime; add incremental inputs
5295 entry before members.
5296 (class Unused_symbol_visitor): New class.
5297 (Incremental_inputs::report_archive_end): Use Library_base; use
5298 visitor class to record unused symbols; don't add incremental inputs
5299 entry after members.
5300 (Incremental_inputs::report_object): Use Library_base.
5301 * incremental.h
5302 (Incremental_archive_entry::Incremental_archive_entry): Remove
5303 unused Archive parameter.
5304 (Incremental_inputs::report_archive_begin): Use Library_base.
5305 (Incremental_inputs::report_archive_end): Likewise.
5306 (Incremental_inputs::report_object): Likewise.
5307 * object.cc (Sized_relobj::do_for_all_global_symbols): New
5308 function.
5309 * object.h (Object::for_all_global_symbols): New function.
5310 (Object::do_for_all_global_symbols): New function.
5311 (Sized_relobj::do_for_all_global_symbols): New function.
5312 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
5313 function.
5314 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
5315 function.
5316
5317 2011-03-27 Ian Lance Taylor <iant@google.com>
5318
5319 * archive.cc (Archive::interpret_header): Return -1 if something
5320 goes wrong. Change callers accordingly.
5321
5322 2011-03-25 Cary Coutant <ccoutant@google.com>
5323
5324 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5325 * testsuite/Makefile.in: Regenerate.
5326
5327 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
5328
5329 * plugin.cc (get_view): New.
5330 (Plugin::load): Pass get_view to the plugin.
5331 (Plugin_manager::get_view): New.
5332
5333 2011-03-21 Ian Lance Taylor <iant@google.com>
5334
5335 * testsuite/final_layout.sh: Rewrite to not use dc.
5336 * testsuite/relro_test.sh: Fail if dc is not present.
5337
5338 2011-03-21 Sriraman Tallam <tmsriram@google.com>
5339
5340 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5341 Change == to -eq.
5342 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5343 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5344 Change == to -eq.
5345 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5346 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5347
5348 2011-03-14 Ian Lance Taylor <iant@google.com>
5349
5350 * script-sections.cc (Sort_output_sections::script_compare):
5351 Rename from is_before, change return type.
5352 (Sort_output_sections::operator()): Adjust accordingly.
5353
5354 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
5355
5356 PR gold/12572
5357 * testsuite/odr_violation2.cc: Add comment to make all error line
5358 numbers double digits.
5359 * testsuite/debug_msg.sh: Adjust expected errors.
5360
5361 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
5362
5363 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5364 but mark earlier ones as non-canonical
5365 (offset_to_iterator): Update search target and example
5366 (do_addr2line): Return extra lines in a vector*
5367 (format_file_lineno): Extract from do_addr2line
5368 (one_addr2line): Add vector* out-param
5369 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5370 when a lineno entry appeared last for its instruction
5371 (Dwarf_line_info): Add vector* out-param
5372 * object.cc (Relocate_info): Pass NULL for the vector* out-param
5373 * symtab.cc (Odr_violation_compare): Include the lineno in the
5374 comparison again.
5375 (linenos_from_loc): New. Combine the canonical line for an
5376 address with its other lines.
5377 (True_if_intersect): New. Helper functor to make
5378 std::set_intersection a query.
5379 (detect_odr_violations): Compare sets of lines instead of just
5380 one line for each function. This became less deterministic, but
5381 has fewer false positives.
5382 * symtab.h: Declarations.
5383 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5384 mix an optimized and non-optimized object in the same binary
5385 (odr_violation2.so): Same.
5386 * testsuite/Makefile.in: Regenerate from Makefile.am.
5387 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5388 * testsuite/debug_msg.sh: Update line numbers and add
5389 assertions.
5390 * testsuite/odr_violation1.cc: Use OdrDerived, in a
5391 non-optimized context.
5392 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5393 isn't inlined, and use OdrDerived in an optimized context.
5394 * testsuite/odr_header1.h: Defines OdrDerived, where
5395 optimization will change the
5396 first-instruction-in-the-destructor's file and line number.
5397 * testsuite/odr_header2.h: Defines OdrBase.
5398
5399 2011-03-09 Ian Lance Taylor <iant@google.com>
5400
5401 * fileread.cc (File_read::clear_views): Don't delete the whole
5402 file view.
5403
5404 2011-03-08 Ian Lance Taylor <iant@google.com>
5405
5406 PR gold/12525
5407 * fileread.cc: #include <climits>.
5408 (GOLD_IOV_MAX): Define.
5409 (File_read::read_multiple): Limit number of entries by iov_max.
5410 * fileread.h (class File_read): Always set max_readv_entries to
5411 128.
5412
5413 2011-03-07 Ian Lance Taylor <iant@google.com>
5414
5415 PR gold/12525
5416 * options.h (class General_options): Add -dy and -dn.
5417
5418 2011-03-02 Cary Coutant <ccoutant@google.com>
5419
5420 * testsuite/script_test_9.t: Add TLS segment.
5421
5422 2011-03-02 Simon Baldwin <simonb@google.com>
5423
5424 * configure.ac: Add check for gnu_indirect_function support in
5425 the toolchain building binutils.
5426 * configure: Rebuild.
5427
5428 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
5429
5430 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5431 plugin only symbols.
5432 (Symbol_table::sized_finalize_symbol) Mark symbol only present
5433 in plugin files as not needed in the symbol table.
5434
5435 2011-02-11 Sriraman Tallam <tmsriram@google.com>
5436
5437 * output.cc (Output_section::add_input_section): Delay fill
5438 generation for section ordering.
5439
5440 2011-02-09 Ian Lance Taylor <iant@google.com>
5441
5442 PR gold/12316
5443 * object.h (class Sized_relobj): Remove clear_local_symbols.
5444 * reloc.cc (Sized_relobj::do_relocate): Don't call
5445 clear_local_symbols.
5446
5447 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
5448
5449 * plugin.cc (is_visible_from_outside): Return true for symbols
5450 in the -u option.
5451
5452 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
5453
5454 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5455 filename.
5456
5457 2011-02-02 Sriraman Tallam <tmsriram@google.com>
5458
5459 * icf.h (is_section_foldable_candidate): Change type of parameter
5460 to std::string.
5461 * icf.cc (Icf::find_identical_sections): Change type of local variable
5462 section_name to be std::string.
5463 (is_function_ctor_or_dtor): Change type of parameter to std::string.
5464
5465 2011-01-25 Ian Lance Taylor <iant@google.com>
5466
5467 * script.cc (script_add_extern): Rewrite to use
5468 add_symbol_reference.
5469
5470 2011-01-25 Doug Kwan <dougkwan@google.com>
5471
5472 * icf.cc (get_section_contents): Always lock section's object.
5473
5474 2011-01-24 Ian Lance Taylor <iant@google.com>
5475
5476 * options.h (class General_options): Accept
5477 --no-detect-odr-violations.
5478
5479 2011-01-24 Ian Lance Taylor <iant@google.com>
5480
5481 * version.cc (version_string): Bump to 1.11.
5482
5483 2011-01-24 Ian Lance Taylor <iant@google.com>
5484
5485 * plugin.cc (class Plugin_rescan): Define new class.
5486 (Plugin_manager::claim_file): Set any_claimed_.
5487 (Plugin_manager::save_archive): New function.
5488 (Plugin_manager::save_input_group): New function.
5489 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5490 necessary.
5491 (Plugin_manager::new_undefined_symbol): New function.
5492 (Plugin_manager::rescan): New function.
5493 (Plugin_manager::rescannable_defines): New function.
5494 (Plugin_manager::add_input_file): Set any_added_.
5495 * plugin.h (class Plugin_manager): define new fields rescannable_,
5496 undefined_symbols_, any_claimed_, and any_added_. Declare
5497 Plugin_rescan as friend. Declare new functions.
5498 (Plugin_manager::Rescannable): Define type.
5499 (Plugin_manager::Rescannable_list): Define type.
5500 (Plugin_manager::Undefined_symbol_list): Define type.
5501 (Plugin_manager::Plugin_manager): Initialize new fields.
5502 * archive.cc (Archive::defines_symbol): New function.
5503 (Add_archive_symbols::run): Pass archive to plugins if any.
5504 * archive.h (class Archive): Declare defines_symbol.
5505 * readsyms.cc (Input_group::~Input_group): New function.
5506 (Finish_group::run): Pass input_group to plugins if any.
5507 * readsyms.h (class Input_group): Declare destructor.
5508 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5509 any.
5510
5511 2011-01-10 Ian Lance Taylor <iant@google.com>
5512
5513 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5514 section as relro.
5515 (Layout::set_segment_offsets): Reset increase_relro before calling
5516 set_section_addresses a second time.
5517
5518 2011-01-04 Cary Coutant <ccoutant@google.com>
5519
5520 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5521 sections before NOBITS sections.
5522
5523 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
5524
5525 * version.cc (print_version): Update copyright to 2011.
5526
5527 2010-12-23 Cary Coutant <ccoutant@google.com>
5528
5529 * output.h (Output_data_reloc::add_output_section): Pass OD instead
5530 of OS to this->add. Add OD parameter to second form of the function.
5531
5532 2010-12-20 Ian Lance Taylor <iant@google.com>
5533
5534 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5535 second of two consecutive entries with same offset.
5536
5537 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5538
5539 * testsuite/Makefile.am (ifuncmain2static_LDADD)
5540 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5541 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5542 to avoid unneeded links against $(LDADD).
5543 * testsuite/Makefile.in: Regenerate.
5544
5545 2010-12-15 Ian Lance Taylor <iant@google.com>
5546
5547 PR gold/12324
5548 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5549 for R_X86_64_32 and R_X86_64_PC32.
5550 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5551 ver_matching_def_pic.o.
5552 (ver_matching_def_pic.o): New target.
5553
5554 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5555
5556 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5557 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5558 Move definition before File_read::View member definitions.
5559 (File_read::View::~View): Initialize and hold lock before
5560 updating current_mapped_bytes.
5561
5562 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5563
5564 * dwarf_reader.cc: Remove outdated comment.
5565 * gold-threads.cc: Fix typo in error message.
5566 * archive.cc: Fix typos in comments.
5567 * archive.h: Likewise.
5568 * arm-reloc-property.cc: Likewise.
5569 * arm-reloc-property.h: Likewise.
5570 * arm-reloc.def: Likewise.
5571 * arm.cc: Likewise.
5572 * attributes.h: Likewise.
5573 * cref.cc: Likewise.
5574 * ehframe.cc: Likewise.
5575 * fileread.h: Likewise.
5576 * gold.h: Likewise.
5577 * i386.cc: Likewise.
5578 * icf.cc: Likewise.
5579 * incremental.h: Likewise.
5580 * int_encoding.cc: Likewise.
5581 * layout.h: Likewise.
5582 * main.cc: Likewise.
5583 * merge.h: Likewise.
5584 * object.cc: Likewise.
5585 * object.h: Likewise.
5586 * options.cc: Likewise.
5587 * readsyms.cc: Likewise.
5588 * reduced_debug_output.cc: Likewise.
5589 * reloc.cc: Likewise.
5590 * script-sections.cc: Likewise.
5591 * sparc.cc: Likewise.
5592 * symtab.h: Likewise.
5593 * target-reloc.h: Likewise.
5594 * target.cc: Likewise.
5595 * target.h: Likewise.
5596 * timer.cc: Likewise.
5597 * timer.h: Likewise.
5598 * x86_64.cc: Likewise.
5599
5600 2010-12-09 Cary Coutant <ccoutant@google.com>
5601
5602 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5603 stack.
5604 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5605 parameter; change all callers.
5606 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5607 * options.h (warn_execstack): New option.
5608
5609 2010-12-07 Doug Kwan <dougkwan@google.com>
5610
5611 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5612 like function call relocations.
5613
5614 2010-12-07 Ian Lance Taylor <iant@google.com>
5615
5616 * archive.cc (Archive::get_elf_object_for_member): Permit
5617 punconfigured to be NULL.
5618 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5619 (Archive::include_member): Pass NULL to get_elf_object_for_member
5620 if we searched for the archive and this is the first included
5621 object.
5622
5623 2010-12-01 Ian Lance Taylor <iant@google.com>
5624
5625 * dwarf_reader.h (class Sized_dwarf_line_info): Add
5626 track_relocs_type_ field.
5627 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5628 Set track_relocs_type_.
5629 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5630 contents when using RELA relocs.
5631 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5632 reloc_map_.
5633 * reloc.cc (Track_relocs::next_addend): New function.
5634 * reloc.h (class Track_relocs): Declare next_addend.
5635
5636 2010-12-01 Ian Lance Taylor <iant@google.com>
5637
5638 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5639 virtual destructor.
5640
5641 2010-12-01 Ian Lance Taylor <iant@google.com>
5642
5643 * README: Update compilers known to work and fail.
5644
5645 2010-11-23 Matthias Klose <doko@ubuntu.com>
5646
5647 * configure.in: For --enable-gold, handle value `default' instead of
5648 `both*'. Always install ld as ld.bfd, install as ld if gold is
5649 not the default.
5650 * configure: Regenerate.
5651
5652 2010-11-18 Doug Kwan <dougkwan@google.com>
5653
5654 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5655 and right_alignment to be zero. Store result alignment only if it is
5656 greater than existing alignment.
5657
5658 2010-11-16 Cary Coutant <ccoutant@google.com>
5659
5660 PR gold/12220
5661 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5662 Check for ".zdebug_line".
5663
5664 2010-11-16 Doug Kwan <dougkwan@google.com>
5665 Cary Coutant <ccoutant@google.com>
5666
5667 * output.h (Output_segment::set_section_addresses): Pass increase_relro
5668 by reference; adjust all callers.
5669 * output.cc (Output_segment::set_section_addresses): Adjust references
5670 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5671 list is empty.
5672 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5673 end at page boundary.
5674
5675 2010-11-16 Cary Coutant <ccoutant@google.com>
5676
5677 PR gold/12220
5678 * layout.cc (Layout::choose_output_section): Transform names of
5679 compressed sections even when using a script with a SECTIONS clause.
5680 (Layout::output_section_name): Remove code to transform
5681 compressed debug section names.
5682 * output.cc (Output_section::add_input_section): Use uncompressed
5683 section size when tracking input sections.
5684
5685 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
5686
5687 * symtab.h (Symbol::NON_PIC_REF): Remove.
5688 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5689 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
5690 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5691 (Symbol::use_plt_offset): Take a flags argument and pass it
5692 directly to needs_dynamic_reloc. Restrict check for undefined
5693 weak symbols to function calls.
5694 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5695 (Target_arm::Scan::global): Use it.
5696 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5697 (Target_arm::Relocate::relocate): Likewise.
5698 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5699 parameter with an r_type parameter. Use get_reference_flags
5700 to get the flags.
5701 (Target_arm::Relocate::relocate): Update accordingly.
5702 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5703 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5704 (Target_i386::Scan::global): Likewise.
5705 (Target_i386::Relocate::relocate): Likewise.
5706 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5707 parameter with an r_type parameter. Use get_reference_flags
5708 to get the flags.
5709 (Target_i386::Relocate::relocate): Update accordingly.
5710 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5711 (Target_powerpc::Scan::global): Use it.
5712 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5713 (Target_powerpc::Relocate::relocate): Likewise.
5714 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5715 (Target_sparc::Scan::global): Use it.
5716 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5717 (Target_sparc::Relocate::relocate): Likewise.
5718 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5719 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5720 (Target_x86_64::Scan::global): Likewise.
5721 (Target_x86_64::Relocate::relocate): Likewise.
5722
5723 2010-11-08 Doug Kwan <dougkwan@google.com>
5724 Cary Coutant <ccoutant@google.com>
5725
5726 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5727 (Arm_exidx_merge_section::section_contents_): New data member.
5728 (Arm_input_section::Arm_input_section): Initialize original_contents_.
5729 (Arm_input_section::~Arm_input_section): De-allocate memory.
5730 (Arm_input_section::original_contents_): New data member.
5731 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5732 in parameters instead of calling Object::section_contents without
5733 locking.
5734 (Arm_output_section::group_section): New parameter TASK. Pass it
5735 to callees that need locking objects.
5736 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
5737 to lock EXIDX input sections. Fix a formatting issue. Call
5738 Arm_exidx_merged_section::build_contents to create merged section
5739 contents.
5740 (Arm_output_section::create_stub_group): New parameter TASK. Use it
5741 to lock object of stub table owner.
5742 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5743 TEXT_SIZE to initialize data member TEXT_SIZE_.
5744 (Arm_exidx_input_section::addralign): Fix typo in comment.
5745 (Arm_exidx_input_section::text_size): New method.
5746 (Target_arm::do_relax): New parameter TASK. Pass it to callees
5747 that require locking objects. Lock objects before scanning for stubs
5748 and updating local symbols.
5749 (Arm_input_section<big_endian>::init): Copy contents of original
5750 input section.
5751 (Arm_input_section<big_endian>::do_write): Use saved contents of
5752 original input section instead of calling Object::section_contents
5753 without locking.
5754 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5755 size without calling Object::section_size().
5756 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5757 for size. Allocate a buffer for merged EXIDX entries.
5758 (Arm_exidx_merged_section::build_contents): New method.
5759 (Arm_exidx_merged_section::do_write): Move merge section contents
5760 building code to Arm_exidx_merged_section::build_contetns. Write
5761 out contetns in buffer instead of building it on the fly.
5762 (Arm_relobj::make_exidx_input_section): Also pass text section size
5763 to Arm_exidx_input_section constructor.
5764 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
5765 (Arm_dynobj::do_read_symbols): Fix memory leak.
5766 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5767 * target.h: (class Task): Add forward declaration.
5768 (Target::relax): Add new parameter TASK and pass it to
5769 Target::do_relax().
5770 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
5771
5772 2010-11-05 Cary Coutant <ccoutant@google.com>
5773
5774 PR gold/10708
5775 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5776 object when reading from the file.
5777 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5778 second layout pass.
5779 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5780 when reading section contents.
5781 (get_section_contents): Likewise.
5782 (icf::find_identical_sections): Likewise.
5783 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5784 object when reading from the file.
5785 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5786 the object when doing deferred section layout.
5787
5788 2010-11-03 Nick Clifton <nickc@redhat.com>
5789
5790 PR gold/12001
5791 * script.h (class Symbol_assignment: name): New member. Returns
5792 the name of the symbol.
5793 * scrfipt.cc (Script_options::is_pending_assignment): New member.
5794 Returns true if the given symbol name is on the list of
5795 assignments wating to be processed.
5796 * archive.cc (should_incldue_member): If the symbol is undefined,
5797 check to see if it is on the list of symbols pending assignment.
5798
5799 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
5800
5801 * script-sections.cc (Script_sections::find_memory_region): Check
5802 for a NULL output section pointer.
5803
5804 2010-10-29 Doug Kwan <dougkwan@google.com>
5805
5806 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5807 Output_section::add_relaxed_input_section.
5808 * output.cc (Output_section::add_relaxed_input_section): Add new
5809 arguments LAYOUT and NAME. Set section order index.
5810 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5811 Copy section order index.
5812 * output.h (Output_section::add_relaxed_input_section): Add new
5813 arguments LAYOUT and NAME.
5814
5815 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5816
5817 * testsuite/Makefile.am: Move gcctestdir/ld rule to
5818 NATIVE_OR_CROSS_LINKER.
5819 * testsuite/Makefile.in: Regenerate.
5820
5821 2010-10-20 Doug Kwan <dougkwan@google.com>
5822
5823 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5824 without SHF_LINK_ORDER flags.
5825 * layout.cc (Layout::choose_output_section): Do not filter
5826 SHF_LINK_ORDER flag in a relocatable link.
5827
5828 2010-10-17 Cary Coutant <ccoutant@google.com>
5829
5830 * output.h (Output_segment::set_section_addresses): Change function
5831 signature. Update all callers.
5832 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5833 sections.
5834 (Output_segment::set_section_addresses): Align after last TLS
5835 section. Add padding before last relro section instead of after.
5836
5837 2010-10-17 Doug Kwan <dougkwan@google.com>
5838
5839 * gold/arm.cc (Target_arm::got_section): Use correct order and set
5840 GOT output section to be writable.
5841
5842 2010-10-14 Cary Coutant <ccoutant@google.com>
5843
5844 * debug.h (DEBUG_INCREMENTAL): New flag.
5845 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5846 * gold.cc (queue_initial_tasks): Check parameters for incremental link
5847 mode.
5848 * incremental.cc (report_command_line): Ignore all forms of
5849 --incremental.
5850 * layout.cc (Layout::Layout): Check parameters for incremental link
5851 mode.
5852 * options.cc (General_options::parse_incremental): New function.
5853 (General_options::parse_no_incremental): New function.
5854 (General_options::parse_incremental_full): New function.
5855 (General_options::parse_incremental_update): New function.
5856 (General_options::incremental_mode_): New data member.
5857 (General_options::finalize): Check incremental_mode_.
5858 * options.h (General_options): Update help text for --incremental.
5859 Add --no-incremental, --incremental-full, --incremental-update.
5860 (General_options::Incremental_mode): New enum type.
5861 (General_options::incremental_mode): New function.
5862 (General_options::incremental_mode_): New data member.
5863 * parameters.cc (Parameters::incremental_mode_): New data member.
5864 (Parameters::set_options): Set incremental_mode_.
5865 (Parameters::set_incremental_full): New function.
5866 (Parameters::incremental): New function.
5867 (Parameters::incremental_update): New function.
5868 (set_parameters_incremental_full): New function.
5869 * parameters.h (Parameters::set_incremental_full): New function.
5870 (Parameters::incremental): New function.
5871 (Parameters::incremental_update): New function.
5872 (Parameters::incremental_mode_): New data member.
5873 (set_parameters_incremental_full): New function.
5874 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5875 incremental link mode.
5876 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5877 (Sized_relobj::do_relocate_sections): Likewise.
5878 * testsuite/Makefile.am (incremental_test): Use --incremental-full
5879 option.
5880 * testsuite/Makefile.in: Regenerate.
5881 * testsuite/incremental_test.sh: Filter all forms of --incremental.
5882
5883 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5884
5885 * script-sections.h (class Script_sections): Make
5886 Sections_elements typedef public.
5887 * script-sections.cc (class Sort_output_sections): Add elements_
5888 field. Add constructor which sets it; change all callers.
5889 (Sort_output_sections::is_before): New function.
5890 (Sort_output_sections::operator()): Call is_before.
5891 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5892 conditional.
5893 * testsuite/script_test_10.sh: New test. Test script section
5894 order.
5895 * testsuite/script_test_10.t: Likewise.
5896 * testsuite/script_test_10.s: Likewise.
5897 * testsuite/Makefile.am: Wrap the cross linker tests and the
5898 common tests into NATIVE_OR_CROSS_LINKER.
5899 (check_SCRIPTS): Add script_test_10.sh.
5900 (check_DATA): Add script_test_10.stdout.
5901 (script_test_10.o, script_test_10): New targets.
5902 (script_test_10.stdout): New target.
5903 * configure, testsuite/Makefile.in: Regenerate.
5904
5905 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5906
5907 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5908 error for the deprecated relocations.
5909 (Target_arm::Scan::global): Likewise.
5910 (Target_arm::Relocate::relocate): Likewise.
5911
5912 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
5913
5914 * fileread.cc (Input_file::find_file): Initialize *found_name
5915 and *namep when using the fallback search for case 4.
5916
5917 2010-10-11 Cary Coutant <ccoutant@google.com>
5918
5919 * options.h (class General_options): Redefine -z lazy as an alias for
5920 the negation of -z now.
5921
5922 2010-10-11 Ian Lance Taylor <iant@google.com>
5923
5924 * resolve.cc (symbol_to_bits): Report the value of the unsupported
5925 binding.
5926
5927 2010-10-06 Nick Clifton <nickc@redhat.com>
5928
5929 * script-sections.cc(class Memory_region): Remove
5930 current_lma_offset_ field. Rename current_vma_offset_ to
5931 current_offset_. Add last_section_ field.
5932 (Memory_region::get_current_vma_address): Rename to
5933 get_current_address.
5934 (Memory_region::get_current_lma_address): Delete.
5935 (Memory_region::increment_vma_offset): Rename to
5936 increment_offset.
5937 (Memory_region::increment_lma_offset): Delete.
5938 (Memory_region::attributes_compatible): New method. Returns
5939 true if the provided section is compatible with the region.
5940 (Memory_region::get_last_section): New method. Returns the last
5941 section to use the region.
5942 (Memory_region::set_last_section): New method. Stores the last
5943 section to use the region.
5944 (Script_sections::block_in_region): New method. Returns true if
5945 a block of memory is contained within a region.
5946 (Script_sections::find_memory_region): New method. Locates a
5947 memory region to be used to set a VMA or LMA address.
5948 (Output_section_definition::set_section_addresses): Add code to
5949 check for addresses set by memory regions.
5950 (Output_segment::set_section_addresses): Remove memory region
5951 walking code.
5952 (Script_sections::create_segment): Add a warning if a header
5953 segment is created outside of any region.
5954 * script-sections.h (class Script_sections): Add prototypes for
5955 find_memory_region and block_in_region methods.
5956 * testsuite/memory_test.s: Use .long instead of .word.
5957 * testsuite/memory_test.t: Add some more output sections.
5958 * testsuite/memory_test.sh: Update expected output.
5959
5960 2010-10-02 Doug Kwan <dougkwan@google.com>
5961
5962 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5963 defintion to symtab.h
5964 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5965 declaration to defintion.
5966
5967 2010-10-01 Nick Clifton <nickc@redhat.com>
5968
5969 * expression.cc (eval): Replace dummy argument with NULL.
5970 (eval_maybe_dot): Check for a NULL result section pointer.
5971 (Symbol_expression::value): Likewise.
5972 (Dot_expression::value): Likewise.
5973 (BINARY_EXPRESSION): Likewise.
5974 (Max_expression::value): Likewise.
5975 (Min_expression::value): Likewise.
5976 (Absolute_expression::value): Likewise.
5977 (Addr_expression::value_from_output_section): Likewise.
5978 (Loaddddr_expression::value_from_output_section): Likewise.
5979 (Segment_start_expression::value): Likewise.
5980 * script-sections.cc
5981 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5982 argument with NULL.
5983 (Sections_elememt_dot_assignment::set_section_addresses):
5984 Likewise.
5985 (Output_data_expression::do_write_to_buffer): Likewise.
5986 (Output_section_definition::finalize_symbols): Likewise.
5987 (Output_section_definition::set_section_addresses): Likewise.
5988
5989 2010-09-30 Doug Kwan <dougkwan@google.com>
5990
5991 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5992
5993 2010-09-28 Sriraman Tallam <tmsriram@google.com>
5994
5995 * target.h (Target::can_icf_inline_merge_sections): New virtual
5996 function.
5997 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5998 virtual function.
5999 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6000 virtual function.
6001 * icf.cc (get_section_contents): Inline merge sections only when
6002 target allows it.
6003
6004 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6005
6006 * configure: Regenerate.
6007
6008 2010-09-17 Ian Lance Taylor <iant@google.com>
6009
6010 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6011 * testsuite/Makefile.am (memory_test.o): New target.
6012 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6013 memory_test.t.
6014 * testsuite/Makefile.in: Rebuild.
6015
6016 2010-09-17 Doug Kwan <dougkwan@google.com>
6017
6018 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6019 defintion if relocation uses GOT entries of the symbol.
6020 * testsuite/icf_safe_test.sh: Fix test.
6021 * testsuite/icf_safe_so_test.sh: Fix test.
6022
6023 2010-09-16 Cary Coutant <ccoutant@google.com>
6024
6025 * script_sections.cc (class Memory_region): Remove "NULL" from
6026 vector initializations.
6027
6028 2010-09-15 Cary Coutant <ccoutant@google.com>
6029
6030 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6031 Resolve forwarding symbols.
6032
6033 2010-09-15 Doug Kwan <dougkwan@google.com>
6034
6035 * gold/testsuite/script_test_3.t: Add ARM special sections.
6036 * gold/testsuite/script_test_4.t: Same.
6037 * gold/testsuite/script_test_5.t: Same.
6038 * gold/testsuite/script_test_6.t: Same.
6039 * gold/testsuite/script_test_7.t: Same.
6040 * gold/testsuite/script_test_7.t: Same.
6041 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6042
6043 2010-09-14 Cary Coutant <ccoutant@google.com>
6044
6045 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6046 (Target_x86_64::Relocate::relocate_tls): Replace check for
6047 saw_tls_block_reloc_ with test for executable section.
6048
6049 2010-09-12 Cary Coutant <ccoutant@google.com>
6050
6051 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6052 position-independent executables to shared libraries need dynamic
6053 relocations.
6054 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6055 position-independent executables.
6056 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6057 * testsuite/Makefile.in: Regenerate.
6058
6059 2010-09-10 Nick Clifton <nickc@redhat.com>
6060
6061 PR gold/11997
6062 * testsuite/memory_test.t: Discard any sections that are not
6063 needed.
6064
6065 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
6066
6067 PR gold/11996
6068 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6069 "This::" to work around a bug in gcc 4.2.
6070
6071 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6072
6073 2010-09-09 Rafael Espindola <espindola@google.com>
6074
6075 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6076 sections with different PF_X flags in the same segment.
6077 (Layout::find_first_load_seg): Search all segments to find the first
6078 one.
6079 * options.h (rosegment): New.
6080
6081 2010-09-08 Rafael Espindola <espindola@google.com>
6082
6083 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6084
6085 2010-09-08 Doug Kwan <dougkwan@google.com>
6086
6087 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6088 (Arm_relobj::do_relocate_sections): Add new parameter for output
6089 file to match the parent.
6090 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6091 of local symbols instead of input values. Update code to track
6092 changes in gold::relocate_section.
6093 * object.cc (Sized_relobj::compute_final_local_value): New methods.
6094 (Sized_relobj::compute_final_local_value_internal): New methods.
6095 (Sized_relobj::do_finalize_local_symbols): Move code from loop
6096 body into private version of Sized_relobj::compute_final_local_value.
6097 Call the inline method.
6098 * object.h (Symbol_value::Symbol_value): Define destructor. Free
6099 merged symbol value if there is one.
6100 (Symbol_value::has_output_value): New method defintiion.
6101 (Sized_relobj::Compute_final_local_value_status): New enum type.
6102 (Sized_relobj::compute_final_local_value): New methods.
6103 (Sized_relobj::compute_final_local_value_internal): New methods.
6104 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6105 and arm_cortex_a8.sh.
6106 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6107 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6108 New tests.
6109 * Makefile.in: Regenerate.
6110 * testsuite/arm_bl_out_of_range.s: Update test.
6111 * testsuite/thumb_bl_out_of_range.s: Ditto.
6112 * testsuite/thumb_blx_out_of_range.s: Ditto.
6113 * testsuite/arm_branch_out_of_range.sh: New file.
6114 * testsuite/arm_cortex_a8.sh: Ditto.
6115 * testsuite/arm_cortex_a8_b.s: Ditto.
6116 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6117 * testsuite/arm_cortex_a8_b_local.s: Ditto.
6118 * testsuite/arm_cortex_a8_bl.s: Ditto.
6119 * testsuite/arm_cortex_a8_blx.s: Ditto.
6120 * testsuite/arm_cortex_a8_local.s: Ditto.
6121 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6122 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6123
6124 2010-09-08 Rafael Espindola <espindola@google.com>
6125
6126 * Makefile.am (memory_test.stdout): Run readelf with -W.
6127 * Makefile.in: Regenerate.
6128 * testsuite/memory_test.sh: Make the regexps accept both 32 and
6129 64 bit output.
6130
6131 2010-09-08 Rafael Espindola <espindola@google.com>
6132
6133 * script-sections.cc (Script_sections::add_memory_region): Convert
6134 field precision to int.
6135 * script.cc (script_set_section_region, script_set_section_region):
6136 Convert field precision to int.
6137
6138 2010-09-08 Rafael Espindola <espindola@google.com>
6139
6140 * arm.cc (do_finalize_sections): Create the __exidx_start and
6141 __exdix_end symbols even when the section is missing.
6142
6143 2010-09-08 Nick Clifton <nickc@redhat.com>
6144
6145 * README: Remove claim that MEMORY is not supported.
6146 * expression.cc (script_exp_function_origin)
6147 (script_exp_function_length): Move from here to ...
6148 * script.cc: ... here.
6149 (script_set_section_region, script_add_memory)
6150 (script_parse_memory_attr, script_include_directive): New
6151 functions.
6152 * script-sections.cc
6153 (class Memory_region): New class.
6154 (class Output_section_definition): Add set_memory_region,
6155 set_section_vma, set_section_lma and get_section_name methods.
6156 (class Script_Sections): Add add_memory_region,
6157 find_memory_region, find_memory_region_origin,
6158 find_memory_region_length and set_memory_region methods.
6159 Have set_section_addresses method walk the list of set memory
6160 regions.
6161 Extend the print methos to display memory regions.
6162 * script-sections.h: Add prototypes for new methods.
6163 Add enum for MEMORY region attributes.
6164 * yyscript.y: Add support for parsing MEMORY regions.
6165 * script-c.h: Add prototypes for new functions.
6166 * testsuite/Makefile.am: Add test of MEMORY region functionality.
6167 * testsuite/Makefile.in: Regenerate.
6168 * testsuite/memory_test.sh: New script.
6169 * testsuite/memory_test.s: New assembler source file.
6170 * testsuite/memory_test.t: New linker script.
6171
6172 2010-08-27 Doug Kwan <dougkwan@google.com>
6173
6174 * gold/resolve.cc (Symbol_table::should_override): Let a weak
6175 reference override an existing dynamic weak reference.
6176 * testsuite/Makefile.am: Add new test dyn_weak_ref.
6177 * testsuite/Makefile.in: Regenerate.
6178 * testsuite/dyn_weak_ref.sh: New file.
6179 * testsuite/dyn_weak_ref_1.c: Ditto.
6180 * testsuite/dyn_weak_ref_2.c: Ditto.
6181
6182 2010-08-27 Ian Lance Taylor <iant@google.com>
6183
6184 * incremental.h (class Incremental_input_entry): Add virtual
6185 destructor.
6186
6187 2010-08-27 Ian Lance Taylor <iant@google.com>
6188
6189 * testsuite/start_lib_test_3.c: Mark t3 as used.
6190
6191 2010-08-27 Nick Clifton <nickc@redhat.com>
6192
6193 * options.cc (version_script): Fix small typo in previous
6194 whitespace tidyup.
6195
6196 2010-08-25 Nick Clifton <nickc@redhat.com>
6197
6198 * archive.cc: Formatting fixes: Remove whitespace between
6199 typename and following asterisk. Remove whitespace between
6200 function name and opening parenthesis.
6201 * archive.h: Likewise.
6202 * arm.cc: Likewise.
6203 * attributes.cc: Likewise.
6204 * attributes.h: Likewise.
6205 * common.cc: Likewise.
6206 * copy-relocs.cc: Likewise.
6207 * dirsearch.h: Likewise.
6208 * dynobj.cc: Likewise.
6209 * ehframe.cc: Likewise.
6210 * ehframe.h: Likewise.
6211 * expression.cc: Likewise.
6212 * fileread.cc: Likewise.
6213 * fileread.h: Likewise.
6214 * gc.h: Likewise.
6215 * gold-threads.cc: Likewise.
6216 * gold.cc: Likewise.
6217 * i386.cc: Likewise.
6218 * icf.h: Likewise.
6219 * incremental-dump.cc: Likewise.
6220 * incremental.cc: Likewise.
6221 * layout.cc: Likewise.
6222 * layout.h: Likewise.
6223 * main.cc: Likewise.
6224 * merge.cc: Likewise.
6225 * merge.h: Likewise.
6226 * object.cc: Likewise.
6227 * object.h: Likewise.
6228 * options.cc: Likewise.
6229 * options.h: Likewise.
6230 * output.cc: Likewise.
6231 * output.h: Likewise.
6232 * plugin.cc: Likewise.
6233 * plugin.h: Likewise.
6234 * powerpc.cc: Likewise.
6235 * reloc.cc: Likewise.
6236 * script-c.h: Likewise.
6237 * script-sections.cc: Likewise.
6238 * script.cc: Likewise.
6239 * stringpool.cc: Likewise.
6240 * symtab.cc: Likewise.
6241 * symtab.h: Likewise.
6242 * target.cc: Likewise.
6243 * timer.cc: Likewise.
6244 * timer.h: Likewise.
6245 * version.cc: Likewise.
6246 * x86_64.cc: Likewise.
6247
6248 2010-08-24 Nick Clifton <nickc@redhat.com>
6249
6250 PR 11899
6251 * layout.cc (segment_precedes): Sort segments by their physical
6252 addresses, if they have been set.
6253
6254 2010-08-23 Cary Coutant <ccoutant@google.com>
6255
6256 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6257 symbols data.
6258 (Lib_group::include_member): Unlock object after deleting its
6259 symbols data.
6260 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6261 the bug fixed here.
6262
6263 2010-08-19 Neil Vachharajani <nvachhar@google.com>
6264 Cary Coutant <ccoutant@google.com>
6265
6266 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6267 constructor, and set_blocker.
6268 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6269 readsyms_blocker_.
6270 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6271 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6272 * testsuite/Makefile.am (start_lib_test): New test case.
6273 * testsuite/Makefile.in: Regenerate.
6274 * testsuite/start_lib_test_main.c: New file.
6275 * testsuite/start_lib_test_1.c: New file.
6276 * testsuite/start_lib_test_2.c: New file.
6277 * testsuite/start_lib_test_3.c: New file.
6278
6279 2010-08-19 Ian Lance Taylor <iant@google.com>
6280
6281 * Makefile.in: Rebuild with automake 1.11.1.
6282 * aclocal.m4: Likewise.
6283 * testsuite/Makefile.in: Likewise.
6284
6285 2010-08-19 Ian Lance Taylor <iant@google.com>
6286
6287 PR 10893
6288 * i386.cc (class Output_data_plt_i386): Update declarations.
6289 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
6290 local_ifuncs_ fields.
6291 (Target_i386::do_plt_section_for_global): New function.
6292 (Target_i386::do_plt_section_for_local): New function.
6293 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6294 parameter; change all callers. Initialize global_ifuncs_ and
6295 local_ifuncs_. If doing a static link define __rel_iplt_start and
6296 __rel_iplt_end.
6297 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6298 (Output_data_plt_i386::add_local_ifunc_entry): New function.
6299 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6300 symbols.
6301 (Target_i386::make_plt_section): New function, broken out of
6302 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
6303 (Target_i386::make_plt_entry): Call make_plt_section.
6304 (Target_i386::make_local_ifunc_plt_entry): New function.
6305 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6306 (Target_i386::Scan::local): Handle IFUNC symbols. Add
6307 R_386_IRELATIVE to switch.
6308 (Target_i386::Scan::global): Likewise.
6309 (Target_i386::Relocate::relocate): Likewise.
6310 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6311 switch.
6312 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6313 (Target_x86_64::do_plt_section_for_global): New function.
6314 (Target_x86_64::do_plt_section_for_local): New function.
6315 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6316 parameter; change all callers. If doing a static link define
6317 __rela_iplt_start and __rela_iplt_end.
6318 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6319 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6320 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6321 to point to .plt.
6322 (Target_x86_64::make_local_ifunc_plt_entry): New function.
6323 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6324 switch.
6325 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6326 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
6327 R_X86_64_IRELATIVE to switch.
6328 (Target_x86_64::Scan::global): Likewise.
6329 (Target_x86_64::Relocate::relocate): Likewise.
6330 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6331 switch.
6332 * target.h (class Target): Add plt_section_for_global and
6333 plt_section_for_local functions. Add do_plt_section_for_global
6334 and do_plt_section_for_local virtual functions.
6335 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
6336 clarifying comments.
6337 (Symbol::use_plt_offset): Handle IFUNC symbol.
6338 * object.cc (Sized_relobj::Sized_relobj): Initialize
6339 local_plt_offsets_.
6340 (Sized_relobj::local_has_plt_offset): New function.
6341 (Sized_relobj::local_plt_offset): New function.
6342 (Sized_relobj::set_local_plt_offset): New function.
6343 (Sized_relobj::do_count): Handle IFUNC symbol.
6344 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
6345 a bit away from input_shndx_ field. Add set_is_func_symbol and
6346 is_ifunc_symbol functions.
6347 (class Sized_relobj): Update declarations. Remove Tls_got_entry
6348 and Local_tls_got_offsets. Define Local_plt_offsets. Add
6349 local_plt_offsets_ field.
6350 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6351 * output.h (class Output_section_data): Add non-const
6352 output_section function.
6353 (class Output_data_got): Update declarations.
6354 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6355 Add use_plt_offset parameter to global and local constructors.
6356 Change all callers. Change local_sym_index_ field to 31 bits.
6357 Change GSYM_CODE and CONSTANT_CODE accordingly.
6358 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6359 doing a static link don't set sh_link field.
6360 (Output_data_got::Got_entry::write): Use PLT offset if
6361 appropriate.
6362 (Output_data_got::add_global_plt): New function.
6363 (Output_data_got::add_local_plt): New function.
6364 * target-reloc.h (relocate_section): Handle IFUNC symbol.
6365 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6366 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6367 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6368 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6369 IFUNC conditional.
6370 * testsuite/ifunc-sel.h: New file.
6371 * testsuite/ifuncmain1.c: New file.
6372 * testsuite/ifuncmain1vis.c: New file.
6373 * testsuite/ifuncmod1.c: New file.
6374 * testsuite/ifuncdep2.c: New file.
6375 * testsuite/ifuncmain2.c: New file.
6376 * testsuite/ifuncmain3.c: New file.
6377 * testsuite/ifuncmod3.c: New file.
6378 * testsuite/ifuncmain4.c: New file.
6379 * testsuite/ifuncmain5.c: New file.
6380 * testsuite/ifuncmod5.c: New file.
6381 * testsuite/ifuncmain6pie.c: New file.
6382 * testsuite/ifuncmod6.c: New file.
6383 * testsuite/ifuncmain7.c: New file.
6384 * configure, testsuite/Makefile.in: Rebuild.
6385
6386 2010-08-18 Ian Lance Taylor <iant@google.com>
6387
6388 * incremental.cc
6389 (Output_section_incremental_inputs::write_input_files): Add cast
6390 to avoid signed/unsigned comparison warning.
6391 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6392
6393 2010-08-12 Cary Coutant <ccoutant@google.com>
6394
6395 * common.cc (Sort_commons::operator()): Remove unnecessary code.
6396
6397 2010-08-13 Ian Lance Taylor <iant@google.com>
6398
6399 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6400
6401 2010-08-12 Cary Coutant <ccoutant@google.com>
6402 Doug Kwan <dougkwan@google.com>
6403
6404 * resolve.cc (Symbol_table::should_override): When a weak dynamic
6405 defintion overrides non-weak undef, remember that the original undef
6406 is not weak.
6407 * symtab.cc (Symbol_table::sized_write_global): For undef without
6408 an original weak binding, set binding to global in output.
6409 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6410 * testsuite/Makefile.in: Regenerate.
6411 * testsuite/strong_ref_weak_def.sh: New file.
6412 * testsuite/strong_ref_weak_def_1.c: Ditto.
6413 * testsuite/strong_ref_weak_def_2.c: Ditto.
6414
6415 2010-08-12 Cary Coutant <ccoutant@google.com>
6416
6417 * testsuite/incremental_test.sh: Rewrite.
6418 * testsuite/incremental_test_1.c: Rewrite.
6419 * testsuite/incremental_test_2.c: Rewrite.
6420
6421 2010-08-12 Cary Coutant <ccoutant@google.com>
6422
6423 * arm.cc (Target_arm::got_size): Add const.
6424 (Target_arm::got_entry_count): New function.
6425 (Target_arm::plt_entry_count): New function.
6426 (Target_arm::first_plt_entry_offset): New function.
6427 (Target_arm::plt_entry_size): New function.
6428 (Output_data_plt_arm::entry_count): New function.
6429 (Output_data_plt_arm::first_plt_entry_offset): New function.
6430 (Output_data_plt_arm::get_plt_entry_size): New function.
6431 * i386.cc (Target_i386::got_size): Add const.
6432 (Target_i386::got_entry_count): New function.
6433 (Target_i386::plt_entry_count): New function.
6434 (Target_i386::first_plt_entry_offset): New function.
6435 (Target_i386::plt_entry_size): New function.
6436 (Output_data_plt_i386::entry_count): New function.
6437 (Output_data_plt_i386::first_plt_entry_offset): New function.
6438 (Output_data_plt_i386::get_plt_entry_size): New function.
6439 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6440 find_incremental_inputs_sections. Dump incremental_got_plt section.
6441 * incremental.cc: Include target.h.
6442 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6443 parameter. Adjust all callers. Find incremental_got_plt section.
6444 (Incremental_inputs::create_data_sections): Create incremental_got_plt
6445 section.
6446 (Output_section_incremental_inputs::set_final_data_size): Calculate
6447 size of incremental_got_plt section.
6448 (Output_section_incremental_inputs::do_write): Write the
6449 incremental_got_plt section.
6450 (Got_plt_view_info): New struct.
6451 (Local_got_offset_visitor): New class.
6452 (Global_got_offset_visitor): New class.
6453 (Global_symbol_visitor_got_plt): New class.
6454 (Output_section_incremental_inputs::write_got_plt): New function.
6455 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6456 Add parameter. Adjust all callers.
6457 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6458 (Incremental_inputs::got_plt_section): New function.
6459 (Incremental_inputs::got_plt_section_): New data member.
6460 (Incremental_got_plt_reader): New class.
6461 * layout.cc (Layout::create_incremental_info_sections): Add the
6462 incremental_got_plt section.
6463 * object.h (Got_offset_list::get_list): New function.
6464 (Got offset_list::for_all_got_offsets): New function.
6465 (Sized_relobj::local_got_offset_list): New function.
6466 * powerpc.cc (Target_powerpc::got_size): Add const.
6467 (Target_powerpc::got_entry_count): New function.
6468 (Target_powerpc::plt_entry_count): New function.
6469 (Target_powerpc::first_plt_entry_offset): New function.
6470 (Target_powerpc::plt_entry_size): New function.
6471 (Output_data_plt_powerpc::entry_count): New function.
6472 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6473 (Output_data_plt_powerpc::get_plt_entry_size): New function.
6474 * sparc.cc (Target_sparc::got_size): Add const.
6475 (Target_sparc::got_entry_count): New function.
6476 (Target_sparc::plt_entry_count): New function.
6477 (Target_sparc::first_plt_entry_offset): New function.
6478 (Target_sparc::plt_entry_size): New function.
6479 (Output_data_plt_sparc::entry_count): New function.
6480 (Output_data_plt_sparc::first_plt_entry_offset): New function.
6481 (Output_data_plt_sparc::get_plt_entry_size): New function.
6482 * symtab.h (Symbol::got_offset_list): New function.
6483 (Symbol_table::for_all_symbols): New function.
6484 * target.h (Sized_target::got_entry_count): New function.
6485 (Sized_target::plt_entry_count): New function.
6486 (Sized_target::plt_entry_size): New function.
6487 * x86_64.cc (Target_x86_64::got_size): Add const.
6488 (Target_x86_64::got_entry_count): New function.
6489 (Target_x86_64::plt_entry_count): New function.
6490 (Target_x86_64::first_plt_entry_offset): New function.
6491 (Target_x86_64::plt_entry_size): New function.
6492 (Output_data_plt_x86_64::entry_count): New function.
6493 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6494 (Output_data_plt_x86_64::get_plt_entry_size): New function.
6495
6496 2010-08-12 Cary Coutant <ccoutant@google.com>
6497
6498 * archive.cc: Include incremental.h.
6499 (Archive::Archive): Initialize incremental_info_.
6500 (Archive::include_member): Record archive members in incremental info.
6501 (Add_archive_symbols::run): Record begin and end of an archive in
6502 incremental info.
6503 (Lib_group::include_member): Record objects in incremental info.
6504 * archive.h (Incremental_archive_entry): Forward declaration.
6505 (Archive::set_incremental_info): New member function.
6506 (Archive::incremental_info): New member function.
6507 (Archive::Unused_symbol_iterator): New class.
6508 (Archive::unused_symbols_begin): New member function.
6509 (Archive::unused_symbols_end): New member function.
6510 (Archive::incremental_info_): New data member.
6511 * incremental-dump.cc (find_input_containing_global): New function.
6512 (dump_incremental_inputs): Dump new incremental info sections.
6513 * incremental.cc: Include symtab.h.
6514 (Output_section_incremental_inputs): New class.
6515 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6516 new incremental info sections.
6517 (Sized_incremental_binary::do_check_inputs): Likewise.
6518 (Incremental_inputs::report_archive): Remove.
6519 (Incremental_inputs::report_archive_begin): New function.
6520 (Incremental_inputs::report_archive_end): New function.
6521 (Incremental_inputs::report_object): New function.
6522 (Incremental_inputs::finalize_inputs): Remove.
6523 (Incremental_inputs::report_input_section): New function.
6524 (Incremental_inputs::report_script): Rewrite.
6525 (Incremental_inputs::finalize): Do nothing but finalize string table.
6526 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6527 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6528 (Incremental_inputs::create_data_sections): New function.
6529 (Incremental_inputs::relocs_entsize): New function.
6530 (Output_section_incremental_inputs::set_final_data_size): New function.
6531 (Output_section_incremental_inputs::do_write): New function.
6532 (Output_section_incremental_inputs::write_header): New function.
6533 (Output_section_incremental_inputs::write_input_files): New function.
6534 (Output_section_incremental_inputs::write_info_blocks): New function.
6535 (Output_section_incremental_inputs::write_symtab): New function.
6536 * incremental.h (Incremental_script_entry): Forward declaration.
6537 (Incremental_object_entry): Forward declaration.
6538 (Incremental_archive_entry): Forward declaration.
6539 (Incremental_inputs): Forward declaration.
6540 (Incremental_inputs_header_data): Remove.
6541 (Incremental_inputs_header): Remove.
6542 (Incremental_inputs_header_write): Remove.
6543 (Incremental_inputs_entry_data): Remove.
6544 (Incremental_inputs_entry): Remove.
6545 (Incremental_inputs_entry_write): Remove.
6546 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6547 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6548 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6549 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6550 Likewise.
6551 (Incremental_input_entry): New class.
6552 (Incremental_script_entry): New class.
6553 (Incremental_object_entry): New class.
6554 (Incremental_archive_entry): New class.
6555 (Incremental_inputs::Incremental_inputs): Initialize new data members.
6556 (Incremental_inputs::report_inputs): Remove.
6557 (Incremental_inputs::report_archive): Remove.
6558 (Incremental_inputs::report_archive_begin): New function.
6559 (Incremental_inputs::report_archive_end): New function.
6560 (Incremental_inputs::report_object): Change prototype.
6561 (Incremental_inputs::report_input_section): New function.
6562 (Incremental_inputs::report_script): Change prototype.
6563 (Incremental_inputs::get_reloc_count): New function.
6564 (Incremental_inputs::set_reloc_count): New function.
6565 (Incremental_inputs::create_data_sections): New function.
6566 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6567 (Incremental_inputs::inputs_section): New function.
6568 (Incremental_inputs::symtab_section): New function.
6569 (Incremental_inputs::relocs_section): New function.
6570 (Incremental_inputs::get_stringpool): Add const.
6571 (Incremental_inputs::command_line): Add const.
6572 (Incremental_inputs::inputs): Remove.
6573 (Incremental_inputs::command_line_key): New function.
6574 (Incremental_inputs::input_file_count): New function.
6575 (Incremental_inputs::input_files): New function.
6576 (Incremental_inputs::relocs_entsize): New function.
6577 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6578 (Incremental_inputs::finalize_inputs): Remove.
6579 (Incremental_inputs::Input_info): Remove.
6580 (Incremental_inputs::lock_): Remove.
6581 (Incremental_inputs::inputs_): Change type.
6582 (Incremental_inputs::inputs_map_): Remove.
6583 (Incremental_inputs::current_object_entry_): New data member.
6584 (Incremental_inputs::inputs_section_): New data member.
6585 (Incremental_inputs::symtab_section_): New data member.
6586 (Incremental_inputs::relocs_section_): New data member.
6587 (Incremental_inputs::reloc_count_): New data member.
6588 (Incremental_inputs_reader): New class.
6589 (Incremental_symtab_reader): New class.
6590 (Incremental_relocs_reader): New class.
6591 * layout.cc (Layout::finalize): Move finalization of incremental info
6592 and creation of incremental info sections to follow finalization of
6593 symbol table. Set offsets for postprocessing sections.
6594 (Layout::create_incremental_info_sections): Call
6595 Incremental_inputs::create_data_sections. Add incremental symtab
6596 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
6597 sections to layout after input sections.
6598 * layout.h (struct Timespec): Forward declaration.
6599 (Layout::incremental_inputs): Add const.
6600 (Layout::create_incremental_info_sections): Add parameter.
6601 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6602 * object.cc: Include incremental.h.
6603 (Relobj::finalize_incremental_relocs): New function.
6604 (Sized_relobj::do_layout): Record input sections in incremental info.
6605 * object.h (Object::output_section): New function.
6606 (Object::output_section_offset): Moved from Relobj.
6607 (Object::get_incremental_reloc_base): New function.
6608 (Object::get_incremental_reloc_count): New function.
6609 (Object::do_output_section): New function.
6610 (Object::do_output_section_offset): Moved from Relobj.
6611 (Object::do_get_incremental_reloc_base): New function.
6612 (Object::do_get_incremental_reloc_count): New function.
6613 (Object::Object): Initialize new data members.
6614 (Relobj::output_section): Renamed do_output_section and moved to
6615 protected.
6616 (Relobj::output_section_offset): Moved to Object.
6617 (Relobj::do_get_incremental_reloc_base): New function.
6618 (Relobj::do_get_incremental_reloc_count): New function.
6619 (Relobj::allocate_incremental_reloc_counts): New function.
6620 (Relobj::count_incremental_reloc): New function.
6621 (Relobj::finalize_incremental_relocs): New function.
6622 (Relobj::next_incremental_reloc_index): New function.
6623 (Relobj::reloc_counts_): New data member.
6624 (Relobj::reloc_bases_): New data member.
6625 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
6626 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
6627 (Sized_relobj::incremental_relocs_scan): New function.
6628 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6629 (Sized_relobj::incremental_relocs_write): New function.
6630 (Sized_relobj::incremental_relocs_write_reltype): New function.
6631 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6632 incremental link.
6633 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6634 archives and object files elsewhere.
6635 (Add_symbols::run): Report object files here.
6636 (Finish_group::run): Report end of archive at end of group.
6637 * reloc.cc: Include layout.h, incremental.h.
6638 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6639 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6640 (Sized_relobj::incremental_relocs_scan): New function.
6641 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6642 (Sized_relobj::do_relocate_sections): Write incremental relocations.
6643 (Sized_relobj::incremental_relocs_write): New function.
6644 (Sized_relobj::incremental_relocs_write_reltype): New function.
6645 * script.cc (read_input_script): Rewrite test for incremental link.
6646 Change call to Incremental_inputs::report_script.
6647 * symtab.h (Symbol_table::first_global_index): New function.
6648 (Symbol_table::output_count): New function.
6649
6650 2010-08-12 Doug Kwan <dougkwan@google.com>
6651
6652 * arm.cc (Target_arm::merge_object_attributes): Check command line
6653 options --no-wchar-size-warning and --no-enum-size-warning.
6654 * options.h (General_options): Add ld-compatible options
6655 --no-enum-size-warning and --no-wchar-size-warning.
6656
6657 2010-08-04 Ian Lance Taylor <iant@google.com>
6658
6659 * x86_64.cc (Target_x86_64::Scan::local): Use
6660 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6661 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6662 (Target_x86_64::Scan::global): Likewise.
6663 (Target_x86_64::Relocate::relocate): Likewise.
6664 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6665 Likewise.
6666
6667 2010-08-03 Cary Coutant <ccoutant@google.com>
6668
6669 * merge.cc (Output_merge_string::do_add_input_section): Count strings
6670 to reserve space in merged_strings vector. Keep total input size
6671 for stats.
6672 (Output_merge_string::do_print_merge_stats): Print total input size.
6673 * merge.h (Output_merge_string): Add input_size_ field.
6674 * stringpool.cc (Stringpool_template::string_length): Move
6675 implementations out of Stringpool_template class and place in
6676 stringpool.h.
6677 * stringpool.h (string_length): Move out of Stringpool_template.
6678
6679 2010-08-03 Ian Lance Taylor <iant@google.com>
6680
6681 PR 11712
6682 * layout.cc (relaxation_loop_body): If address of load segment is
6683 set, adjust address to include headers if possible.
6684
6685 2010-08-03 Ian Lance Taylor <iant@google.com>
6686
6687 * version.cc (version_string): Bump to 1.10.
6688
6689 2010-08-03 Ian Lance Taylor <iant@google.com>
6690
6691 PR 11805
6692 * layout.h (enum Output_section_order): Define.
6693 (class Layout): Update declarations.
6694 * layout.cc (Layout::get_output_section): Add order parameter.
6695 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6696 is_first_non_relro parameters. Change all callers.
6697 (Layout::choose_output_section): Likewise.
6698 (Layout::add_output_section_data): Likewise.
6699 (Layout::make_output_section): Likewise. Set order.
6700 (Layout::default_section_order): New function.
6701 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6702 * output.cc (Output_section::Output_section): Initialize order_.
6703 Don't initialize deleted fields.
6704 (Output_segment::Output_segment): Don't initialize deleted
6705 fields.
6706 (Output_segment::add_output_section_to_load): New function
6707 replacing add_output_section. Change all callers to call this or
6708 add_output_section_to_nonload.
6709 (Output_segment::add_output_section_to_nonload): New function.
6710 (Output_segment::remove_output_section): Rewrite.
6711 (Output_segment::add_initial_output_data): Likewise.
6712 (Output_segment::has_any_data_sections): Likewise.
6713 (Output_segment::is_first_section_relro): Likewise.
6714 (Output_segment::maximum_alignment): Likewise.
6715 (Output_segment::has_dynamic_reloc): New function replacing
6716 dynamic_reloc_count. Change all callers.
6717 (Output_segment::has_dynamic_reloc_list): New function replacing
6718 dynamic_reloc_count_list. Change all callers.
6719 (Output_segment::set_section_addresses): Rewrite.
6720 (Output_segment::set_offset): Rewrite.
6721 (Output_segment::find_first_and_last_list): Remove.
6722 (Output_segment::set_tls_offsets): Rewrite.
6723 (Output_segment::first_section_load_address): Likewise.
6724 (Output_segment::output_section_count): Likewise.
6725 (Output_segment::section_with_lowest_load_address): Likewise.
6726 (Output_segment::write_section_headers): Likewise.
6727 (Output_segment::print_sections_to_map): Likewise.
6728 * output.h (class Output_data): Remove dynamic_reloc_count_
6729 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
6730 (Output_data::add_dynamic_reloc): Rewrite.
6731 (Output_data::has_dynamic_reloc): New function.
6732 (Output_data::dynamic_reloc_count): Remove.
6733 (class Output_section): Add order_ field. Remvoe is_relro_local_,
6734 is_last_relro_, is_first_non_relro_, is_interp_,
6735 is_dynamic_linker_section_ fields. Add order and set_order
6736 functions. Remove is_relro_local, set_is_relro_local,
6737 is_last_relro, set_is_last_relro, is_first_non_relro,
6738 set_is_first_non_relro functions, is_interp, set_is_interp,
6739 is_dynamic_linker_section, and set_is_dynamic_linker_section
6740 functions.
6741 (class Output_segment): Change Output_data_list from std::list to
6742 std:;vector. Add output_lists_ field. Remove output_data_ and
6743 output_bss_ fields. Update declarations.
6744
6745 2010-08-02 Ian Lance Taylor <iant@google.com>
6746
6747 * arm.cc (Target_arm::gc_process_relocs): Use typename.
6748 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6749 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6750
6751 2010-08-02 Ian Lance Taylor <iant@google.com>
6752
6753 PR 11855
6754 * script.cc (Script_options::Script_options): Initialize
6755 symbol_definitions_ and symbol_references_.
6756 (Script_options::add_symbol_assignment): Update
6757 symbol_definitions_ and symbol_references_.
6758 (Script_options::add_symbol_reference): New function.
6759 (script_symbol): New function.
6760 * script.h (class Script_options): Add symbol_definitions_ and
6761 symbol_references_ fields.
6762 (Script_options::referenced_const_iterator): New type.
6763 (Script_options::referenced_begin): New function.
6764 (Script_options::referenced_end): New function.
6765 (Script_options::is_referenced): New function.
6766 (Script_options::any_unreferenced): New function.
6767 * script-c.h (script_symbol): Declare.
6768 * yyscript.y (exp): Call script_symbol.
6769 * symtab.cc: Include "script.h".
6770 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6771 Change all callers. Check symbols referenced by scripts.
6772 (Symbol_table::add_undefined_symbols_from_command_line): Add
6773 layout parameter. Change all callers.
6774 (Symbol_table::do_add_undefined_symbols_from_command_line):
6775 Likewise. Break out loop body. Check symbols referenced by
6776 scripts.
6777 (Symbol_table::add_undefined_symbol_from_command_line): New
6778 function broken out of
6779 do_add_undefined_symbols_from_command_line.
6780 * symtab.h (class Symbol_table): Update declarations.
6781 * archive.cc: Include "layout.h".
6782 (Archive::should_include_member): Add layout parameter. Change
6783 all callers. Check for symbol mentioned in expression.
6784 * archive.h (class Archive): Update declaration.
6785 * object.cc (Sized_relobj::do_should_include_member): Add layout
6786 parameter.
6787 * object.h (Object::should_include_member): Add layout parameter.
6788 Change all callers.
6789 (Object::do_should_include_member): Add layout parameter.
6790 (class Sized_relobj): Update declaration.
6791 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6792 parameter.
6793 * dynobj.h (class Sized_dynobj): Update declaration.
6794 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6795 layout parameter.
6796 * plugin.h (class Sized_pluginobj): Update declaration.
6797
6798 2010-08-02 Ian Lance Taylor <iant@google.com>
6799
6800 PR 11866
6801 * output.cc (Output_segment::set_offset): Search for the first and
6802 last sections rather than assuming that the list is in order.
6803 (Output_segment::find_first_and_last_list): New function.
6804 * output.h (class Output_segment): Update declarations.
6805 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6806 (relro_strip_test_SOURCES): New variable.
6807 (relro_strip_test_DEPENDENCIES): New variable.
6808 (relro_strip_test_LDFLAGS): New variable.
6809 (relro_strip_test_LDADD): New variable.
6810 (relro_strip_test.so): New target.
6811
6812 2010-08-02 Ian Lance Taylor <iant@google.com>
6813
6814 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6815 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6816 (Target_i386::got_tlsdesc_section): New function.
6817 (Target_i386::got_section): Create space for GOT entries for
6818 TLSDESC relocations.
6819 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6820 R_386_TLS_GOTDESC.
6821 (Target_i386::Scan::global): Likewise.
6822 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6823 using TLSDESC GOT.
6824 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6825 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6826 (Target_x86_64::got_tlsdesc_section): New function.
6827 (Target_x86_64::got_section): Create space for GOT entries for
6828 TLSDESC relocations.
6829 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6830 R_386_TLS_GOTDESC.
6831 (Target_x86_64::Scan::global): Likewise.
6832 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6833 using TLSDESC GOT.
6834
6835 2010-08-02 Ian Lance Taylor <iant@google.com>
6836
6837 * testsuite/final_layout.sh: Use dc to convert from hex to
6838 decimal.
6839
6840 2010-07-29 Sriraman Tallam <tmsriram@google.com>
6841
6842 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6843 paramter to the call to gold::gc_process_relocs.
6844 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6845 paramter to the call to gold::gc_process_relocs.
6846 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6847 parameter to the call to gold::gc_process_relocs.
6848 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6849 template parameter to the call to gold::gc_process_relocs.
6850 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6851 paramter to the call to gold::gc_process_relocs.
6852 * gc.h (get_embedded_addend_size): New function.
6853 (gc_process_relocs): Save the size of the reloc for use by ICF.
6854 * icf.cc (get_section_contents): Get the addend from the text section
6855 for SHT_REL relocation sections.
6856 * icf.h (Icf::Reloc_addend_size_info): New typedef.
6857 (Icf::Reloc_info): Add new member reloc_addend_size_info.
6858 * int_encoding.h (read_from_pointer): New overloaded function.
6859 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6860 * testsuite/icf_sht_rel_addend_test.sh: New file.
6861 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6862 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6863
6864 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6865
6866 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6867 * Makefile.in: Regenerate.
6868 * testsuite/Makefile.in: Regenerate.
6869
6870 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
6871
6872 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6873 * gold/testsuite/debug_msg.cc: Likewise.
6874 * gold/testsuite/odr_violation1.cc
6875 * gold/testsuite/odr_violation2.cc
6876
6877 2010-07-21 Cary Coutant <ccoutant@google.com>
6878
6879 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6880 string, and length fields.
6881 (Output_merge_string::Merged_strings_list): New type.
6882 (Output_merge_string::Merged_strings_lists): New typedef.
6883 (Output_merge_string): Replace merged_strings_ with
6884 merged_strings_lists_.
6885 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6886 Merged_strings_list per input object and section. Don't store pointer
6887 to the string. Don't store length with each merged string entry.
6888 (Output_merge_string::finalize_merged_data): Loop over list of merged
6889 strings lists. Recompute length of each merged string.
6890
6891 2010-07-15 Cary Coutant <ccoutant@google.com>
6892
6893 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6894 here.
6895
6896 2010-07-14 Ian Lance Taylor <iant@google.com>
6897
6898 * descriptors.cc (Descriptors::open): Report correct name in error
6899 message.
6900
6901 2010-07-13 Doug Kwan <dougkwan@google.com>
6902
6903 * arm.cc (Arm_input_section::Arm_input_section): For a
6904 SHT_ARM_EXIDX section, always keeps the input sections.
6905 (Arm_input_section::set_exidx_section_link): New method.
6906 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6907 has_errors_ to false.
6908 (Arm_exidx_input_section::has_errors,
6909 Arm_exidx_input_section::set_has_errors): New methods.
6910 (Arm_exidx_input_section::has_errors_): New data member.
6911 (Arm_relobj::get_exidx_shndx_list): New method.
6912 (Arm_output_section::append_text_sections_to_list): Do not skip
6913 section without SHF_EXECINSTR.
6914 (Arm_output_section::fix_exidx_coverage): Skip input sections with
6915 errors.
6916 (Arm_relobj::make_exidx_input_section): Add new parameter for text
6917 section header. Make error messages more verbose. Check for
6918 a non-executable section linked to an EXIDX section.
6919 (Arm_relobj::do_read_symbols): Remove error checking, which has been
6920 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
6921 check that there is no deferred EXIDX section if we exit early.
6922 Instead of not making an EXIDX section in case of an error, make one
6923 and set the has_errors flag of it.
6924 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6925 in a relocatable link.
6926 (Target_arm::do_relax): Look for the EXIDX output section instead of
6927 assuming that it is called .ARM.exidx.
6928 (Target_arm::fix_exidx_coverage): Add a new parameter for input
6929 section list. Do not check for SHF_EXECINSTR section flags but
6930 skip any input section with errors.
6931 * output.cc (Output_section::Output_section): Initialize
6932 always_keeps_input_sections_ to false.
6933 (Output_section::add_input_section): Check for
6934 always_keeps_input_sections_.
6935 * output.h (Output_section::always_keeps_input_sections,
6936 Output_section::set_always_keeps_input_sections): New methods.
6937 (Output_section::always_keeps_input_sections): New data member.
6938
6939 2010-07-13 Rafael Espindola <espindola@google.com>
6940
6941 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6942 * fileread.h (Input_file): Add try_extra_search_path and find_file.
6943
6944 2010-07-13 Philip Herron <herron.philip@googlemail.com>
6945 Ian Lance Taylor <iant@google.com>
6946
6947 * output.h (Output_section_lookup_maps::add_merge_section):
6948 Correct check of whether value was inserted.
6949 (Output_section_lookup_maps::add_merge_input_section): Likewise.
6950 (Output_section_lookup_maps::add_relaxed_input_section):
6951 Likewise.
6952 * arm.cc (Target_arm::got_section): Remove used local os.
6953 * i386.cc (Target_i386::got_section): Likewise.
6954 * x86_64.cc (Target_x86_64::got_section): Likewise.
6955 * sparc.cc (Target_sparc::got_section): Likewise.
6956 (Target_sparc::relocate): Remove unused local have_got_offset.
6957 * powerpc.cc (Target_powerpc::relocate): Likewise.
6958
6959 2010-07-13 Ian Lance Taylor <iant@google.com>
6960
6961 * compressed_output.cc (zlib_decompress): Fix signature in
6962 !HAVE_ZLIB_H case.
6963
6964 * archive.cc (Archive::include_member): Unlock an external member
6965 of a thin archive. Don't bother to delete an object we know is
6966 NULL.
6967
6968 2010-07-12 Cary Coutant <ccoutant@google.com>
6969
6970 * compressed_output.cc (zlib_decompress): New function.
6971 (get_uncompressed_size): New function.
6972 (decompress_input_section): New function.
6973 * compressed_output.h (get_uncompressed_size): New function.
6974 (decompress_input_section): New function.
6975 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6976 Handle compressed debug sections.
6977 * layout.cc (is_compressed_debug_section): New function.
6978 (Layout::output_section_name): Map compressed section names to
6979 canonical names.
6980 * layout.h (is_compressed_debug_section): New function.
6981 (is_debug_info_section): Recognize compressed debug sections.
6982 * merge.cc: Include compressed_output.h.
6983 (Output_merge_data::do_add_input_section): Handle compressed
6984 debug sections.
6985 (Output_merge_string::do_add_input_section): Handle compressed
6986 debug sections.
6987 * object.cc: Include compressed_output.h.
6988 (Sized_relobj::Sized_relobj): Initialize new data members.
6989 (build_compressed_section_map): New function.
6990 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6991 * object.h (Object::section_is_compressed): New method.
6992 (Object::do_section_is_compressed): New method.
6993 (Sized_relobj::Compressed_section_map): New type.
6994 (Sized_relobj::do_section_is_compressed): New method.
6995 (Sized_relobj::compressed_sections_): New data member.
6996 * output.cc (Output_section::add_input_section): Handle compressed
6997 debug sections.
6998 * reloc.cc: Include compressed_output.h.
6999 (Sized_relobj::write_sections): Handle compressed debug sections.
7000
7001 2010-07-08 Cary Coutant <ccoutant@google.com>
7002
7003 * resolve.cc (Symbol_table::resolve): Remember whether undef was
7004 weak when resolving to a dynamic def.
7005 (Symbol_table::should_override): Add adjust_dyndef flag; set it
7006 for weak undef/dynamic def cases. Adjust callers.
7007 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7008 undef_binding_weak_.
7009 (Symbol_table::sized_write_globals): Adjust symbol binding.
7010 (Symbol_table::sized_write_symbol): Add binding parameter.
7011 * symtab.h (Symbol::set_undef_binding): New method.
7012 (Symbol::is_undef_binding_weak): New method.
7013 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7014 (Symbol_table::should_override): Add new parameter.
7015 (Symbol_table::sized_write_symbol): Add new parameter.
7016
7017 * testsuite/weak_undef_file1.cc: Add new test case.
7018 * testsuite/weak_undef_file2.cc: Fix header comment.
7019 * testsuite/weak_undef_test.cc: Add new test case.
7020
7021 2010-06-29 Doug Kwan <dougkwan@google.com>
7022
7023 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7024 Initialize USE_SYMBOL_.
7025 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7026 definition.
7027 (Arm_reloc_property::uses_symbol_): New data member declaration.
7028 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7029 uses symbol value and symbol is undefined but not weakly undefined.
7030
7031 2010-06-28 Rafael Espindola <espindola@google.com>
7032
7033 * plugin.cc (Plugin::load): Use dlerror.
7034
7035 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
7036
7037 * symtab.cc (detect_odr_violations): When reporting an ODR
7038 violation, report an object where the symbol is defined.
7039
7040 2010-06-25 Doug Kwan <dougkwan@google.com>
7041
7042 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7043 (Target_arm::section_may_have_icf_unsafe_pointers): New method
7044 definition.
7045 (Target_arm::Scan::local_reloc_may_be_function_pointer,
7046 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7047 target hook to detect function points.
7048 (Target_arm::Scan::possible_function_pointer_reloc): New method.
7049 * icf.h (Icf::check_section_for_function_pointers): Change type of
7050 parameter SECTION_NAME to const reference to std::string. Use
7051 target hook to determine if section may have unsafe pointers.
7052 * target.h (Target::section_may_have_icf_unsafe_pointers): New
7053 method definition.
7054
7055 2010-06-21 Rafael Espindola <espindola@google.com>
7056
7057 * fileread.cc (Input_file::find_fie): New
7058 (Input_file::open): Use Input_file::find_fie.
7059 * fileread.h (Input_file::find_fie): New
7060 * plugin.cc (set_extra_library_path): New.
7061 (Plugin::load): Add set_extra_library_path to the transfer vector.
7062 (Plugin_manager::set_extra_library_path): New.
7063 (Plugin_manager::add_input_file): Use the extra search path if set.
7064 (set_extra_library_path(): New.
7065 * plugin.h (Plugin_manager): Add set_extra_library_path and
7066 extra_search_path_.
7067
7068 2010-06-19 Cary Coutant <ccoutant@google.com>
7069
7070 * layout.cc (gdb_sections): Add .debug_types.
7071 (lines_only_debug_sections): Likewise.
7072
7073 2010-06-18 Rafael Espindola <espindola@google.com>
7074
7075 * plugin.cc (add_input_file,add_input_library)
7076 (Plugin_manager::add_input_file): Make filename arguments const.
7077 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7078 const.
7079
7080 2010-06-16 Doug Kwan <dougkwan@google.com>
7081
7082 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7083 .ARM.attributes section if we have not merged any input
7084 attributes sections.
7085
7086 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7087
7088 * arm.cc: Allow combining objects with no EABI version
7089 information.
7090
7091 2010-06-15 Rafael Espindola <espindola@google.com>
7092
7093 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7094
7095 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7096
7097 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7098 (struct iovec): Correct !HAVE_READV definition.
7099
7100 2010-06-10 Cary Coutant <ccoutant@google.com>
7101
7102 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7103 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7104 reloc sections.
7105 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7106
7107 PR 11683
7108 * symtab.h (Symbol::is_placeholder): New member function.
7109 * target-reloc.h (relocate_section): Check for placeholder symbols.
7110
7111 * testsuite/Makefile.am (plugin_test_8): New test.
7112 (plugin_test_9): New test.
7113 * testsuite/Makefile.in: Regenerate.
7114
7115 2010-06-09 Nick Clifton <nickc@redhat.com>
7116
7117 * yyscript.y (input_list_element): Allow strings prefixed with
7118 the '-' character. Treat these as libraries.
7119 * script.cc (script_add_library): New function. Adds a library
7120 specified by "-l<name>" found in an input script.
7121 * script-c.h: Add prototype for script_add_library.
7122
7123 2010-06-07 Doug Kwan <dougkwan@google.com>
7124
7125 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7126 Restrict stub-group size to be within long conditional branch
7127 range when working around cortex-A8 erratum.
7128
7129 2010-06-07 Damien Diederen <dd@crosstwine.com>
7130
7131 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7132 #ifdef typo.
7133
7134 2010-06-03 Sriraman Tallam <tmsriram@google.com>
7135
7136 PR gold/11658
7137 * output.cc
7138 (Output_section::Input_section_sort_entry::compare_section_ordering):
7139 Change to return non-zero correctly.
7140 (Output_section::Input_section_sort_section_order_index_compare
7141 ::operator()): Change to fix ambiguity in comparisons.
7142
7143 2010-06-01 Sriraman Tallam <tmsriram@google.com>
7144
7145 * gold.h (is_wildcard_string): New function.
7146 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7147 (Layout::layout_eh_frame): Ditto.
7148 (Layout::find_section_order_index): New method.
7149 (Layout::read_layout_from_file): New method.
7150 * layout.h (Layout::find_section_order_index): New method.
7151 (Layout::read_layout_from_file): New method.
7152 (Layout::input_section_position_): New private member.
7153 (Layout::input_section_glob_): New private member.
7154 * main.cc (main): Call read_layout_from_file here.
7155 * options.h (--section-ordering-file): New option.
7156 * output.cc (Output_section::input_section_order_specified_): New
7157 member.
7158 (Output_section::Output_section): Initialize new member.
7159 (Output_section::add_input_section): Add new parameter.
7160 Keep input sections when --section-ordering-file is used.
7161 (Output_section::set_final_data_size): Sort input sections when
7162 section ordering file is specified.
7163 (Output_section::Input_section_sort_entry): Add new parameter.
7164 Check sorting type.
7165 (Output_section::Input_section_sort_entry::compare_section_ordering):
7166 New method.
7167 (Output_section::Input_section_sort_compare::operator()): Change to
7168 consider section_order_index.
7169 (Output_section::Input_section_sort_init_fini_compare::operator()):
7170 Change to consider section_order_index.
7171 (Output_section::Input_section_sort_section_order_index_compare
7172 ::operator()): New method.
7173 (Output_section::sort_attached_input_sections): Change to sort
7174 according to section order when specified.
7175 (Output_section::add_input_section<32, true>): Add new parameter.
7176 (Output_section::add_input_section<64, true>): Add new parameter.
7177 (Output_section::add_input_section<32, false>): Add new parameter.
7178 (Output_section::add_input_section<64, false>): Add new parameter.
7179 * output.h (Output_section::add_input_section): Add new parameter.
7180 (Output_section::input_section_order_specified): New
7181 method.
7182 (Output_section::set_input_section_order_specified): New method.
7183 (Input_section::Input_section): Initialize section_order_index_.
7184 (Input_section::section_order_index): New method.
7185 (Input_section::set_section_order_index): New method.
7186 (Input_section::section_order_index_): New member.
7187 (Input_section::Input_section_sort_section_order_index_compare): New
7188 struct.
7189 (Output_section::input_section_order_specified_): New member.
7190 * script-sections.cc (is_wildcard_string): Delete and move modified
7191 method to gold.h.
7192 (Output_section_element_input::Output_section_element_input): Modify
7193 call to is_wildcard_string.
7194 (Output_section_element_input::Input_section_pattern
7195 ::Input_section_pattern): Ditto.
7196 (Output_section_element_input::Output_section_element_input): Ditto.
7197 * testsuite/Makefile.am (final_layout): New test case.
7198 * testsuite/Makefile.in: Regenerate.
7199 * testsuite/final_layout.cc: New file.
7200 * testsuite/final_layout.sh: New file.
7201
7202 2010-06-01 Rafael Espindola <espindola@google.com>
7203
7204 * plugin.cc (Plugin::load): Pass the output name to the plugin.
7205
7206 2010-06-01 Rafael Espindola <espindola@google.com>
7207
7208 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7209 visibility of symbols.
7210
7211 2010-05-27 Doug Kwan <dougkwan@google.com>
7212
7213 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7214 from start of output section instead of address for a local symbol
7215 in a merged or relaxed section when doing a relocatable link.
7216
7217 2010-05-26 Rafael Espindola <espindola@google.com>
7218
7219 PR 11604
7220 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7221 adding sections the garbage collector removed.
7222 * gold/testsuite/Makefile.am: Add test.
7223 * gold/testsuite/Makefile.in: Regenerate.
7224 * gold/testsuite/plugin_test_7.sh: New.
7225 * gold/testsuite/plugin_test_7_1.c: New.
7226 * gold/testsuite/plugin_test_7_2.c: New.
7227
7228 2010-05-26 Rafael Espindola <espindola@google.com>
7229
7230 * script-sections.cc (Output_section_definition::set_section_addresses):
7231 Check for --section-start.
7232
7233 2010-05-26 Doug Kwan <dougkwan@google.com>
7234
7235 * arm.cc (Arm_scan_relocatable_relocs): New class.
7236 (Target_arm::relocate_special_relocatable): New method.
7237 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7238 (Arm_relocate_functions::thumb_branch_common): Same.
7239 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7240 instead of Default_scan_relocatable_relocs.
7241 * target-reloc.h (relocate_for_relocatable): Let target handle
7242 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7243 * target.h (Sized_target::relocate_special_relocatable): New method.
7244
7245 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7246
7247 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7248
7249 2010-05-23 Doug Kwan <dougkwan@google.com>
7250
7251 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7252 instead of a cast.
7253 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7254 with a direct branch, not a conditional branch, to a stub.
7255 * merge.cc (Output_merge_base::record_input_section): New method
7256 defintion.
7257 (Output_merge_data::do_add_input_section): Record input section if
7258 keeps-input-sections flag is set.
7259 (Output_merge_string::do_add_input_section): Ditto.
7260 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7261 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7262 INPUT_SECTIONS_.
7263 (Output_merge_base::keeps_input_sections,
7264 Output_merge_base::set_keeps_input_sections,
7265 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7266 method definitions.
7267 (Output_merge_base::Input_sections): New type declaration.
7268 (Output_merge_base::input_sections_begin,
7269 Output_merge_base::input_sections_end,
7270 Output_merge_base::do_set_keeps_input_sections): New method definitions.
7271 (Output_merge_base::bool keeps_input_sections_,
7272 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7273 Output_merge_base::input_sections_): New data members.
7274 (Output_merge_data::do_set_keeps_input_sections): New method
7275 defintion.
7276 (Output_merge_string::do_set_keeps_input_sections): Ditto.
7277 * output.cc (Output_section::Input_section::relobj): Move method
7278 defintion from class declaration to here and handle merge sections.
7279 (Output_section::Input_section::shndx): Ditto.
7280 (Output_section::Output_section): Remove initializations of removed
7281 data members and initialize new data member LOOKUP_MAPS_.
7282 (Output_section::add_input_section): Set keeps-input-sections flag
7283 for a newly created merge output section as appropriate. Adjust code
7284 to use Output_section_lookup_maps class.
7285 (Output_section::add_relaxed_input_section): Adjst code for lookup
7286 maps code refactoring.
7287 (Output_section::add_merge_input_section): Add a new parameter
7288 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
7289 class. If adding input section to a newly created merge output
7290 section fails, remove the new merge section.
7291 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7292 Adjust code for use of the Output_section_lookup_maps class.
7293 (Output_section::find_merge_section): Ditto.
7294 (Output_section::build_lookup_maps): New method defintion.
7295 (Output_section::find_relaxed_input_section): Adjust code to use
7296 Output_section_lookup_maps class.
7297 (Output_section::get_input_sections): Export merge sections. Adjust
7298 code to use Output_section_lookup_maps class.
7299 (Output_section:::add_script_input_section): Adjust code to use
7300 Output_section_lookup_maps class. Update lookup maps for merge
7301 sections also.
7302 (Output_section::discard_states): Use Output_section_lookup_maps.
7303 (Output_section::restore_states): Same.
7304 * output.h (Merge_section_properties): Move class defintion out of
7305 Output_section.
7306 (Output_section_lookup_maps): New class.
7307 (Output_section::Input_section::is_merge_section): New method
7308 defintion.
7309 (Output_section::Input_section::relobj): Move defintion out of class
7310 defintion. Declare method only.
7311 (Output_section::Input_section::shndx): Ditto.
7312 (Output_section::Input_section::output_merge_base): New method defintion.
7313 (Output_section::Input_section::u2_.pomb): New union field.
7314 (Output_section::Merge_section_by_properties_map,
7315 Output_section::Output_section_data_by_input_section_map,
7316 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7317 Remove types.
7318 (Output_section::add_merge_input_section): Add new parameter
7319 KEEPS_INPUT_SECTIONS.
7320 (Output_section::build_lookup_maps): New method declaration.
7321 (Output_section::merge_section_map_,
7322 Output_section::merge_section_by_properties_map_,
7323 Output_section::relaxed_input_section_map_,
7324 Output_section::is_relaxed_input_section_map_valid_): Remove data
7325 members.
7326 (Output_section::lookup_maps_): New data member.
7327
7328 2010-05-21 Doug Kwan <dougkwan@google.com>
7329
7330 PR gold/11619
7331 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7332 avoid a compilation error.
7333
7334 2010-05-19 Rafael Espindola <espindola@google.com>
7335
7336 * script-sections.cc (Output_section_definition::allocate_to_segment):
7337 Update the phdrs_list even when the output section is NULL.
7338 * testsuite/Makefile.am: Add test.
7339 * testsuite/Makefile.in: Regenerate.
7340 * testsuite/script_test_9.cc: New.
7341 * testsuite/script_test_9.sh: New.
7342 * testsuite/script_test_9.t: New.
7343
7344 2010-05-19 Doug Kwan <dougkwan@google.com>
7345
7346 * arm.cc (Arm_input_section::original_size): New method.
7347 (Arm_input_section::do_addralign): Add a cast.
7348 (Arm_input_section::do_output_offset): Remove static cast.
7349 (Arm_input_section::original_addralign,
7350 Arm_input_section::original_size_): Change type to uint32_t.
7351 (Arm_input_section::init): Add safe casts for section alignment
7352 and size.
7353 (Arm_input_section::set_final_data_size): Do not set address and
7354 offset of stub table.
7355 (Arm_output_section::fix_exidx_coverage): Change use of of
7356 Output_section::Simple_input_section to that of
7357 Output_section::Input_section.
7358 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7359 except for the first pass.
7360 * output.cc (Output_section::get_input_sections): Change type of
7361 input_sections to std::list<Input_section>.
7362 (Output_section::add_script_input_section): Rename from
7363 Output_section::add_simple_input_section. Change type of SIS
7364 parameter from Simple_input_section to Input_section.
7365 * output.h (Output_section::Simple_input_section): Remove class.
7366 (Output_section::Input_section): Change class visibility to public.
7367 (Output_section::Input_section::addralign): Use stored alignments
7368 for special input sections if set.
7369 (Output_section::Input_section::set_addralign): New method.
7370 (Output_section::get_input_sections): Change parameter type from
7371 list of Simple_input_section to list of Input_section.
7372 (Output_section::add_script_input_section): Rename from
7373 Output_section::add_simple_input_section. Change first parameter's
7374 type from Simple_input_section to Input_section and remove the
7375 second and third parameters.
7376 * script-sections.cc (Input_section::Input_section_list): Change
7377 type to list of Output_section::Input_section/
7378 (Input_section_info::Input_section_info): Change parameter type of
7379 INPUT_SECTION to Output_section::Input_section.
7380 (Input_section_info::input_section): Change return type.
7381 (Input_section_info::input_section_): Change type to
7382 Output_section::Input_section.
7383 (Output_section_element_input::set_section_addresses): Adjust code
7384 to use Output_section::Input_section instead of
7385 Output_section::Simple_input_section. Adjust code for renaming
7386 of Output_section::add_simple_input_section.
7387 (Orphan_output_section::set_section_addresses): Ditto.
7388
7389 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7390
7391 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7392 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7393
7394 2010-05-18 Rafael Espindola <espindola@google.com>
7395
7396 * options.cc (General_options::finalize): Handle -nostdlib.
7397 * options.h (nostdlib): New option.
7398 * script.cc (script_add_search_dir): Handle -nostdlib.
7399
7400 2010-05-12 Doug Kwan <dougkwan@google.com>
7401
7402 * arm.cc (Target_arm::do_finalize_sections): Create an empty
7403 attributes section only if there no attributes section after merging.
7404 (Target_arm::merge_object_attributes): Move value of
7405 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7406 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7407 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7408 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7409 and arm_attr_merge_7.stdout.
7410 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7411 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7412 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7413 arm_attr_merge_7b.o): New rules.
7414 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7415 arm_attr_merge_7
7416 * testsuite/Makefile.in: Regenerate.
7417 * testsuite/arm_attr_merge.sh: New file.
7418 * testsuite/arm_attr_merge_[67][ab].s: Same.
7419
7420 2010-05-05 Nick Clifton <nickc@redhat.com>
7421
7422 * po/es.po: Updated Spanish translation.
7423
7424 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7425
7426 * Makefile.am (install-exec-local): Properly install gold as
7427 default cross linker.
7428 * Makefile.in: Regenerated.
7429
7430 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7431 Nick Clifton <nickc@redhat.com>
7432
7433 * configure.ac (install_as_default): Define and set to false
7434 unless --enable-gold or --enable-gold=both/gold has been
7435 specified.
7436 * configure: Regenerate.
7437
7438 * Makefile.am (install-exec-local): Install the executable as
7439 'ld.gold'. If install_as_default is true then also install it as
7440 'ld'.
7441 * Makefile.in: Regenerated.
7442
7443 2010-04-24 Ian Lance Taylor <iant@google.com>
7444
7445 * layout.cc (Layout::layout_reloc): In relocatable link don't
7446 combine reloc sections for grouped sections.
7447
7448 2010-04-23 Sriraman Tallam <tmsriram@google.com>
7449
7450 * gc.h (gc_process_relocs): Pass information on relocs pointing to
7451 sections that are not ordinary to icf.
7452 * icf.cc (get_section_contents): Handle relocation pointing to section
7453 with no object or shndx information.
7454 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7455 * testsuite/Makefile.in: Regenerate.
7456 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7457 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7458
7459 2010-04-22 Ian Lance Taylor <iant@google.com>
7460
7461 * expression.cc (Expression::Expression_eval_info): Add
7462 result_alignment_pointer field.
7463 (Expression::eval_with_dot): Add result_alignment_pointer
7464 parameter. Change all callers.
7465 (Expression::eval_maybe_dot): Likewise.
7466 (class Binary_expression): Add alignment_pointer parameter to
7467 left_value and right_value. Change all callers.
7468 (BINARY_EXPRESSION): Set result alignment.
7469 (class Trinary_expression): Add alignment_pointer parameter to
7470 arg2_value and arg3_value. Change all callers.
7471 (Trinary_cond::value): Set result alignment.
7472 (Max_expression::value, Min_expression::value): Likewise.
7473 (Align_expression::value): Likewise.
7474 * script-sections.cc (class Sections_element): Add dot_alignment
7475 parameter to set_section_addresses virtual function. Update
7476 instantiations.
7477 (class Output_section_element): Likewise.
7478 (Script_sections::create_segments): Add dot_alignment parameter.
7479 Change all callers.
7480 (Script_sections::create_segments_from_phdrs_clause): Likewise.
7481 (Script_sections::set_phdrs_clause_addresses): Likewise.
7482 * script-sections.h: Update declarations.
7483 * script.h: Update declarations.
7484 * output.h (Output_segment::set_minimum_p_align): Don't decrease
7485 min_p_align.
7486 * testsuite/script_test_3.t: Set large alignment.
7487 * testsuite/script_test_3.sh: Make sure that at least one LOAD
7488 segment has expected alignment.
7489
7490 2010-04-22 Nick Clifton <nickc@redhat.com>
7491
7492 * po/gold.pot: Updated by the Translation project.
7493 * po/vi.po: Updated Vietnamese translation.
7494
7495 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
7496
7497 * testsuite/Makefile.am (check_PROGRAMS): Add
7498 icf_virtual_function_folding_test.
7499 * testsuite/Makefile.in: Regenerated.
7500
7501 2010-04-15 Andrew Haley <aph@redhat.com>
7502
7503 * options.h (merge_exidx_entries): New option.
7504 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7505 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7506 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7507 (Target_arm::merge_exidx_entries): New function.
7508 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7509 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7510 to Arm_exidx_fixup constructor.
7511 Add new arg, merge_exidx_entries.
7512 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7513 Arm_output_section::fix_exidx_coverage.
7514
7515 2010-04-18 Sriraman Tallam <tmsriram@google.com>
7516
7517 * icf.cc (get_section_contents): Check for preemptible functions.
7518 Ignore addend when appropriate.
7519 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
7520 section folded.
7521 (add_from_relobj): Check for section folded.
7522 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7523 * symtab.h (should_add_dynsym_entry): Add new parameter.
7524 * target-reloc.h (scan_relocs): Check for section folded.
7525 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7526 Check reloc types for function pointers in shared objects.
7527 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7528 case.
7529 (icf_preemptible_functions_test): New test case.
7530 (icf_string_merge_test): New test case.
7531 * testsuite.Makefile.in: Regenerate.
7532 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7533 bar_glob. Refactor code.
7534 * testsuite/icf_preemptible_functions_test.cc: New file.
7535 * testsuite/icf_preemptible_functions_test.sh: New file.
7536 * testsuite/icf_string_merge_test.cc: New file.
7537 * testsuite/icf_string_merge_test.sh: New file.
7538 * testsuite/icf_virtual_function_folding_test.cc: New file.
7539 * testsuite/icf_virtual_function_folding_test.sh: New file.
7540
7541 2010-04-14 Doug Kwan <dougkwan@google.com>
7542
7543 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7544 for local symbol recounting if we remove a section due to ICF.
7545 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7546 there are no regular objects in input.
7547
7548 2010-04-13 Doug Kwan <dougkwan@google.com>
7549
7550 * arm.cc (Arm_input_section::set_final_data_size): Compute
7551 accurate final data size instead of using current data size.
7552
7553 2010-04-09 Doug Kwan <dougkwan@google.com>
7554
7555 * layout.cc (Layout::choose_output_section): Handle script section
7556 types.
7557 (Layout::make_output_section_for_script): Add section type parameter.
7558 Handle script section types.
7559 * layout.h (Layout::make_output_section_for_script): Add section
7560 type parameter.
7561 * output.cc (Output_section::Output_section): Initialize data member
7562 is_noload_.
7563 (Output_section::do_reset_address_and_file_offset): Do not set address
7564 to 0 if section is a NOLOAD section.
7565 * output.h (Output_section::is_noload): New method.
7566 (Output_section::set_is_noload): Ditto.
7567 (Output_section::is_noload_): New data member.
7568 * script-c.h (Script_section_type): New enum type.
7569 (struct Parser_output_section_header): Add new file section_type.
7570 * script-sections.cc (Sections_element::output_section_name): Add
7571 parameter for returning script section type.
7572 (Output_section_definition::output_section_name): Ditto.
7573 (Output_section_definition::section_type)P; New method.
7574 (Output_section_definiton::script_section_type_name): Ditto.
7575 (Output_section_definition::script_section_type_): New data member.
7576 (Output_section_definition::Output_section_definition): Initialize
7577 data member Output_section_definition::script_section_type_.
7578 (Output_section_definition::create_sections): Pass script section type
7579 to Layout::make_output_section_for_script.
7580 (Output_section_definition::output_section_name): Return script
7581 section type to caller.
7582 (Output_section_definition::set_section_address): Do not advance
7583 dot value and load address if section type is NOLOAD. Set address
7584 of NOLOAD sections regardless of section flags.
7585 (Output_section_definition::print): Print section type if it is
7586 not SCRIPT_SECTION_TYPE_NONE.
7587 (Output_section_definition::section_type): New method.
7588 (Output_section_definition::script_section_type_name): Ditto.
7589 (Script_sections::output_section_name): Add new parameter
7590 PSECTION_TYPE for returning script section type. Pass it to
7591 section elements. Handle discard sections.
7592 (Sort_output_sections::operator()): Handle NOLOAD sections.
7593 * script-sections.h (Script_sections::Section_type): New enum type.
7594 (Script_sections::output_section_name): Add a new parameter for
7595 returning script section type.
7596 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7597 INFO and NOLOAD.
7598 * yyscript.y (union): Add new field SECTION_TYPE.
7599 (COPY, DSECT, INFO, NOLOAD): New tokens.
7600 (opt_address_and_section_type): Change type to output_section_header.
7601 (section_type): New non-terminal
7602 (section_header): Handle section type.
7603 (opt_address_and_section_type): Return section type value.
7604
7605 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
7606
7607 * testsuite/plugin_common_test_1.c (foo): Add prototype.
7608 * testsuite/plugin_common_test_2.c (foo): Likewise.
7609
7610 2010-04-08 Doug Kwan <dougkwan@google.com>
7611
7612 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7613 Output_merge_data.
7614 * output.cc (Output_section::add_merge_input_section): Simplify
7615 code and return status of Output_merge_base::add_input_section.
7616 Update merge section map only if Output_merge_base::add_input_section
7617 returns true.
7618
7619 2010-04-07 Doug Kwan <dougkwan@google.com>
7620
7621 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7622 if section is marked as containing instructions but has no mapping
7623 symbols.
7624 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7625 correct section index.
7626 (Arm_relobj::find_linked_text_section): Ditto.
7627
7628 2010-04-07 Cary Coutant <ccoutant@google.com>
7629
7630 * archive.cc (include_member): Destroy Read_symbols_data object before
7631 releasing file.
7632 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7633 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7634 (Read_symbols_data::~Read_symbols_data) New destructor.
7635 (Section_relocs::Section_relocs) New constructor.
7636 (Section_relocs::~Section_relocs) New destructor.
7637 (Read_relocs_data::Read_relocs_data) New constructor.
7638 (Read_relocs_data::~Read_relocs_data) New destructor.
7639 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7640 pointers to NULL after deleting.
7641
7642 2010-04-07 Doug Kwan <dougkwan@google.com>
7643
7644 * arm.cc: Replace "endianity" with "endianness" in comments.
7645 (Arm_exidx_cantunwind): Ditto.
7646 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7647 (Arm_relobj::merge_flags_and_attributes): New method.
7648 (Arm_relobj::merge_flags_and_attributes_): New data member.
7649 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7650 (Arm_relobj::scan_sections_for_stubs): Ditto.
7651 (Arm_relobj::do_read_symbols): Check to see if we really want to
7652 merge processor-specific flags and attributes. Exit early if
7653 an object is empty except for section names and the undefined symbol.
7654 (Target_arm::do_finalize_sections): Move check for ELF format to
7655 Arm_relobj::do_read_symbols. Merge processor specific flags and
7656 attributes from a regular object only when we have determined that
7657 it is aapropriate. Do not create an .ARM.attributes section in
7658 output if there is no regular input object.
7659 (Target_arm::merge_processor_specific_flags): Check
7660 --warn-mismatch before printing any error.
7661 (Target_arm::merge_object_attributes): Ditto.
7662 * gold.cc (queue_middle_tasks): Handle the case in which there is
7663 no regular object in input.
7664 * options.cc (General_options::parse_EB): New method.
7665 (General_options::parse_EL): Same.
7666 (General_options::General_options): Initialize endianness_.
7667 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7668 New options.
7669 (General_options::Endianness): New enum.
7670 (General_options::endianness): New method.
7671 (General_options::endianness_): New data member.
7672 * parameters.cc (Parameters::set_options): Check target endianness.
7673 (Parameters::set_target_once): Ditto.
7674 (Parameters::check_target_endianness): New method.
7675 (parameters_force_valid_target): If either -EL or -EB is specified,
7676 use it to define endianness of default target.
7677 * parameters.h (Parameters::check_target_endianness): New method
7678 declaration.
7679 * target.h (class Target): Change "endianity" to "endianness"
7680 in comments.
7681
7682 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7683
7684 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7685 * configure: Regenerate.
7686 * Makefile.in: Regenerate.
7687 * testsuite/Makefile.in: Regenerate.
7688
7689 2010-04-06 Cary Coutant <ccoutant@google.com>
7690
7691 gcc PR lto/42757
7692 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7693 prevailing definitions of common symbols.
7694 * testsuite/plugin_test_6.sh: New test case.
7695 * testsuite/plugin_common_test_1.c: New test case.
7696 * testsuite/plugin_common_test_2.c: New test case.
7697 * testsuite/Makefile.am (plugin_test_6): New test case.
7698 * testsuite/Makefile.in: Regenerate.
7699
7700 2010-04-06 Nick Clifton <nickc@redhat.com>
7701
7702 * po/vi.po: New Vietnamese translation.
7703
7704 2010-03-30 Doug Kwan <dougkwan@google.com>
7705
7706 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7707
7708 2010-03-25 Doug Kwan <dougkwan@google.com>
7709
7710 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7711 to avoid a conversion warning on a 32-bit host.
7712
7713 2010-03-24 Ian Lance Taylor <iant@google.com>
7714
7715 * testsuite/script_test_3.t: Add a TLS segment.
7716 * testsuite/Makefile.am (check_PROGRAMS): Add
7717 tls_phdrs_script_test.
7718 (tls_phdrs_script_test_SOURCES): Define.
7719 (tls_phdrs_script_test_DEPENDENCIES): Define.
7720 (tls_phdrs_script_test_LDFLAGS): Define.
7721 (tls_phdrs_script_test_LDADD): Define.
7722 * testsuite/Makefile.in: Rebuild.
7723
7724 2010-03-23 Cary Coutant <ccoutant@google.com>
7725
7726 * fileread.cc (find_or_make_view): Fix comment.
7727
7728 2010-03-23 Ian Lance Taylor <iant@google.com>
7729
7730 * script-sections.cc (class Orphan_section_placement): Define
7731 PLACE_TLS and PLACE_TLS_BSS.
7732 (Orphan_section_placement::Orphan_section_placement): Initialize
7733 new places.
7734 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7735 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7736 (tls_script_test_SOURCES): Define.
7737 (tls_script_test_DEPENDENCIES): Define.
7738 (tls_script_test_LDFLAGS): Define.
7739 (tls_script_test_LDADD): Define.
7740 * testsuite/Makefile.in: Rebuild.
7741
7742 2010-03-22 Doug Kwan <dougkwan@google.com>
7743
7744 * arm.cc (Arm_relocate_functions::abs8,
7745 Arm_relocate_functions::abs16): Use correct check for overflow
7746 specified in the ARM ELF specs.
7747 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
7748 target of a BLX instruction specially.
7749 (Reloc_stub::stub_type_for_reloc): Ditto.
7750 (Relocate::relocate): Use symbolic names instead of numeric relocation
7751 codes to report error.
7752 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7753 workaround.
7754 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7755 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7756 thumb2_blx_out_of_range.stdout
7757 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7758 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7759 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7760 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7761 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7762 thumb2_blx_in_range, thumb2_blx_in_range.o,
7763 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7764 thumb2_blx_out_of_range.o): New rules.
7765 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7766 thumb2_blx_in_range and thumb2_blx_out_of_range.
7767 * testsuite/Makefile.in: Regenerate.
7768 * arm_branch_in_range.sh: Add tests for THUMB BLX.
7769 * testsuite/thumb_blx_in_range.s: New file.
7770 * testsuite/thumb_blx_out_of_range.s: New file.
7771
7772 2010-03-22 Rafael Espindola <espindola@google.com>
7773
7774 * archive.cc (Should_include): Move to archive.h.
7775 (should_include_member): Make it a member of Archive.
7776 (Lib_group): New.
7777 (Add_lib_group_symbols): New.
7778 * archive.h: Include options.h.
7779 (Archive_member): Moved from Archive.
7780 (Should_include): Moved from archive.cc.
7781 (Lib_group): New.
7782 (Add_lib_group_symbols): New.
7783 * dynobj.cc (do_should_include_member): New.
7784 * dynobj.h (do_should_include_member): New.
7785 * gold.cc (queue_initial_tasks): Update call to queue.
7786 * main.cc (main): Print lib group stats.
7787 * object.cc (do_should_include_member): New.
7788 * object.h: Include archive.h.
7789 (Object::should_include_member): New.
7790 (Object::do_should_include_member): New.
7791 (Sized_relobj::do_should_include_member): New.
7792 * options.cc (General_options::parse_start_lib): New.
7793 (General_options::parse_end_lib): New.
7794 (Input_arguments::add_file): Handle lib groups.
7795 (Input_arguments::start_group): Check we are not in a lib.
7796 (Input_arguments::start_lib): New.
7797 (Input_arguments::end_lib): New.
7798 * options.h (General_options): Add start_lib and end_lib.
7799 (Input_argument::lib_): New.
7800 (Input_argument::lib): New.
7801 (Input_argument::is_lib): New.
7802 (Input_file_lib): New.
7803 (Input_arguments::in_lib_): New.
7804 (Input_arguments::in_lib): New.
7805 (Input_arguments::start_lib): New.
7806 (Input_arguments::end_lib_): New.
7807 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7808 in unused members as preempted.
7809 (Sized_pluginobj::do_should_include_member): New.
7810 * plugin.h (Sized_pluginobj::do_should_include_member): New.
7811 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7812 return the blocker.
7813 (Read_symbols::do_whole_lib_group): New.
7814 (Read_symbols::do_lib_group): New.
7815 (Read_symbols::do_read_symbols): Handle lib groups.
7816 (Read_symbols::get_name): Handle lib groups.
7817 * readsyms.h (Read_symbols): Add an archive member pointer.
7818 (Read_symbols::do_whole_lib_group): New.
7819 (Read_symbols::do_lib_group): New.
7820 (Read_symbols::member_): New.
7821 * script.cc (read_input_script): Update call to queue_soon.
7822
7823 2010-03-19 Doug Kwan <dougkwan@google.com>
7824
7825 * arm.cc (Stub_table::Stub_table): Initialize new data members
7826 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7827 (Stub_table::add_reloc_stub): Assign stub offset and update
7828 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7829 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7830 New data members.
7831 (Stub_table::update_data_size_and_addralign): Use
7832 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7833 instead of going over all reloc stubs.
7834 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7835 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7836 Stringpool_template::offset_ to size of Stringpool_char.
7837 (Stringpool_template::new_key_offset): Remove code to initialize
7838 Stringpool_template::offset_.
7839 * stringpool.h (Stringpool_template::set_no_zero_null): Set
7840 Stringpool_template::offset_ to zero.
7841
7842 2010-03-15 Doug Kwan <dougkwan@google.com>
7843
7844 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7845 offset_.
7846 (Stringpool_template::new_key_offset): New method.
7847 (Stringpool_template::add_string): Assign offsets when adding new
7848 strings.
7849 (Stringpool_template::set_string_offsets): Do not set string offsets
7850 when not optimizing.
7851 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7852 member size_.
7853 (Chunked_vector::clear): Clear size_.
7854 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7855 (Chunked_vector::size): Return size_.
7856 (Chunked_vector::push_back): Use size_ to find insert position.
7857 (Chunked_vector::size_): New data member.
7858 (Stringpool_template::set_no_zero_null): Assert string set is empty.
7859 (Stringpool_template::new_key_offset): New method declaration.
7860 (Stringpool_template::offset_): New data member.
7861
7862 2010-03-15 Rafael Espindola <espindola@google.com>
7863
7864 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7865 Add_symbols' constructor.
7866 * readsyms.h (Add_symbols): Remove the input_group member.
7867
7868 2010-03-10 Ian Lance Taylor <iant@google.com>
7869
7870 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7871 target to ask whether a reference to a symbol requires a stack
7872 split.
7873 * target.h (Target::is_call_to_non_split): New function.
7874 (Target::do_is_call_to_non_split): Declare virtual function.
7875 * target.cc: Include "symtab.h".
7876 (Target::do_is_call_to_non_split): New function.
7877 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7878
7879 2010-03-10 Cary Coutant <ccoutant@google.com>
7880
7881 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7882 (File_read::open[1]): Remove initial mapping of whole_file_view_.
7883 (File_read::open[2]): Add whole_file_view_ to list of views.
7884 (File_read::make_view): Remove test of whole_file_view_.
7885 (File_read::find_or_make_view): Create whole_file_view_ if
7886 necessary.
7887 (File_read::clear_views): Replace bool parameter with enum;
7888 adjust all callers. Don't delete views with permanent data;
7889 do delete cached views and views from archives if
7890 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
7891 if clearing the corresponding view.
7892 * fileread.h (File_read::Clear_views_mode): New enum.
7893 (File_read::View::is_permanent_view): New method.
7894 (File_read::clear_views): Replace bool parameter
7895 with enum; adjust all callers.
7896 * options.h (General_options): Change keep_files_mapped option;
7897 add map_whole_files.
7898 * readsyms.cc (Add_symbols::run): Delete sd_ object before
7899 releasing the file.
7900 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7901 the file.
7902
7903 2010-03-10 David S. Miller <davem@davemloft.net>
7904
7905 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7906
7907 2010-03-09 Sriraman Tallam <tmsriram@google.com>
7908
7909 * icf.cc (get_section_contents): Add '@' marker after processing the
7910 merge reloc.
7911
7912 2010-03-08 Doug Kwan <dougkwan@google.com>
7913
7914 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7915 due to a conversion warning.
7916 (Arm_relobj::update_output_local_symbol_count): Check for local
7917 symbol with unset output index.
7918
7919 2010-03-05 Ian Lance Taylor <iant@google.com>
7920
7921 * options.h (class General_options): Add --spare-dynamic-tags.
7922 * output.cc (Output_data_dynamic::set_final_data_size): Implement
7923 --spare-dynamic-tags.
7924
7925 2010-03-05 Ian Lance Taylor <iant@google.com>
7926
7927 * incremental.cc: Include "libiberty.h".
7928
7929 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
7930
7931 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7932 function, is_info_ member.
7933 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7934 (Versions::Versions): Update caller.
7935 (Versions::define_base_version): Likewise.
7936 (Versions::add_def): Likewise.
7937
7938 2010-03-03 Sriraman Tallam <tmsriram@google.com>
7939
7940 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7941 (Scan::possible_function_pointer_reloc): New function.
7942 (Scan::local_reloc_may_be_function_pointer): Change to call
7943 possible_function_pointer_reloc.
7944 (Scan::global_reloc_may_be_function_pointer): Ditto.
7945 * icf.h (Icf::check_section_for_function_pointers): Change to reject
7946 relocations in ".data.rel.ro._ZTV" section.
7947 * testsuite/icf_safe_so_test.sh: Change to pass i386.
7948 * testsuite/icf_safe_so_test.cc: Ditto.
7949 * testsuite/icf_safe_test.cc: Ditto.
7950 * testsuite/icf_safe_test.sh: Ditto.
7951
7952 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7953 Ian Lance Taylor <iant@google.com>
7954
7955 * target-reloc.h (relocate_section): Check the symbol table index
7956 for -1U before setting the local symbol index.
7957 (scan_relocatable_relocs): If copying the relocation, record that
7958 the local symbol is required.
7959 * object.h (Symbol_value::is_output_symtab_index_set): New
7960 function.
7961 (Symbol_value::may_be_discarded_from_output_symtab): New
7962 function.
7963 (Symbol_value::has_output_symtab_entry): New function.
7964 (Symbol_value::needs_output_symtab_entry): Remove.
7965 (Symbol_value::output_symtab_index): Make sure the symbol index is
7966 set.
7967 (Symbol_value::set_output_symtab_index): Make sure the symbol
7968 index is not set. Make sure the new index is valid.
7969 (Symbol_value::set_must_have_output_symtab_entry): New function.
7970 (Symbol_value::has_output_dynsym_entry): New function.
7971 (Symbol_value::set_output_dynsym_index): Make sure the new index
7972 is valid.
7973 (Sized_relobj::set_must_have_output_symtab_entry): New function.
7974 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7975 local symbol if permitted.
7976 (Sized_relobj::do_finalize_local_symbols): Call
7977 is_output_symtab_index_set rather than needs_output_symtab_entry.
7978 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7979 rather than needs_output_symtab_entry. Call
7980 has_output_dynsym_entry rather than needs_output_dynsym_entry.
7981 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7982 is_output_symtab_index_set rather than needs_output_symtab_entry.
7983 * testsuite/discard_locals_relocatable_test.c: New file.
7984 * testsuite/discard_locals_test.sh: Test -r.
7985 * testsuite/Makefile.am (check_DATA): Add
7986 discard_locals_relocatable_test1.syms,
7987 discard_local_relocatable_test2.syms.
7988 (MOSTLYCLEANFILES): Likewise. Also add
7989 discard_locals_relocatable_test1.lout and
7990 discard_locals_relocatable_test2.out.
7991 (discard_locals_relocatable_test1.syms): New target.
7992 (discard_locals_relocatable_test.o): New target.
7993 (discard_locals_relocatable_test1.out): New target.
7994 (discard_locals_relocatable_test2.syms): New target.
7995 (discard_locals_relocatable_test2.out): New target.
7996 (various): Add missing ../ld-new dependencies.
7997 * testsuite/Makefile.in: Rebuild.
7998
7999 2010-03-03 Nick Clifton <nickc@redhat.com>
8000
8001 * po/fi.po: New Finnish translation.
8002
8003 2010-03-01 Doug Kwan <dougkwan@google.com>
8004
8005 * layout.cc (Layout::Layout): Force section types of .init_array*,
8006 .preinit_array* and .fini_array* sections.
8007 * output.cc (Output_section::Input_section_sort_entry::has_priority):
8008 Fix check of return value of std::string::find.().
8009 (Output_section::Input_section_sort_compare::operator()): Remove
8010 comment about .init_array.
8011 (Output_section::Input_section_sort_init_fini_compare::operator()):
8012 New method.
8013 (Output_section::sort_attached_input_sections): Handle .init_array
8014 and .fini_array specially.
8015 * output.h (Output_section::Inut_section_sort_compare): Update
8016 comment.
8017 (Output_section::Input_section_sort_init_fini_compare): New struct.
8018
8019 2010-02-26 Doug Kwan <dougkwan@google.com>
8020
8021 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8022 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8023 * testsuite/debug_msg.sh: Avoid matching source line number for
8024 use of global variable undef_int.
8025
8026 2010-02-26 Doug Kwan <dougkwan@google.com>
8027
8028 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8029 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8030 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8031 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8032 * options.cc (General_options::General_options): Initialize member
8033 fix_v4bx_.
8034 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8035 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8036 and rm_no_fix_v4bx.stdout
8037 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8038 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8039 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8040 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8041 and arm_no_fix_v4bx.
8042 * Makefile.in: Regenerate.
8043 * testsuite/arm_fix_v4bx.s: New file.
8044 * testsuite/arm_fix_v4bx.sh: Ditto.
8045
8046 2010-02-24 Doug Kwan <dougkwan@google.com>
8047
8048 * arm.cc (Target_arm::got_section): Make the .got section the first
8049 non RELRO section in the data segment.
8050 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8051 suffixes of section names.
8052
8053 2010-02-24 Doug Kwan <dougkwan@google.com>
8054
8055 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8056 flags and attributes merging if an input file is a binary file.
8057 * fileread.cc (Input_file::open): Record format of original file.
8058 * fileread.h (Input_file::Format): New enum type.
8059 (Input_file::Input_file): Initialize data member format_.
8060 (Input_file::format): New method definition.
8061 (Input_file::format_):: New data member.
8062
8063 2010-02-24 Doug Kwan <dougkwan@google.com>
8064
8065 * arm.cc (Arm_output_data_got): New class.
8066 (ARM_TCB_SIZE): New constant
8067 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8068 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8069 If user uses a script with a SECTIONS clause, issue only a warning
8070 for a misplaced EXIDX input section. Otherwise, issue an error.
8071 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8072 garbage collection.
8073 (Target_arm::got_mode_index_entry): Handle static linking.
8074 (Target_arm::Scan::local): Ditto.
8075 (Target_arm::Scan::global): Ditto.
8076 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
8077 all incorrectly implemented relocations.
8078 (Target_arm::fix_exidx_coverage): Pass layout to
8079 Arm_output_section::fix_exidx_coverage.
8080 * layout.cc (Layout::section_name_mapping): Remove trailing dots
8081 from ".ARM.exidx." and ".ARM.extab.".
8082
8083 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8084
8085 * arm.cc (Target_arm::do_finalize_sections): Create attribute
8086 section if it does not already exist.
8087 * attributes.cc (Attributes_section_data::Attributes_section_data):
8088 Don't crash if size is zero.
8089
8090 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8091 Ian Lance Taylor <iant@google.com>
8092
8093 * gold.cc (queue_middle_tasks): If no input files were opened,
8094 exit.
8095 * workqueue.h (Task_function::Task_function): Assert that there is
8096 a blocker.
8097
8098 2010-02-22 Doug Kwan <dougkwan@google.com>
8099
8100 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8101 * icf.cc (get_section_contents): Cast snprintf arguments to long long
8102 types to avoid warnings due to different uint64_t implementations
8103 on different hosts.
8104
8105 2010-02-21 Doug Kwan <dougkwan@google.com>
8106
8107 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8108 handling of the maximum backward branch offset.
8109 (Arm_relocate_functions::thumb_branch_common): Ditto.
8110 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8111 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8112 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8113 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8114 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8115 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8116 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8117 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8118 thumb_bl_out_of_range thumb_bl_out_of_range.o,
8119 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8120 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8121 thumb2_bl_out_of_range.o): New rules.
8122 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8123 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8124 thumb2_bl_out_of_range
8125 * testsuite/Makefile.in: Regenerate.
8126 * testsuite/arm_bl_in_range.s: New file.
8127 * testsuite/arm_bl_out_of_range.s: Ditto.
8128 * testsuite/arm_branch_in_range.sh: Ditto.
8129 * testsuite/arm_branch_range.t: Ditto.
8130 * testsuite/thumb2_branch_range.t: Ditto.
8131 * testsuite/thumb_bl_in_range.s: Ditto.
8132 * testsuite/thumb_bl_out_of_range.s: Ditto.
8133 * testsuite/thumb_branch_range.t: Ditto.
8134
8135 2010-02-20 Sriraman Tallam <tmsriram@google.com>
8136
8137 * gc.h (gc_process_relocs): Change vectors to point to the new list.
8138 Add reloc offset information.
8139 * icf.cc (get_section_contents): Change iterators to point to the new
8140 vectors. Add reloc offset information to the contents.
8141 * icf.h (Icf::Sections_reachable_info): New typedef.
8142 (Icf::Sections_reachable_list): New typedef.
8143 (Icf::Offset_info): New typedef.
8144 (Icf::Reloc_info): New struct typedef.
8145 (Icf::Reloc_info_list): New typedef.
8146 (Icf::symbol_reloc_list): Delete method.
8147 (Icf::addend_reloc_list): Delete method.
8148 (Icf::section_reloc_list): Delete method.
8149 (Icf::reloc_info_list): New method.
8150 (Icf::reloc_info_list_): New member.
8151
8152 2010-02-19 Doug Kwan <dougkwan@google.com>
8153
8154 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8155 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8156 * arm.cc (Arm_relocation_functions): New forward declaration.
8157 (Target_arm::Target_arm): Initialize new data members
8158 got_mod_index_offset_ and tls_base_symbol_defined_.
8159 (Target_arm::Relocate::relocate_tls): New method.
8160 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8161 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8162 New methods.
8163 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8164 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8165 (Target_arm::got_mod_index_offset_,
8166 Target_arm::tls_base_symbol_defined_): New data members.
8167 (Target_arm::Scan::local, Target::Scan::global,
8168 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8169 relocations.
8170
8171 2010-02-18 Doug Kwan <dougkwan@google.com>
8172
8173 * arm.cc (Arm_relobj::find_linked_text_section): New method.
8174 (Arm_relobj::make_exidx_input_section): Pass section index of linked
8175 text section as a parameter becuase some broken tools may not set
8176 the link in section header.
8177 (Target_arm::has_got_section): New method.
8178 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8179 without any mapping symbol as data only. Remove warning.
8180 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8181 link in its section header, try to discover the link by inspecting the
8182 REL31 relocation at the beginning of the section.
8183 (Target_arm::Scan::check_non_pic): Report name of offending relocation
8184 in error message.
8185 (Target_arm::Scan::global): Treat any reference to the symbol
8186 _GLOBAL_OFFSET_TABLE_ as a GOT access.
8187
8188 2010-02-12 Sriraman Tallam <tmsriram@google.com>
8189
8190 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8191 (Scan::global_reloc_may_be_function_pointer): New function.
8192 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8193 (Scan::global_reloc_may_be_function_pointer): New function.
8194 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8195 (Scan::global_reloc_may_be_function_pointer): New function.
8196 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8197 (Scan::global_reloc_may_be_function_pointer): New function.
8198 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8199 (Scan::global_reloc_may_be_function_pointer): New function.
8200 (Scan::possible_function_pointer_reloc): New function.
8201 (Target_x86_64::can_check_for_function_pointers): New function.
8202 * gc.h (gc_process_relocs): Scan relocation types to determine if
8203 function pointers were taken for targets that support it.
8204 * icf.cc (Icf::find_identical_sections): Include functions for
8205 folding in safe ICF whose pointer is not taken.
8206 * icf.h (Secn_fptr_taken_set): New typedef.
8207 (fptr_section_id_): New member.
8208 (section_has_function_pointers): New function.
8209 (set_section_has_function_pointers): New function.
8210 (check_section_for_function_pointers): New function.
8211 * options.h: Fix comment for safe ICF option.
8212 * target.h (can_check_for_function_pointers): New function.
8213 * testsuite/Makefile.am: Add icf_safe_so_test test case.
8214 Modify icf_safe_test for X86-64.
8215 * testsuite/Makefile.in: Regenerate.
8216 * testsuite/icf_safe_so_test.cc: New file.
8217 * testsuite/icf_safe_so_test.sh: New file.
8218 * testsuite/icf_safe_test.cc (kept_func_3): New function.
8219 (main): Change to take pointer to function kept_func_3.
8220 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8221 folding is done correctly for X86-64.
8222
8223 2010-02-12 David S. Miller <davem@davemloft.net>
8224
8225 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8226 is_symbolless parameter.
8227 (Output_reloc<SHT_REL>::is_symbolless): New.
8228 (Output_reloc<SHT_REL>::is_symbolless_): New.
8229 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8230 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8231 (Output_reloc<SHT_RELA>::is_symbolless): New.
8232 (Output_data_reloc::add_global): Handle is_symbolless.
8233 (Output_data_reloc::add_global_relative): Likewise.
8234 (Output_data_reloc::add_local): Likewise.
8235 (Output_data_reloc::add_local_relative): Likewise.
8236 (Output_data_reloc::add_symbolless_global_addend): New.
8237 (Output_data_reloc::add_symbolless_local_addend): New.
8238 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8239 is_symbolless.
8240 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8241 instead of ->is_relative_
8242 (Output_reloc::write): Likewise.
8243 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8244 (Output_reloc::write_rel): Simplify.
8245
8246 * sparc.cc (Target_sparc::Scan::local): Use
8247 ->add_symbolless_local_addend as needed.
8248 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8249 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
8250 based upon relocation offset.
8251
8252 2010-02-11 Doug Kwan <dougkwan@google.com>
8253
8254 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8255 (Target_arm::Scan::global): Ditto. Also remove a comment before the
8256 beginning of function.
8257 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8258 and MOVT_ABS relocations. Those are non issued in scanning. Fix
8259 parameter is_32bit in calls to should_apply_static_reloc.
8260 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8261 (check_DATA): Add arm_abs_global.stdout.
8262 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8263 arm_abs_global.stdout): New rules.
8264 (MOSTLLYCLEANFILES): Add arm_abs_global
8265 * Makefile.in: Regenerate.
8266 * testsuite/arm_abs_global.s: New file.
8267 * testsuite/arm_abs_global.sh: Ditto.
8268 * testsuite/arm_abs_lib.s: Ditto.
8269
8270 2010-02-11 Ian Lance Taylor <iant@google.com>
8271
8272 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8273 Read_relocs task.
8274 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
8275 Allocate_commons_task first.
8276 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8277 task, rather than symtab_lock_.
8278 (Gc_process_relocs::~Gc_process_relocs): New function.
8279 (Gc_process_relocs::is_runnable): Check this_blocker_.
8280 (Gc_process_relocs::locks): Use next_blocker_ rather than
8281 blocker_.
8282 (Scan_relocs::~Scan_relocs): New function.
8283 (Scan_relocs::is_runnable): Check this_blocker_ rather than
8284 symtab_lock_.
8285 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
8286 next_blocker_.
8287 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8288 fields. Add this_blocker_ and next_blocker_ fields. Adjust
8289 constructor accordingly.
8290 (class Gc_process_relocs): Likewise.
8291 (class Scan_relocs): Likewise.
8292 * common.h (class Allocate_commons_task): Remove symtab_lock_
8293 field, and corresponding constructor parameter.
8294 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8295 symtab_lock_.
8296 (Allocate_commons_task::locks): Likewise.
8297
8298 2010-02-11 Ian Lance Taylor <iant@google.com>
8299
8300 * gold-threads.h (class Once): Define.
8301 (class Initialize_lock): Rewrite as child of Once.
8302 * gold-threads.cc (class Once_initialize): Define.
8303 (once_pointer_control): New static variable.
8304 (once_pointer, once_arg): New static variables.
8305 (c_run_once): New static function.
8306 (Once::Once, Once::run_once, Once::internal_run): New functions.
8307 (class Initialize_lock_once): Remove.
8308 (initialize_lock_control): Remove.
8309 (initialize_lock_pointer): Remove.
8310 (initialize_lock_once): Remove.
8311 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8312 (Initialize_lock::initialize): Rewrite.
8313 (Initialize_lock::do_run_once): New function.
8314 * archive.cc (Archive::interpret_header): Only clear name if it is
8315 not already empty.
8316 * fileread.cc: Include "gold-threads.h"
8317 (file_counts_lock): New static variable.
8318 (file_counts_initialize_lock): Likewise.
8319 (File_read::release): Only increment counts when using --stats.
8320 Use a lock around the increment.
8321 * parameters.cc (class Set_parameters_target_once): Define.
8322 (set_parameters_target_once): New static variable.
8323 (Parameters::Parameters): Move here from parameters.h.
8324 (Parameters::set_target): Rewrite.
8325 (Parameters::set_target_once): New function.
8326 (Parameters::clear_target): Move here and rewrite.
8327 * parameters.h (class Parameters): Update declarations. Add
8328 set_parameters_target_once_ field.
8329 (Parameters::Parameters): Move to parameters.cc.
8330 (Parameters::clear_target): Likewise.
8331 * readsyms.cc (Read_symbols::do_group): Create a Start_group
8332 task.
8333 (Start_group::~Start_group): New function.
8334 (Start_group::is_runnable): New function.
8335 (Start_group::locks, Start_group::run): New functions.
8336 (Finish_group::run): Change saw_undefined to size_t.
8337 * readsyms.h (class Start_group): Define.
8338 (class Finish_group): Change saw_undefined_ field to size_t.
8339 (Finish_group::Finish_group): Remove saw_undefined and
8340 this_blocker parameters. Change all callers.
8341 (Finish_group::set_saw_undefined): New function.
8342 (Finish_group::set_blocker): New function.
8343 * symtab.h (class Symbol_table): Change saw_undefined to return
8344 size_t. Change saw_undefined_ field to size_t.
8345 * target-select.cc (Set_target_once::do_run_once): New function.
8346 (Target_selector::Target_selector): Initialize set_target_once_
8347 field. Don't initialize lock_ and initialize_lock_ fields.
8348 (Target_selector::instantiate_target): Rewrite.
8349 (Target_selector::set_target): New function.
8350 * target-select.h (class Set_target_once): Define.
8351 (class Target_selector): Update declarations. Make
8352 Set_target_once a friend. Remove lock_ and initialize_lock_
8353 fields. Add set_target_once_ field.
8354
8355 2010-02-10 Ian Lance Taylor <iant@google.com>
8356
8357 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8358 queueing any tasks.
8359 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
8360 (queue_middle_tasks): Add all blockers before queueing any tasks.
8361 (queue_final_tasks): Likewise.
8362 * token.h (Task_token::add_blockers): New function.
8363 * object.h (Input_objects::number_of_relobjs): New function.
8364
8365 2010-02-10 Ian Lance Taylor <iant@google.com>
8366
8367 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8368 shared, not if not position independent.
8369 * x86_64.cc (Relocate::relocate_tls): Likewise.
8370 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8371 (tls_pie_pic_test): New target.
8372 * testsuite/Makefile.in: Rebuild.
8373
8374 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8375 (tls_test_main_pie.o, tls_test_pie.o): New targets.
8376 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8377 * testsuite/Makefile.in: Rebuild.
8378
8379 2010-02-09 David S. Miller <davem@davemloft.net>
8380
8381 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8382 R_SPARC_RELATIVE using ->add_local_relative().
8383 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8384
8385 * output.h (Output_data_dynamic::add_section_size): New method
8386 that takes two Output_data objects.
8387 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8388 entry param. Handle it in initializers.
8389 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8390 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8391 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8392 arg.
8393 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8394 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8395 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8396 for dynrel_includes_plt.
8397 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8398 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8399 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8400 before .rela.plt
8401 (Target_sparc::do_finalize_sections): Update to pass true for
8402 dynrel_includes_plt.
8403 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8404 output before .rela.plt
8405 (Target_powerpc::do_finalize_sections): Update to pass true for
8406 dynrel_includes_plt when 32-bit.
8407
8408 2010-02-08 Doug Kwan <dougkwan@google.com>
8409
8410 * arm.cc (Arm_relobj::simple_input_section_output_address): New
8411 method.
8412 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8413 Arm_relobj::scan_section_for_cortex_a8_stubs,
8414 Arm_relobj::do_relocation_section): Instead of calling
8415 Output_section::output_address, use faster
8416 Arm_relobj::simple_input_section_output_address.
8417
8418 2010-02-08 David S. Miller <davem@davemloft.net>
8419
8420 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8421 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8422 relocation helper function.
8423
8424 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8425 just like R_SPARC_GOT{10,13,22}.
8426 (Target_sparc::Scan::local): Likewise.
8427 (Target_sparc::Relocate:relocate): Likewise.
8428
8429 2010-02-06 Ian Lance Taylor <iant@google.com>
8430
8431 * configure.ac: Rewrite targetobjs duplicate removal code to use
8432 only shell constructs.
8433 * configure: Rebuild.
8434
8435 2010-02-05 Doug Kwan <dougkwan@google.com>
8436
8437 PR 11247
8438 * arm.cc (Arm_relobj::section_is_scannable): New method.
8439 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8440 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8441
8442 2010-02-04 Doug Kwan <dougkwan@google.com>
8443
8444 PR 11247
8445 * arm-reloc-property.cc (cstdio): Include.
8446 * configure.ac (targetobjs): Remove duplicates.
8447 * configure: Regenerate.
8448 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8449 big and little endian version for a given address size.
8450
8451 2010-02-03 Doug Kwan <dougkwan@google.com>
8452
8453 * arm-reloc-property.cc
8454 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8455 definition.
8456 * arm-reloc-property.h
8457 (Arm_reloc_property_table::get_implemented_static_reloc_property):
8458 New method definition.
8459 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8460 declaration.
8461 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8462 overflow to N.
8463 (GOT_PREL): Change implemented to Y.
8464 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8465 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8466 (Arm_relocate_functions::movw_abs_nc): Remove method.
8467 (Arm_relocate_functions::movt_abs): Ditto.
8468 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8469 (Arm_relocate_functions::thm_movt_abs): Ditto.
8470 (Arm_relocate_functions::movw_rel_nc): Ditto.
8471 (Arm_relocate_functions::movw_rel): Ditto.
8472 (Arm_relocate_functions::movt_rel): Ditto.
8473 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8474 (Arm_relocate_functions:thm_movw_rel): Ditto.
8475 (Arm_relocate_functions:thm_movt_rel): Ditto.
8476 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8477 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8478 New method definitions.
8479 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8480 (Arm_relocation_functions::arm_grp_ldr): Ditto.
8481 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8482 (Arm_relocation_functions::arm_grp_ldc): Ditto.
8483 (Target_arm::Relocate::relocate): Check for non-static or
8484 unimplemented relocation code and exit early. Change calls to
8485 Target_arm::reloc_uses_thumb_bit and
8486 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8487 instead. Refactor code to handle similar relocations to increase
8488 code sharing. Remove check for unsupported relocation code in switch
8489 statement.
8490 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8491 relocation property table to find out size. Change error message to
8492 print out the name of a relocation code instead of the numeric value.
8493 (Target_arm::scan_reloc_for_stub): Use relocation property table
8494 instead of calling Target_arm::reloc_uses_thumb_bit().
8495
8496 2010-02-02 Doug Kwan <dougkwan@google.com>
8497
8498 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8499 types of relaxed input section.
8500
8501 2010-02-02 Doug Kwan <dougkwan@google.com>
8502
8503 * Makefile.am (HFILES): Add arm-reloc-property.h.
8504 (DEFFILES): New.
8505 (TARGETSOURCES): Add arm-reloc-property.cc
8506 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8507 (libgold_a_SOURCES): $(DEFFILES)
8508 * Makefile.in: Regenerate.
8509 * arm-reloc-property.cc: New file.
8510 * arm-reloc-property.h: New file.
8511 * arm-reloc.def: New file.
8512 * arm.cc: Update comments.
8513 (arm-reloc-property.h): New included header.
8514 (arm_reloc_property_table): New global variable.
8515 (Target_arm::do_select_as_default_target): New method definition.
8516 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8517 arm-reloc-property to targ_extra_obj.
8518 * parameters.cc (set_parameters_target): Call
8519 Target::select_as_default_target().
8520 * target.h (Target::select_as_default_target): New method definition.
8521 (Target::do_select_as_default_target): Same.
8522
8523 2010-02-01 Doug Kwan <dougkwan@google.com>
8524
8525 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8526 first_output_text_section_.
8527 (Arm_exidx_fixup::first_output_text_section): New method definition.
8528 (Arm_exidx_fixup::first_output_text_section_): New data member.
8529 (Arm_exidx_fixup::process_exidx_section): Record the first text
8530 output section seen.
8531 (Arm_output_section::fix_exidx_coverage): Set correct linked section
8532 and entsize in output section header.
8533
8534 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8535
8536 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8537 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8538 (Arm_relocate_functions::thm_alu11): New Method.
8539 (Arm_relocate_functions::thm_pc8): New Method.
8540 (Arm_relocate_functions::thm_pc12): New Method.
8541 (Target_arm::Scan::local): Handle the relocations.
8542 (Target_arm::Scan::global): Likewise.
8543 (Target_arm::Relocate::relocate): Likewise.
8544 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8545
8546 2010-01-29 Doug Kwan <dougkwan@google.com>
8547
8548 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8549 of relocation types as ld.
8550
8551 2010-01-29 Doug Kwan <dougkwan@google.com>
8552
8553 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8554 to public.
8555 (Arm_relocate_functions::thumb_branch_common): Ditto.
8556 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8557 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8558 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8559 Arm_relocate_functions::jump24): Remove.
8560 (Target_arm::Relocate::relocate): Adjust code to call
8561 Arm_relocation_functions::arm_branch_common and
8562 Arm_relocation_functions::thumb_branch_common instead of their removed
8563 wrappers. Merge switch-cases together to reduce source code size.
8564
8565 2010-01-29 Doug Kwan <dougkwan@google.com>
8566
8567 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8568 output_local_symbol_count_needs_update_.
8569 (Arm_relobj::output_local_symbol_count_needs_update,
8570 Arm_relobj::set_output_local_symbol_count_needs_update,
8571 Arm_relobj::update_output_local_symbol_count): New methods.
8572 (Arm_relobj::output_local_symbol_count_needs_update_): New data
8573 member.
8574 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8575 of pointed function as in a R_ARM_PREL31 relocation.
8576 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8577 for output local symbol count updating.
8578 (Target_arm::do_relax): Update output local symbol counts in objects
8579 if necessary.
8580 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8581
8582 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8583
8584 * arm.cc: Added support for the ARM relocations:
8585 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8586 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8587 (Arm_relocate_functions::movw_rel_nc): Renamed (was
8588 movw_prel_nc).
8589 (Arm_relocate_functions::movw_rel): New method.
8590 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8591 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8592 thm_movw_prel_nc).
8593 (Arm_relocate_functions::thm_movw_rel): New method.
8594 (Arm_relocate_functions::thm_movt_rel): Renamed (was
8595 thm_movt_prel).
8596 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8597 relocations.
8598 (Target_arm::Scan::global): Likewise.
8599 (Target_arm::Relocate::relocate): Likewise.
8600 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8601 Likewise.
8602
8603 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8604
8605 * arm.cc: Added support for ARM group relocations.
8606 (Target_arm::reloc_needs_sym_origin): New method.
8607 (Arm_relocate_functions::calc_grp_kn): New method.
8608 (Arm_relocate_functions::calc_grp_residual): New method.
8609 (Arm_relocate_functions::calc_grp_gn): New method.
8610 (Arm_relocate_functions::arm_grp_alu): New Method.
8611 (Arm_relocate_functions::arm_grp_ldr): New Method.
8612 (Arm_relocate_functions::arm_grp_ldrs): New Method.
8613 (Arm_relocate_functions::arm_grp_ldc): New Method.
8614 (Target_arm::Scan::local): Handle the ARM group relocations.
8615 (Target_arm::Scan::global): Likewise.
8616 (Target_arm::Relocate::relocate): Likewise.
8617 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8618 Likewise.
8619
8620 2010-01-26 Doug Kwan <dougkwan@google.com>
8621
8622 * arm.cc (set): Include.
8623 (class Arm_exidx_fixup): Change type of last_input_section_ to const
8624 pointer type.
8625 (Arm_output_section::Text_section_list): New type.
8626 (Arm_output_section::append_text_sections_to_list): New method.
8627 (Arm_output_section::fix_exidx_coverage): Ditto.
8628 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8629 (Arm_relobj::convert_input_section_to_relaxed_section): Use
8630 Relobj::set_section_offset() instead of
8631 Sized_relobj::invalidate_section_offset().
8632 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8633 parameter for section headers. Ignore relocation sections for
8634 unallocated sections and EXIDX sections.
8635 (Target_arm::fix_exidx_coverage): New method.
8636 (Target_arm::output_section_address_less_than): New type.
8637 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8638 linked text section instead of the EXIDX section.
8639 (Arm_output_section::create_stub_group): Add an assertion to check
8640 that this is not an EXIDX output section.
8641 (Arm_output_section::append_text_sections_to_list): New method.
8642 (Arm_output_section::fix_exidx_coverage): Ditto.
8643 (Arm_relobj::scan_sections_for_stubs): Adjust call to
8644 Arm_relobj::section_needs_reloc_stub_scanning.
8645 (Target_arm::do_relax): Fix EXIDX output section coverage in the
8646 first pass.
8647 (Target_arm::fix_exidx_coverage): New method.
8648 * object.h (Relobj::set_output_section): New method.
8649 (Sized_relobj::invalidate_section_offset): Remove method.
8650 (Sized_relobj::do_invalidate_section_offset): Remove method.
8651 (Sized_relobj::do_set_section_offset): Handle offset value -1.
8652
8653 2010-01-25 Doug Kwan <dougkwan@google.com>
8654
8655 * arm.cc (Arm_exidx_merged_section::do_output_offset):
8656 Fix warning due to signed and unsigned comparison on a 32-bit host.
8657
8658 2010-01-22 Doug Kwan <dougkwan@google.com>
8659
8660 * arm.cc (Target_arm::do_relax): Record an output section for section
8661 offset adjustment it contains any stub table that has changed.
8662 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8663 offsets in an output section if necessary.
8664 * output.cc (Output_section::Output_section): Initialize
8665 section_offsets_need_adjustments_.
8666 (Output_section::add_input_section_for_script): Renamed to
8667 Output_section::add_simple_input_section.
8668 (Output_section::save_states): Add a comment.
8669 (Output_section::discard_states): New method defintion.
8670 (Output_section::adjust_section_offsets): Same.
8671 * output.h (Output_section::add_input_section_for_script): Renamed to
8672 Output_section::add_simple_input_section.
8673 (Output_section::discard_states): New method declaration.
8674 (Output_section::adjust_section_offsets): Same.
8675 (Output_section::section_offsets_need_adjustment,
8676 Output_section::set_section_offsets_need_adjustment): New method
8677 definitions.
8678 (Output_section::section_offsets_need_adjustment_): New data member.
8679 * script-sections.cc
8680 (Output_section_element_input::set_section_address): Adjust code for
8681 renaming of Output_section::add_input_section_for_script.
8682 (Orphan_output_section::set_section_address): Same.
8683
8684 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8685
8686 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8687 Fix_v4bx enum values .
8688 * gold/options.h (General_options): New option definitions.
8689 (General_options::fix_v4bx): New method.
8690 (General_options::Fix_v4bx): New enum.
8691 * gold/options.cc (General_options::parse_fix_v4bx): New method.
8692 (General_options::parse_fix_v4bx_interworking): New method.
8693
8694 2010-01-22 Doug Kwan <dougkwan@google.com>
8695
8696 * arm.cc (Arm_exidx_fixup): New class.
8697
8698 2010-01-21 Doug Kwan <dougkwan@google.com>
8699
8700 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8701 classes.
8702 (Arm_exidx_section_offset_map): New type.
8703
8704 2010-01-21 Doug Kwan <dougkwan@google.com>
8705
8706 * arm.cc (Arm_exidx_input_section): New class.
8707 (Arm_relobj::exidx_input_section_by_link,
8708 Arm_relobj::exidx_input_section_by_shndx,
8709 Arm_relobj::make_exidx_input_section): New methods.
8710 (read_arm_attributes_section): Remove.
8711 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8712 information about them.
8713 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8714 to here.
8715
8716 2010-01-20 Doug Kwan <dougkwan@google.com>
8717
8718 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8719 Input_section_specifier to Section_id.
8720 (Target_arm::new_arm_input_section: Adjust code for change of key
8721 type.
8722 (Target_arm::find_arm_input_section): Ditto.
8723 * gc.h (object.h): Include for Section_id nand Section_id_hash.
8724 (Section_id): Remove.
8725 (Garbage_collection::Section_id_hash): Remove.
8726 * icf.h (object.h): Include for Section_id nand Section_id_hash.
8727 (Section_id): Remove.
8728 (Icf::Section_id_hash): Remove.
8729 * object.h (Section_id, Const_section_id, Section_id_hash,
8730 Const_section_id_hash): New type definitions.
8731 * output.cc (Output_section::add_relaxed_input_section): Change to
8732 use Const_section_id instead of Input_section_specifier as key type.
8733 (Output_section::add_merge_input_section): Ditto.
8734 (Output_section::build_relaxation_map): Change to use Section_id
8735 instead of Input_section_specifier as key type.
8736 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8737 Ditto.
8738 (Output_section::convert_input_sections_to_relaxed_sections): Change
8739 to use Const_section_id instead of Input_section_specifier as key type.
8740 (Output_section::find_merge_section): Ditto.
8741 (Output_section::find_relaxed_input_section): Ditto.
8742 * output.h (Input_section_specifier): Remove class.
8743 (Output_section::Output_section_data_by_input_section_map): Change
8744 key type to Const_section_id.
8745 (Output_section::Output_relaxed_input_section_by_input_section_map):
8746 Ditto.
8747 (Output_section::Relaxation_map): Change key type to Section_id.
8748
8749 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8750
8751 * gold/arm.cc: Added support for R_ARM_V4BX relocation
8752 (class Arm_v4bx_stub): New class.
8753 (DEF_STUBS): Updated definition to support v4_veneer_bx.
8754 (Stub_factory::make_arm_v4bx_stub): New method.
8755 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8756 (Stub_table::empty): Handle v4bx stubs.
8757 (Stub_table::add_arm_v4bx_stub): New method.
8758 (Stub_table::find_arm_v4bx_stub): New method.
8759 (Arm_relocate_functions::v4bx): New method.
8760 (Target_arm::fix_v4bx): New method.
8761 (Target_arm::Target_arm): Handle R_ARM_V4BX.
8762 (Stub_table::relocate_stubs): Likewise.
8763 (Stub_table::do_write): Likewise.
8764 (Stub_table::update_data_size_and_addralign): Likewise.
8765 (Stub_table::finalize_stubs): Likewise.
8766 (Target_arm::Scan::local): Likewise.
8767 (Target_arm::Scan::global): Likewise.
8768 (Target_arm::do_finalize_sections): Likewise.
8769 (Target_arm::Relocate::relocate): Likewise.
8770 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8771 Likewise.
8772 (Target_arm::scan_reloc_for_stub): Likewise.
8773 (Target_arm::scan_reloc_section_for_stubs): Likewise.
8774
8775 2010-01-19 Ian Lance Taylor <iant@google.com>
8776
8777 * output.cc (Output_section_headers::do_sized_write): Write large
8778 segment count to sh_info field.
8779 (Output_file_header::do_sized_write): For large segment count,
8780 write PN_XNUM to e_phnum field.
8781
8782 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8783
8784 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8785 (Arm_relocate_functions::thm_jump8): New function.
8786 (Arm_relocate_functions::thm_jump11): New function.
8787 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8788 R_ARM_THM_JUMP11.
8789 (Target_arm::Scan::global): Likewise.
8790 (Target_arm::Relocate::relocate): Likewise.
8791 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8792 Likewise.
8793
8794 2010-01-14 Doug Kwan <dougkwan@google.com>
8795
8796 * arm.cc (map, utility): Include headers.
8797 (Target_arm::apply_cortex_a8_workaround): New method.
8798 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8799 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8800 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8801 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8802 the --[no-]fix-cortex-a8 command line options.
8803 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8804 (Target_arm::relocate_stub): Use addend in instruction template.
8805 * options.h (DEFINE_bool): Set the user-set flag.
8806 (General_options): Add --[no-]-fix-cortex options.
8807 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8808 : Update fast look-up map after conversion.
8809
8810 2010-01-14 Sriraman Tallam <tmsriram@google.com>
8811
8812 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8813 in the first pass of do_layout.
8814
8815 2010-01-13 Doug Kwan <dougkwan@google.com>
8816
8817 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8818 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8819 apparent compiler problem of not folding static constant integral
8820 data members of elfcpp::Elf_sizes<32>.
8821
8822 2010-01-13 Doug Kwan <dougkwan@google.com>
8823
8824 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8825 Arm_relobj::section_needs_cortex_a8_stub_scanning,
8826 Arm_relobj::scan_section_for_cortex_a8_erratum,
8827 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8828 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8829 sections to scan for relocation stubs into a new method
8830 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
8831 relocation and Cortex-A8 stub scanning.
8832 (Target_arm::do_relax): Force stubs to be after stubbed sections
8833 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
8834 the beginning of a new relaxation pass. Update a comment.
8835 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8836
8837 2010-01-12 Ian Lance Taylor <iant@google.com>
8838
8839 * target-reloc.h (visibility_error): New inline function.
8840 (relocate_section): Call visibility_error.
8841 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8842 (MOSTLYCLEANFILES): Likewise.
8843 (protected_4_pic.o, protected_3.err): New targets.
8844 * testsuite/protected_4.cc: New file.
8845
8846 2010-01-12 Doug Kwan <dougkwan@google.com>
8847
8848 * arm.cc (Cortex_a8_reloc): New class.
8849 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8850 and cortex_a8_relocs_info_.
8851 (Target_arm::fix_cortex_a8): New method definition.
8852 (Target_arm::Cortex_a8_relocs_info): New type.
8853 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8854 New data member declarations.
8855 (Target_arm::scan_reloc_for_stub): Record information about
8856 relocations for THUMB branches that might be exempted from the
8857 Cortex-A8 workaround.
8858 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8859 at the beginning of a relaxation pass.
8860
8861 2010-01-12 Doug Kwan <dougkwan@google.com>
8862
8863 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8864 (Arm_relobj::Mapping_symbol_position,
8865 Arm_reloj::Mapping_symbol_position_less,
8866 Arm_relobj::Mapping_symbols_info): New types.
8867 (Target_arm::is_mapping_symbol_name): New method definition.
8868 (Arm_relobj::do_count_local_symbols): Save information about mapping
8869 symbols.
8870
8871 2010-01-11 Doug Kwan <dougkwan@google.com>
8872
8873 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8874 Arm_relocate_functions::thumb32_branch_upper,
8875 Arm_relocate_functions::thumb32_branch_lower,
8876 Arm_relocate_functions::thumb32_cond_branch_offset,
8877 Arm_relocate_functions::thumb32_cond_branch_upper,
8878 Arm_relocate_functions::thumb32_cond_branch_lower,
8879 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8880 branch offset encoding.
8881 (Arm_relocate_functions::thumb_branch_common): Use new branch
8882 offset encoding methods to avoid code duplication.
8883 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8884 (Stub_addend_reader::operator()): Use new branch encoding method
8885 to avoid code duplication.
8886
8887 2010-01-11 Doug Kwan <dougkwan@google.com>
8888
8889 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8890 (Target_arm::do_finalize_sections): Define special EXIDX section
8891 symbols only if referenced.
8892 * gc.h (Garbage_collection::add_reference): New method.
8893 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8894 code duplication.
8895
8896 2010-01-11 Ian Lance Taylor <iant@google.com>
8897
8898 * script.cc (Version_script_info::build_expression_list_lookup):
8899 Change complaing about duplicate wildcard match from error to
8900 warning.
8901
8902 * script.cc (class Lazy_demangler): Recreate--revert part of patch
8903 of 2009-12-30.
8904 (Version_script_info::Version_script_info): Initialize globs_,
8905 default_version_, default_is_global_, and exact_. Don't
8906 initialize globals_ or locals_.
8907 (Version_script_info::build_lookup_tables): Build local symbols
8908 first.
8909 (Version_script_info::unquote): New function.
8910 (Version_script_info::add_exact_match): New function.
8911 (Version_script_info::build_expression_list_lookup): Remove lookup
8912 parameter. Add is_global parameter. Change all callers. Handle
8913 wildcard pattern specially. Unquote pattern. Call
8914 add_exact_match.
8915 (Version_script_info::get_name_to_match): New function.
8916 (Version_script_info::get_symbol_version): New function.
8917 (Version_script_info::get_symbol_version_helper): Remove.
8918 (Version_script_info::check_unmatched_names): Call unquote.
8919 * script.h (class Version_script_info): Change get_symbol_version
8920 to be non-inline and add is_global parameter; change all callers.
8921 Rewrite symbol_is_local. Update declarations. Define struct
8922 Version_tree_match, Exact, Globs. Don't define struct Lookup.
8923 Remove globals_ and locals_ members. Add exact_, globs_,
8924 default_version_, is_global_.
8925 (Version_script_info::Glob): Remove pattern, add expression and
8926 is_global. Update constructor. Change all callers.
8927 * dynobj.cc (Versions::finalize): Mark the version symbol as the
8928 default version.
8929 (Versions::symbol_section_contents): If a symbol is undefined, or
8930 defined in a dynamic object, set the version index to
8931 VER_NDX_LOCAL.
8932 * symtab.cc (Symbol_table::add_from_relobj): Don't call
8933 symbol_is_local.
8934 (Symbol_table::add_from_pluginobj): Likewise.
8935 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8936
8937 2010-01-11 Doug Kwan <dougkwan@google.com>
8938
8939 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8940 (incremental_dump_LDADD): Add linking option for libintl.
8941 * Makefile.in: Regenerate.
8942
8943 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
8944
8945 PR gold/11144
8946 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8947 instead of -Ds.
8948 * testsuite/Makefile.in: Regenerated.
8949
8950 2010-01-10 Doug Kwan <dougkwan@google.com>
8951
8952 * options.h (DEFINE_var): Use parentheses around argument varname__
8953 in macro body to avoid any unintended subsequent substitutions.
8954
8955 2010-01-10 Ian Lance Taylor <iant@google.com>
8956
8957 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8958 candidates before doing symbol resolution.
8959
8960 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8961 ODR candidates if only one is weak.
8962
8963 2010-01-08 Ian Lance Taylor <iant@google.com>
8964
8965 * script.cc (Version_script_info::build_expression_list_lookup):
8966 Don't warn about ambiguous version, just record the ambiguity.
8967 (Version_script_info::get_symbol_version_helper): Give error if
8968 version is ambiguous.
8969
8970 2010-01-08 Doug Kwan <dougkwan@google.com>
8971
8972 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8973 prev_data_size_ and prev_addralign_. Remove initializer for
8974 deleted data member has_been_changed_.
8975 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8976 to determine if the table is empty.
8977 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8978 Remove.
8979 (Stub_table::add_reloc_stub): Define method in class definition
8980 instead of just declaring it there.
8981 (Stub_table::add_cortex_a8_stub): New method definition.
8982 (Stub_table::update_data_size_and_addralign): Ditto.
8983 (Stub_table::finalize_stubs): Ditto.
8984 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8985 (Stub_table::do_addralign_): Return address alignment in the
8986 (Stub_table::do_reset_address_and_file_offset): Define method in
8987 class definition instead of declaring it there. Set current data
8988 size to be the data size of the previous pass.
8989 (Stub_table::set_final_data_size): Use current data size as the
8990 final data size.
8991 (Stub_table::relocate_stub): Change parameter type of stub from
8992 Reloc_stub pointer to Stub pointer.
8993 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8994 (Stub_table::Cortex_a8_stub_list): New typedef.
8995 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8996 Stub_table::prev_addralign_): New data member.
8997 (Arm_relobj::Arm_relobj): Initialize data member
8998 section_has_cortex_a8_workaround_.
8999 (Arm_relobj::section_has_cortex_a8_workaround,
9000 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9001 definitions.
9002 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9003 declarations.
9004 (Target_arm::relocate_stub): Change parameter type of stub from
9005 Reloc_stub pointer to Stub pointer.
9006 (Insn_template::size, Insn_template::alignment): Handle
9007 THUMB16_SPECIAL_TYPE.
9008 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9009 Stub_table::update_data_size_and_addralign,
9010 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9011 definitions.
9012 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9013 (Stub_table::do_write): Ditto.
9014 (Target_arm::do_relax): Adjust code for changes in Stub_table.
9015
9016 2010-01-08 Ian Lance Taylor <iant@google.com>
9017
9018 PR 11108
9019 * symtab.h (class Symbol): Remove fields is_target_special_ and
9020 has_plt_offset_. Add field is_defined_in_discarded_section_.
9021 (Symbol::is_defined_in_discarded_section): New function.
9022 (Symbol::set_is_defined_in_discarded_section): New function.
9023 (Symbol::has_plt_offset): Rewrite.
9024 (Symbol::set_plt_offset): Verify that new offset is not -1U.
9025 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9026 Don't initialize is_target_special_ or has_plt_offset_.
9027 Initialize is_defined_in_discarded_section_.
9028 (Symbol_table::add_from_relobj): If appropriate, set
9029 is_defined_in_discarded_section.
9030 * resolve.cc (Symbol::override_base_with_special): Don't test
9031 is_target_special_. Change has_plt_offset_ to has_plt_offset().
9032 * target-reloc.h (relocate_section): Do special handling for
9033 symbols defined in discarded sections for global symbols as well
9034 as local symbols.
9035
9036 2010-01-08 Ian Lance Taylor <iant@google.com>
9037
9038 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9039 the SHT_SYMTAB case.
9040
9041 2010-01-08 Ian Lance Taylor <iant@google.com>
9042
9043 * object.cc (Sized_relobj::do_layout): Don't get confused if
9044 layout_eh_frame returns NULL.
9045
9046 2010-01-08 Ian Lance Taylor <iant@google.com>
9047
9048 PR 11084
9049 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9050 dynamic symbol table, use the normal symbol table.
9051 (Sized_dynobj::do_read_symbols): Remove assertion about type of
9052 symbol table.
9053
9054 2010-01-08 Ian Lance Taylor <iant@google.com>
9055
9056 PR 11072
9057 * layout.cc (Layout::include_section): Remove .gnu_debuglink
9058 sections.
9059
9060 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
9061
9062 * version.cc (print_version): Change to "Copyright 2010".
9063
9064 2010-01-08 Ian Lance Taylor <iant@google.com>
9065
9066 PR 10287
9067 PR 11063
9068 * i386.cc (class Target_i386): Change return type of plt_section
9069 to be non-const.
9070 (class Output_data_plt_i386): Add tls_desc_rel_ field.
9071 (Output_data_plt_i386::Output_data_plt_i386): Initialize
9072 tls_desc_rel_ field.
9073 (Output_data_plt_i386::rel_tls_desc): New function.
9074 (Target_i386::rel_tls_desc_section): New function.
9075 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9076 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9077 R_386_TLS_DESC reloc in rel_tls_desc_section.
9078 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9079 Define struct Tlsdesc_info.
9080 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9081 (Target_x86_64::do_reloc_symbol_index): New function.
9082 (Target_x86_64::add_tlsdesc_info): New function.
9083 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9084 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9085 tlsdesc_rel_ field.
9086 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
9087 all callers.
9088 (Output_data_plt_x86_64::rela_tlsdesc): New function.
9089 (Target_x86_64::rela_tlsdesc_section): New function.
9090 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9091 handling.
9092 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9093 (Target_x86_64::do_reloc_addend): New function.
9094 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9095 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9096 declarations. Define TARGET_CODE. Add arg field to u1_ union.
9097 (Output_reloc::type): New function.
9098 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9099 (Output_reloc::is_target_specific): New function.
9100 (Output_reloc::target_arg): New function.
9101 (class Output_reloc) [SHT_RELA]: Add four new constructors for
9102 absolute relocs and target specific relocs.
9103 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9104 add_target_specific.
9105 (class Output_data_reloc) [SHT_RELA]: Likewise.
9106 * output.cc (Output_reloc::Output_reloc): Add four new versions
9107 for absolute relocs and target specific relocs.
9108 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9109 (Output_reloc::get_symbol_index): Likewise.
9110 (Output_reloc::local_section_offset): Check that local_sym_index_
9111 is not TARGET_CODE or 0.
9112 (Output_reloc::symbol_value): Likewise.
9113 (Output_reloc::write) [SHT_RELA]: Call target for target specific
9114 reloc.
9115 * target.h (class Target): Add reloc_symbol_index and reloc_addend
9116 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
9117 functions.
9118 * layout.cc (add_target_dynamic_tags): Use output section for
9119 DT_PLTRELSZ and DT_JMPREL.
9120
9121 2010-01-07 Ian Lance Taylor <iant@google.com>
9122
9123 PR 11061
9124 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9125 function.
9126 (class Output_data_reloc_generic): Define.
9127 (class Output_data_reloc_base): Change base class to
9128 Output_data_reloc_generic. Change add() method to call
9129 bump_relative_reloc_count for a relative reloc. Remove
9130 sort_relocs_ field.
9131 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9132 to sort_relocs().
9133 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9134 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
9135 appropriate.
9136 * layout.h (class Layout): Update declaration.
9137
9138 2010-01-07 Ian Lance Taylor <iant@google.com>
9139
9140 * output.h (class Output_data): Add const version of
9141 output_section and do_output_section.
9142 (class Output_section_data): Add const version of
9143 do_output_section.
9144 (class Output_section): Likewise.
9145 * layout.cc (Layout::add_target_dynamic_tags): New function.
9146 * layout.h (class Layout): Update declarations.
9147 * arm.cc (Target_arm::do_finalize_sections): Use
9148 add_target_dynamic_tags.
9149 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9150 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9151 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9152 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9153
9154 2010-01-07 Ian Lance Taylor <iant@google.com>
9155
9156 PR 11042
9157 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9158 object as needed.
9159
9160 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
9161 Ian Lance Taylor <iant@google.com>
9162
9163 PR 11019
9164 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9165 Xindex::read_symtab_xindex.
9166
9167 2010-01-07 Doug Kwan <dougkwan@google.com>
9168
9169 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9170 (Insn_template::thumb16_bcond_insn): New method declaration.
9171 (Insn_template): Fix spelling.
9172 (Stub::thumb16_special): New method declaration.
9173 (Stub::do_write): Define virtual method which was previously pure
9174 virtual.
9175 (Stub::do_thumb16_special): New method declaration.
9176 (Stub::do_fixed_endian_write): New template member.
9177 (Reloc_stub::do_write): Remove.
9178 (Reloc_stub::do_fixed_endian_write): Remove.
9179 (Cortex_a8_stub): New class definition.
9180 (Stub_factory::make_cortex_a8_stub): New method definition.
9181 (Stub_factory::Stub_factory): Add missing static storage class
9182 qualifier for elf32_arm_stub_a8_veneer_blx.
9183
9184 2010-01-07 Ian Lance Taylor <iant@google.com>
9185
9186 PR 10980
9187 * options.h (class General_options): Add --warn-unresolved-symbols
9188 and --error-unresolved-symbols.
9189 * errors.cc (Errors::undefined_symbol): Implement
9190 --warn-unresolved-symbols.
9191
9192 * options.h (class General_options): Add -z text and -z textoff.
9193 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9194
9195 2010-01-06 Sriraman Tallam <tmsriram@google.com>
9196
9197 * gc.h (Garbage_collection::Cident_section_map): New typedef.
9198 (Garbage_collection::cident_sections): New function.
9199 (Garbage_collection::add_cident_section): New function.
9200 (Garbage_collection::cident_sections_): New member.
9201 (gc_process_relocs): Add references to sections whose names are C
9202 identifiers.
9203 * gold.h (cident_section_start_prefix): New constant.
9204 (cident_section_stop_prefix): New constant.
9205 (is_cident): New function.
9206 * layout.cc (Layout::define_section_symbols): Replace string constants
9207 with the newly defined constants.
9208 * object.cc (Sized_relobj::do_layout): Track sections whose names are
9209 C identifiers.
9210 * testsuite/Makefile.am: Add gc_orphan_section_test.
9211 * testsuite/Makefile.in: Regenerate.
9212 * testsuite/gc_orphan_section_test.cc: New file.
9213 * testsuite/gc_orphan_section_test.sh: New file.
9214
9215 2010-01-06 Ian Lance Taylor <iant@google.com>
9216
9217 PR 10980
9218 * options.h (class General_options): Add --warn-shared-textrel.
9219 * layout.cc (Layout::finish_dynamic_section): Implement
9220 --warn-shared-textrel.
9221
9222 PR 10980
9223 * options.h (class General_options): Add --warn-multiple-gp.
9224
9225 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9226
9227 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9228 $(THREADSLIB) and $(LIBDL).
9229 * Makefile.in: Rebuild.
9230
9231 2010-01-06 Ian Lance Taylor <iant@google.com>
9232
9233 PR 10980
9234 * options.cc (General_options::parse_section_start): New function.
9235 (General_options::section_start): New function.
9236 (General_options::General_options): Initialize all members.
9237 * options.h: Include <map>
9238 (class General_options): Add --section-start. Add section_starts_
9239 member.
9240 * layout.cc (Layout::attach_allocated_section_to_segment): If
9241 --section-start was used, set the address of the segment. Remove
9242 local sort_sections.
9243 (Layout::relaxation_loop_body): If the address of the load segment
9244 has been set by --section-start, don't use it.
9245 * output.h (Output_segment::update_flags_for_output_section): New
9246 function.
9247 * output.cc (Output_segment::add_output_section): Call
9248 update_flags_for_output_section.
9249
9250 2010-01-05 Ian Lance Taylor <iant@google.com>
9251
9252 PR 10980
9253 * options.h (class General_options): Add --undefined-version.
9254 * script.cc (struct Version_expression): Add was_matched_by_symbol
9255 field.
9256 (Version_script_info::matched_symbol): New function.
9257 (Version_script_info::get_symbol_version_helper): Call
9258 matched_symbol.
9259 (Version_script_info::check_unmatched_names): New function.
9260 * script.h (class Version_script_info): Update declarations.
9261 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9262
9263 * options.h (class General_options): Use DEFINE_bool_alias for
9264 allow_multiple_definition.
9265 * resolve.cc (Symbol_table::should_override): Don't test
9266 allow_multiple_definition.
9267
9268 PR 10980
9269 * options.h (class General_options): Add --cref.
9270 * main.cc (main): Print cref table if --cref. Don't close mapfile
9271 until after printing cref table.
9272 * cref.cc: Include "symtab.h".
9273 (class Cref_inputs): Define Cref_table_compare and Cref_table.
9274 (Cref_table_compare::operator()): New function.
9275 (Cref_inputs::gather_cref): New function.
9276 (filecol): New static const.
9277 (Cref_inputs::print_cref): New function.
9278 (Cref::print_cref): New function.
9279 * cref.h: Include <cstdio>.
9280 (class Cref): Update declarations.
9281 * mapfile.h (Mapfile::file): New function.
9282 * object.h (class Object): Define Symbols. Declare virtual
9283 do_get_global_symbols.
9284 (Object::get_global_symbols): New function.
9285 * object.cc (Input_objects::add_object): Pass object to cref_ if
9286 --cref.
9287 (Input_objects::archive_start): Likewise.
9288 (Input_objects::archive_stop): Likewise.
9289 (Input_objects::print_cref): New function.
9290 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9291 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9292 --cref.
9293 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9294 function.
9295 * plugin.h (class Sized_pluginobj): Update declarations.
9296
9297 2010-01-05 Ian Lance Taylor <iant@google.com>
9298
9299 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9300 to is_default_version. Rename insdef to insdefault.
9301 (Symbol_table::add_from_relobj): Rename def to is_default_version
9302 and local to is_forced_local.
9303 (Symbol_table::add_from_pluginobj): Likewise.
9304 (Symbol_table::add_from_dynobj): Likewise.
9305 (Symbol_table::define_special_symbol): Rename insdef to
9306 insdefault.
9307
9308 2010-01-04 Ian Lance Taylor <iant@google.com>
9309
9310 PR 10980
9311 * options.h (class General_options): Add
9312 --allow-multiple-definition and -z muldefs.
9313 * resolve.cc (Symbol_table::should_override): Don't warn about a
9314 multiple symbol definition if --allow-multiple-definition or -z
9315 muldefs.
9316
9317 PR 10980
9318 * options.h (class General_options): Add --add-needed and
9319 --copy-dt-needed-entries. Tweak --as-needed help entry.
9320 * object.cc (Input_objects::check_dynamic_dependencies): Give an
9321 error if --copy-dt-needed-entries aka --add-needed is used and
9322 would cause a change in behaviour.
9323
9324 PR 10980
9325 * options.h (class General_options): Add -G as a short version of
9326 --shared. Add no-op options -assert, -g, and -i.
9327
9328 2010-01-04 Sriraman Tallam <tmsriram@google.com>
9329
9330 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9331 check for .text or .gnu.linkonce.t sections.
9332 * icf.cc (Icf::find_identical_sections): Ditto.
9333 Change the detection for mangled function name within the section
9334 name.
9335 * icf.h (is_section_foldable_candidate): New function.
9336
9337 2009-12-30 Ian Lance Taylor <iant@google.com>
9338
9339 PR 10980
9340 * options.h (class General_options): Permit two dashes with
9341 --retain-symbols-file.
9342
9343 2009-12-30 Ian Lance Taylor <iant@google.com>
9344
9345 PR 10979
9346 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9347 don't put the file header and segment headers in the text
9348 segment.
9349
9350 PR 10979
9351 * common.cc (Sort_commons::operator()): Stabilize sort when both
9352 entries are NULL.
9353 (Symbol_table::do_allocate_commons_list): When allocating common
9354 symbols, skip a symbol which is no longer common.
9355 * symtab.h (Symbol::is_common): Test whether the symbol comes from
9356 an object before checking its type.
9357 * testsuite/common_test_2.c: New file.
9358 * testsuite/common_test_3.c: New file.
9359 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9360 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9361 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9362 (common_test_2_pic.o, common_test_2.so): New targets.
9363 (common_test_3_pic.o, common_test_3.so): New targets.
9364 * testsuite/Makefile.in: Rebuild.
9365
9366 PR 10979
9367 * script.cc (read_input_script): If we see a new SECTIONS clause,
9368 and we have added an input section, give an error.
9369 * layout.h (class Layout): Add have_added_input_section function.
9370 Add have_added_input_section_ field.
9371 * layout.cc (Layout::Layout): Initialize
9372 have_added_input_section_.
9373 (Layout::layout): Set have_added_input_section_.
9374 (Layout::layout_eh_frame): Likewise.
9375
9376 2009-12-30 Ian Lance Taylor <iant@google.com>
9377
9378 PR 10931
9379 * options.h (class General_options): Add --sort-common option.
9380 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9381 * common.cc (Sort_common): Add sort_order parameter to
9382 constructor. Add sort_order_ field.
9383 (Sort_commons::operator): Check sort_order_.
9384 (Symbol_table::allocate_commons): Determine the sort order.
9385 (Symbol_table::do_allocate_commons): Add sort_order parameter.
9386 Change all callers.
9387 (Symbol_table::do_allocate_commons_list): Likewise.
9388
9389 2009-12-30 Ian Lance Taylor <iant@google.com>
9390
9391 PR 10916
9392 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9393 symbols from this object, don't change the visibility of an
9394 undefined symbol.
9395 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9396
9397 2009-12-30 Ian Lance Taylor <iant@google.com>
9398
9399 PR 10861
9400 * script.h (class Version_script_info): Define Language enum.
9401 Update declarations. Define Glob, Exact, and Lookup types. Add
9402 new fields globals_, locals_, and is_finalized_.
9403 * script.cc: Various formatting fixes.
9404 (class Parser_closure): Change language_stack_ from a vector of
9405 std::string to one of Version_script_info::Language. Adjust all
9406 uses accordingly.
9407 (class Lazy_demangler): Remove.
9408 (struct Version_expression): Change language from std::string to
9409 Version_script_info::Language.
9410 (Version_script_info::Version_script_info): New function.
9411 (Version_script_info::~Version_script_info): Don't call clear.
9412 (Version_script_info::finalize): New function.
9413 (Version_script_info::build_lookup_tables): New function.
9414 (Version_script_info::build_expression_list_lookup): New
9415 function.
9416 (Version_script_info::get_symbol_version_helper): Rewrite to use
9417 lookup tables.
9418 (Version_script_info::print_expression_list): Adjust to use
9419 Version_script_info::Language.
9420 (script_push_lex_into_version_mode): Check that the version script
9421 has not been finalized.
9422 (version_script_push_lang): Change language string to
9423 Version_script_info::Language.
9424 * options.cc (Command_line::version_script): New function.
9425 * options.h (class General_options): Add finalize_dynamic_list
9426 function. Change version_script from declaration to definition.
9427 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9428 * testsuite/version_script.map: Remove duplicate def of foo.
9429 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9430 version_script.map.
9431 * testsuite/Makefile.in: Rebuild.
9432
9433 2009-12-30 Ian Lance Taylor <iant@google.com>
9434
9435 PR 10843
9436 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9437 if the input symbol index is 0, make the output symbol index 0.
9438
9439 2009-12-30 Ian Lance Taylor <iant@google.com>
9440
9441 PR 10670
9442 * options.h (class General_options): Add -x/--discard-all.
9443 * object.cc (Sized_relobj::do_count_local_symbols): Handle
9444 --discard-all. If the local symbol needs a dynamic entry, check
9445 that before handling --discard-locals.
9446
9447 2009-12-30 Ian Lance Taylor <iant@google.com>
9448
9449 PR 10450
9450 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9451 flags to PF_R.
9452 (Output_segment::add_output_section): Don't change the flags if
9453 the type is PT_TLS.
9454
9455 PR 10450
9456 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9457 GNU hash table if they need a dynamic value. Otherwise, don't add
9458 them if they are defined in a dynamic object or are forced local.
9459
9460 2009-12-29 Ian Lance Taylor <iant@google.com>
9461
9462 PR 10450
9463 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9464 .gnu.hash table for a 32-bit target.
9465
9466 PR 10450
9467 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9468 regular and a dynamic object only needs a dynamic symbol table
9469 entry if it is externally visible.
9470
9471 PR 10450
9472 * i386.cc (class Target_i386): Initialize global_offset_table_ in
9473 constructor. Add global_offset_table_ field.
9474 (Target_i386::got_section): Set global_offset_table_.
9475 (Target_i386::do_finalize_sections): Set global_offset_table_
9476 size.
9477 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9478 in constructor. Add global_offset_table_ field.
9479 (Target_x86_64::got_section): Set global_offset_table_.
9480 (Target_x86_64::do_finalize_sections): Set global_offset_table_
9481 size.
9482
9483 * layout.cc (Layout::Layout): Initialize increase_relro_.
9484 (Layout::get_output_section): Add is_relro, is_last_relro, and
9485 is_first_non_relro parameters. Change all callers.
9486 (Layout::choose_output_section): Likewise.
9487 (Layout::add_output_section_data): Likewise.
9488 (Layout::make_output_section): Likewise.
9489 (Layout::set_segment_offsets): Clear increase_relro when using a
9490 linker script.
9491 * layout.h (class Layout): Add increase_relro method. Add
9492 increase_relro_ field. Update declarations.
9493 * output.cc (Output_section::Output_section): Initialize
9494 is_last_relro_ and is_first_non_relro_.
9495 (Output_segment::add_output_section): Group relro sections is
9496 do_sort is true. Handle is_last_relro and is_first_non_relro.
9497 (Output_segment::maximum_alignment): Remove relro handling.
9498 (Output_segment::set_section_addresses): Add increase_relro
9499 parameter. Change all callers. Add initial alignment to align
9500 relro sections on separate page. Remove old relro handling.
9501 (Output_segment::set_section_list_addresses): Remove in_relro
9502 parameter. Change all callers.
9503 (Output_segment::set_offset): Add increase parameter. Change all
9504 callers. Remove old relro handling.
9505 * output.h (class Output_section): Add new methods: is_last_relro,
9506 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9507 Add is_last_relro_ and is_first_non_relro_ fields.
9508 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9509 Create separate .got.plt section. Call increase_relro.
9510 * x86_64.cc (Target_x86_64::got_section): Likewise.
9511 * testsuite/relro_script_test.t: Add .got.plt.
9512
9513 PR 10450
9514 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9515 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9516 (Layout::finalize): Call set_dynamic_symbol_size.
9517 (Layout::set_dynamic_symbol_size): New function.
9518 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
9519 set_dynamic_symbol_size.
9520
9521 PR 10450
9522 * output.h (class Output_section): Add is_entsize_zero_ field.
9523 * output.cc (Output_section::Output_section): Initialize
9524 is_entsize_zero_.
9525 (Output_section::set_entsize): If two different entsizes are
9526 requested, force it to zero.
9527 (Output_section::add_input_section): Set flags for .debug_str
9528 before updating section flags. Set entsize.
9529 (Output_section::update_flags_for_input_section): Set SHF_MERGE
9530 and SHF_STRING if all input sections have those flags.
9531
9532 2009-12-29 Rafael Espindola <espindola@google.com>
9533
9534 * main.cc (main): Fix the sys time reporting.
9535 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9536 reporting.
9537
9538 2009-12-29 Sriraman Tallam <tmsriram@google.com>
9539
9540 * options.cc (General_options::parse_version): Allow -v to exit
9541 without an error if there is nothing to link.
9542
9543 2009-12-29 Ian Lance Taylor <iant@google.com>
9544
9545 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9546 using a version of gcc before 4.1.
9547 * configure: Rebuild.
9548
9549 2009-12-28 Chris Demetriou <cgd@google.com>
9550
9551 * attributes.cc (Output_attributes_section_data::do_write): Use
9552 std::vector::front rather than std::vector::data.
9553
9554 2009-12-28 Ian Lance Taylor <iant@google.com>
9555
9556 * symtab.h (class Symbol_table): Add enum Defined.
9557 * resolve.cc (Symbol_table::should_override): Add defined
9558 parameter. Change all callers. Test whether object is NULL
9559 before calling a method on it.
9560 (Symbol_table::report_resolve_problem): Add defined parameter.
9561 Change all callers.
9562 (Symbol_table::should_override_with_special): Likewise.
9563 * symtab.cc (Symbol_table::define_in_output_data): Add defined
9564 parameter. Change all callers.
9565 (Symbol_table::do_define_in_output_data): Likewise.
9566 (Symbol_table::define_in_output_segment): Likewise.
9567 (Symbol_table::do_define_in_output_segment): Likewise.
9568 (Symbol_table::define_as_constant): Likewise.
9569 (Symbol_table::do_define_as_constant): Likewise.
9570 * script.h (class Symbol_assignment): Add is_defsym parameter to
9571 constructor; change all callers.
9572 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9573 parameter. Change all callers. Add is_defsym_ field.
9574 (class Parser_closure): Add parsing_defsym parameter to
9575 constructor; change all callers. Add parsing_defsym accessor
9576 function. Add parsing_defsym_ field.
9577
9578 2009-12-28 Ian Lance Taylor <iant@google.com>
9579
9580 * gold.cc (queue_middle_tasks): Fix formatting.
9581 * object.cc (Relobj::is_section_name_included): Likewise.
9582
9583 2009-12-23 Ian Lance Taylor <iant@google.com>
9584
9585 * i386.cc (Target_i386::do_calls_non_split): Recognize
9586 -fsplit-stack prologue for a function with a static chain.
9587 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9588 -fsplit-stack prologue when using %r11.
9589
9590 2009-12-21 Sriraman Tallam <tmsriram@google.com>
9591
9592 * options.cc (General_options::parse_version): Make -v continue and do
9593 the link like GNU ld does.
9594
9595 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
9596
9597 * Makefile.am (CCFILES): Add timer.cc.
9598 (HFILES): Add timer.h.
9599 * configure.ac: Check for sysconf and times.
9600 * main.cc: include timer.h.
9601 (main): Use Timer instead of get_run_time.
9602 * timer.cc: New.
9603 * timer.h: New.
9604 * workqueue.cc: include timer.h.
9605 (Workqueue::find_and_run_task):
9606 Report user, sys and wall time.
9607 * Makefile.in: Regenerate.
9608 * config.in: Regenerate.
9609 * configure: Regenerate.
9610
9611 2009-12-16 Doug Kwan <dougkwan@google.com>
9612
9613 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9614 sections.
9615 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9616 relaxed input sections.
9617 * output.cc (Output_section::find_relaxed_input_section): Change
9618 return type to Output_relaxed_input_section pointer. Adjust code
9619 for new type of relaxed_input_section_map_.
9620 * output.h (Output_section::find_relaxed_input_section): Change
9621 return type to Output_relaxed_input_section pointer.
9622 (Output_section::Output_relaxed_input_section_by_input_section_map):
9623 New type.
9624 (Output_section::relaxed_input_section_map_): Change type to
9625 Output_section::Output_relaxed_input_section_by_input_section_map.
9626 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9627 input section.
9628
9629 2009-12-15 Ian Lance Taylor <iant@google.com>
9630
9631 * layout.cc (Layout::create_shstrtab): Only write out after input
9632 sections if we are compressing debug sections.
9633
9634 2009-12-15 Ian Lance Taylor <iant@google.com>
9635
9636 * archive.cc (Archive::add_symbols): Only look up a symbol without
9637 a version if there is, in fact, a version.
9638
9639 2009-12-14 Ian Lance Taylor <iant@google.com>
9640
9641 Revert -Wshadow changes, all changes from:
9642 2009-12-11 Doug Kwan <dougkwan@google.com>
9643 2009-12-11 Nick Clifton <nickc@redhat.com>
9644 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9645
9646 2009-12-11 Doug Kwan <dougkwan@google.com>
9647
9648 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9649 due to -Wshadow.
9650 * attributes.cc (Object_attribute::size): Ditto.
9651 (Attributes_section_data::size): Ditto.
9652 (Attributes_section_data::Attributes_section_data): Ditto.
9653 (Output_attributes_section_data::do_write): Ditto.
9654 * attributes.h (Object_attribute::set_type): Ditto.
9655 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9656
9657 2009-12-11 Nick Clifton <nickc@redhat.com>
9658
9659 * archive.cc: Fix shadowed variable warnings.
9660 * arm.cc: Likewise.
9661 * compressed_output.cc: Likewise.
9662 * compressed_output.h: Likewise.
9663 * configure: Likewise.
9664 * dwarf_reader.cc: Likewise.
9665 * dynobj.cc: Likewise.
9666 * dynobj.h: Likewise.
9667 * ehframe.cc: Likewise.
9668 * ehframe.h: Likewise.
9669 * errors.cc: Likewise.
9670 * expression.cc: Likewise.
9671 * fileread.cc: Likewise.
9672 * fileread.h: Likewise.
9673 * freebsd.h: Likewise.
9674 * i386.cc: Likewise.
9675 * icf.cc: Likewise.
9676 * incremental.h: Likewise.
9677 * layout.cc: Likewise.
9678 * layout.h: Likewise.
9679 * mapfile.cc: Likewise.
9680 * merge.cc: Likewise.
9681 * merge.h: Likewise.
9682 * object.cc: Likewise.
9683 * object.h: Likewise.
9684 * options.h: Likewise.
9685 * output.cc: Likewise.
9686 * output.h: Likewise.
9687 * parameters.cc: Likewise.
9688 * plugin.cc: Likewise.
9689 * powerpc.cc: Likewise.
9690 * reduced_debug_output.cc: Likewise.
9691 * reduced_debug_output.h: Likewise.
9692 * reloc.cc: Likewise.
9693 * reloc.h: Likewise.
9694 * resolve.cc: Likewise.
9695 * script-sections.cc: Likewise.
9696 * script.cc: Likewise.
9697 * script.h: Likewise.
9698 * sparc.cc: Likewise.
9699 * symtab.cc: Likewise.
9700 * symtab.h: Likewise.
9701 * target-select.cc: Likewise.
9702 * target-select.h: Likewise.
9703 * token.h: Likewise.
9704 * workqueue.cc: Likewise.
9705 * workqueue.h: Likewise.
9706 * x86_64.cc: Likewise.
9707
9708 2009-12-10 Doug Kwan <dougkwan@google.com>
9709
9710 * arm.cc (attributes.h): New include.
9711 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9712 (Arm_relobj::~Arm_relobj): Delete object pointed by
9713 attributes_section_data_.
9714 (Arm_relobj::attributes_section_data): New method definition.
9715 (Arm_relobj::attributes_section_data_): New data member declaration.
9716 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9717 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9718 attributes_section_data_.
9719 (Arm_dynobj::attributes_section_data): New method definition.
9720 (Arm_dynobj::attributes_section_data_): New data member declaration.
9721 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
9722 initialization value of may_use_blx_ to false.
9723 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9724 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9725 object attributes to compute results instead of hard-coding.
9726 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9727 Target_arm::get_secondary_compatible_arch,
9728 Target_arm::set_secondary_compatible_arch
9729 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9730 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9731 New method declarations.
9732 (Target_arm::get_aeabi_object_attribute): New method definition.
9733 (Target_arm::attributes_section_data_): New data member declaration.
9734 (read_arm_attributes_section): New template definition.
9735 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9736 (Arm_dynobj::do_read_symbols): Ditto.
9737 (Target_arm::do_finalize_sections): Merge attributes sections from
9738 input. Check for BLX use after attributes section merging.
9739 Fix __exidx_start and __exidx_end visibility. Create an
9740 .ARM.attributes section if necessary.
9741 (Target_arm::get_secondary_compatible_arch,
9742 Target_arm::set_secondary_compatible_arch,
9743 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9744 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9745 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9746 New method definitions.
9747
9748 2009-12-09 Ian Lance Taylor <iant@google.com>
9749
9750 * plugin.cc (Plugin::load): Don't cast from void* to a function
9751 pointer.
9752
9753 2009-12-09 Ian Lance Taylor <iant@google.com>
9754
9755 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9756 information fields.
9757
9758 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
9759
9760 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9761 Replace two_file_shared_1.so with two_file_shared_2.so.
9762 * testsuite/Makefile.in: Regenerated.
9763
9764 2009-12-08 Doug Kwan <dougkwan@google.com>
9765
9766 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9767 (HFILES): Add attributes.h and int_encoding.h.
9768 * Makefile.in: Regenerate.
9769 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9770 function definitions to int_encoding.cc
9771 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9772 prototypes to int_encoding.h
9773 * reduced_debug_output.cc (int_encoding.h): New include.
9774 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9775 function definitions to int_encoding.cc
9776 (insert_into_vector, read_from_pointer): Move template definitions to
9777 int_encoding.h
9778 * attributes.cc: New file.
9779 * attributes.h: New file.
9780 * int_encoding.cc: New file.
9781 * int_encoding.h: New file.
9782
9783 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
9784
9785 PR gold/11055
9786 * incremental-dump.cc (dump_incremental_inputs): New.
9787 (main): Use dump_incremental_inputs.
9788
9789 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
9790
9791 PR gold/10893
9792 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9793 checking elfcpp::STT_FUNC.
9794 (Target_i386::Relocate::relocate): Likewise.
9795 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9796
9797 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9798 symbols from shared libraries into normal FUNC symbols.
9799
9800 * symtab.h (Symbol): Add is_func and use it.
9801
9802 2009-12-05 Doug Kwan <dougkwan@google.com>
9803
9804 * arm.cc (Target_arm::arm_info): Initialize new fields
9805 attributes_section and attributes_vendor.
9806 * i386.cc (Target_i386::i386_info): Same.
9807 * object.cc (Sized_relobj::do_layout): Skip attribute section.
9808 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9809 fields attributes_section and attributes_vendor.
9810 * sparc.cc (Target_sparc::sparc_info): Same.
9811 * target.h (Target::attributes_section, Target::attributes_vendor,
9812 Target::is_attributes_section, Target::attribute_arg_type,
9813 Target::attributes_order): New method definitions.
9814 (Target::Target_info::attributes_section,
9815 Target::Target_info::attributes_vendor): New fields.
9816 (Target::do_attribute_arg_type, Target::do_attributes_order): New
9817 virtual method definitions.
9818 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9819 attributes_section and attributes_vendor.
9820 * testsuite/testfile.cc (Target_test::test_target_info): Same.
9821
9822 2009-12-05 Doug Kwan <dougkwan@google.com>
9823
9824 * arm.cc: Update comments about interworking and stub generation.
9825 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9826 considered as non-PIC.
9827 (Arm_relocate_functions::base_abs): Fix formatting.
9828 (Arm_relocate_functions::got_prel): Fix comment. Change interface
9829 of function to use GOT entry address instead of offset.
9830 (Target_arm::Scan::global): Issue an error if a symbol would need a
9831 PLT does not get one because it is untyped. Remove code to create
9832 dynamic symbols for relative branches.
9833 (Target_arm::Relocate::relocate: Use 0 instead of false since function
9834 takes unsigned integer instead of boolean.
9835
9836 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
9837
9838 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9839 (two_file_test_LDADD): Likewise.
9840 (common_test_1_LDADD): Likewise.
9841 (exception_test_LDADD) Likewise.
9842 (weak_test_LDADD): Likewise.
9843 (many_sections_test_LDADD): Likewise.
9844 (initpri1_LDADD): Likewise.
9845 (script_test_1_LDADD): Likewise.
9846 (script_test_2_LDADD): Likewise.
9847 (justsyms_LDADD): Likewise.
9848 (binary_test_LDADD): Likewise.
9849 (large_LDADD): Likewise.
9850 * testsuite/Makefile.in: Regenerated.
9851
9852 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
9853
9854 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9855 (Symbol_table::override_with_special): Likewise.
9856 (Symbol_table::add_from_object): Likewise.
9857
9858 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9859
9860 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9861 Don't set the data_offset twice.
9862
9863 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9864
9865 * testsuite/Makefile.in: Regenerate.
9866
9867 2009-12-03 Doug Kwan <dougkwan@google.com>
9868
9869 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9870 (Target_arm::do_finalize_sections): Add parameter for symbol table
9871 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
9872 * i386.cc (Target_i386::do_finalize_sections): Add an additional
9873 parameter for symbol table pointer.
9874 * layout.cc (Layout::finalize): Call Target::finalize_sections with
9875 an additional parameter for a pointer to symbol table.
9876 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9877 parameter for a symbol table pointer.
9878 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9879 * target.h (Target::finalize_sections, Target::do_finalize_sections):
9880 Ditto.
9881 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9882 parameter for a symbol table pointer.
9883
9884 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
9885
9886 * incremental.cc (Incremental_inputs_header)
9887 (Incremental_inputs_header_write, Incremental_inputs_entry)
9888 (Incremental_inputs_entry_write): Move ...
9889 * incremental.h (Incremental_inputs_header)
9890 (Incremental_inputs_header_write, Incremental_inputs_entry)
9891 (Incremental_inputs_entry_write): here.
9892
9893 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9894
9895 * incremental.cc (make_sized_incremental_binary): Set the target.
9896 Error if it is incompatible.
9897 * output.h (Output_file): Add filename method.
9898
9899 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9900
9901 * incremental.cc (Incremental_inputs_entry): Remove unused argument
9902 from the get_* methods.
9903
9904 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9905
9906 * incremental-dump.cc (main): Check that the offeset of a script is 0.
9907 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9908 Write 0 for the data_offset of scripts.
9909
9910 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9911
9912 * testsuite/Makefile.am: Add the incremental_test.sh test.
9913 * testsuite/incremental_test.sh: New.
9914 * testsuite/incremental_test_1.c: New.
9915 * testsuite/incremental_test_2.c: New.
9916
9917 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
9918
9919 * incremental-dump.cc (main): Fix typos.
9920
9921 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
9922
9923 PR gold/11025
9924 * incremental-dump.cc (main): Use llu to print 64 bit values.
9925
9926 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
9927 H.J. Lu <hongjiu.lu@intel.com>
9928
9929 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9930 $(LIBDL).
9931 (incremental_dump_LDADD): Likewise.
9932 * Makefile.in: Regenerated.
9933
9934 2009-11-25 Doug Kwan <dougkwan@google.com>
9935
9936 Revert:
9937
9938 2009-11-25 Doug Kwan <dougkwan@google.com>
9939
9940 * arm.cc (Target_arm::Target_arm): Move method definition
9941 outside of class definition. Add code to handle
9942 --target1-rel, --target1-abs and --target2= options.
9943 (Target_arm::get_reloc_reloc_type): Change method to be
9944 non-static and const.
9945 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9946 New data member declaration.
9947 (Target_arm::Scan::local, Target_arm::Scan::global,
9948 Target_arm::Relocate::relocate,
9949 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9950 Adjust call to Target_arm::get_real_reloc_type.
9951 (Target_arm::get_real_reloc_type): Use command line options
9952 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9953 * options.h (--target1-rel, --target1-abs, --target2): New
9954 ARM-only options.
9955
9956 2009-11-25 Doug Kwan <dougkwan@google.com>
9957
9958 * arm.cc (Target_arm::Target_arm): Move method definition outside of
9959 class definition. Add code to handle --target1-rel, --target1-abs
9960 and --target2= options.
9961 (Target_arm::get_reloc_reloc_type): Change method to be non-static
9962 and const.
9963 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9964 member declaration.
9965 (Target_arm::Scan::local, Target_arm::Scan::global,
9966 Target_arm::Relocate::relocate,
9967 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9968 call to Target_arm::get_real_reloc_type.
9969 (Target_arm::get_real_reloc_type): Use command line options to
9970 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9971 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9972 options.
9973
9974 2009-11-25 Doug Kwan <dougkwan@google.com>
9975
9976 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9977 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9978 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9979 formatting.
9980 (Arm_relocate_functions::thm_call): Replace body with a call to
9981 Arm_relocate_functions::thumb_branch_common.
9982 (Arm_relocate_functions::thm_jump24,
9983 Arm_relocate_functions::thm_xpc22): New method definitions.
9984 (Arm_relocate_functions::thumb_branch_common): New method definition.
9985 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9986 operator.
9987 (Target_arm::Relocate::relocate): Adjust call to thm_call.
9988 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9989
9990 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9991
9992 * Makefile.am: Build incremental-dump
9993 * Makefile.in: Regenerate.
9994 * incremental-dump.cc: New.
9995 * incremental.cc (Incremental_inputs_header_data,
9996 Incremental_inputs_entry_data): Move to incremental.h
9997 * incremental.h: (Incremental_inputs_header_data,
9998 Incremental_inputs_entry_data): Move from incremental.cc
9999
10000 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10001
10002 * incremental.cc (Incremental_inputs_header,
10003 Incremental_inputs_header_write, Incremental_inputs_entry,
10004 Incremental_inputs_entry_write): Add a typedef with the data type.
10005
10006 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
10007
10008 * incremental.cc (Incremental_inputs_header,
10009 Incremental_inputs_header_write, Incremental_inputs_entry,
10010 Incremental_inputs_entry_write): Update comment about which
10011 type has the filed descriptions.
10012
10013 2009-11-15 Doug Kwan <dougkwan@google.com>
10014
10015 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10016 (Arm_relocate_functions::arm_branch_common): Change method defintion
10017 in class definition to a method declaration and update list of formal
10018 parameters.
10019 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10020 Arm_relocation_functions::jump24): Adjust call to
10021 Arm_relocate_functions::arm_branch_common. Update list of formal
10022 parameters.
10023 (Arm_relocate_functions::xpc25): New method definition.
10024 (Arm_relocate_functions::arm_branch_common): Move method defintion
10025 out from class definition. Use stubs for mode-switching and extending
10026 branch ranges.
10027 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10028 specially. Change code to enable use of stubs in ARM branches.
10029
10030 2009-11-10 Doug Kwan <dougkwan@google.com>
10031
10032 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10033 in method declaration.
10034 (Target_arm::relocate_stub): New method declaration.
10035 (Target_arm::default_target): Change to return a pointer instead of
10036 a const reference.
10037 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10038 Target_arm::default_target.
10039 (Arm_Relobj::do_relocate_sections): Remove options paramater in
10040 method definition.
10041 (Target_arm::relocate_section): Adjust view.
10042 (Target_arm::relocate_stub): New method definition.
10043
10044 2009-11-10 Doug Kwan <dougkwan@google.com>
10045
10046 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10047 a format warning.
10048 * incremental.cc (open_incremental_binary): Initialized local
10049 variables to avoid warnings.
10050 * object.cc (make_elf_object): Ditto.
10051 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10052 a format warning.
10053
10054 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
10055
10056 PR gold/10930
10057 * testsuite/plugin_test.c: Include "config.h".
10058
10059 2009-11-09 Doug Kwan <dougkwan@google.com>
10060
10061 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10062 (arm_symbol_value): Remove.
10063 (Arm_relocate_functions::arm_branch_common,
10064 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10065 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10066 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10067 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10068 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10069 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10070 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10071 Arm_relocate_functions::thm_mobw_abs_nc,
10072 Arm_relocate_functions::thm_mov_abs,
10073 Arm_relocate_functions::movw_prel_nc,
10074 Arm_relocate_functions::thm_movt_abs,
10075 Arm_relocate_functions::movt_prel,
10076 Arm_relocate_functions::thm_movw_prel_nc,
10077 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10078 (Target_arm::Relocate::relocate): Only decompose address into two
10079 parts if relocation type uses the thumb-bit and pass the actual
10080 bit instead of a flag indicating that the thumb-bit is used. Adjust
10081 calls to methods in Arm_relocate_functions for this change.
10082
10083 2009-11-08 Ian Lance Taylor <iant@google.com>
10084
10085 PR 10925
10086 * reloc.cc: Instantiate
10087 Sized_relobj::initialize_input_to_output_maps and
10088 Sized_relobj:free_input_to_output_maps.
10089
10090 2009-11-06 Ian Lance Taylor <iant@google.com>
10091
10092 PR 10876
10093 * defstd.cc (in_segment): Set only_if_ref true for "end".
10094
10095 2009-11-06 Doug Kwan <dougkwan@google.com>
10096
10097 * arm.cc (class Reloc_stub): Correct a comment.
10098 (Target_arm::Target_arm): Initialize arm_input_section_map_.
10099 (Target_arm::scan_section_for_stubs): New method declaration.
10100 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10101 Change methods from private to protected.
10102 (Target_arm::do_may_relax): New method definition.
10103 (Target_arm::do_relax, Target_arm::group_sections,
10104 Target_arm::scan_reloc_for_stub,
10105 Target_arm::scan_reloc_section_for_stubs): New method declarations.
10106 (Target_arm::arm_input_section_map_): New data member declaration.
10107 (Target_arm::scan_reloc_for_stub,
10108 Target_arm::scan_reloc_section_for_stubs,
10109 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10110 Target_arm::do_relax): New method definitions.
10111
10112 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
10113
10114 * configure.ac: Check for (struct stat)::st_mtim
10115 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10116 * config.in: Regenerate.
10117 * configure: Regenerate.
10118
10119 2009-11-05 Ian Lance Taylor <iant@google.com>
10120
10121 PR 10910
10122 * output.cc (Output_segment::add_output_section): Add missing
10123 return statement.
10124
10125 2009-11-04 Ian Lance Taylor <iant@google.com>
10126
10127 PR 10880
10128 * object.h (class Object): Add is_needed and set_is_needed
10129 methods. Add is_needed_ field. Make bool fields into bitfields.
10130 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10131 defined in a dynamic object and referenced by a regular object,
10132 set is_needed for the dynamic object.
10133 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10134 if the file is marked with as_needed and it is not needed.
10135
10136 2009-11-04 Ian Lance Taylor <iant@google.com>
10137
10138 PR 10887
10139 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10140 tags if data is discarded by linker script.
10141 * i386.cc (Target_i386::do_finalize_sections): Likewise.
10142 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10143 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10144 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10145
10146 2009-11-04 Ian Lance Taylor <iant@google.com>
10147
10148 * layout.cc (Layout::get_output_section): Add is_interp and
10149 is_dynamic_linker_section parameters. Change all callers.
10150 (Layout::choose_output_section): Likewise.
10151 (Layout::make_output_section): Likewise.
10152 (Layout::add_output_section_data): Add is_dynamic_linker_section
10153 parameter. Change all callers.
10154 * layout.h (class Layout): Update declarations.
10155 * output.h (class Output_section): Add is_interp, set_is_interp,
10156 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10157 Add is_interp_, is_dynamic_linker_section_ fields. Change
10158 generate_code_fills_at_write_ to a bitfield.
10159 * output.cc (Output_section::Output_sections): Initialize new
10160 fields.
10161 (Output_segment::add_output_section): Add do_sort parameter.
10162 Change all callers.
10163
10164 2009-11-03 Ian Lance Taylor <iant@google.com>
10165
10166 PR 10860
10167 * options.h (class General_options): Add --warn-common.
10168 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10169 merging two common symbols.
10170 (Symbol_table::should_override): Handle --warn-common when merging
10171 a common symbol with a defined symbol. Use report_resolve_problem
10172 for multiple definitions.
10173 (Symbol_table::report_resolve_problem): New function.
10174 * symtab.h (class Symbol_table): Declare report_resolve_problem.
10175
10176 2009-11-03 Doug Kwan <dougkwan@google.com>
10177
10178 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10179 stub_factory_.
10180 (Target_arm::stub_factory): New method definition.
10181 (Target_arm::new_arm_input_section,
10182 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10183 Target_arm::reloc_uses_thumb_bit): New method declarations.
10184 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10185 New type definitions.
10186 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10187 member declarations.
10188 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10189 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10190 New method definitions.
10191
10192 2009-11-03 Ian Lance Taylor <iant@google.com>
10193
10194 * options.h (class General_options): Add --warn_constructors.
10195
10196 2009-11-03 Ian Lance Taylor <iant@google.com>
10197
10198 PR 10893
10199 * defstd.cc (in_section): Add entries for __rel_iplt_start,
10200 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10201
10202 2009-11-03 Ian Lance Taylor <iant@google.com>
10203
10204 PR 10895
10205 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10206 --msgid-bugs-address.
10207 (install-pdf): New target.
10208 (install-data_yes): Look up one directory to find mkinstalldirs.
10209
10210 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
10211
10212 * po/Make-in (.po.gmo): Don't generate .gmo files in source
10213 tree.
10214
10215 2009-10-30 Doug Kwan <dougkwan@google.com>
10216
10217 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10218
10219 2009-10-30 Doug Kwan <dougkwan@google.com>
10220
10221 * arm.cc (Stub_addend_reader): New struct template definition
10222 and partial specializations.
10223 (Stub_addend_reader::operator()): New method definition for a
10224 partially specialized template.
10225
10226 2009-10-30 Doug Kwan <dougkwan@google.com>
10227
10228 * arm.cc (Arm_relobj::processor_specific_flags): New method
10229 definition.
10230 (Arm_relobj::do_read_symbols): New method declaration.
10231 (Arm_relobj::processor_specific_flags_): New data member declaration.
10232 (Arm_dynobj): New class definition.
10233 (Target_arm::do_finalize_sections): Add input_objects parameter.
10234 (Target_arm::do_adjust_elf_header): New method declaration.
10235 (Target_arm::are_eabi_versions_compatible,
10236 (Target_arm::merge_processor_specific_flags): New method declaration.
10237 (Target_arm::do_make_elf_object): New overloaded method definitions
10238 and declaration.
10239 (Arm_relobj::do_read_symbols): New method definition.
10240 (Arm_dynobj::do_read_symbols): Ditto.
10241 (Target_arm::do_finalize_sections): Add input_objects parameters.
10242 Merge processor-specific flags from all input objects.
10243 (Target_arm::are_eabi_versions_compatible,
10244 Target_arm::merge_processor_specific_flags,
10245 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10246 New method definitions.
10247 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10248 Input_objects pointer type parameter.
10249 * layout.cc (Layout::finalize): Pass input objects to target's.
10250 finalize_sections function.
10251 * output.cc (Output_file_header::do_sized_write): Set ELF file
10252 header's processor-specific flags.
10253 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10254 Input_objects pointer type parameter.
10255 * sparc.cc (Target_sparc::do_finalize_sections): Same.
10256 * target.h (Input_objects): New forward class declaration.
10257 (Target::processor_specific_flags,
10258 Target::are_processor_specific_flags_sect): New method definitions.
10259 (Target::finalize_sections): Add input_objects parameter.
10260 (Target::Target): Initialize processor_specific_flags_ and
10261 are_processor_specific_flags_set_.
10262 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10263 parameter.
10264 (Target::set_processor_specific_flags): New method definition.
10265 (Target::processor_specific_flags_,
10266 Target::are_processor_specific_flags_set_): New data member
10267 declarations.
10268 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10269 Input_objects pointer type parameter.
10270
10271 2009-10-30 Doug Kwan <dougkwan@google.com>
10272
10273 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10274
10275 2009-10-28 Ian Lance Taylor <iant@google.com>
10276
10277 * object.h (class Relobj): Drop options parameter from
10278 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10279 do_scan_relocs, do_relocate. Change all callers.
10280 (class Sized_relobj): Drop options parameters from
10281 do_gc_process_relocs, do_scan_relocs, do_relocate,
10282 do_relocate_sections, relocate_sections, emit_relocs_scan,
10283 emit_relocs_scan_reltype. Change all callers.
10284 (struct Relocate_info): Remove options field and all references to
10285 it.
10286 * reloc.h (class Read_relocs): Remove options constructor
10287 parameter and options_ field. Change all callers.
10288 (class Gc_process_relocs, class Scan_relocs): Likewise.
10289 (class Relocate_task): Likewise.
10290 * target-reloc.h (scan_relocs): Remove options parameter. Change
10291 all callers.
10292 (scan_relocatable_relocs): Likewise.
10293 * target.h (class Sized_target): Remove options parameter from
10294 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
10295 all callers.
10296 * gc.h (gc_process_relocs): Remove options parameter. Change all
10297 callers.
10298 * arm.cc: Update functions to remove options parameters.
10299 * i386.cc: Likewise.
10300 * powerpc.cc: Likewise.
10301 * sparc.cc: Likewise.
10302 * x86_64.cc: Likewise.
10303 * testsuite/testfile.cc: Likewise.
10304
10305 2009-10-28 Doug Kwan <dougkwan@google.com>
10306
10307 * arm.cc (Arm_relobj): New class definition.
10308 (Arm_relobj::scan_sections_for_stubs,
10309 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10310 New method definitions.
10311
10312 2009-10-28 Cary Coutant <ccoutant@google.com>
10313
10314 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10315 (Plugin::cleanup_done_): New member.
10316 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10317 (Plugin_manager::cleanup_done_): Remove.
10318 (Plugin_manager::add_input_file): Edit error message.
10319 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10320 (Plugin_manager::cleanup): Remove use of cleanup_done_.
10321
10322 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
10323
10324 * fileread.cc: (File_read::View::~View): Use the new
10325 data_ownership_ filed.
10326 (File_read::~File_read): Dispose the new whole_file_view_.
10327 (File_read::open): Mmap the whole file if needed.
10328 (File_read::open): Use whole_file_view_ instead of contents_.
10329 (File_read::find_view): Use whole_file_view_ if applicable.
10330 (File_read::do_read): Use whole_file_view_ instead of contents_.
10331 (File_read::make_view): Use whole_file_view_ instead of contents_,
10332 update File_read::View::View call.
10333 (File_read::find_or_make_view): Update File_read::View::View
10334 call.
10335 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10336 remove contents_
10337 (File_read::View::Data_ownership): New enum.
10338 (File_read::View::View): Replace bool mapped_ with Data_ownership
10339 argument.
10340 (File_read::View::mapped_): Remove (replaced by data_ownership_).
10341 (File_read::View::data_ownership_): New field.
10342 (File_read::contents_): Remove (replaced by whole_file_view_).
10343 (File_read::whole_file_view_): New field.
10344 * options.h (class General_options): Add --keep-files-mapped.
10345
10346 2009-10-27 Cary Coutant <ccoutant@google.com>
10347
10348 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10349 * testsuite/Makefile.am (plugin_test_5): New test case.
10350 * testsuite/Makefile.in: Regenerate.
10351
10352 2009-10-25 Doug Kwan <dougkwan@google.com>
10353
10354 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10355 from private to protected to allow access by child class.
10356 (Sized_relobj::do_relocate_sections): New method declaration.
10357 (Sized_relobj::relocate_sections): Virtualize.
10358 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10359 Sized_relobj::relocate_sections. Instantiate template explicitly
10360 for different target sizes and endianity.
10361
10362 2009-10-24 Doug Kwan <dougkwan@google.com>
10363
10364 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10365 (Arm_input_section::as_arm_input_section): New method.
10366 (Arm_output_section): New class definition.
10367 (Arm_output_section::create_stub_group,
10368 Arm_output_section::group_sections): New method definitions.
10369
10370 2009-10-22 Doug Kwan <dougkwan@google.com>
10371
10372 * arm.cc (Arm_input_section): New class definition.
10373 (Arm_input_section::init, Arm_input_section:do_write,
10374 Arm_input_section::set_final_data_size,
10375 Arm_input_section::do_reset_address_and_file_offset): New method
10376 definitions.
10377
10378 2009-10-21 Doug Kwan <dougkwan@google.com>
10379
10380 * arm.cc (Stub_table, Arm_input_section): New forward class
10381 declarations.
10382 (Stub_table): New class defintion.
10383 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10384 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10385 New method definition.
10386
10387 2009-10-21 Doug Kwan <dougkwan@google.com>
10388
10389 * arm.cc: Update copyright comments.
10390 (Target_arm): New forward class template declaration.
10391 (Arm_address): New type.
10392 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10393 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10394 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10395 constants.
10396 (Insn_template): Same.
10397 (DEF_STUBS): New macro.
10398 (Stub_type): New enum type.
10399 (Stub_template): New class definition.
10400 (Stub): Same.
10401 (Reloc_stub): Same.
10402 (Stub_factory): Same.
10403 (Target_arm::Target_arm): Initialize may_use_blx_ and
10404 should_force_pic_veneer_.
10405 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10406 Target_arm::should_force_pic_veneer,
10407 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10408 Target_arm::using_thumb_only, Target_arm:;default_target): New
10409 method defintions.
10410 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10411 New data member declarations.
10412 (Insn_template::size, Insn_template::alignment): New method defintions.
10413 (Stub_template::Stub_template): New method definition.
10414 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10415 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10416 (Stub_factory::Stub_factory): New method definition.
10417 * gold.h (string_hash): New template.
10418 * output.h (Input_section_specifier::hash_value): Use
10419 gold::string_hash.
10420 (Input_section_specifier::string_hash): Remove.
10421 * stringpool.cc (Stringpool_template::string_hash): Use
10422 gold::string_hash.
10423
10424 2009-10-20 Doug Kwan <dougkwan@google.com>
10425
10426 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10427 symbols of relaxed input sections.
10428 * output.h (Output_section::find_relaxed_input_section): Make
10429 method public.
10430
10431 2009-10-16 Doug Kwan <dougkwan@google.com>
10432
10433 * dynobj.cc (Versions::Versions): Initialize version_script_.
10434 Only insert base version symbol definition for a shared object
10435 if version script defines any version versions.
10436 (Versions::define_base_version): New method definition.
10437 (Versions::add_def): Check that base version is not needed.
10438 (Versions::add_need): Define base version lazily.
10439 * dynobj.h (Versions::define_base_version): New method declaration.
10440 (Versions::needs_base_version_): New data member declaration.
10441 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10442 (check_DATA): Add no_version_test.stdout.
10443 (libno_version_test.so, no_version_test.o no_version_test.stdout):
10444 New make rules.
10445 * testsuite/Makefile.in: Regenerate.
10446 * testsuite/no_version_test.c: New file.
10447 * testsuite/no_version_test.sh: Ditto.
10448
10449 2009-10-16 Doug Kwan <dougkwan@google.com>
10450
10451 * expression.cc (class Segment_start_expression): New class definition.
10452 (Segment_start_expression::value): New method definition.
10453 (script_exp_function_segment_start): Return a new
10454 Segment_start_expression.
10455 * gold/script-c.h (script_saw_segment_start_expression): New function
10456 prototype.
10457 * script-sections.cc (Script_sections::Script_sections): Initialize
10458 SAW_SEGMENT_START_EXPRESSION_ to false.
10459 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10460 and -Tbbs options to specify section addresses if given in
10461 command line and no SEGMENT_START expression is seen in a script.
10462 * script-sections.h (Script_sections::saw_segment_start_expression,
10463 Script_sections::set_saw_segment_start_expression): New method
10464 definition.
10465 (Script_sections::saw_segment_start_expression_): New data member
10466 declaration.
10467 * script.cc (script_saw_segment_start_expression): New function.
10468 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10469 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10470 script_test_7.sh and script_test_8.sh.
10471 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10472 script_test_8.stdout.
10473 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10474 (script_test_6, script_test_6.stdout, script_test_7,
10475 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10476 * Makefile.in: Regenerate.
10477 * testsuite/script_test_6.sh: New file.
10478 * testsuite/script_test_6.t: Same.
10479 * testsuite/script_test_7.sh: Same.
10480 * testsuite/script_test_7.t: Same.
10481 * testsuite/script_test_8.sh: Same.
10482
10483 2009-10-16 Doug Kwan <dougkwan@google.com>
10484
10485 * output.cc (Output_segment::set_section_list_address): Cast
10486 expressions to unsigned long long type to avoid format warnings.
10487
10488 2009-10-15 Ian Lance Taylor <iant@google.com>
10489
10490 * script.cc (Script_options::add_symbol_assignment): Always add a
10491 dot assignment to script_sections_.
10492 * script-sections.cc (Script_sections::add_dot_assignment):
10493 Initialize if necessary.
10494
10495 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10496 program headers with no load segment if there is a linker script.
10497
10498 * layout.cc (Layout::set_segment_offsets): Align the file offset
10499 to the segment aligment for -N or -n with no load segment.
10500 * output.cc (Output_segment::add_output_section): Don't crash if
10501 the first section is a TLS section.
10502 (Output_segment::set_section_list_addresses): Print an error
10503 message if the address moves backward in a linker script.
10504 * script-sections.cc
10505 (Output_section_element_input::set_section_addresses): Don't
10506 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10507 (Orphan_output_section::set_section_addresses): Likewise.
10508
10509 2009-10-15 Doug Kwan <dougkwan@google.com>
10510
10511 * layout.cc (Layout::finish_dynamic_section): Generate tags
10512 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10513 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10514 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10515
10516 2009-10-14 Ian Lance Taylor <iant@google.com>
10517
10518 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10519 fields.
10520 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10521 data_shdr fields of relinfo.
10522 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10523 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
10524 R_386_TLS_LDO_32, adjust based on section flags.
10525 (Target_i386::Relocate::fix_up_ldo): Remove.
10526
10527 2009-10-13 Ian Lance Taylor <iant@google.com>
10528
10529 Add support for -pie.
10530 * options.h (class General_options): Add -pie and
10531 --pic-executable.
10532 (General_options::output_is_position_independent): Test -pie.
10533 (General_options::output_is_executable): Return true if not shared
10534 and not relocatable.
10535 (General_options::output_is_pie): Remove.
10536 * options.cc (General_options::finalize): Reject incompatible uses
10537 of -pie.
10538 * gold.cc (queue_middle_tasks): A -pie link is not static.
10539 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10540 * symtab.cc (Symbol::final_value_is_known): Return false if
10541 output_is_position_independent.
10542 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10543 output_is_position_independent.
10544 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10545 output_is_position_independent.
10546 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10547 output_is_position_independent.
10548 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10549 two_file_pie_test.
10550 (basic_pie_test.o, basic_pie_test): New targets.
10551 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10552 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10553 (two_file_pie_test): New target.
10554 * testsuite/Makefile.in: Rebuild.
10555 * README: Remove note saying that -pie is not supported.
10556
10557 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
10558
10559 * options.h (class General_options): Add -init and -fini.
10560 * layout.cc (Layout::finish_dynamic_section): Emit
10561 given init and fini functions.
10562
10563 2009-10-13 Sriraman Tallam <tmsriram@google.com>
10564
10565 * gc.h (gc_process_relocs): Check if icf is enabled using new
10566 function.
10567 * gold.cc (queue_initial_tasks): Likewise.
10568 (queue_middle_tasks): Likewise.
10569 * object.cc (do_layout): Likewise.
10570 * symtab.cc (is_section_folded): Likewise.
10571 * main.cc (main): Likewise.
10572 * reloc.cc (Read_relocs::run): Likewise.
10573 (Sized_relobj::do_scan_relocs): Likewise.
10574 * icf.cc (is_function_ctor_or_dtor): New function.
10575 (Icf::find_identical_sections): Check if function is ctor or dtor when
10576 safe icf is chosen.
10577 * options.h (General_options::icf): Change option to be an enum.
10578 (Icf_status): New enum.
10579 (icf_enabled): New method.
10580 (icf_safe_folding): New method.
10581 (set_icf_status): New method.
10582 (icf_status_): New variable.
10583 * (options.cc) (General_options::finalize): Set icf_status_.
10584 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10585 icf_test and icf_keep_unique_test to use the --icf enum flag.
10586 * testsuite/icf_safe_test.sh: New file.
10587 * testsuite/icf_safe_test.cc: New file.
10588
10589 2009-10-12 Sriraman Tallam <tmsriram@google.com>
10590
10591 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10592 includes to gc.h and icf.h.
10593 * arm.cc: Include gc.h.
10594 * gold.cc: Likewise.
10595 * i386.cc: Likewise.
10596 * powerpc.cc: Likewise.
10597 * sparc.cc: Likewise.
10598 * x86_64.cc: Likewise.
10599 * gc.h: Include icf.h.
10600
10601 2009-10-11 Ian Lance Taylor <iant@google.com>
10602
10603 * plugin.cc: Include "gold.h" before other header files.
10604
10605 2009-10-10 Chris Demetriou <cgd@google.com>
10606
10607 * options.h (Input_file_argument::Input_file_type): New enum.
10608 (Input_file_argument::is_lib_): Replace with...
10609 (Input_file_argument::type_): New member.
10610 (Input_file_argument::Input_file_argument): Take Input_file_type
10611 'type' rather than boolean 'is_lib' as second argument.
10612 (Input_file_argument::is_lib): Use type_.
10613 (Input_file_argument::is_searched_file): New function.
10614 (Input_file_argument::may_need_search): Handle is_searched_file.
10615 * options.cc (General_options::parse_library): Support -l:filename.
10616 (General_options::parse_just_symbols): Update for Input_file_argument
10617 changes.
10618 (Command_line::process): Likewise.
10619 * archive.cc (Archive::get_file_and_offset): Likewise.
10620 * plugin.cc (Plugin_manager::release_input_file): Likewise.
10621 * script.cc (read_script_file, script_add_file): Likewise.
10622 * fileread.cc (Input_file::Input_file): Likewise.
10623 (Input_file::will_search_for): Handle is_searched_file.
10624 (Input_file::open): Likewise.
10625 * readsyms.cc (Read_symbols::get_name): Likewise.
10626 * testsuite/Makefile.am (searched_file_test): New test.
10627 * testsuite/Makefile.in: Regenerate.
10628 * testsuite/searched_file_test.cc: New file.
10629 * testsuite/searched_file_test_lib.cc: New file.
10630
10631 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10632 Ian Lance Taylor <iant@google.com>
10633
10634 * descriptor.cc: Include <cstdio> and "binary-io.h".
10635 (Descriptors::open): Open the files in binary mode always.
10636 * script.cc (Lex::get_token): Treat \r as whitespace.
10637
10638 2009-10-09 Ian Lance Taylor <iant@google.com>
10639
10640 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10641
10642 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10643 Ian Lance Taylor <iant@google.com>
10644
10645 * configure.ac: Check for readv function also.
10646 * fileread.cc (readv): Define if not HAVE_READV.
10647 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10648 does not exist.
10649 * config.in: Regenerate.
10650 * configure: Regenerate.
10651
10652 2009-10-09 Doug Kwan <dougkwan@google.com>
10653
10654 * layout.cc (Layout::make_output_section): Call target hook to make
10655 ordinary output section.
10656 (Layout::finalize): Adjust parameter list of call the
10657 Target::may_relax().
10658 * layout.h (class Layout::section_list): New method.
10659 * merge.h (Output_merge_base::entsize): Change visibility to public.
10660 (Output_merge_base::is_string, Output_merge_base::do_is_string):
10661 New methods.
10662 (Output_merge_string::do_is_string): New method.
10663 * object.cc (Sized_relobj::do_setup): renamed from
10664 Sized_relobj::set_up.
10665 * object.h (Sized_relobj::adjust_shndx,
10666 Sized_relobj::initializ_input_to_output_maps,
10667 Sized_relobj::free_input_to_output_maps): Change visibilities to
10668 protected.
10669 (Sized_relobj::setup): Virtualize.
10670 (Sized_relobj::do_setup): New method declaration.
10671 (Sized_relobj::invalidate_section_offset,
10672 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10673 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10674 * options.cc (parse_int): New function.
10675 * options.h (parse_int): New declaration.
10676 (DEFINE_int): New macro.
10677 (stub_group_size): New option.
10678 * output.cc (Output_section::Output_section): Initialize memebers
10679 merge_section_map_, merge_section_by_properties_map_,
10680 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10681 (Output_section::add_input_section): Handled deferred code-fill
10682 generation and remove an old comment.
10683 (Output_section::add_relaxed_input_section): New method definition.
10684 (Output_section::add_merge_input_section): Use merge section by
10685 properties map to speed to search. Update merge section maps
10686 as appropriate.
10687 (Output_section::build_relaxation_map): New method definition.
10688 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10689 Same.
10690 (Output_section::relax_input_section): Renamed to
10691 Output_section::convert_input_sections_to_relaxed_sections and change
10692 interface to take a vector of pointers to relaxed sections.
10693 (Output_section::find_merge_section,
10694 Output_section::find_relaxed_input_section): New method definitions.
10695 (Output_section::is_input_address_mapped,
10696 Output_section::output_offset, Output_section::output_address):
10697 Use output section data maps to speed up searching.
10698 (Output_section::find_starting_output_address): Add comments.
10699 (Output_section::do_write,
10700 Output_section::write_to_postprocessing_buffer): Do code-fill
10701 generation as appropriate.
10702 (Output_section::get_input_sections): Invalidate relaxed input section
10703 map.
10704 (Output_section::restore_states): Adjust type of checkpoint .
10705 Invalidate relaxed input section map.
10706 * output.h (Output_merge_base): New class declaration.
10707 (Input_section_specifier): New class defintion.
10708 (class Output_relaxed_input_section) Change base class to
10709 Output_section_data_build.
10710 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10711 base class initializer.
10712 (Output_section::add_relaxed_input_section): New method declaration.
10713 (Output_section::Input_section): Change visibility to protected.
10714 (Output_section::Input_section::relobj,
10715 Output_section::Input_section::shndx): Handle relaxed input sections.
10716 Output_section::input_sections) Change visibility to protected. Also
10717 define overload to return a non-const pointer.
10718 (Output_section::Merge_section_properties): New class defintion.
10719 (Output_section::Merge_section_by_properties_map,
10720 Output_section::Output_section_data_by_input_section_map,
10721 Output_section::Relaxation_map): New types.
10722 (Output_section::relax_input_section): Rename method to
10723 Output_section::convert_input_sections_to_relaxed_sections and change
10724 interface to take a vector of relaxed section pointers.
10725 (Output_section::find_merge_section,
10726 Output_section::find_relaxed_input_section,
10727 Output_section::build_relaxation_map,
10728 Output_section::convert_input_sections_in_list_to_relaxed_sections):
10729 New method declarations.
10730 (Output_section::merge_section_map_
10731 Output_section::merge_section_by_properties_map_,
10732 Output_section::relaxed_input_section_map_,
10733 Output_section::is_relaxed_input_section_map_valid_,
10734 Output_section::generate_code_fills_at_write_): New data members.
10735 * script-sections.cc
10736 (Output_section_element_input::set_section_addresses): Call
10737 current_data_size and addralign methods of relaxed input sections.
10738 (Orphan_output_section::set_section_addresses): Call current_data_size
10739 and addralign methods of relaxed input sections.
10740 * symtab.cc (Symbol_table::compute_final_value): Extract template
10741 from the body of Symbol_table::sized_finalize_symbol.
10742 (Symbol_table::sized_finalized_symbol): Call
10743 Symbol_table::compute_final_value.
10744 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10745 (Symbol_table::compute_final_value): New templated method declaration.
10746 * target.cc (Target::do_make_output_section): New method defintion.
10747 * target.h (Target::make_output_section): New method declaration.
10748 (Target::relax): Add more parameters for input objects, symbol table
10749 and layout. Adjust call to do_relax.
10750 (Target::do_make_output_section): New method declaration.
10751 (Target::do_relax): Add parameters for input objects, symbol table
10752 and layout.
10753
10754 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10755
10756 * pread.c: Include stdio.h.
10757
10758 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10759
10760 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10761 defined.
10762
10763 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10764
10765 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10766 Change read_shndx type to unsigned int.
10767 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10768 int.
10769 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10770 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10771 Change read_shndx type to unsigned int.
10772 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10773 int.
10774 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10775 * layout.cc (Layout::create_symtab_sections): Cast the result of
10776 local_symcount * symsize to off_t in the gold_assert.
10777
10778 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10779
10780 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10781 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10782 R_ARM_BASE_ABS.
10783 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10784 (Arm_relocate_functions::thm_abs5): New function.
10785 (Arm_relocate_functions::abs12): New function.
10786 (Arm_relocate_functions::abs16): New function.
10787 (Arm_relocate_functions::base_abs): New function.
10788 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10789 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
10790 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10791 R_ARM_BASE_ABS.
10792 (Scan::global): Likewise.
10793 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10794 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10795 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10796 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10797 R_ARM_BASE_ABS.
10798
10799 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10800
10801 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10802 (Arm_relocate_functions::movt_prel): New function.
10803 (Arm_relocate_functions::thm_movw_prel_nc): New function.
10804 (Arm_relocate_functions::thm_movt_prel): New function.
10805 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10806 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10807 (Scan::global, Relocate::relocate): Likewise.
10808 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10809
10810 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10811
10812 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10813 Incremental_checker.
10814 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10815 unsigned int.
10816 (class Incremental_inputs_header): New class.
10817 (Incremental_inputs_header_writer): Edit comment.
10818 (Incremental_inputs_entry): New class.
10819 (Incremental_inputs_entry_writer): Edit comment.
10820 (Sized_incremental_binary::do_find_incremental_inputs_section):
10821 Add *strtab_shndx parameter, fill it.
10822 (Sized_incremental_binary::do_check_inputs): New method.
10823 (Incremental_checker::can_incrementally_link_output_file): Use
10824 Sized_incremental_binary::check_inputs.
10825 (Incremental_inputs::report_command_line): Save command line in
10826 command_line_.
10827 * incremental.h:
10828 (Incremental_binary::find_incremental_inputs_section): New
10829 method.
10830 (Incremental_binary::do_find_incremental_inputs_section): Add
10831 strtab_shndx parameter.
10832 (Incremental_binary::do_check_inputs): New pure virtual method.
10833 (Sized_incremental_binary::do_check_inputs): Declare.
10834 (Incremental_checker::Incremental_checker): Add incremental_inputs
10835 parameter, use it to initialize incremental_inputs_.
10836 (Incremental_checker::incremental_inputs_): New field.
10837 (Incremental_checker::command_line): New method.
10838 (Incremental_checker::inputs): New method.
10839 (Incremental_checker::command_line_): New field.
10840
10841 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10842
10843 * incremental.cc: Include <cstdarg> and "target-select.h".
10844 (vexplain_no_incremental): New function.
10845 (explain_no_incremental): New function.
10846 (Incremental_binary::error): New method.
10847 (Sized_incremental_binary::do_find_incremental_inputs_section): New
10848 method.
10849 (make_sized_incremental_binary): New function.
10850 (open_incremental_binary): New function.
10851 (can_incrementally_link_file): Add checks if output is ELF and has
10852 inputs section.
10853 * incremental.h: Include "elfcpp_file.h" and "output.h".
10854 (Incremental_binary): New class.
10855 (Sized_incremental_binary): New class.
10856 (open_incremental_binary): Declare.
10857 * object.cc (is_elf_object): Use
10858 elfcpp::Elf_recognizer::is_elf_file.
10859 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10860 * output.h (Output_file::filesize): New method.
10861
10862 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10863
10864 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10865 New function.
10866 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10867 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10868 function.
10869 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10870 function.
10871 (Arm_relocate_functions::movw_abs_nc): New function.
10872 (Arm_relocate_functions::movt_abs): New function.
10873 (Arm_relocate_functions::thm_movw_abs_nc): New function.
10874 (Arm_relocate_functions::thm_movt_abs): New function.
10875 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10876 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10877 (Scan::global): Likewise.
10878 (Relocate::relocate): Likewise.
10879 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10880
10881 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10882
10883 * arm.cc (Arm_relocate_functions::got_prel) New function.
10884 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10885 (Relocate::relocate): Likewise.
10886 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10887
10888 2009-10-06 Ian Lance Taylor <iant@google.com>
10889
10890 * options.h (class General_options): Define
10891 split_stack_adjust_size parameter.
10892 * object.h (class Object): Add uses_split_stack_ and
10893 has_no_split_stack_ fields. Add uses_split_stack and
10894 has_no_split_stack accessor functions. Declare
10895 handle_split_stack_section.
10896 (class Reloc_symbol_changes): Define.
10897 (class Sized_relobj): Define Function_offsets. Declare
10898 split_stack_adjust, split_stack_adjust_reltype, and
10899 find_functions.
10900 * object.cc (Object::handle_split_stack_section): New function.
10901 (Sized_relobj::do_layout): Call handle_split_stack_section.
10902 * dynobj.cc (Sized_dynobj::do_layout): Call
10903 handle_split_stack_section.
10904 * reloc.cc (Sized_relobj::relocate_sections): Call
10905 split_stack_adjust for executable sections in split_stack
10906 objects. Pass reloc_map to relocate_section.
10907 (Sized_relobj::split_stack_adjust): New function.
10908 (Sized_relobj::split_stack_adjust_reltype): New function.
10909 (Sized_relobj::find_functions): New function.
10910 * target-reloc.h: Include "object.h".
10911 (relocate_section): Add reloc_symbol_changes parameter. Change
10912 all callers.
10913 * target.h (class Target): Add calls_non_split method. Declare
10914 do_calls_non_split virtual method. Declare match_view and
10915 set_view_to_nop.
10916 * target.cc: Include "elfcpp.h".
10917 (Target::do_calls_non_split): New function.
10918 (Target::match_view): New function.
10919 (Target::set_view_to_nop): New function.
10920 * gold.cc (queue_middle_tasks): Give an error if mixing
10921 split-stack and non-split-stack objects with -r.
10922 * i386.cc (Target_i386::relocate_section): Add
10923 reloc_symbol_changes parameter.
10924 (Target_i386::do_calls_non_split): New function.
10925 * x86_64.cc (Target_x86_64::relocate_section): Add
10926 reloc_symbol_changes parameter.
10927 (Target_x86_64::do_calls_non_split): New function.
10928 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10929 parameter.
10930 * powerpc.cc (Target_powerpc::relocate_section): Add
10931 reloc_symbol_changes parameter.
10932 * sparc.cc (Target_sparc::relocate_section): Add
10933 reloc_symbol_changes parameter.
10934 * configure.ac: Call AM_CONDITIONAL for the default target.
10935 * configure: Rebuild.
10936 * testsuite/Makefile.am (TEST_AS): New variable.
10937 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10938 (check_DATA): Add split_i386 and split_x86_64 files.
10939 (SPLIT_DEFSYMS): Define.
10940 (split_i386_[1234n].o): New targets.
10941 (split_i386_[124]): New targets.
10942 (split_i386_[1234r].stdout): New targets.
10943 (split_x86_64_[1234n].o): New targets.
10944 (split_x86_64_[124]): New targets.
10945 (split_x86_64_[1234r].stdout): New targets.
10946 (MOSTLYCLEANFILES): Add new executables.
10947 * testsuite/split_i386.sh: New file.
10948 * testsuite/split_x86_64.sh: New file.
10949 * testsuite/split_i386_1.s: New file.
10950 * testsuite/split_i386_2.s: New file.
10951 * testsuite/split_i386_3.s: New file.
10952 * testsuite/split_i386_4.s: New file.
10953 * testsuite/split_i386_n.s: New file.
10954 * testsuite/split_x86_64_1.s: New file.
10955 * testsuite/split_x86_64_2.s: New file.
10956 * testsuite/split_x86_64_3.s: New file.
10957 * testsuite/split_x86_64_4.s: New file.
10958 * testsuite/split_x86_64_n.s: New file.
10959 * testsuite/testfile.cc (Target_test): Update relocation_section
10960 function.
10961 * testsuite/Makefile.in: Rebuild.
10962
10963 2009-10-06 Ian Lance Taylor <iant@google.com>
10964
10965 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10966 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10967 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
10968 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10969 the address on ldo_addrs_.
10970 (Target_i386::Relocate::fix_up_ldo): New function.
10971
10972 2009-10-06 Rafael Espindola <espindola@google.com>
10973
10974 * plugin.cc (add_input_library): New.
10975 (Plugin::load): Add add_input_library to tv.
10976 (Plugin_manager::add_input_file): Add the is_lib argument.
10977 (add_input_file): Update call to Plugin_manager::add_input_file.
10978 (add_input_library): New.
10979 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10980
10981 2009-09-30 Doug Kwan <dougkwan@google.com>
10982
10983 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10984 symbol and call Symbol::may_need_copy_reloc to determine if
10985 a copy reloc is needed.
10986 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10987 nocopyreloc is given in command line.
10988 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10989 given in command line.
10990 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10991 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10992 of the removed Target_i386::may_need_copy_reloc.
10993 * options.h (copyreloc): New option with default value false.
10994 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10995 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10996 instead of the removed Target_powerpc::may_need_copy_reloc.
10997 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10998 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10999 instead of the removed Target_sparc::may_need_copy_reloc.
11000 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11001 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11002 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11003 instead of the removed Target_x86_64::may_need_copy_reloc.
11004
11005 2009-09-30 Ian Lance Taylor <iant@google.com>
11006
11007 * object.h (class Object): Remove target_ field, and target,
11008 sized_target, and set_target methods.
11009 (Object::sized_target): Remove.
11010 (class Sized_relobj): Update declarations. Remove sized_target.
11011 * object.cc (Sized_relobj::setup): Remove target parameter.
11012 Change all callers.
11013 (Input_objects::add_object): Don't do anything with the target.
11014 (make_elf_sized_object): Add punconfigured parameter. Change all
11015 callers. Set or test parameter target.
11016 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11017 Change all callers.
11018 * parameters.cc (Parameters::set_target): Change parameter type to
11019 be non-const.
11020 (Parameters::default_target): Remove.
11021 (set_parameters_target): Change parameter type to be non-const.
11022 (parameters_force_valid_target): New function.
11023 (parameters_clear_target): New function.
11024 * parameters.h (class Parameters): Update declarations. Remove
11025 default_target method. Add sized_target and clear_target
11026 methods. Change target_ to be non-const.
11027 (set_parameters_target): Update declaration.
11028 (parameters_force_valid_target): Declare.
11029 (parameters_clear_target): Declare.
11030 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11031 as NULL if we aren't searching.
11032 (Add_symbols::run): Don't check for compatible target.
11033 * fileread.cc (Input_file::open_binary): Call
11034 parameters_force_valid_target.
11035 * gold.cc (queue_middle_tasks): Likewise.
11036 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
11037 set_target on object.
11038 * dynobj.h (class Sized_dynobj): Update declarations.
11039 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11040 make_elf_object returns NULL.
11041 (Archive::include_member): Don't check whether object target is
11042 compatible.
11043 * output.cc (Output_section::add_input_section): Get target from
11044 parameters.
11045 (Output_section::relax_input_section): Likewise.
11046 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11047 parameters.
11048 (Sized_relobj::do_scan_relocs): Likewise.
11049 (Sized_relobj::relocate_sections): Likewise.
11050 * resolve.cc (Symbol_table::resolve): Likewise.
11051 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
11052 parameter. Change all callers.
11053 (Symbol_table::add_from_object): Get target from parameters.
11054 (Symbol_table::add_from_relobj): Don't check object target.
11055 (Symbol_table::add_from_dynobj): Likewise.
11056 (Symbol_table::define_special_symbol): Get target from
11057 parameters.
11058 * symtab.h (class Symbol_table): Update declaration.
11059 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11060 parameter. Change all callers. Clear parameter target.
11061 (Binary_test): Test target here.
11062 * testsuite/object_unittest.cc (gold_testsuite): Remove
11063 target_test_pointer parameter. Change all callers.
11064 (Object_test): Test target here.
11065
11066 2009-09-26 Ian Lance Taylor <iant@google.com>
11067
11068 * testsuite/initpri1.c: Don't try to use constructor priorities if
11069 compiling with gcc before 4.3.
11070
11071 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
11072
11073 * testsuite/retain_symbols_file_test.sh (check_present): Change
11074 output file name to retain_symbols_file_test.stdout.
11075 (check_absent): Likewise.
11076
11077 2009-09-18 Craig Silverstein <csilvers@google.com>
11078
11079 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11080 * options.cc: Include <cerrno> and <fstream>.
11081 (General_options::finalize): Parse -retain-symbols-file tag.
11082 * options.h: New flag.
11083 (General_options): New method should_retain_symbol, new
11084 variable symbols_to_retain.
11085 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11086 should_retain_symbol map.
11087 * testsuite/Makefile.am (retain_symbols_file_test): New test.
11088 * testsuite/Makefile.in: Regenerate.
11089 * testsuite/retain_symbols_file_test.sh: New file.
11090
11091 2009-09-18 Nick Clifton <nickc@redhat.com>
11092
11093 * po/es.po: Updated Spanish translation.
11094
11095 2009-09-17 Doug Kwan <dougkwan@google.com>
11096
11097 * debug.h (DEBUG_RELAXATION): New constant.
11098 (DEBUG_ALL): Add DEBUG_RELAXATION.
11099 (debug_string_to_enum): Add relaxation debug option.
11100 * layout.cc
11101 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11102 Layout::Relaxation_debug_check::read_sections,
11103 Layout::Relaxation_debug_check::read_sections): New method definitions.
11104 (Layout::Layout): Initialize data members
11105 record_output_section_data_from_scrips_,
11106 script_output_section_data_list_ and relaxation_debug_check_.
11107 (Layout::save_segments, Layout::restore_segments,
11108 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11109 Layout::relaxation_loop_body): New method definitions.
11110 (Layout::finalize): Support relaxation. Move section layout code to
11111 Layout::relaxation_loop_body.
11112 (Layout::set_asection_address_from_script): Move code for orphan
11113 section placement out.
11114 (Layout::place_orphan_sections_in_script): New method definition.
11115 * layout.h (Output_segment_headers, Output_file_header):
11116 New forward class declarations.
11117 (Layout::~Layout): Define.
11118 (Layout::new_output_section_data_from_script): New method definition.
11119 (Layout::place_orphan_sections_in_script): New method declaration.
11120 (Layout::Segment_states): New type declaration.
11121 (Layout::save_segments, Layout::restore_segments,
11122 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11123 Layout::relaxation_loop_body): New method declarations.
11124 (Layout::Output_section_data_list): New type declaration.
11125 (Layout::Relaxation_debug_check): New class definition.
11126 (Layout::record_output_section_data_from_script_,
11127 Layout::script_output_section_data_list_, Layout::segment_states_,
11128 Layout::relaxation_debug_check_): New data members.
11129 * output.cc: (Output_section_headers::do_size): New method definition.
11130 (Output_section_headers::Output_section_headers): Move size
11131 computation to Output_section_headers::do_size.
11132 (Output_segment_headers::do_size): New method definition.
11133 (Output_file_header::Output_file_header): Move size computation to
11134 Output_file_header::do_size and call it.
11135 (Output_file_header::do_size): New method definition.
11136 (Output_data_group::Output_data_group): Adjust call to
11137 Output_section_data.
11138 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11139 (Output_symtab_xindex::do_write): Add array bound check.
11140 (Output_section::Input_section::print_to_mapfile): Handle
11141 RELAXED_INPUT_SECTION_CODE.
11142 (Output_section::Output_section): Initialize data member checkpoint_.
11143 (Output_section::~Output_section): Delete checkpoint object pointed
11144 by checkpoint_.
11145 (Output_section::add_input_section): Always add an Input_section if
11146 relaxing.
11147 (Output_section::add_merge_input_section): Add assert.
11148 (Output_section::relax_input_section): New method definition.
11149 (Output_section::set_final_data_size): Set load address to zero for
11150 an unallocated section.
11151 (Output_section::do_address_and_file_offset_have_reset_values):
11152 New method definition.
11153 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11154 Handle relaxed input section.
11155 (Output_section::sort_attached_input_sections): Checkpoint input
11156 section list lazily.
11157 (Output_section::get_input_sections): Change type of input_sections to
11158 list of Simple_input_section pointers. Checkpoint input section list
11159 lazily. Also handle relaxed input sections.
11160 (Output_section::add_input_section_for_script): Take a reference to
11161 a Simple_input_section object instead of Relobj pointer and section
11162 index as parameter. Handle relaxed input sections.
11163 (Output_section::save_states, Output_section::restore_states): New
11164 method definitions.
11165 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11166 (Output_data::is_data_size_fixed): New method definition.
11167 (Output_data::reset_addresss_and_file_offset): Do not reset data size
11168 if it is fixed.
11169 (Output_data::address_and_file_offset_have_reset_values): New method
11170 definition.
11171 (Output_data::do_address_and_file_offset_have_reset_values): New method
11172 definition.
11173 (Output_data::set_data_size): Check that data size is not fixed.
11174 (Output_data::fix_data_size): New method definition.
11175 (Output_data::is_data_size_fixed_): New data member.
11176 (Output_section_headers::set_final_data_size): New method definition.
11177 (Output_section_headers::do_size): New method declaration.
11178 (Output_segment_headers::set_final_data_size): New method definition.
11179 (Output_segment_headers::do_size): New method declaration.
11180 (Output_file_header::set_final_data_size)::New method definition.
11181 (Output_file_header::do_size)::New method declaration.
11182 (Output_section_data::Output_section_data): Add new parameter
11183 is_data_size_fixed and use it to fix data size.
11184 (Output_data_const::Output_data_const): Adjust call to base class
11185 constructor and fix data size.
11186 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11187 base class constructor and fix data size.
11188 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11189 base class constructor and fix data size.
11190 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11191 class constructor and fix data size.
11192 (Output_data_group::set_final_data_size): New method definition.
11193 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11194 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11195 class constructor and fix data size.
11196 (Output_relaxed_input_section): New class definition.
11197 (Output_section::Simple_input_section): New class definition.
11198 (Output_section::get_input_sections): Adjust parameter list.
11199 (Output_section::add_input_section_for_script): Same.
11200 (Output_section::save_states, Output_section::restore_states,
11201 Output_section::do_address_and_file_offset_have_reset_values,
11202 (Output_section::Input_section::Input_section): Handle
11203 RELAXED_INPUT_SECTION_CODE. Add new overload for
11204 Output_relaxed_input_section.
11205 (Output_section::Input_section::is_input_section,
11206 Output_section::Input_section::set_output_section): Handle relaxed
11207 input section.
11208 (Output_section::Input_section::is_relaxed_input_section,
11209 Output_section::Input_section::output_section_data,
11210 Output_section::Input_section::relaxed_input_section): New method
11211 definitions.
11212 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11213 value.
11214 (Output_section::Input_section::u1_): Update comments.
11215 (Output_section::Input_section::u2_): Add new union member poris.
11216 (Output_section::Checkpoint_output_section): New classs definition.
11217 (Output_section::relax_input_section): New method declaration.
11218 (Output_section::checkpoint_): New data member.
11219 (Output_segment): Update comments.
11220 (Output_segment::Output_segment): Un-privatize copy constructor.
11221 (Output_segment::operator=): Un-privatize.
11222 * script-sections.cc (Output_section_element::Input_section_list):
11223 Change element type to Output_section::Simple_input_section.
11224 (Output_section_element_dot_assignment::set_section_addresses):
11225 Register output section data for relaxation clean up.
11226 (Output_data_exression::Output_data_expression): Adjust call to base
11227 constructor to fix data size.
11228 (Output_section_element_data::set_section_addresses): Register
11229 Output_data_expression object for relaxation clean up.
11230 (struct Input_section_info): Replace Relobj pointer and section index
11231 pair with Output_section::Simple_input_section and Convert struct to a
11232 class.
11233 (Input_section_sorter::operator()): Adjust access to
11234 Input_section_info data member to use accessors.
11235 (Output_section_element_input::set_section_addresses): Use layout
11236 parameter. Adjust code to use Output_section::Simple_input_section
11237 and Input_secction_info classes. Register filler for relaxation
11238 clean up.
11239 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11240 and section index pair with Output_section::Simple_input_section
11241 class. Adjust code accordingly.
11242 (Phdrs_element::release_segment): New method definition.
11243 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11244 segment list.
11245 (Script_sections::release_segments): New method definition.
11246 * gold/script-sections.h (Script_sections::release_segments): New
11247 method declaration.
11248 * gold/target.h (Target::may_relax, Target::relax,
11249 Target::do_may_relax, Target::do_relax): New method definitions.
11250
11251 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
11252
11253 * arm.cc (has_signed_unsigned_overflow): New function.
11254 (Arm_relocate_functions::abs8): New function.
11255 (Target_arm::Scan::local): Handle R_ARM_ABS8.
11256 (Target_arm::Scan::global): Likewise.
11257 (Target_arm::relocate::relocate): Likewise.
11258 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11259 Likewise.
11260
11261 2009-09-16 Cary Coutant <ccoutant@google.com>
11262
11263 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11264 * testsuite/Makefile.in: Regenerate.
11265
11266 2009-09-11 Nick Clifton <nickc@redhat.com>
11267
11268 * po/gold.pot: Updated by the Translation project.
11269
11270 2009-09-08 Cary Coutant <ccoutant@google.com>
11271
11272 * output.cc (Output_file::open): Add execute permission to empty file.
11273 * testsuite/Makefile.am (permission_test): New test.
11274 * testsuite/Makefile.in: Regenerate.
11275
11276 2009-09-02 Ian Lance Taylor <iant@google.com>
11277
11278 * output.cc (Output_file::resize): Call map_no_anonymous rather
11279 than map.
11280
11281 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
11282
11283 * gold.cc: Include "incremental.h".
11284 (queue_initial_tasks): Call Incremental_checker methods.
11285 * incremental.cc: Include "output.h".
11286 (Incremental_checker::can_incrementally_link_output_file): New
11287 method.
11288 * incremental.h (Incremental_checker): New class.
11289
11290 * output.cc (Output_file::open_for_modification): New method.
11291 (Output_file::map_anonymous): Changed return type to bool. Record
11292 map in base_ field.
11293 (Output_file::map_no_anonymous): New method, broken out of map.
11294 (Output_file::map): Use map_no_anonymous and map_anonymous.
11295 * output.h (class Output_file): Update declarations.
11296
11297 2009-08-24 Cary Coutant <ccoutant@google.com>
11298
11299 * options.h (Command_line::Pre_options): New class.
11300 (Command_line::pre_options): New member.
11301 * options.cc (gold::options::ready_to_register): New variable.
11302 (One_option::register_option): Do nothing if not registering options.
11303 Assert if same short option registered twice.
11304 (General_options::General_options): Turn off option registration when
11305 done constructing.
11306 (Command_line::Pre_options::Pre_options): New constructor.
11307
11308 2009-08-24 Cary Coutant <ccoutant@google.com>
11309
11310 * options.h (General_options::no_keep_memory): Remove incorrect
11311 short option.
11312
11313 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
11314
11315 * Makefile.am (am__skiplex, am__skipyacc): New.
11316 * Makefile.in: Regenerate.
11317
11318 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
11319
11320 * Makefile.am (AM_CPPFLAGS): Renamed from ...
11321 (INCLUDES): ... this.
11322 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11323 (AM_CPPFLAGS): Renamed from ...
11324 (INCLUDE): ... this.
11325 * Makefile.in, testsuite/Makefile.in: Regenerate.
11326
11327 * Makefile.in: Regenerate.
11328 * aclocal.m4: Likewise.
11329 * config.in: Likewise.
11330 * configure: Likewise.
11331 * testsuite/Makefile.in: Likewise.
11332
11333 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11334 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11335 * Makefile.in: Regenerate.
11336 * testsuite/Makefile.in: Regenerate.
11337
11338 2009-08-19 Cary Coutant <ccoutant@google.com>
11339
11340 * resolve.cc (Symbol_table::resolve): Don't complain about defined
11341 symbols in shared libraries overridden by hidden or internal symbols
11342 in the main program.
11343
11344 2009-08-19 Chris Demetriou <cgd@google.com>
11345
11346 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11347 checking source file names in error messages.
11348
11349 2009-08-18 Doug Kwan <dougkwan@google.com>
11350
11351 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11352 an elcpp::Ehdr as parameter. Adjust call to set_target.
11353 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11354 an elfcpp::Ehdr as parameter.
11355 * object.cc (Object::set_target): Remove the version that looks up
11356 a target and sets it.
11357 (Sized_relobj::setup): Take a Target object instead of
11358 an elfcpp::Ehdr as parameter. Adjust call to set_target.
11359 (make_elf_sized_object): Find target and ask target to
11360 make an ELF object.
11361 * object.h: (Object::set_target): Remove the version that looks up
11362 a target and sets it.
11363 (Sized_relobj::setup): Take a Target object instead of
11364 an elfcpp:Ehdr as parameter.
11365 * target.cc: Include dynobj.h.
11366 (Target::do_make_elf_object_implementation): New.
11367 (Target::do_make_elf_object): New.
11368 * target.h (Target::make_elf_object): New template declaration.
11369 (Target::do_make_elf_object): New method declarations.
11370 (Target::do_make_elf_object_implementation): New template declaration.
11371
11372 2009-08-14 Ian Lance Taylor <iant@google.com>
11373
11374 * gold.h (FUNCTION_NAME): Define.
11375 (gold_unreachable): Use FUNCTION_NAME.
11376
11377 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11378
11379 * icf.cc (Icf::find_identical_sections): Issue a warning when a
11380 symbol in the --keep-unique list is not found.
11381
11382 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11383
11384 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11385 been maked as --keep-unique.
11386 (Icf::unfold_section): New function.
11387 * icf.h (Icf::unfold_section): New function.
11388 * options.h (General_options::keep_unique): New option.
11389 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11390 * testsuite/Makefile.in: Regenerate.
11391 * testsuite/icf_keep_unique_test.sh: New file.
11392 * testsuite/icf_keep_unique_test.cc: New file.
11393
11394 2009-08-12 Cary Coutant <ccoutant@google.com>
11395
11396 PR 10471
11397 * resolve.cc (Symbol_table::resolve): Check for references from
11398 dynamic objects to hidden and internal symbols.
11399 * testsuite/Makefile.am (hidden_test.sh): New test.
11400 * testsuite/Makefile.in: Regenerate.
11401 * testsuite/hidden_test.sh: New script.
11402 * testsuite/hidden_test_1.c: New test source.
11403 * testsuite/hidden_test_main.c: New test source.
11404
11405 2009-08-11 Doug Kwan <dougkwan@google.com>
11406
11407 * arm.cc: Update comments.
11408 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11409 segment to locate the .ARM.exidx section if present.
11410
11411 2009-08-09 Doug Kwan <dougkwan@google.com>
11412
11413 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11414 patch.
11415
11416 2009-08-07 Sriraman Tallam <tmsriram@google.com>
11417 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11418 compiler warnings.
11419
11420 2009-08-06 Sriraman Tallam <tmsriram@google.com>
11421
11422 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11423 valid tls_segment only for non-debug-section relocations.
11424 * testsuite/Makefile.am: Add gc_tls_test.
11425 * testsuite/Makefile.in: Regenerate.
11426 * testsuite/gc_tls_test.cc: New file.
11427 * testsuite/gc_tls_test.sh: New file.
11428
11429 2009-08-05 Sriraman Tallam <tmsriram@google.com>
11430
11431 * icf.cc: New file.
11432 * icf.h: New file.
11433 * Makefile.am (CCFILES): Add icf.cc.
11434 (HFILES): Add icf.h
11435 * Makefile.in: Regenerate.
11436 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11437 * gc.h (gc_process_relocs): Populate lists used by icf to contain
11438 section, symbol and addend information for the relocs.
11439 * gold.cc (queue_middle_tasks): Call identical code folding.
11440 * gold.h: Add defines for multimap.
11441 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11442 to the call of finalize_local_symbols.
11443 * main.cc (main): Create object of class Icf.
11444 * object.cc (Sized_relobj::do_layout): Allow this function to be
11445 called twice during icf.
11446 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11447 to sections marked as identical by icf.
11448 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11449 when available.
11450 (Sized_relobj::do_section_entsize): New function.
11451 * object.h (Object::section_entsize): New function.
11452 (Object::do_section_entsize): New pure virtual function.
11453 (Relobj::finalize_local_symbols): Add new parameter.
11454 (Relobj::do_section_entsize): New function.
11455 * options.h (General_options::icf): New option.
11456 (General_options::icf_iterations): New option.
11457 (General_options::print_icf_sections): New option.
11458 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11459 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11460 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11461 icf.
11462 * symtab.cc (Symbol_table::is_section_folded): New function.
11463 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
11464 to sections marked as identical by icf.
11465 * symtab.h (Symbol_table::set_icf): New function.
11466 (Symbol_table::icf): New function.
11467 (Symbol_table::is_section_folded): New function.
11468 (Symbol_table::icf_): New data member.
11469 * target-reloc.h (relocate_section): Ignore sections folded by icf.
11470 * testsuite/Makefile.am: Add commands to build icf_test.
11471 * testsuite/Makefile.in: Regenerate.
11472 * testsuite/icf_test.sh: New file.
11473 * testsuite/icf_test.cc: New file.
11474
11475 2009-07-24 Chris Demetriou <cgd@google.com>
11476
11477 * layout.cc (is_compressible_debug_section): Fix incorrect
11478 comment about compressed section names.
11479
11480 2009-07-20 Ian Lance Taylor <ian@airs.com>
11481
11482 PR 10419
11483 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11484
11485 2009-07-16 Ian Lance Taylor <iant@google.com>
11486
11487 PR 10400
11488 * layout.h: #include <map>.
11489 (class Kept_section): Change from struct to class. Add accessors
11490 and setters. Add section size to Comdat_group mapping. Change
11491 Comdat_group to std::map. Add is_comdat_ field. Add
11492 linkonce_size field in union.
11493 (class Layout): Update declaration of find_or_add_kept_section.
11494 Don't declare find_kept_object.
11495 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11496 parameter. Add object, shndx, is_comdat, and is_group_name
11497 parameters. Change all callers. Adjust for new Kept_section.
11498 (Layout::find_kept_object): Remove.
11499 * object.cc (Sized_relobj::include_section_group): Update use of
11500 Kept_section. Rename secnum to shndx. Only record
11501 Kept_comdat_section if sections are the same size.
11502 (Sized_relobj::include_linkonce_section): Update use of
11503 Kept_section. Only record Kept_comdat_section if sections are the
11504 same size. Set size of linkonce section.
11505 (Sized_relobj::map_to_kept_section): Update call to
11506 get_kept_comdat_section.
11507 * object.h (class Sized_relobj): Rename fields in
11508 Kept_comdat_section to drop trailing underscores; change object
11509 field to Relobj*. Change Kept_comdat_section_table to store
11510 struct rather than pointer.
11511 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11512 Add kept_object and kept_shndx parameters. Change all callers.
11513 (Sized_relobj::get_kept_comdat_section): Change return type to
11514 bool. Add kept_object and kept_shndx parameters. Change all
11515 callers.
11516 * plugin.cc (Pluginobj::include_comdat_group): Update call to
11517 Layout::find_or_add_kept_section.
11518
11519 2009-07-09 Ian Lance Taylor <iant@google.com>
11520
11521 * merge.cc (Object_merge_map::initialize_input_to_output_map):
11522 Reserve space in the hash table.
11523
11524 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
11525
11526 * fileread.cc (File_read::get_mtime): New method.
11527 * fileread.h (Timespec): New structure.
11528 (File_read::get_mtime): New method.
11529 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11530 Renamed from timestamp_nsec.
11531 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11532 Elf_Xword.
11533 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11534 timestamp_nsec.
11535 (Incremental_inputs::report_archive): Save mtime; style fix.
11536 (Incremental_inputs::report_obejct): Save mtime; style fix.
11537 (Incremental_inputs::report_script): Save mtime; style fix.
11538 (Incremental_inputs::finalize_inputs): Style fix.
11539 (Incremental_inputs::finalize): Style fix.
11540 (Incremental_inputs::create_input_section_data): Store inputs
11541 mtime.
11542 * incremental.h (Incremental_inputs::report_script): Add mtime
11543 argument.
11544 (Incremental_inputs::Input_info::Input_info): Intialize only one
11545 union member.
11546 (Incremental_inputs::Input_info::archive): Move to nameless
11547 union.
11548 (Incremental_inputs::Input_info::obejct): Move to nameless union.
11549 (Incremental_inputs::Input_info::script): Move to nameless union.
11550 (Incremental_inputs::mtime): New field.
11551 * script.cc (read_input_script): Pass file mtime to
11552 Incremental_input.
11553 * script.h (Script_info::inputs): Style fix.
11554
11555 2009-07-01 Ian Lance Taylor <ian@airs.com>
11556
11557 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11558 instead of 32.
11559
11560 2009-06-24 Ian Lance Taylor <iant@google.com>
11561
11562 PR 10156
11563 * layout.cc (Layout::choose_output_section): If we find an
11564 existing section, update the flags.
11565 (Layout::create_notes): New function, broken out of
11566 Layout::finalize.
11567 (Layout::finalize): Don't create note sections.
11568 (Layout::create_note): Don't crash if linker script discards
11569 section.
11570 (Layout::create_gold_note): Likewise.
11571 (Layout::create_build_id): Likewise. Don't set
11572 after_input_sections on the section.
11573 (Layout::create_executable_stack_info): Remove target parameter.
11574 Change caller.
11575 * layout.h (class Layout): Declare create_notes. Update
11576 declaration of create_executable_stack_info.
11577 * gold.cc (queue_middle_tasks): Call create_notes.
11578 * output.cc (Output_section::update_flags_for_input_section): Move
11579 here from output.h. If SHF_ALLOC flag is newly set, mark address
11580 invalid.
11581 * output.h (Output_data::mark_address_invalid): New function.
11582 (class Output_section): Only declare, not define,
11583 update_flags_for_input_section. Remove set_flags.
11584
11585 2009-06-24 Ian Lance Taylor <iant@google.com>
11586
11587 * script-sections.cc (Output_section_definition::
11588 set_section_addresses): Rename shadowing local load_address to
11589 laddr.
11590
11591 2009-06-24 Ian Lance Taylor <iant@google.com>
11592
11593 PR 10244
11594 * reloc.cc (relocate_sections): Skip empty relocation sections.
11595
11596 2009-06-23 Ian Lance Taylor <iant@google.com>
11597
11598 PR 10156
11599 * layout.cc (Layout::create_note): Use choose_output_section
11600 rather than make_output_section.
11601
11602 2009-06-23 Ian Lance Taylor <iant@google.com>
11603
11604 PR 10237
11605 * options.cc (General_options::parse_V): Set printed_version_.
11606 (General_options::General_options): Initialize printed_version_.
11607 * options.h (class General_options): Add printed_version_ field.
11608 * gold.cc (queue_initial_tasks): If there are no input files,
11609 don't give a fatal error if we printed the version information.
11610 (queue_middle_tasks): If using -r with a shared object, give a
11611 fatal error rather than an ordinary error.
11612
11613 2009-06-23 Ian Lance Taylor <iant@google.com>
11614
11615 PR 10219
11616 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11617 (Layout::make_output_section): Set have_stabstr_section_ if we see
11618 a .stab*str section.
11619 (Layout::finalize): Call link_stabs_sections.
11620 (Layout::link_stabs_sections): New file.
11621 * layout.h (class Layout): Add have_stabstr_section_ field.
11622 Declare link_stabs_sections.
11623
11624 2009-06-23 Doug Kwan <dougkwan@google.com>
11625
11626 * Makefile.am (libgold_a_LIBADD): New.
11627 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11628 * Makefile.in: Regenerate.
11629 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11630 * configure: Regenerate.
11631 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11632 * fileread.cc: Include sys/state.h
11633 * gold.h: Declare memmem and strndup if found missing.
11634 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11635
11636 2009-06-23 Ian Lance Taylor <iant@google.com>
11637
11638 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11639 * configure: Rebuild.
11640
11641 2009-06-23 Ian Lance Taylor <iant@google.com>
11642
11643 PR 10147
11644 * object.cc (Object::section_contents): Don't try to get a view if
11645 the section has length zero.
11646 (Object::handle_gnu_warning_section): If the section is empty, use
11647 the name of the section as the warning.
11648
11649 2009-06-23 Ian Lance Taylor <iant@google.com>
11650
11651 PR 10133
11652 * stringpool.h (class Stringpool_template): Add optimize_ field.
11653 (Stringpool_template::set_optimize): New function.
11654 * stringpool.cc (Stringpool_template::Stringpool_template):
11655 Initialize optimize_ field.
11656 (Stringpool_template::set_string_offsets): Test local optimize
11657 fild rather than parameter.
11658 * layout.cc (Layout::Layout): Call set_optimize on the section
11659 name stringpool.
11660
11661 2009-06-22 Ian Lance Taylor <iant@google.com>
11662
11663 PR 10030
11664 * yyscript.y: Parse TARGET.
11665 * script.cc (script_set_target): New function.
11666 * script-c.h (script_set_target): Declare.
11667 * options.cc (General_options::string_to_object_format): Rename
11668 from string_to_object_format in anonymous namespace. Change
11669 callers.
11670 * options.h (class General_options): Declare
11671 string_to_object_format.
11672
11673 2009-06-22 Ian Lance Taylor <iant@google.com>
11674
11675 * script-sections.cc (Script_sections::create_segments): Don't put
11676 program headers in a PT_LOAD segment if -n or -N.
11677
11678 2009-06-22 Ian Lance Taylor <iant@google.com>
11679
11680 PR 10141
11681 * options.h (class General_options): Add -z lazy and -z now. Sort
11682 -z options into alphabetical order.
11683 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11684
11685 2009-06-21 Ian Lance Taylor <iant@google.com>
11686
11687 * layout.cc (Layout::make_output_section): Call
11688 Target::new_output_section.
11689 (Layout::attach_allocated_section_to_segment): Put large section
11690 sections in a separate load segment with the large segment flag
11691 set.
11692 (Layout::segment_precedes): Sort large data segments after other
11693 load segments.
11694 (align_file_offset): New static function.
11695 (Layout::set_segment_offsets): Use align_file_offset.
11696 * output.h (class Output_section): Add is_small_section_ and
11697 is_large_section_ fields.
11698 (Output_section::is_small_section): New function.
11699 (Output_section::set_is_small_section): New function.
11700 (Output_section::is_large_section): New function.
11701 (Output_section::set_is_large_section): New function.
11702 (Output_section::is_large_data_section): New function.
11703 (class Output_segment): Add is_large_data_segment_ field.
11704 (Output_segment::is_large_data_segment): New function.
11705 (Output_segment::set_is_large_data_segment): New function.
11706 * output.cc (Output_section::Output_section): Initialize new
11707 fields.
11708 (Output_segment::Output_segment): Likewise.
11709 (Output_segment::add_output_section): Add assertion that large
11710 data sections always go in large data segments. Force small data
11711 sections to the end of the list of data sections. Force small BSS
11712 sections to the start of the list of BSS sections. For large BSS
11713 sections to the end of the list of BSS sections.
11714 * symtab.h (class Symbol): Declare is_common_shndx.
11715 (Symbol::is_defined): Check Symbol::is_common_shndx.
11716 (Symbol::is_common): Likewise.
11717 (class Symbol_table): Define enum Commons_section_type. Update
11718 declarations. Add small_commons_ and large_commons_ fields.
11719 * symtab.cc (Symbol::is_common_shndx): New function.
11720 (Symbol_table::Symbol_table): Initialize new fields.
11721 (Symbol_table::add_from_object): Put small and large common
11722 symbols in the right list.
11723 (Symbol_table::sized_finalized_symbol): Check
11724 Symbol::is_common_shndx.
11725 (Symbol_table::sized_write_globals): Likewise.
11726 * common.cc (Symbol_table::do_allocate_commons): Allocate new
11727 common symbol lists. Don't call do_allocate_commons_list if the
11728 list is empty.
11729 (Symbol_table::do_allocate_commons_list): Remove is_tls
11730 parameter. Add comons_section_type parameter. Change all
11731 callers. Handle small and large common symbols.
11732 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11733 Symbol::is_common_shndx.
11734 * resolve.cc (symbol_to_bits): Likewise.
11735 * target.h (Target::small_common_shndx): New function.
11736 (Target::small_common_section_flags): New function.
11737 (Target::large_common_shndx): New function.
11738 (Target::large_common_section_flags): New function.
11739 (Target::new_output_section): New function.
11740 (Target::Target_info): Add small_common_shndx, large_common_shndx,
11741 small_common_section_flags, and large_common_section_flags
11742 fields.
11743 (Target::do_new_output_section): New virtual function.
11744 * arm.cc (Target_arm::arm_info): Initialize new fields.
11745 * i386.cc (Target_i386::i386_info): Likewise.
11746 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11747 Likewise.
11748 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11749 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11750 (Target_x86_64::do_new_output_section): New function.
11751 * configure.ac: Define conditional MCMODEL_MEDIUM.
11752 * testsuite/Makefile.am (check_PROGRAMS): Add large.
11753 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11754 (large_LDFLAGS): Define.
11755 * testsuite/large.c: New file.
11756 * testsuite/testfile.cc (Target_test::test_target_info):
11757 Initialize new fields.
11758 * configure, testsuite/Makefile.in: Rebuild.
11759
11760 2009-06-05 Doug Kwan <dougkwan@google.com>
11761
11762 * Makefile.am (CCFILES): Add target.cc.
11763 * Makefile.in: Regenerate.
11764 * i386.cc (class Target_i386): Define new virtual method to
11765 override do_is_local_label_name in parent.
11766 * object.cc (Sized_relobj::do_count_local_symbols): Discard
11767 local symbols if --discard-locals or -X is given.
11768 * options.h (class General_options): Declare new options
11769 '--discard-locals' and '-X' for discarding locals.
11770 * target.h (class Target): Define new methods is_local_label_name.
11771 Declare new virtual method do_is_local_label_name.
11772 * target.cc: New file.
11773 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11774 (check_SCRIPTS): Add discard_locals_test.sh.
11775 (check_DATA): Add discard_local_tests.syms.
11776 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11777 (discard_local_tests.syms, discard_locals_test.o): New make rules.
11778 * testsuite/Makefile.in: Regenerate.
11779 * testsuite/discard_locals_test.c: New file.
11780 * testsuite/discard_locals_test.sh: Same.
11781
11782 2009-06-05 Doug Kwan <dougkwan@google.com>
11783
11784 * object.cc (Sized_relobj::Sized_relobj): Initialize
11785 discarded_eh_frame_shndx_ to -1U.
11786 (Sized_relobj::do_layout): Record index of a discard .eh_frame
11787 section.
11788 (Sized_relobj::do_count_local_symbols): Skip local symbols in
11789 a discarded .eh_frame section.
11790 (Sized_relobj::do_finalize_local_symbols): Ditto.
11791 * object.h (class Sized_relobj): Declare new member
11792 discarded_eh_frame_shndx_.
11793 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11794 (local_labels_test.o, local_labels_test): New rules.
11795 * testsuite/Makefile.in: Regenerate.
11796
11797 2009-06-04 Doug Kwan <dougkwan@google.com>
11798
11799 * layout.cc (Layout::section_name_mapping): Add mapping for
11800 special ARM sections.
11801
11802 2009-06-03 Doug Kwan <dougkwan@google.com>
11803
11804 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11805 (utils::has_overflow): Same.
11806
11807 2009-06-03 Ian Lance Taylor <iant@google.com>
11808
11809 * layout.cc (Layout::section_name_mapping): New array, replacing
11810 Layout::linkonce_mapping.
11811 (Layout::section_name_mapping_count): New variable, replacing
11812 Layout::linkonce_mapping_count.
11813 (Layout::linkonce_output_name): Remove.
11814 (Layout::output_section_name): Rewrite.
11815 * layout.h (class Layout): Rename Linkonce_mapping to
11816 Section_name_mapping, linkonce_mapping to section_name_mapping,
11817 linkonce_mapping_count to section_name_mapping_count. Don't
11818 declare linkonce_output_name.
11819
11820 2009-06-03 Doug Kwan <dougkwan@google.com>
11821
11822 * gold/arm.cc (namespace utils): New.
11823 (Target_arm::reloc_is_non_pic): Define new method.
11824 (class Arm_relocate_functions): New.
11825 (Target_arm::Relocate::relocate): Handle relocation types used by
11826 Android.
11827
11828 2009-06-03 Ian Lance Taylor <iant@google.com>
11829
11830 * arm.cc (Target_arm::scan::global): Use || instead of |.
11831
11832 2009-06-02 Doug Kwan <dougkwan@google.com>
11833
11834 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
11835 issued_non_pic_error_.
11836 (class Target_arm::Scan): Declare new method check_non_pic.
11837 Define new method symbol_needs_plt_entry.
11838 Declare new data member issued_non_pic_error_.
11839 (class Target_arm::Relocate): Declare new method
11840 should_apply_static_reloc.
11841 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11842 (Target_arm::Scan::check_non_pic): Define new method.
11843 (Target_arm::Scan::local): Handle a small subset of reloc types used
11844 by Android.
11845 (Target_arm::Scan::local): Same.
11846 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11847
11848 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
11849
11850 * incremental.cc (Incremental_inputs::report_command_line): Filter
11851 out --incremental-* options.
11852
11853 2009-05-29 Doug Kwan <dougkwan@google.com>
11854
11855 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11856 template class.
11857 (class Target_arm): Update comment.
11858 (Target_arm::Target_arm): Initialize new data members GOT_,
11859 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11860 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11861 and Target_arm::rel_dyn_section.
11862 Declare new_enum Target_arm::Got_type.
11863 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11864 and DYNBSS_.
11865 Update commments for member do_dynsym_value.
11866 (Target_arm::got_size, Target_arm::plt_section,
11867 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11868 new methods inside class defintion.
11869 (Target_arm::got_section): Define new method.
11870 (Target_arm::rel_dyn_section): Same.
11871 (Output_data_plt_arm): New template class.
11872 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11873 (Output_data_plt_arm:do_adjust_output_section): Define new method.
11874 (Output_data_plt_arm::add_entry): Same.
11875 (Output_data_plt_arm::first_plt_entry): Define new
11876 static data member for PLT instruction template.
11877 (Output_data_plt_arm::plt_entry): Same.
11878 (Output_data_plt_arm::do_write): Define new method.
11879 (Target_arm::make_plt_entry): Same.
11880 (Target_arm::do_finalize_sections): Same.
11881 (Target_arm::do_dynsym_value): Same.
11882
11883 2009-05-28 Doug Kwan <dougkwan@google.com>
11884
11885 * Makefile.am (TARGETSOURCES): Add arm.cc.
11886 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11887 * Makefile.in: Regenerate.
11888 * arm.cc: New file.
11889 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11890
11891 2009-05-26 Doug Kwan <dougkwan@google.com>
11892
11893 * options.cc (General_options::parse_exclude_libs). Fix a comment.
11894 (General_options::check_excluded_libs): Strip off directories in
11895 archive name before matching like GNU ld does.
11896 * testsuite/Makefile.am (MOSTLYCLEANFILES,
11897 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11898 (exclude_libs_test_LDFLAGS): Add linker option
11899 -Wl,--exclude-libs,libexclude_libs_test_3
11900 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11901 an explicit archive without using -l.
11902 (alt/libexclude_libs_test_3.a): New make rule.
11903 * testsuite/Makefile.in: Regenerate.
11904 * testsuite/exclude_libs_test.c : Declare lib3_default().
11905 (main): Call it.
11906 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11907 * exclude_libs_test_3.c: New file.
11908
11909 2009-05-26 Nick Clifton <nickc@redhat.com>
11910
11911 * po/id.po: New Indonesian translation.
11912 * po/gold.pot: Updated template file.
11913
11914 2009-05-22 Sriraman Tallam <tmsriram@google.com>
11915
11916 * testsuite/Makefile.am: Add -ffunction-sections to compile
11917 gc_comdat_test files. Add -Wl,--gc-sections to build
11918 gc_comdat_test.
11919 * testsuite/Makefile.in: Regenerate.
11920 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11921
11922 2009-05-21 Sriraman Tallam <tmsriram@google.com>
11923
11924 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11925 kept comdat section was garbage collected.
11926 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11927 * testsuite/Makefile.in: Regenerate.
11928 * testsuite/gc_comdat_test.sh: New file.
11929 * testsuite/gc_comdat_test_1.cc: New file.
11930 * testsuite/gc_comdat_test_2.cc: New file.
11931
11932 2009-05-19 Doug Kwan <dougkwan@google.com>
11933
11934 * archive.cc (Archive::Archive): Move constructor from archive.h
11935 to here. Initialize no_export_.
11936 (Archive::get_elf_object_for_member): Set no_export flag of object.
11937 * archive.h (Archive::Archive): Move constructor body to
11938 archive.cc.
11939 (Archive::no_export): New method.
11940 (Archive::no_export_): New field.
11941 * object.h (Object::Object): Initialize no_export_ to false.
11942 (Object::no_export, Object::set_no_export): New methods.
11943 (Object::no_export_): New field.
11944 * options.cc (General_options::parse_exclude_libs): New method.
11945 (General_options::check_excluded_libs) Same.
11946 * options.h (exclude_libs): New option.
11947 (General_options::check_excluded_libs): New method declaration.
11948 (General_options::excluded_libs_): New field.
11949 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11950 default or protected visibility if an object has no-export flag set.
11951 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11952 (check_SCRIPTS): Add exclude_libs_test.sh.
11953 (check_DATA): Add exclude_libs_test.syms.
11954 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11955 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11956 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11957 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11958 (exclude_libs_test.syms, libexclude_libs_test_1.a,
11959 libexclude_libs_test_2.a): New rules.
11960 * testsuite/Makefile.in: Regenerate.
11961 * testsuite/exclude_libs_test.c: New file.
11962 * testsuite/exclude_libs_test.sh: Ditto.
11963 * testsuite/exclude_libs_test_1.c: Ditto.
11964 * testsuite/exclude_libs_test_2.c: Ditto.
11965
11966 2009-05-15 Ian Lance Taylor <iant@google.com>
11967
11968 * configure.ac: Check for declarations for cases where libiberty.h
11969 checks HAVE_DECL_xxx.
11970 * configure, config.in: Rebuild.
11971
11972 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
11973
11974 * gold.h (Incremental_argument_list): Remove (invalid) forward
11975 declaration.
11976 * incremental.cc (Incremental_inputs::report_achive): New method.
11977 (Incremental_inputs::report_object): New method.
11978 (Incremental_inputs::report_script): New method.
11979 (Incremental_inputs::finalize_inputs): New method.
11980 (Incremental_inputs::finalize): Call finalize_inputs().
11981 (Incremental_inputs::sized_create_incremental_inputs_section_data):
11982 Create inputs entries.
11983 * incremental.h (Incremental_input_type): New enum.
11984 (Incremental_inputs::Incremental_input): Initialize new fields.
11985 (Incremental_inputs::report_inputs): New method.
11986 (Incremental_inputs::report_achive): New method.
11987 (Incremental_inputs::report_object): New method.
11988 (Incremental_inputs::report_script): New method.
11989 (Incremental_inputs::finalize_inputs): New method.
11990 (Incremental_inputs::Input_info): New struct.
11991 (Incremental_inputs::Input_info_map): New typedef.
11992 (Incremental_inputs::lock_): New field.
11993 (Incremental_inputs::Inputs_): New field.
11994 (Incremental_inputs::Inputs_map): New field.
11995 * main.cc (main): Call Incremental_input::report_inputs.
11996 * options.h (Input_argument_list): Typedef moved from
11997 Input_arguments.
11998 (Input_file_group::Files): Remove, use ::Input_argument_list.
11999 (Input_file_group::Input_argument_list): Remove, use
12000 ::Input_argument_list.
12001 * plugin.cc (Plugin_manager::add_input_file): Add error in
12002 incremental build.
12003 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12004 functions.
12005 * script.cc (read_input_script): Call
12006 Incremental_input::report_script.
12007 * script.h (Script_info): New class.
12008
12009 2009-04-27 Ian Lance Taylor <iant@google.com>
12010
12011 * x86_64.cc (do_adjust_output_section): Set entsize to
12012 plt_entry_size.
12013
12014 2009-04-23 Elliott Hughes <enh@google.com>
12015
12016 * output.cc (Output_file::close): After short writes, continue
12017 writing from the correct offset in the buffer being written.
12018
12019 2009-04-23 Chris Demetriou <cgd@google.com>
12020
12021 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12022 * configure: Regenerate.
12023 * config.in: Regenerate.
12024 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12025 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12026
12027 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
12028
12029 * incremental.cc (Incremental_inputs_header_data): Renamed from
12030 Incremental_input_header_data.
12031 (Incremental_inputs_header_data::data_size): New field.
12032 (Incremental_inputs_header_data::put_input_file_count): Renamed
12033 from input_file_count.
12034 (Incremental_inputs_header_data::put_command_line_offset): Renamed
12035 from command_line_offset.
12036 (Incremental_inputs_header_data::put_reserved): Renamed from
12037 put_reserved.
12038 (Incremental_inputs_entry_data): Renamed from
12039 Incremental_input_entry_data.
12040 (Incremental_inputs_entry_data::data_size): New field.
12041 (Incremental_inputs::report_command_line): New method.
12042 (Incremental_inputs::finalize): New method.
12043 (Incremental_inputs::create_incremental_inputs_data): New method.
12044 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12045 * incremental.h: New file.
12046 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12047 (Layout::finalize): Create incremental inputs section in
12048 incremental builds.
12049 (Layout::create_incremental_info_sections): New method.
12050 * layout.h (Layout::incremental_inputs): New method.
12051 (Layout::create_incremental_info_sections): New method.
12052 (Layout::incremental_inputs_): New field.
12053 * main.cc (main): Notify Incremental_input of the command line.
12054
12055 2009-04-01 Ian Lance Taylor <iant@google.com>
12056 Mikolaj Zalewski <mikolajz@google.com>
12057
12058 * gold.h (reserve_unordered_map): Define, three versions, one for
12059 each version of Unordered_map.
12060 * layout.cc (Layout::Layout): Remove options parameter. Add
12061 number_of_input_files parameter. Don't initialize options_.
12062 Initialize number_of_input_files_ and resized_signatures_. Move
12063 sections_are_attached_.
12064 (Layout::layout_group): Reserve space for group_signatures_.
12065 (Layout::find_or_add_kept_section): Change name parameter to be a
12066 reference. Resize signatures_ map when it gets large enough.
12067 (Layout::layout_eh_frame): Use parameters->options() instead of
12068 this->options_.
12069 (Layout::make_output_section): Likewise.
12070 (Layout::attach_allocated_section_to_segment): Likewise.
12071 (Layout::finalize, Layout::create_executable_stack): Likewise.
12072 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12073 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12074 * layout.h (class Layout): Update declarations. Remove options_
12075 field. Add number_of_input_files_ and resized_signatures_
12076 fields. Move sections_are_attached_ field.
12077 * main.cc (main): Pass number of input files to Layout
12078 constructor. Don't pass options.
12079
12080 2009-03-30 Ian Lance Taylor <iant@google.com>
12081
12082 * ffsll.c (ffsll): Correct implementation.
12083
12084 2009-03-27 Ian Lance Taylor <iant@google.com>
12085
12086 * ffsll.c: New file.
12087 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12088 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12089 * ftruncate.c (ftruncate): Declare before definition.
12090 * mremap.c (mremap): Likewise.
12091 * pread.c (pread): Likewise.
12092 * configure, Makefile.in, config.in: Rebuild.
12093
12094 * mremap.c: New file.
12095 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12096 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12097 (mremap): Declare if HAVE_MREMAP is not defined.
12098 * configure, Makefile.in, config.in: Rebuild.
12099
12100 2009-03-27 Cary Coutant <ccoutant@google.com>
12101
12102 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12103 position independent.
12104 * sparc.cc (Target_sparc::check_non_pic): Likewise.
12105 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12106
12107 2009-03-24 Cary Coutant <ccoutant@google.com>
12108
12109 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12110 an executable.
12111 (needs_dynamic_reloc): Likewise.
12112
12113 2009-03-24 Ian Lance Taylor <iant@google.com>
12114
12115 * yyscript.y (file_cmd): Recognize EXTERN.
12116 (extern_name_list, extern_name_list_body): New nonterminals.
12117 * script.cc (script_add_extern): Define.
12118 * script-c.h (script_add_extern): Declare.
12119
12120 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
12121
12122 * object.cc (is_elf_object): Define.
12123 * object.h (is_elf_object): Declare.
12124 * archive.cc (Archive::get_elf_object_for_member): Call
12125 is_elf_object.
12126 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12127
12128 2009-03-24 Elliott Hughes <enh@google.com>
12129
12130 * output.cc (Output_file::map_anonymous): Define.
12131 (Output_file::map): Use map_anonymous. If the regular mmap fails,
12132 try an anonymous one. Report the size if the mmap fails.
12133 * output.h (class Output_file): Declare map_anonymous.
12134
12135 2009-03-24 Ian Lance Taylor <iant@google.com>
12136
12137 * target-select.cc (instantiate_target): Don't acquire the lock if
12138 the instantiated_target_ field has already been set.
12139
12140 2009-03-23 Ian Lance Taylor <iant@google.com>
12141
12142 * gold-threads.h (class Initialize_lock): Define.
12143 * gold-threads.cc (class Initialize_lock_once): Define.
12144 (initialize_lock_control): New static variable.
12145 (initialize_lock_pointer): New static variable.
12146 (initialize_lock_once): New static function.
12147 (Initialize_lock::Initialize_lock): Define.
12148 (Initialize_lock::initialize): Define.
12149 * target-select.h: Include "gold-threads.h".
12150 (class Target_selector): Add lock_ and initialize_lock_ fields.
12151 Don't define instantiate_target, just declare it.
12152 * target-select.cc (Target_selector::Target_selector): Initialize
12153 new fields.
12154 (Target_selector::instantiate_target): Define.
12155 * descriptors.h: Include "gold-threads.h".
12156 (class Descriptors): Add initialize_lock_ field.
12157 * descriptors.cc (Descriptors::Descriptors): Initialize new
12158 field.
12159 (Descriptors::open): Use initialize_lock_ field
12160 * errors.h (class Errors): Add initialize_lock_ field.
12161 * errors.cc (Errors::Errors): Initialize new field.
12162 (Errors::initialize_lock): Use initialize_lock_ field.
12163 * powerpc.cc (class Target_selector_powerpc): Remove
12164 instantiated_target_ field. In do_recognize call
12165 instantiate_target rather than do_instantiate_target. In
12166 do_instantiate_target just allocate a new target.
12167 * sparc.cc (class Target_selector_sparc): Likewise.
12168
12169 * freebsd.h: New file.
12170 * i386.cc: Include "freebsd.h".
12171 (Target_i386): Derive from Target_freebsd rather than
12172 Sized_target.
12173 (Target_selector_i386): Derive from Target_selector_freebsd rather
12174 than Target_selector.
12175 * x86_64.cc: Include "freebsd.h".
12176 (Target_x86_64): Derive from Target_freebsd rather than
12177 Sized_target.
12178 (Target_selector_x86_64): Derive from Target_selector_freebsd
12179 rather than Target_selector.
12180 * target.h (class Target): Add adjust_elf_header and
12181 do_adjust_elf_header.
12182 * output.cc (Output_file_header:: do_sized_write): Call target
12183 adjust_elf_header routine.
12184 * configure.tgt: Set targ_osabi.
12185 * configure.ac: Define GOLD_DEFAULT_OSABI.
12186 * parameters.cc (Parameters::default_target): Pass
12187 GOLD_DEFAULT_OSABI to select_target.
12188 * target-select.h (class Target_selector): Make instantiate_target
12189 protected rather than private.
12190 * Makefile.am (HFILES): Add freebsd.h.
12191 * configure, Makefile.in, config.in: Rebuild.
12192
12193 * merge.cc (do_add_input_section): Correct pend value. Change
12194 message about last entry not being null terminated from error to
12195 warning.
12196
12197 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
12198
12199 * incremental.cc: New file.
12200 * Makefile.am (CCFILES): Add incremental.cc.
12201 * Makefile.in: Rebuild.
12202
12203 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
12204
12205 * layout.cc (Layout::output_section_name): Preserve names
12206 of '.note.' sections.
12207
12208 2009-03-19 Ian Lance Taylor <iant@google.com>
12209
12210 * descriptors.cc (Descriptors::open): Check that the options are
12211 valid before using them.
12212
12213 2009-03-18 Ian Lance Taylor <iant@google.com>
12214
12215 * script-sections.h: Include <list>.
12216 (class Script_sections): Change Sections_elements from std::vector
12217 to std::list. Typedef public Elements_iterator. Add
12218 orphan_section_placement_, data_segment_align_start_, and
12219 saw_data_segment_align_ fields. Remove data_segment_align_index_
12220 field.
12221 * script-sections.cc (class Orphan_section_placement): New class.
12222 (class Sections_element): Add virtual functions is_relro and
12223 orphan_section_init. Remove virtual function place_orphan_here.
12224 (class Output_section_definition): Add is_relro and
12225 orphan_section_init. Remove place_orphan_here.
12226 (class Orphan_output_section): Likewise.
12227 (Script_sections::Script_sections): Update for field changes.
12228 (Script_sections::data_segment_align): Set saw_data_segment_align_
12229 and data_segment_align_start_, not data_segment_align_index.
12230 (Script_sections::data_segment_relro_end): Check
12231 saw_data_segment_align_. Use data_segment_align_start_ rather
12232 than data_segment_align_index_.
12233 (Script_sections::place_orphan): Rewrite to use
12234 Orphan_section_placement.
12235
12236 2009-03-17 Ian Lance Taylor <iant@google.com>
12237
12238 * archive.cc (Archive::add_symbols): Check for a version attached
12239 to the symbol name in the archive map.
12240 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12241 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12242 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12243 (ver_test_11.a): New target.
12244 * testsuite/Makefile.in: Rebuild.
12245
12246 * configure.ac: Check for chsize and posix_fallocate. Replace
12247 ftruncate.
12248 * ftruncate.c: New file, from gnulib.
12249 * output.cc (posix_fallocate): Define dummy version if not
12250 HAVE_POSIX_FALLOCATE.
12251 (Output_file::map): Call posix_fallocate rather than lseek and
12252 write.
12253 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12254 * configure, Makefile.in, config.in: Rebuild.
12255
12256 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
12257
12258 * layout.h (Layout::create_note): Add section_name parameter.
12259 * layout.cc (Layout::create_note): Likewise.
12260 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12261
12262 2009-03-17 Ian Lance Taylor <iant@google.com>
12263
12264 * descriptors.cc: Include "options.h".
12265 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12266 (Descriptors::open): Always use O_CLOEXEC when opening a new
12267 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
12268 then set FD_CLOEXEC.
12269
12270 * sparc.cc (class Target_sparc): Add has_got_section.
12271 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12272 make sure we have a GOT section.
12273
12274 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12275 (Target_sparc::Scan::local): Likewise.
12276 (Target_sparc::Scan::global): Likewise.
12277 (Target_sparc::Relocate::relocate): Likewise.
12278 (Target_sparc::Relocate::relocate_tls): Likewise.
12279
12280 * symtab.cc (Symbol_table::define_default_version): New function,
12281 broken out of add_from_object.
12282 (Symbol_table::add_from_object): Call define_default_version.
12283 (Symbol_table::define_special_symbol): Add resolve_oldsym
12284 parameter. Change all callers. If the version for a symbol comes
12285 from a version script, resolve it with the symbol with the same
12286 name with no version. Also add the symbol without a version if
12287 appropriate.
12288 (do_define_in_output_data): If resolving with oldsym, don't delete
12289 sym.
12290 (do_define_in_output_segment): Likewise.
12291 (do_define_as_constant): Likewise.
12292 * symtab.h (class Symbol_table): Update declarations.
12293
12294 2009-03-13 Ian Lance Taylor <iant@google.com>
12295
12296 * readsyms.cc (Read_symbols::incompatible_warning): New function.
12297 (Read_symbols::requeue): New function.
12298 (Read_symbols::do_read_symbols): If make_elf_object fails because
12299 the target type is not configured, and the file was searched for,
12300 issue a warning and retry with the next directory.
12301 (Add_symbols::run): If the file has an incompatible format, and
12302 it was searched for, requeue the Read_symbols task. On error,
12303 release the object.
12304 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
12305 dirindex parameter to constructor. Change all callers. Declare
12306 incompatible_warning and requeue.
12307 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12308 input_argument_ and input_group_ fields. Add them to
12309 constructor. Change all callers.
12310 (class Read_script): Add dirindex_ field. Add it to constructor.
12311 Change all callers.
12312 * archive.cc (Archive::setup): Remove input_objects parameter.
12313 Change all callers.
12314 (Archive::get_file_and_offset): Likewise.
12315 (Archive::read_all_symbols): Likewise.
12316 (Archive::read_symbols): Likewise.
12317 (Archive::get_elf_object_for_member): Remove input_objects
12318 parameter. Add punconfigured parameter. Change all callers.
12319 (Archive::add_symbols): Change return type to bool. Check return
12320 value of include_member.
12321 (Archive::include_all_members): Likewise.
12322 (Archive::include_member): Change return type to bool. Return
12323 false if first included object has incompatible target. Set
12324 included_member_ field.
12325 (Add_archive_symbols::run): If add_symbols returns false, requeue
12326 Read_symbols task.
12327 * archive.h (class Archive): Add included_member_ field.
12328 Initialize it in constructor. Add input_file and searched_for
12329 methods. Update declarations.
12330 (class Add_archive_symbols): Add dirpath_, dirindex_, and
12331 input_argument_ fields. Add them to constructor. Change all
12332 callers.
12333 * script.cc: Include "target-select.h".
12334 (class Parser_closure): Add skip_on_incompatible_target_ and
12335 found_incompatible_target_ fields. Add
12336 skip_on_incompatible_target parameter to constructor. Change all
12337 callers. Add methods skip_on_incompatible_target,
12338 clear_skip_on_incompatible_target, found_incompatible_target, and
12339 set_found_incompatible_target.
12340 (read_input_script): Add dirindex parameter. Change all callers.
12341 If parser finds an incompatible target, requeue Read_symbols
12342 task.
12343 (script_set_symbol): Clear skip_on_incompatible_target in
12344 closure.
12345 (script_add_assertion, script_parse_option): Likewise.
12346 (script_start_sections, script_add_phdr): Likewise.
12347 (script_check_output_format): New function.
12348 * script.h (read_input_script): Update declaration.
12349 * script-c.h (script_check_output_format): Declare.
12350 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12351 (ignore_cmd): Remove OUTPUT_FORMAT.
12352 * fileread.cc (Input_file::Input_file): Add explicit this.
12353 (Input_file::will_search_for): New function.
12354 (Input_file::open): Add pindex parameter. Change all callers.
12355 * fileread.h (class Input_file): Add input_file_argument method.
12356 Declare will_search_for. Update declarations.
12357 * object.cc (make_elf_object): Add punconfigured parameter.
12358 Change all callers.
12359 * object.h (class Object): Make input_file public. Add
12360 searched_for method.
12361 (make_elf_object): Update declaration.
12362 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
12363 restart search.
12364 * dirsearch.h (class Dirsearch): Update declaration.
12365 * options.h (class General_options): Add --warn-search-mismatch.
12366 * parameters.cc (Parameters::is_compatible_target): New function.
12367 * parameters.h (class Parameters): Declare is_compatible_target.
12368 * workqueue.cc (Workqueue::add_blocker): New function.
12369 * workqueue.h (class Workqueue): Declare add_blocker.
12370
12371 * fileread.cc (Input_file::open): Remove options parameter.
12372 Change all callers.
12373 (Input_file::open_binary): Likewise.
12374 * script.cc (read_input_script): Likewise.
12375 * readsyms.h (class Read_symbols): Remove options_ field. Remove
12376 options parameter from constructor. Change all callers.
12377 (class Read_script): Likewise.
12378 * fileread.h (class Input_file): Update declarations.
12379 * script.h (read_input_script): Update declaration.
12380
12381 2009-03-10 Nick Clifton <nickc@redhat.com>
12382
12383 * po/es.po: New Spanish translation.
12384
12385 2009-03-06 Cary Coutant <ccoutant@google.com>
12386
12387 * options.cc (parse_short_option): Keep dash_z from registering itself.
12388
12389 2009-03-03 Ian Lance Taylor <iant@google.com>
12390
12391 PR 9918
12392 * target-reloc.h (relocate_section): Pass output_section to
12393 relocate.
12394 * i386.cc (Target_i386::should_apply_static_reloc): Add
12395 output_section parameter. Change all callers.
12396 (Target_i386::Relocate::relocate): Add output_section parameter.
12397 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12398 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12399 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12400 * testsuite/two_file_shared.sh: New script.
12401 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12402 (check_DATA): Add two_file_shared.dbg.
12403 (two_file_shared.dbg): New target.
12404 * testsuite/Makefile.in: Rebuild.
12405
12406 2009-03-01 Ian Lance Taylor <iant@google.com>
12407
12408 * configure.ac: Check for byteswap.h.
12409 * configure: Rebuild.
12410 * config.in: Rebuild.
12411
12412 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
12413
12414 * layout.cc (Layout::find_or_add_kept_section): New function.
12415 (Layout::add_comdat): Removed.
12416 * layout.h (struct Kept_section): Move out of class Layout.
12417 Remove trailing underscores from field names. Add group_sections
12418 field. Rename group_ field to is_group. Change all uses.
12419 (class Layout): Declare find_or_add_kept_section, not add_comdat.
12420 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12421 comdat_groups_ field.
12422 (Sized_relobj::include_section_group): Use
12423 find_or_add_kept_section and Kept_section::group_sections.
12424 (Sized_relobj::include_linkonce_section): Likewise.
12425 * object.cc (class Sized_relobj): Don't define Comdat_group or
12426 Comdat_group_table. Remove find_comdat_group and
12427 add_comdat_group. Remove comdat_groups_ field.
12428 * plugin.cc (include_comdat_group): Use
12429 Layout::find_or_add_kept_section.
12430
12431 2009-02-28 Ian Lance Taylor <iant@google.com>
12432
12433 * README: --gc-sections and map files are now supported. Document
12434 some build requirements.
12435
12436 PR 6992
12437 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12438 relocatable link set the value of the section symbol to zero.
12439 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12440 relocatable link don't include the section address in the local
12441 symbol value.
12442
12443 2009-02-27 Ian Lance Taylor <iant@google.com>
12444
12445 PR 6811
12446 * options.h (class Search_directory): Add is_system_directory.
12447 (class General_options): Declare is_in_system_directory.
12448 * options.cc (get_relative_sysroot): Make static.
12449 (get_default_sysroot): Make static.
12450 (General_optoins::is_in_system_directory): New function.
12451 * fileread.cc (Input_file::is_in_system_directory): New function.
12452 * fileread.h (class Input_file): Declare is_in_system_directory.
12453 * object.h (class Object): Add is_in_system_directory.
12454 (class Input_objects): Remove system_library_directory_ field.
12455 * object.cc (Input_objects::add_object): Don't set
12456 system_library_directory_.
12457 (input_objects::found_in_system_library_directory): Remove.
12458 * symtab.cc (Symbol_table::write_globals): Remove input_objects
12459 parameter. Change all callers.
12460 (Symbol_table::sized_write_globals): Likewise.
12461 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12462 Call Object::is_in_system_directory.
12463 * symtab.h (class Symbol_table): Update declarations.
12464
12465 PR 5990
12466 * descriptors.h (Open_descriptor): Add is_on_stack field.
12467 * descriptors.cc (Descriptors::open): If the descriptor is on the
12468 top of the stack, remove it. Initialize is_on_stack field.
12469 (Descriptors::release): Only add pod to stack if it is not on the
12470 stack already.
12471 (Descriptors::close_some_descriptor): Clear stack_next and
12472 is_on_stack fields.
12473
12474 PR 7091
12475 * output.cc (Output_section::find_starting_output_address): Rename
12476 from starting_output_address; add PADDR parameter; change return
12477 type.
12478 * output.h (class Output_section): Declare
12479 find_starting_output_address instead of starting_output_address.
12480 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12481 section symbol for which we can't find a merge section.
12482
12483 PR 9836
12484 * symtab.cc (Symbol_table::add_from_object): If the visibility is
12485 hidden or internal, force the symbol to be local.
12486 * resolve.cc (Symbol::override_visibility): Define.
12487 (Symbol::override_base): Use override_visibility.
12488 (Symbol_table::resolve): Likewise.
12489 (Symbol::override_base_with_special): Likewise.
12490 (Symbol_table::override_with_special): If the visibility is hidden
12491 or internal, force the symbol to be local.
12492 * symtab.h (class Symbol): Add set_visibility and
12493 override_visibility.
12494 * testsuite/ver_test_1.sh: New file.
12495 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12496 (check_DATA): Add ver_test_1.syms.
12497 (ver_test_1.syms): New target.
12498 * testsuite/Makefile.in: Rebuild.
12499
12500 2009-02-25 Cary Coutant <ccoutant@google.com>
12501
12502 * layout.cc (Layout::choose_output_section): Don't rename sections
12503 when using a linker script that has a SECTIONS clause.
12504 * Makefile.in: Regenerate.
12505
12506 * testsuite/Makefile.am (script_test_5.sh): New test case.
12507 * testsuite/Makefile.in: Regenerate.
12508 * testsuite/script_test_5.cc: New file.
12509 * testsuite/script_test_5.sh: New file.
12510 * testsuite/script_test_5.t: New file.
12511
12512 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
12513
12514 * archive.cc (Archive::include_member): Update calls to add_symbols.
12515 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12516 the Layout argument.
12517 * dynobj.h (do_add_symbols): Add the Layout argument.
12518 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12519 Layout argument.
12520 * object.h (Object::add_symbols): Add the Layout argument.
12521 (Object::do_add_symbols): Add the Layout argument.
12522 (Sized_relobj::do_add_symbols): Add the Layout argument.
12523 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12524 Unify the two versions.
12525 (Add_plugin_symbols): Remove.
12526 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12527 (Sized_pluginobj::do_add_symbols): Unify the two versions.
12528 (Add_plugin_symbols): Remove.
12529 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12530 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12531 (Add_symbols::run): Make it work with Pulginobj.
12532
12533 2009-02-06 Ian Lance Taylor <iant@google.com>
12534
12535 * object.cc (Sized_relobj::do_layout): Make info message start
12536 with lower case letter.
12537
12538 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
12539
12540 * binary.cc: Fix file comment.
12541
12542 * options.h (enum Incremental_disposition): Define.
12543 (class General_options): Add new options: --incremental,
12544 --incremental_changed, --incremental_unchanged,
12545 --incremental_unknown. Add incremental_disposition_ and
12546 implicit_incremental_ fields.
12547 (General_options::incremental_disposition): New function.
12548 (class Position_dependent_options): Add incremental_disposition
12549 option.
12550 (Position_dependent_options::copy_from_options): Set incremental
12551 dispositions.
12552 * options.cc (General_options::parse_incremental_changed): New
12553 function.
12554 (General_options::parse_incremental_unchanged): New function.
12555 (General_options::parse_incremental_unknown): New function.
12556 (General_options::General_options): Initialize new fields
12557 incremental_disposition_ and implicit_incremental_.
12558 (General_options::finalize): Check for uasge of --incremental-*
12559 without --incremental.
12560
12561 2009-02-06 Chris Demetriou <cgd@google.com>
12562
12563 * gold.h (gold_undefined_symbol): Change to take only a Symbol
12564 pointer and to report location as the file name associated with
12565 the symbol.
12566 (gold_undefined_symbol_at_location): New function to replace the
12567 old gold_undefined_symbol functionality.
12568 * target-reloc.h (relocate_section): Update to use
12569 gold_undefined_symbol_at_location.
12570 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12571 Call gold_undefined_symbol function rather than gold_error.
12572 * errors.h (Errors::undefined_symbol): Take location as a
12573 string, rather than calculating it from a relocation.
12574 * errors.cc (Errors::fatal): Print "fatal error:" before the
12575 formatted message.
12576 (Errors::error, Errors::error_at_location): Print "error: "
12577 before the formatted message.
12578 (Errors::undefined_symbol): Take location as a string, rather
12579 than calculating it from a relocation.
12580 (gold_undefined_symbol_at_location): New function akin to
12581 old gold_undefined_symbol, calculates location from relocation.
12582 (gold_undefined_symbol): Change to take only a Symbol pointer
12583 and to report location as the file name associated with the symbol.
12584 * testsuite/debug_msg.sh: Update for changed error messages.
12585 * testsuite/undef_symbol.sh: Likewise.
12586
12587 2009-02-04 Duncan Sands <baldrick@free.fr>
12588
12589 PR 9812
12590 * reduced_debug_output.h
12591 (Output_reduced_debug_abbrev_section::failed): Use format for
12592 gold_warning.
12593 (Output_reduced_debug_info_section::faild): Likewise.
12594
12595 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
12596
12597 * script.cc (Lazy_demangler): New class.
12598 (Version_script_info::get_symbol_version_helper): Demangle a
12599 symbol only once.
12600
12601 2009-01-29 Cary Coutant <ccoutant@google.com>
12602
12603 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12604 to __tls_get_addr.
12605 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12606
12607 2009-01-28 Ian Lance Taylor <iant@google.com>
12608
12609 * version.cc (version_string): Bump to 1.9.
12610
12611 * gold.h: Include <cstring> and <stdint.h>.
12612 * version.cc: Include <cstdio>.
12613 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12614 warning.
12615 * reduced_debug_output.cc (insert_into_vector): Rename from
12616 Insert_into_vector; change all callers. Use Swap_unaligned to
12617 avoid aliasing issue; remove union since it is unnecessary.
12618
12619 2009-01-27 Sriraman Tallam <tmsriram@google.com>
12620
12621 * Makefile.am (CCFILES): Add gc.cc.
12622 (HFILES): Add gc.h.
12623 * Makefile.in: Regenerate.
12624 * gold.cc (Gc_runner): New class.
12625 (queue_initial_tasks): Call garbage collection related tasks
12626 when corresponding options are invoked.
12627 (queue_middle_gc_tasks): New function.
12628 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12629 processed early before laying out sections during garbage collection.
12630 * gold.h (queue_middle_gc_tasks): New function.
12631 (is_prefix_of): Move from "layout.cc".
12632 * i386.cc (Target_i386::gc_process_relocs): New function.
12633 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12634 * main.cc (main): Create object of class "Garbage_collection".
12635 * object.cc (Relobj::copy_symbols_data): New function.
12636 (Relobj::is_section_name_included): New function.
12637 (Sized_relobj::do_layout): Allow this function to be called twice
12638 during garbage collection and defer layout of section during the
12639 first call.
12640 * object.h (Relobj::get_symbols_data): New function.
12641 (Relobj::is_section_name_included): New function.
12642 (Relobj::copy_symbols_data): New function.
12643 (Relobj::set_symbols_data): New function.
12644 (Relobj::get_relocs_data): New function.
12645 (Relobj::set_relocs_data): New function.
12646 (Relobj::is_output_section_offset_invalid): New pure virtual function.
12647 (Relobj::gc_process_relocs): New function.
12648 (Relobj::do_gc_process_relocs): New pure virtual function.
12649 (Relobj::sd_): New data member.
12650 (Sized_relobj::is_output_section_offset_invalid): New function.
12651 (Sized_relobj::do_gc_process_relocs): New function.
12652 * options.h (General_options::gc_sections): Modify to not be a no-op.
12653 (General_options::print_gc_sections): New option.
12654 * plugin.cc (Plugin_finish::run): Remove function call to
12655 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
12656 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12657 * reloc.cc (Read_relocs::run): Add task to process relocs and
12658 determine unreferenced sections when doing garbage collection.
12659 (Gc_process_relocs): New class.
12660 (Sized_relobj::do_gc_process_relocs): New function.
12661 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12662 sections that are garbage collected.
12663 * reloc.h (Gc_process_relocs): New class.
12664 * sparc.cc (Target_sparc::gc_process_relocs): New function.
12665 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12666 symbols whose corresponding sections are garbage collected.
12667 (Symbol_table::Symbol_table): Add new parameter for the garbage
12668 collection object.
12669 (Symbol_table::gc_mark_undef_symbols): New function.
12670 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12671 (Symbol_table::gc_mark_dyn_syms): New function.
12672 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12673 as garbage.
12674 (Symbol_table::add_from_object): Likewise.
12675 (Symbol_table::add_from_relobj): When building shared objects, do not
12676 treat externally visible symbols as garbage.
12677 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12678 table information for static and relocatable links.
12679 * symtab.h (Symbol_table::set_gc): New function.
12680 (Symbol_table::gc): New function.
12681 (Symbol_table::gc_mark_undef_symbols): New function.
12682 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12683 (Symbol_table::gc_mark_dyn_syms): New function.
12684 (Symbol_table::gc_): New data member.
12685 * target.h (Sized_target::gc_process_relocs): New pure virtual
12686 function.
12687 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12688 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12689
12690 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
12691
12692 * options.h (General_options::gc_sections): Define as a no-op for now.
12693 (General_options::no_keep_memory): Ditto.
12694 (General_options::Bshareable): Define.
12695 * options.cc (General_options::finalize): Honor -Bshareable.
12696
12697 2009-01-20 Andreas Schwab <schwab@suse.de>
12698
12699 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12700 read the value in the contents, since we don't use it. Use the
12701 template endianness when writing.
12702 (Relocate::relocate): Use it for R_PPC_REL16_HA.
12703
12704 2009-01-19 Andreas Schwab <schwab@suse.de>
12705
12706 * configure.tgt (powerpc64-*): Fix targ_obj.
12707
12708 2009-01-15 Ian Lance Taylor <iant@google.com>
12709
12710 * object.cc (Sized_relobj::write_local_symbols): Don't write out
12711 local symbols when stripping all symbols.
12712
12713 2009-01-14 Cary Coutant <ccoutant@google.com>
12714
12715 * output.cc (Output_reloc): Add explicit instantiations.
12716
12717 2009-01-14 Cary Coutant <ccoutant@google.com>
12718
12719 * archive.cc (Archive::get_elf_object_for_member): Remove call
12720 to File_read::claim_for_plugin.
12721 * descriptors.cc (Descriptors::open): Remove reference to
12722 is_claimed.
12723 (Descriptors::claim_for_plugin): Remove.
12724 * descriptors.h (Descriptors::claim_for_plugin): Remove.
12725 (Descriptors::is_claimed): Remove.
12726 (claim_descriptor_for_plugin): Remove.
12727 * fileread.cc (File_read::claim_for_plugin): Remove.
12728 * fileread.h (File_read::claim_for_plugin): Remove.
12729 (File_read::descriptor): Reopen descriptor if necessary.
12730 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
12731 (Plugin_manager::all_symbols_read): Add task parameter. Change
12732 all callers.
12733 (Plugin_manager::get_input_file): New function.
12734 (Plugin_manager::release_input_file): New function.
12735 (Pluginobj::Pluginobj): Add filesize parameter and initialize
12736 corresponding data member.
12737 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12738 and pass to base constructor. Change all callers.
12739 (get_input_file, release_input_file): New functions.
12740 (make_sized_plugin_object): Add filesize parameter. Change all callers.
12741 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12742 (Plugin_manager::all_symbols_read): Add task parameter.
12743 (Plugin_manager::get_input_file): New function.
12744 (Plugin_manager::release_input_file): New function.
12745 (Plugin_manager::task_): New data member.
12746 (Pluginobj::Pluginobj): Add filesize parameter.
12747 (Pluginobj::filename): New function.
12748 (Pluginobj::descriptor): New function.
12749 (Pluginobj::filesize): New function.
12750 (Pluginobj::filesize_): New data member.
12751 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12752 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12753 File_read::claim_for_plugin; use Object::unlock to unlock the file.
12754
12755 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12756 with archive libraries.
12757 * testsuite/Makefile.in: Regenerate.
12758 * testsuite/plugin_test.c (struct sym_info): New type.
12759 (get_input_file, release_input_file): New static variables.
12760 (onload): Capture new transfer vector entries.
12761 (claim_file_hook): Stop reading at end of file according to filesize.
12762 Factor out parsing of readelf output into separate function.
12763 (all_symbols_read_hook): Exercise get_input_file and release_input_file
12764 APIs and get the source file name from the symbol table. Convert
12765 source file name to corresponding object file name. Print info
12766 message when adding new input files.
12767 (parse_readelf_line): New function.
12768 * testsuite/plugin_test_1.sh: Add checks for new info messages.
12769 * testsuite/plugin_test_2.sh: Likewise.
12770 * testsuite/plugin_test_3.sh: Likewise.
12771 * testsuite/plugin_test_4.sh: New test case.
12772
12773 2009-01-07 Ian Lance Taylor <iant@google.com>
12774
12775 * version.cc (version_string): Bump to 1.8.
12776
12777 2008-12-23 Cary Coutant <ccoutant@google.com>
12778
12779 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12780 * plugin.cc (Plugin_manager::finish): Rename as
12781 layout_deferred_objects. Move cleanup to separate function.
12782 (Plugin_manager::cleanup): New function.
12783 (Plugin_finish::run): Call layout_deferred_objects and cleanup
12784 separately.
12785 * plugin.h (Plugin_manager::finish): Rename as
12786 layout_deferred_objects.
12787 (Plugin_manager::cleanup): New function.
12788 (Plugin_manager::cleanup_done): New field.
12789
12790 2008-12-23 Cary Coutant <ccoutant@google.com>
12791
12792 * plugin.cc (is_visible_from_outside): New function.
12793 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12794 so we don't return "IR only" status for exported symbols or -r links.
12795
12796 * testsuite/Makefile.am (plugin_test_3): New test case.
12797 * testsuite/Makefile.in: Regenerate.
12798 * testsuite/plugin_test_3.sh: New file.
12799
12800 2008-12-22 Cary Coutant <ccoutant@google.com>
12801
12802 * object.cc (Sized_relobj::layout_section): New function.
12803 (Sized_relobj::do_layout): Defer layout of input sections until after
12804 plugin has provided replacement files.
12805 (Sized_relobj::do_layout_deferred_sections): New function.
12806 * object.h (Relobj::set_section_offset): Remove virtual keyword.
12807 (Relobj::layout_deferred_sections): New function.
12808 (Relobj::do_layout_deferred_sections): New function.
12809 (Sized_relobj::do_layout_deferred_sections): New function.
12810 (Sized_relobj::layout_section): New function.
12811 (Sized_relobj::Deferred_layout): New structure.
12812 (Sized_relobj::deferred_layout_): New field.
12813 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12814 Change all callers. Layout deferred sections.
12815 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
12816 references.
12817 (Plugin_hook::run): Move code from do_plugin_hook inline.
12818 (Plugin_hook::do_plugin_hook): Remove.
12819 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12820 (Plugin_manager::finish): Renamed, was cleanup.
12821 (Plugin_manager::should_defer_layout): New function.
12822 (Plugin_manager::add_deferred_layout_object): New function.
12823 (Plugin_manager::Deferred_layout_list): New type.
12824 (Plugin_manager::deferred_layout_objects_): New field.
12825 (Plugin_hook::do_plugin_hook): Remove.
12826
12827 2008-12-17 Ian Lance Taylor <iant@google.com>
12828
12829 * options.h (class General_options): Add --no case for
12830 --export-dynamic.
12831
12832 2008-12-16 Cary Coutant <ccoutant@google.com>
12833
12834 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12835 vector.
12836 (Plugin_manager::claim_file): Create plugin object even if
12837 plugin did not call the add_symbols callback.
12838 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12839 asking for more symbols than were added.
12840 * testsuite/Makefile.am (plugin_test_1): Add test case with
12841 no global symbols.
12842 (empty.syms): New target.
12843 * testsuite/Makefile.in: Regenerate.
12844 * testsuite/plugin_test.c (claim_file_hook): Add new debug
12845 message. Don't call add_symbols if no globals.
12846 (all_symbols_read_hook): Don't provide replacement for empty
12847 claimed file.
12848
12849 2008-12-12 Ian Lance Taylor <iant@google.com>
12850
12851 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12852 r_type == 0 for a local symbol with r_sym == 0.
12853 (scan_relocatable_relocs): Pass r_sym to
12854 local_non_section_strategy.
12855 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12856 r_sym parameter.
12857
12858 * configure.ac: Update test for TLS descriptors: they are
12859 supported as of glibc 2.9.
12860 * configure: Rebuild.
12861
12862 2008-12-11 Ian Lance Taylor <iant@google.com>
12863
12864 PR 7091
12865 * target-reloc.h (Default_scan_relocatable_relocs): For each
12866 function, map r_type == 0 to RELOC_DISCARD.
12867
12868 2008-12-10 Cary Coutant <ccoutant@google.com>
12869
12870 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12871 object to override a kept COMDAT group from a plugin object.
12872
12873 2008-12-09 Ian Lance Taylor <iant@google.com>
12874
12875 PR 7088
12876 * yyscript.y (file_cmd): Handle INPUT.
12877
12878 * testsuite/initpri1.c: Change all declarations to be full
12879 prototypes by adding void, to avoid compiler warnings.
12880
12881 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
12882
12883 * options.cc (General_options::parse_plugin_opt): New.
12884 (General_options::add_plugin): The argument now is just the filename.
12885 (General_options::add_plugin_option): New.
12886 * options.h (plugin_opt): New.
12887 (add_plugin): Change argument name.
12888 (add_plugin_option): New.
12889 * plugin.cc (Plugin::load): Don't parse the plugin option.
12890 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12891 (Plugin::add_option): New.
12892 (Plugin::args_): Change type.
12893 (Plugin::filename_): New.
12894 (Plugin_manager::add_plugin_option): New.
12895 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12896 * testsuite/Makefile.in: Regenerate.
12897
12898 2008-12-05 Cary Coutant <ccoutant@google.com>
12899
12900 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12901 Handle --strip-lto-sections option.
12902 * options.h (strip_lto_sections): New option.
12903
12904 2008-12-01 Cary Coutant <ccoutant@google.com>
12905
12906 * plugin.cc (ld_plugin_message): Change format parameter to const.
12907 Fix mismatch between new[] and delete.
12908
12909 2008-11-14 Cary Coutant <ccoutant@google.com>
12910
12911 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12912 instead of -1U.
12913
12914 2008-11-05 Craig Silverstein <csilvers@google.com>
12915
12916 * options.cc (General_options::parse_dynamic_list): New function.
12917 * options.h (General_options): New flags dynamic_list,
12918 dynamic_list_data, dynamic_list_cpp_new, and
12919 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
12920 (General_options::in_dynamic_list): New function.
12921 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12922 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12923 (Lex::can_continue_name): Likewise.
12924 (yylex): Likewise.
12925 (read_script_file): New parameter script_options.
12926 (read_dynamic_list): New function.
12927 (Script_options::define_dynamic_list): New function.
12928 (dynamic_list_keyword_parsecodes): New variable.
12929 (dynamic_list_keywords): New variable.
12930 * script.h (Script_options::define_dynamic_list): New function
12931 prototype.
12932 (read_dynamic_list): New function prototype.
12933 * symtab.cc (strprefix): New macro.
12934 (Symbol::should_add_dynsym_entry): Support dynamic_list,
12935 dynamic_list_data, dynamic_list_cpp_new, and
12936 dynamic_list_cpp_typeinfo.
12937 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12938 (dynamic_list_expr): New rule.
12939 (dynamic_list_nodes): Likewise.
12940 (dynamic_list_node): Likewise.
12941 * testsuite/Makefile.am (dynamic_list): New test.
12942 * testsuite/Makefile.in: Regenerated.
12943 * testsuite/dynamic_list.t: New file.
12944 * testsuite/dynamic_list.sh: New file.
12945
12946 2008-11-05 Craig Silverstein <csilvers@google.com>
12947
12948 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12949 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12950 (t11_last): Likewise.
12951 * testsuite/ver_test_6.c (main): Likewise.
12952
12953 2008-10-07 Cary Coutant <ccoutant@google.com>
12954
12955 * options.c (General_options::finalize): Add check for -static and
12956 -shared.
12957 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12958 is not empty.
12959
12960 2008-10-02 Cary Coutant <ccoutant@google.com>
12961
12962 * plugin.cc (make_sized_plugin_object): Fix conditional
12963 compilation to work when not all targets are enabled.
12964
12965 2008-09-29 Cary Coutant <ccoutant@google.com>
12966
12967 * archive.cc (Archive::get_file_and_offset): Use filename instead
12968 of name to get library path.
12969 (Archive::include_member): Unlock external member of a thin archive.
12970
12971 * testsuite/Makefile.am (TEST_AR): New variable.
12972 (thin_archive_test_1): New test.
12973 (thin_archive_test_2): New test.
12974 * testsuite/Makefile.in: Regenerate.
12975 * testsuite/thin_archive_main.cc: New file.
12976 * testsuite/thin_archive_test_1.cc: New file.
12977 * testsuite/thin_archive_test_2.cc: New file.
12978 * testsuite/thin_archive_test_3.cc: New file.
12979 * testsuite/thin_archive_test_4.cc: New file.
12980
12981 2008-09-29 Cary Coutant <ccoutant@google.com>
12982
12983 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12984 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12985 instead of -1U.
12986 (Sized_relobj::do_finalize_local_symbols): Likewise.
12987 (Sized_relobj::map_to_kept_section): Likewise.
12988 * object.h (Sized_relobj::invalid_address): New constant.
12989 (Sized_relobj::do_output_section_offset): Check for invalid_address
12990 and return -1ULL.
12991 * output.cc (Output_reloc::local_section_offset): Use constant
12992 invalid_address instead of -1U.
12993 (Output_reloc::get_address): Likewise.
12994 (Output_section::output_address): Change -1U to -1ULL.
12995 * output.h (Output_reloc::invalid_address): New constant.
12996 * reloc.cc (Sized_relobj::write_sections): Use constant
12997 invalid_address instead of -1U.
12998 (Sized_relobj::relocate_sections): Likewise.
12999 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13000 values for merge sections.
13001 * target-reloc.h (relocate_for_relocatable): Use constant
13002 invalid_address instead of -1U.
13003
13004 2008-09-19 Cary Coutant <ccoutant@google.com>
13005
13006 Add plugin functionality for link-time optimization (LTO).
13007 * configure.ac (plugins): Add --enable-plugins option.
13008 * configure: Regenerate.
13009 * config.in: Regenerate.
13010 * Makefile.am (LIBDL): New variable.
13011 (CCFILES): Add plugin.cc.
13012 (HFILES): Add plugin.h.
13013 (ldadd_var): Add LIBDL.
13014 * Makefile.in: Regenerate.
13015
13016 * archive.cc: Include "plugin.h".
13017 (Archive::setup): Don't preread archive symbols when using a plugin.
13018 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
13019 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13020 files.
13021 (Archive::include_member): Add symbols from plugin objects.
13022 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13023 * descriptors.cc (Descriptors::open): Check for file descriptors
13024 abandoned by plugins.
13025 (Descriptors::claim_for_plugin): New function.
13026 * descriptors.h (Descriptors::claim_for_plugin): New function.
13027 (Open_descriptor::is_claimed): New field.
13028 (claim_descriptor_for_plugin): New function.
13029 * fileread.cc (File_read::claim_for_plugin): New function.
13030 * fileread.h (File_read::claim_for_plugin): New function.
13031 (File_read::descriptor): New function.
13032 * gold.cc: Include "plugin.h".
13033 (queue_initial_tasks): Add task to call plugin hooks for generating
13034 new object files.
13035 * main.cc: Include "plugin.h".
13036 (main): Load plugin libraries.
13037 * object.h (Pluginobj): Declare.
13038 (Object::pluginobj): New function.
13039 (Object::do_pluginobj): New function.
13040 (Object::set_target): New function.
13041 * options.cc: Include "plugin.h".
13042 (General_options::parse_plugin): New function.
13043 (General_options::General_options): Initialize plugins_ field.
13044 (General_options::add_plugin): New function.
13045 * options.h (Plugin_manager): Declare.
13046 (General_options): Add --plugin option.
13047 (General_options::has_plugins): New function.
13048 (General_options::plugins): New function.
13049 (General_options::add_plugin): New function.
13050 (General_options::plugins_): New field.
13051 * plugin.cc: New file.
13052 * plugin.h: New file.
13053 * readsyms.cc: Include "plugin.h".
13054 (Read_symbols::do_read_symbols): Check for archive before checking
13055 for ELF file. Call plugin hooks to claim files.
13056 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13057 from a real object file; force override when processing replacement
13058 files.
13059 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13060 (Symbol::init_base_object): Likewise.
13061 (Symbol::init_base_output_data): Likewise.
13062 (Symbol::init_base_output_segment): Likewise.
13063 (Symbol::init_base_constant): Likewise.
13064 (Symbol::init_base_undefined): Likewise.
13065 (Symbol::output_section): Assert that object is not a plugin.
13066 (Symbol_table::add_from_pluginobj): New function.
13067 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13068 undefined.
13069 (Symbol_table::sized_write_globals): Likewise.
13070 (Symbol_table::add_from_pluginobj): Instantiate template.
13071 * symtab.h (Sized_pluginobj): Declare.
13072 (Symbol::in_real_elf): New function.
13073 (Symbol::set_in_real_elf): New function.
13074 (Symbol::in_real_elf_): New field.
13075 (Symbol_table::add_from_pluginobj): New function.
13076
13077 * testsuite/Makefile.am (AM_CFLAGS): New variable.
13078 (LIBDL): New variable.
13079 (LDADD): Add LIBDL.
13080 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13081 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13082 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13083 (MOSTLYCLEANFILES): Likewise.
13084 * testsuite/Makefile.in: Regenerate.
13085 * testsuite/plugin_test.c: New file.
13086 * testsuite/plugin_test_1.sh: New file.
13087 * testsuite/plugin_test_2.sh: New file.
13088
13089 2008-09-16 Ian Lance Taylor <iant@google.com>
13090
13091 * target-reloc.h (relocate_section): Check whether a symbol is
13092 defined by the ABI before reporting an undefined symbol error.
13093 * target.h (Target::is_defined_by_abi): Make parameter const.
13094 (Target::do_is_defined_by_abi): Likewise.
13095 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13096 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13097 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13098 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13099 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13100 * testsuite/Makefile.in: Rebuild.
13101
13102 * fileread.cc (make_view): Add casts to avoid warning.
13103
13104 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13105
13106 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13107 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13108
13109 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
13110
13111 * options.h (General_options::output_is_executable): New.
13112 (General_options::output_is_pie): New.
13113 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13114 for shared libraries.
13115 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13116
13117 2008-09-11 Chris Demetriou <cgd@google.com>
13118
13119 * options.h (origin): New -z option.
13120 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13121 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13122 in DT_FLAGS_1.
13123
13124 2008-09-05 Cary Coutant <ccoutant@google.com>
13125
13126 * fileread.cc (File_read::make_view): Add check for attempt to map
13127 beyond end of file.
13128
13129 2008-09-05 Cary Coutant <ccoutant@google.com>
13130
13131 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13132 explicit instantiations.
13133
13134 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
13135
13136 PR gold/6858
13137 * options.cc (General_options::finalize): Allow undefined symbols
13138 in shlibs if linking -shared.
13139
13140 PR gold/6859
13141 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13142 symbols as not needing a dynsym entry.
13143
13144 2008-08-20 Craig Silverstein <csilvers@google.com>
13145
13146 * fileread.cc (File_read::open): Do not lock the file unless it
13147 was successfully opened.
13148
13149 2008-08-14 Cary Coutant <ccoutant@google.com>
13150
13151 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13152 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13153 * testsuite/tls_test.cc (struct int128): 128-bit struct
13154 for testing TLS relocs with non-zero addend.
13155 (v12): New TLS variable.
13156 (t12): New test.
13157 (t_last): Add check for v12.
13158 * testsuite/tls_test.h (t12): New function.
13159 * testsuite/tls_test_main.cc (thread_routine): Call new test.
13160
13161 2008-08-13 Ian Lance Taylor <iant@google.com>
13162
13163 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13164 set tls_segment_ or relro_segment_.
13165 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13166 when appropriate.
13167 * output.h (Output_section::clear_is_relro): New function.
13168 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13169 sections specially even when output_data_ is empty.
13170 (Output_segment::maximum_alignment): When first section is relro,
13171 only force alignment for PT_LOAD segments.
13172 * script.cc (script_data_segment_align): New function.
13173 (script_data_segment_relro_end): New function.
13174 * script-c.h (script_data_segment_align): Declare.
13175 (script_data_segment_relro_end): Declare.
13176 * script-sections.h (class Script_sections): Declare
13177 data_segment_align and data_segment_relro_end. Add fields
13178 segment_align_index_ and saw_relro_end_.
13179 * script-sections.cc (class Sections_element): Add set_is_relro
13180 virtual function. Add new bool* parameter to place_orphan_here.
13181 Add get_output_section virtual function.
13182 (class Output_section_definition): Add set_is_relro. Add new
13183 bool* parameter to place_orphan_here. Add get_output_section.
13184 Add is_relro_ field.
13185 (Output_section_definition::Output_section_definition): Initialize
13186 evaluated_address_, evaluated_load_address, evaluated_addralign_,
13187 and is_relro_ fields.
13188 (Output_section_definition::place_orphan_here): Add is_relro
13189 parameter.
13190 (Output_section_definition::set_section_addresses): Set relro for
13191 output section.
13192 (Output_section_definition::alternate_constraint): Likewise.
13193 (class Orphan_output_section): Add new bool* parameter to
13194 place_orphan_here. Add get_output_section.
13195 (Orphan_output_section::place_orphan_here): Add is_relro
13196 parameter.
13197 (Script_sections::Script_sections): Initialize
13198 data_segment_align_index_ and saw_relro_end_.
13199 (Script_sections::data_segment_align): New function.
13200 (Script_sections::data_segment_relro_end): New function.
13201 (Script_sections::place_orphan): Set or clear is_relro.
13202 (Script_sections::set_section_addresses): Force alignment of first
13203 TLS section.
13204 * yyscript.y (exp): Call script_data_segment_align and
13205 script_data_segment_relro_end.
13206 * testsuite/relro_script_test.t: New file.
13207 * testsuite/relro_test.cc (using_script): Declare.
13208 (t1, t2): Test using_script.
13209 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13210 (relro_script_test_SOURCES): Define.
13211 (relro_script_test_DEPENDENCIES): Define.
13212 (relro_script_test_LDFLAGS): Define.
13213 (relro_script_test_LDADD): Define.
13214 (relro_script_test.so): New target.
13215 * testsuite/Makefile.in: Rebuild.
13216
13217 2008-08-06 Cary Coutant <ccoutant@google.com>
13218
13219 * archive.cc (Archive::total_archives, Archive::total_members)
13220 (Archive::total_members_loaded): New variables.
13221 (Archive::setup): Add parameter. Add option to preread
13222 archive symbols.
13223 (Archive::read_armap): Add counter.
13224 (Archive::get_file_and_offset): New function.
13225 (Archive::get_elf_object_for_member): New function.
13226 (Archive::read_all_symbols): New function.
13227 (Archive::read_symbols): New function.
13228 (Archive::add_symbols): Add counters.
13229 (Archive::include_all_members): Use armap to find members if it's
13230 already built.
13231 (Archive::include_member): Skip reading symbols if already read.
13232 Factored code into Archive::get_file_and_offset and
13233 Archive::get_elf_object_for_member. Changed call to
13234 Mapfile::report_include_archive_member.
13235 (Archive::print_stats): New function.
13236 * archive.h: Declare Object and Read_symbols_data classes.
13237 (Archive::Archive): Add initializers for new members.
13238 (Archive::setup): Add parameter.
13239 (Archive::print_stats): New function.
13240 (Archive::total_archives, Archive::total_members)
13241 (Archive::total_members_loaded): New variables.
13242 (Archive::get_file_and_offset): New function.
13243 (Archive::get_elf_object_for_member): New function.
13244 (Archive::read_all_symbols): New function.
13245 (Archive::read_symbols): New function.
13246 (Archive::Archive_member): New class.
13247 (Archive::members_): New member.
13248 (Archive::num_members_): New member.
13249 * main.cc: Include archive.h.
13250 (main): Call Archive::print_stats.
13251 * mapfile.cc (Mapfile::report_include_archive_member): Delete
13252 archive parameter; member_name is now the fully-decorated name.
13253 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13254 * options.h: (General_options): Add --preread-archive-symbols option.
13255 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13256 Archive::setup.
13257
13258 2008-08-04 Ian Lance Taylor <iant@google.com>
13259
13260 * symtab.h (Symbol::use_plt_offset): New function.
13261 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13262 * powerpc.cc (Relocate::relocate): Likewise.
13263 * sparc.cc (Relocate::relocate): Likewise.
13264 * x86_64.cc (Relocate::relocate): Likewise.
13265 * testsuite/weak_plt.sh: New test.
13266 * testsuite/weak_plt_main.cc: New test.
13267 * testsuite/weak_plt_shared.cc: New test.
13268 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13269 (check_PROGRAMS): Add weak_plt.
13270 (check_DATA): Add weak_plt_shared.so.
13271 (weak_plt_main_pic.o, weak_plt): New targets.
13272 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13273 * testsuite/Makefile.in: Rebuild.
13274
13275 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13276 gcctestdir/ld.
13277 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13278 * testsuite/Makefile.in: Rebuild.
13279
13280 2008-08-04 Alan Modra <amodra@bigpond.net.au>
13281
13282 * Makefile.am (POTFILES.in): Set LC_ALL=C.
13283 * Makefile.in: Regenerate.
13284 * po/POTFILES.in: Regenerate.
13285
13286 2008-07-29 Ian Lance Taylor <iant@google.com>
13287
13288 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13289 symbols before other symbols.
13290 * testsuite/script_test_2.cc (test_addr): Declare.
13291 (test_addr_alias): Declare.
13292 (main): Check that test_addr and test_addr_alias have the right
13293 values.
13294 * testsuite/script_test_2.t: Define test_addr_alias and
13295 test_addr.
13296
13297 2008-07-24 Ian Lance Taylor <iant@google.com>
13298
13299 PR 5990
13300 * descriptors.cc: New file.
13301 * descriptors.h: New file.
13302 * gold-threads.h (class Hold_optional_lock): New class.
13303 * fileread.cc: Include "descriptors.h".
13304 (File_read::~File_read): Release descriptor rather than closing
13305 it.
13306 (File_read::open) [file]: Call open_descriptor rather than open.
13307 Set is_descriptor_opened_.
13308 (File_read::open) [memory]: Assert that descriptor is not open.
13309 (File_read::reopen_descriptor): New function.
13310 (File_read::release): Release descriptor.
13311 (File_read::do_read): Make non-const. Reopen descriptor.
13312 (File_read::read): Make non-const.
13313 (File_read::make_view): Reopen descriptor.
13314 (File_read::do_readv): Likewise.
13315 * fileread.h (class File_read): Add is_descriptor_opened_ field.
13316 Update declarations.
13317 * layout.cc: Include "descriptors.h".
13318 (Layout::create_build_id): Use open_descriptor rather than open.
13319 * output.cc: Include "descriptors.h".
13320 (Output_file::open): Use open_descriptor rather than open.
13321 * archive.cc (Archive::const_iterator): Change Archive to be
13322 non-const.
13323 (Archive::begin, Archive::end): Make non-const.
13324 (Archive::count_members): Likewise.
13325 * archive.h (class Archive): Update declarations.
13326 * object.h (Object::read): Make non-const.
13327 * Makefile.am (CCFILES): Add descriptors.cc.
13328 (HFILES): Add descriptors.h.
13329 * Makefile.in: Rebuild.
13330
13331 PR 6716
13332 * gold.h: Always include <clocale>. Add Solaris workarounds
13333 following code in binutils/sysdep.h.
13334
13335 PR 6048
13336 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13337 this->eh_frame_hdr_ is NULL before using it.
13338
13339 * dynobj.cc (Versions::Versions): Update comment.
13340
13341 * dynobj.cc (Versions::Versions): If there is an soname, use it as
13342 the base version name.
13343
13344 * stringpool.cc (Stringpool_template::add_with_length): Set key to
13345 array size plus one.
13346 (Stringpool_template::set_string_offsets): Subtract one from key
13347 before using it as an array index.
13348 (Stringpool_template::get_offset_with_length): Likewise.
13349 (Stringpool_template::write_to_buffer): Likewise.
13350 * stringpool.h (Stringpool_template::get_offset_from_key):
13351 Likewise.
13352
13353 2008-07-23 Ian Lance Taylor <iant@google.com>
13354
13355 PR 6658
13356 * object.h (Merged_symbol_value::value): Do our best to handle a
13357 negative addend.
13358
13359 PR 6647
13360 * script.cc (Version_script_info::get_versions): Don't add empty
13361 version tag to return value.
13362 (Version_script_info::get_symbol_version_helper): Change return
13363 type to bool. Add pversion parameter. Change all callers.
13364 (script_register_vers_node): Don't require a non-NULL tag.
13365 * script.h (class Version_script_info): Update declarations.
13366 (Version_script_info::get_symbol_version): Change return type to
13367 bool. Add version parameter. Change all callers.
13368 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13369 handling. Handle an empty version from a version script.
13370 (Symbol_table::define_special_symbol): Likewise.
13371 * testsuite/ver_test_10.script: New file.
13372 * testsuite/ver_test_10.sh: New file.
13373 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13374 (check_DATA): Add ver_test_10.syms.
13375 (ver_test_10.syms, ver_test_10.so): New target.
13376 * testsuite/Makefile.in: Rebuild.
13377
13378 2008-07-23 Simon Baldwin <simonb@google.com>
13379
13380 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13381 to zero for undefined symbols from dynamic libraries.
13382
13383 2008-07-23 Ian Lance Taylor <iant@google.com>
13384
13385 * symtab.cc (Symbol_table::resolve): Remove version parameter.
13386 Change all callers.
13387 * symtab.h (class Symbol_table): Update declaration.
13388 * testsuite/ver_test_9.cc: New file.
13389 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13390 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13391 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13392 (ver_test_9.so, ver_test_9.o): New targets.
13393 * testsuite/Makefile.in: Rebuild.
13394
13395 2008-07-22 Ian Lance Taylor <iant@google.com>
13396
13397 * options.h (class General_options): Define --check-sections.
13398 * layout.cc (Layout::set_segment_offsets): Handle
13399 --check-sections.
13400
13401 * options.h (class General_options): Define -n/--nmagic and
13402 -N/--omagic.
13403 * options.cc (General_options::finalize): For -n/--nmagic or
13404 -N/--omagic, set -static.
13405 * layout.cc (Layout::attach_allocated_section_to_segment): If
13406 -N/--omagic, don't put read-only and read-write sections in
13407 different segments.
13408 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13409 finding a read-only segment.
13410 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13411 don't set the minimum segment alignment to the common page size,
13412 and don't set the file offset to the address modulo the page size.
13413 * script-sections.cc (Script_sections::create_segments): If
13414 -n/--omagic, don't put read-only and read-write sections in
13415 different segments.
13416
13417 * cref.cc: New file.
13418 * cref.h: New file.
13419 * options.h (class General_options): Add --print-symbol-counts.
13420 * main.cc (main): Issue defined symbol report if requested.
13421 * archive.cc (Archive::interpret_header): Make into a const member
13422 function.
13423 (Archive::add_symbols): Call Input_objects::archive_start and
13424 archive_stop.
13425 (Archive::const_iterator): Define new class.
13426 (Archive::begin, Archive::end): New functions.
13427 (Archive::include_all_members): Rewrite to use iterator.
13428 (Archive::count_members): New function.
13429 * archive.h (class Archive): Update declarations.
13430 (Archive::filename): New function.
13431 * object.cc: Include "cref.h".
13432 (Sized_relobj::Sized_relobj): Initialize defined_count_.
13433 (Sized_relobj::do_get_global_symbol_counts): New function.
13434 (Input_objects::add_object): Add object to cross-referencer.
13435 (Input_objects::archive_start): New function.
13436 (Input_objects::archive_stop): New function.
13437 (Input_objects::print_symbol_counts): New function.
13438 * object.h: Declare Cref and Archive.
13439 (Object::get_global_symbol_counts): New function.
13440 (Object::do_get_global_symbol_counts): New pure virtual function.
13441 (class Sized_relobj): Add defined_count_ field. Update
13442 declarations.
13443 (class Input_objects): Add cref_ field. Update constructor.
13444 Update declarations.
13445 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13446 defined_count_.
13447 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13448 symbol counts.
13449 (Sized_dynobj::do_get_global_symbol_counts): New function.
13450 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13451 defined_count_. Update declarations. Define Symbols typedef.
13452 * symtab.cc (Symbol_table::add_from_relobj): Add defined
13453 parameter. Change all callers.
13454 (Symbol_table::add_from_dynobj): Add sympointers and defined
13455 parameters. Change all callers.
13456 * symtab.h (class Symbol_table): Update declarations.
13457 * Makefile.am (CCFILES): Add cref.cc.
13458 (HFILES): Add cref.h.
13459 * Makefile.in: Rebuild.
13460
13461 2008-07-22 Simon Baldwin <simonb@google.com>
13462
13463 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13464 to zero when writing undefined symbols.
13465
13466 2008-07-22 Ian Lance Taylor <iant@google.com>
13467
13468 * output.cc (Output_section::add_input_section): Don't try to
13469 merge empty merge sections.
13470
13471 2008-07-21 Craig Silverstein <csilvers@google.com>
13472
13473 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13474 Include symbol version in error message.
13475
13476 2008-07-20 Chris Demetriou <cgd@google.com>
13477
13478 * configure.ac (gold_cv_c_random_seed): New configured variable.
13479 (RANDOM_SEED_CFLAGS): New substituted variable.
13480 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13481 * configure: Rebuild.
13482 * Makefile.in: Likewise.
13483 * testsuite/Makefile.in: Likewise.
13484
13485 2008-07-18 Ian Lance Taylor <iant@google.com>
13486
13487 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13488 where we see NAME/NULL and NAME/VERSION as separate symbols.
13489 * testsuite/ver_test_main.cc (main): Call t4.
13490 (t4, t4_2a): Define.
13491 * testsuite/ver_test_2.cc (t4_2): Define.
13492 * testsuite/ver_test_2.script: Put t4_2a in VER2.
13493 * testsuite/ver_test_4.cc (t4_2a): Define.
13494 * testsuite/ver_test_4.script: Put t4_2a in VER2.
13495 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13496
13497 2008-07-17 Ian Lance Taylor <iant@google.com>
13498
13499 * dynobj.cc (Versions::add_def): If we give an error about a
13500 missing version, go ahead and create the version anyhow.
13501
13502 2008-07-10 Ian Lance Taylor <iant@google.com>
13503
13504 Handle output sections with more than 0x7fffffff bytes.
13505 * object.h (class Relobj): Change map_to_output_ to
13506 output_sections_, and just keep a section pointer. Change all
13507 uses. Move comdat group support to Sized_relobj.
13508 (Relobj::is_section_specially_mapped): Remove.
13509 (Relobj::output_section): Remove poff parameter. Change all
13510 callers.
13511 (Relobj::output_section_offset): New function.
13512 (Relobj::set_section_offset): Rewrite.
13513 (Relobj::map_to_output): Remove.
13514 (Relobj::output_sections): New function.
13515 (Relobj::do_output_section_offset): New pure virtual function.
13516 (Relobj::do_set_section_offset): Likewise.
13517 (class Sized_relobj): Add section_offsets_ field. Add comdat
13518 group support from Relobj. Update declarations.
13519 (Sized_relobj::get_output_section_offset): New function.
13520 (Sized_relobj::do_output_section_offset): New function.
13521 (Sized_relobj::do_set_section_offset): New function.
13522 * object.cc (Relobj::output_section_address): Remove.
13523 (Sized_relobj::Sized_relobj): Initialize new fields.
13524 (Sized_relobj::include_section_group): Cast find_kept_object to
13525 Sized_relobj.
13526 (Sized_relobj::include_linkonce_section): Likewise.
13527 (Sized_relobj::do_layout): Use separate arrays for output section
13528 and output offset.
13529 (Sized_relobj::do_count_local_symbols): Change map_to_output to
13530 output_sections.
13531 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13532 output_sections and section_offsets.
13533 (Sized_relobj::write_local_symbols): Likewise.
13534 (map_to_kept_section): Compute output address directly.
13535 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13536 output_sections and section_offsets.
13537 (Sized_relobj::write_sections): Likewise.
13538 (Sized_relobj::relocate_sections): Likewise.
13539 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13540 * output.h (class Output_reloc): Update declarations. Change
13541 u2_.relobj to Sized_relobj*.
13542 (class Output_data_reloc): Change add functions to use
13543 Sized_relobj*.
13544 * output.cc (Output_reloc::Output_reloc): Change relobj to
13545 Sized_relobj*.
13546 (Output_reloc::local_section_offset): Change return type to
13547 Elf_Addr. Use get_output_section_offset.
13548 (Output_reloc::get_address): Likewise.
13549 (Output_section::is_input_address_mapped): Don't call
13550 is_section_specially_mapped.
13551 (Output_section::output_offset): Likewise.
13552 (Output_section::output_address): Likewise.
13553 (Output_section::starting_output_address): Likewise.
13554 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13555 parameter to Sized_relobj*.
13556 (Copy_relocs::need_copy_reloc): Likewise.
13557 (Copy_relocs::save): Likewise.
13558 * copy-relocs.h (class Copy_relocs): Update declarations.
13559 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13560 Sized_relobj*. Change relobj_ field to Sized_relobj*.
13561 * target-reloc.h (relocate_for_relocatable): Change
13562 offset_in_output_section type to Elf_Addr. Change code that uses
13563 it as well.
13564 * layout.cc (Layout::layout): Always set *off.
13565 * mapfile.cc (Mapfile::print_input_section): Use
13566 output_section_offset.
13567 * i386.cc (Target_i386::copy_reloc): Change object parameter to
13568 Sized_relobj*.
13569 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13570 * sparc.cc (Target_sparc::copy_reloc): Likewise.
13571 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13572
13573 2008-07-03 Ian Lance Taylor <iant@google.com>
13574
13575 * layout.cc (Layout::include_section): Do not discard unrecognized
13576 SHT_STRTAB sections.
13577
13578 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
13579
13580 * script.cc (Lex::can_continue_name): Make '?' allowable in
13581 version-script names.
13582 * testsuite/version_script.map: Change glob pattern to use '?'
13583
13584 2008-06-30 Manish Singh <yosh@gimp.org>
13585
13586 PR 6585
13587 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13588 Correct typo.
13589
13590 2008-06-30 Ian Lance Taylor <iant@google.com>
13591
13592 PR 6660
13593 PR 6682
13594 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13595 versions]: Don't try to read the value in the contents, since we
13596 don't use it. Use the template endianness when writing.
13597
13598 2008-06-25 Cary Coutant <ccoutant@google.com>
13599
13600 * fileread.cc (File_read::make_view): Assert on zero-length view.
13601 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13602 symbol table when there are no symbols to read.
13603
13604 2008-06-23 Craig Silverstein <csilvers@google.com>
13605
13606 * version.cc (version_string): Bump to 1.7
13607
13608 2008-06-18 Craig Silverstein <csilvers@google.com>
13609
13610 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13611 constant 0xFFFF to type Valtype.
13612 (Powerpc_relocate_functions::rel16_ha): Likewise.
13613
13614 2008-06-17 Ian Lance Taylor <iant@google.com>
13615
13616 * output.h (Output_section::Input_section): Initialize p2align_ to
13617 zero for Output_section_data constructors.
13618 (Output_section::Input_section::addralign): If not an input
13619 section, return the alignment of the Output_section_data.
13620 * testsuite/copy_test.cc: New file.
13621 * testsuite/copy_test_1.cc: New file.
13622 * testsuite/copy_test_2.cc: New file.
13623 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13624 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13625 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13626 (copy_test_1_pic.o, copy_test_1.so): New targets.
13627 (copy_test_2_pic.o, copy_test_2.so): New targets.
13628 * testsuite/Makefile.in: Rebuild.
13629
13630 * script-sections.cc (Script_sections::place_orphan): Initialize
13631 local variable exact.
13632
13633 2008-06-13 David Edelsohn <edelsohn@gnu.org>
13634
13635 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13636
13637 2008-06-12 David Edelsohn <edelsohn@gnu.org>
13638 David S. Miller <davem@davemloft.net>
13639
13640 * powerpc.cc: New file.
13641 * Makefile.am (TARGETSOURCES): Add powerpc.cc
13642 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13643 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13644 * Makefile.in: Rebuild.
13645
13646 2008-06-09 Ian Lance Taylor <iant@google.com>
13647
13648 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13649 <exception>.
13650 (throwing, orig_terminate): New static variables.
13651 (terminate_handler): New static function.
13652 (t2): Set terminate handler.
13653
13654 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
13655
13656 PR 6584
13657 * binary.cc (Binary_to_elf::sized_convert): Fix .data
13658 alignment.
13659
13660 2008-05-30 Cary Coutant <ccoutant@google.com>
13661
13662 * archive.cc (Archive::include_all_members) Correct to step
13663 over symbol table and extended name table in thin archives.
13664
13665 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
13666
13667 PR 6407
13668 * target-reloc.h (relocate_for_relocatable): Fix new_offset
13669 calculation.
13670
13671 2008-05-28 Caleb Howe <cshowe@google.com>
13672
13673 * reduced_debug_output.cc: New file.
13674 * reduced_debug_output.h: New file.
13675 * options.h (class General_options): Add --strip-debug-non-line.
13676 * options.cc (General_options::finalize): Add strip_debug_non_line
13677 to the strip heirarchy.
13678 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13679 fields.
13680 * layout.cc: Include "reduced_debug_output.h".
13681 (Layout::Layout): Initialize new fields.
13682 (line_only_debug_sections): New static array.
13683 (is_lines_only_debug_sections): New static inline function.
13684 (Layout::include_section): Handle --strip-debug-non-line.
13685 (Layout::make_output_section): If --strip-debug-non-line, build
13686 new output sections for .debug_abbrev and .debug_info.
13687 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13688 gold. Warn about possible overflow.
13689 (read_signed_LEB_128): Likewise.
13690 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13691 (read_signed_LEB_128): Declare.
13692 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13693 (HFILES): Add reduced_debug_output.h.
13694 * Makefile.in: Rebuild.
13695
13696 2008-05-21 Ian Lance Taylor <iant@google.com>
13697
13698 * mapfile.cc: New file.
13699 * mapfile.h: New file.
13700 * options.h (class General_options): Add -M/--print-map and -Map.
13701 * options.cc (General_options::finalize): Make -M equivalent to
13702 -Map -.
13703 * main.cc: Include <cstdio> and "mapfile.h".
13704 (main): Open mapfile if requested.
13705 * gold.cc (class Middle_runner): Add mapfile_ field. Update
13706 constructor. Change caller.
13707 (queue_initial_tasks): Add mapfile parameter. Change caller.
13708 (queue_middle_tasks): Likewise.
13709 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13710 declarations.
13711 * archive.cc: Include "mapfile.h".
13712 (Archive::add_symbols): Add mapfile parameter. Change all
13713 callers. Pass mapfile, symbol, and reason to include_member.
13714 (Archive::include_all_members): Add mapfile parameter. Change all
13715 callers.
13716 (Archive::include_member): Add mapfile, sym, and why parameters.
13717 Change all callers. Report inclusion to map file.
13718 * archive.h: Include "fileread.h".
13719 (class Archive): Update declarations.
13720 (Archive::file): New const method.
13721 (class Add_archive_symbols): Add mapfile_ field. Update
13722 constructor. Change all callers.
13723 * readsyms.h (class Read_symbols): Likewise.
13724 (class Finish_group): Likewise.
13725 (class Read_script): Likewise.
13726 * common.cc: Include "mapfile.h".
13727 (Symbol_table::allocate_commons): Add mapfile parameter. Change
13728 all callers.
13729 (Symbol_table::do_allocate_commons): Likewise.
13730 (Symbol_table::do_allocate_commons_list): Likewise. Report common
13731 symbol allocation to mapfile.
13732 * common.h (class Allocate_commons_task): Add mapfile_ field.
13733 Update constructor. Change all callers.
13734 * symtab.h (class Symbol_table): Update declarations.
13735 * layout.cc: Include "mapfile.h".
13736 (Layout_task_runner::run): Print information to mapfile.
13737 (Layout::create_gold_note): Change Output_data_fixed_space to
13738 Output_data_zero_fill.
13739 (Layout::create_build_id): Likewise.
13740 (Layout::print_to_mapfile): New function.
13741 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
13742 constructor. Change caller.
13743 (class Layout): Declare print_to_mapfile.
13744 * output.cc (Output_section::Input_section::print_to_mapfile): New
13745 function.
13746 (Output_section::add_input_section): If producing a map, always
13747 add to input_sections_ list.
13748 (Output_section::do_print_to_mapfile): New function.
13749 (Output_segment::print_sections_to_mapfile): New function.
13750 (Output_segment::print_section_list_to_mapfile): New function.
13751 * output.h: Include "mapfile.h".
13752 (Output_data::print_to_mapfile): New function.
13753 (Output_data::do_print_to_mapfile): New virtual function.
13754 (Output_segment_headers::do_print_to_mapfile): New function.
13755 (Output_file_header::do_print_to_mapfile): New function.
13756 (Output_data_const::do_print_to_mapfile): New function.
13757 (class Output_data_const_buffer): Add map_name_ field. Update
13758 constructor. Change all callers. Add do_print_to_mapfile
13759 function.
13760 (class Output_data_fixed_space): Likewise.
13761 (class Output_data_space): Likewise.
13762 (class Output_data_zero_fill): New class.
13763 (Output_data_strtab::do_print_to_mapfile): New function.
13764 (Output_data_reloc_base::do_print_to_mapfile): New function.
13765 (Output_relocatable_relocs::do_print_to_mapfile): New function.
13766 (Output_data_group::do_print_to_mapfile): New function.
13767 (Output_data_got::do_print_to_mapfile): New function.
13768 (Output_data_dynamic::do_print_to_mapfile): New function.
13769 (Output_symtab_xindex::do_print_to_mapfile): New function.
13770 (class Output_section): Declare do_print_to_mapflie. Declare
13771 print_to_mapfile in Input_section.
13772 (class Output_segment): Declare new functions.
13773 * object.h (Sized_relobj::symbol_count): New function.
13774 * script-sections.cc
13775 (Output_section_element_dot_assignment::set_section_addresses):
13776 Change Output_data_fixed_space to Output_data_zero_fill.
13777 (Output_data_expression::do_print_to_mapfile): New function.
13778 * script.cc (read_input_script): Add mapfile parameter. Change
13779 all callers.
13780 * script.h (read_input_script): Update declaration.
13781 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13782 (Eh_frame::do_print_to_mapfile): New function.
13783 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13784 (Output_merge_string::do_print_to_mapfile): New function.
13785 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13786 function.
13787 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13788 function.
13789 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13790 function.
13791 * Makefile.am (CCFILES): Add mapfile.cc.
13792 (HFILES): Add mapfile.h.
13793 * Makefile.in: Rebuild.
13794
13795 2008-05-19 Ian Lance Taylor <iant@google.com>
13796
13797 * options.h (class General_options): Add -z relro.
13798 * layout.cc (Layout::Layout): Initialize relro_segment_.
13799 (Layout::add_output_section_data): Return the output section.
13800 (Layout::make_output_section): Rcognize relro sections and mark
13801 them appropriately.
13802 (Layout::attach_allocated_section_to_segment): Put relro sections
13803 in a PT_GNU_RELRO segment.
13804 (Layout::create_initial_dynamic_sections): Mark the .dynamic
13805 section as relro.
13806 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13807 PT_TLS segments.
13808 (Layout::linkonce_mapping): Map d.rel.ro.local to
13809 .data.rel.ro.local.
13810 (Layout::output_section_name): Us .data.rel.ro.local for any
13811 section which begins with that.
13812 * layout.h (class Layout): Update add_output_section_data
13813 declaration. Add relro_segment_ field.
13814 * output.cc (Output_section::Output_section): Initialize is_relro_
13815 and is_relro_local_ fields.
13816 (Output_segment::add_output_section): Group relro sections.
13817 (Output_segment::is_first_section_relro): New function.
13818 (Output_segment::maximum_alignment): If there is a relro section,
13819 align the segment to the common page size.
13820 (Output_segment::set_section_addresses): Track whether we are
13821 looking at relro sections. If the last section is a relro
13822 section, align to the common page size.
13823 (Output_segment::set_section_list_addresses): Add in_relro
13824 parameter. Change all callers. Align to the page size when
13825 moving from relro to non-relro section.
13826 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13827 segment.
13828 * output.h (class Output_section): Add is_relro_ and
13829 is_relro_local_ fields.
13830 (Output_section::is_relro): New function.
13831 (Output_section::set_is_relro): New function.
13832 (Output_section::is_relro_local): New function.
13833 (Output_section::set_is_relro_local): New function.
13834 (class Output_segment): Update declarations.
13835 * i386.cc (Target_i386::got_section): Mark .got section as relro.
13836 * sparc.cc (Target_sparc::got_section): Likewise.
13837 * x86_64.cc (Target_x86_64::got_section): Likewise.
13838 * testsuite/relro_test_main.cc: New file.
13839 * testsuite/relro_test.cc: New file.
13840 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13841 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13842 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13843 (relro_test.so, relro_test_pic.o): New targets.
13844 * testsuite/Makefile.in: Rebuild.
13845
13846 2008-05-16 Ian Lance Taylor <iant@google.com>
13847
13848 * output.cc (Output_segment::add_output_section): Remove front
13849 parameter.
13850 * output.h (class Output_segment): Remove
13851 add_initial_output_section and overloaded add_output_section.
13852 Update declaration of remaining add_output_section.
13853 * layout.cc (Layout::create_interp): Call add_output_section
13854 rather than add_initial_output_section.
13855 (Layout::finish_dynamic_section): Likewise.
13856
13857 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13858 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
13859 know the dynamic type.
13860 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13861 field. Initialize it in constructor.
13862 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13863 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13864 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13865 reloc.
13866
13867 * output.cc (Output_reloc::get_address): Change return type to
13868 Elf_Addr.
13869 * output.h (class Output_reloc): Update get_address declaration.
13870 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13871 for section addresses.
13872
13873 2008-05-09 Ian Lance Taylor <iant@google.com>
13874
13875 PR 6493
13876 * gold.cc (gold_nomem): Use return value of write.
13877
13878 2008-05-08 Ian Lance Taylor <iant@google.com>
13879
13880 * symtab.c (Symbol::init_base_output_data): Add version
13881 parameter. Change all callers.
13882 (Symbol::init_base_output_segment): Likewise.
13883 (Symbol::init_base_constant): Likewise.
13884 (Symbol::init_base_undefined): Likewise.
13885 (Sized_symbol::init_output_data): Likewise.
13886 (Sized_symbol::init_output_segment): Likewise.
13887 (Sized_symbol::init_constant): Likewise.
13888 (Sized_symbol::init_undefined): Likewise.
13889 (Symbol_table::do_define_in_output_data): If the new symbol has a
13890 version, mark it as the default.
13891 (Symbol_table::do_define_in_output_segment): Likewise.
13892 (Symbol_table::do_define_as_constant): Likewise.
13893 * symtab.h (class Symbol): Update declarations.
13894 (class Sized_symbol): Likewise.
13895 * resolve.cc (Symbol::override_version): New function.
13896 (Symbol::override_base): Call override_version.
13897 (Symbol::override_base_with_special): Likewise.
13898 * testsuite/ver_script_8.script: New file.
13899 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13900 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13901 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13902 (ver_test_8_1.so, ver_test_8_2.so): New targets.
13903
13904 2008-05-06 Ian Lance Taylor <iant@google.com>
13905
13906 PR 6049
13907 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13908 functions.
13909 (class General_options): Remove existing --undefined, and add
13910 --no-undefined instead. Add new --undefined as synonym for -u.
13911 * archive.cc (Archive::add_symbols): Check whether symbol was
13912 named with -u.
13913 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13914 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13915 all uses. Add IS_UNDEFINED. Update declarations to split
13916 different versions of init_base. Declare init_base_undefined.
13917 (Symbol::is_defined): Handle IS_UNDEFINED.
13918 (Symbol::is_undefined): Likewise.
13919 (Symbol::is_weak_undefined): Call is_undefined.
13920 (Symbol::is_absolute): Handle IS_CONSTANT.
13921 (class Sized_symbol): Update declarations to split different
13922 versions of init. Declare init_undefined.
13923 (class Symbol_table): Declare new functions.
13924 * symtab.cc (Symbol::init_base_object): Rename from init_base.
13925 Change all callers.
13926 (Symbol::init_base_output_data): Likewise.
13927 (Symbol::init_base_output_segment): Likewise.
13928 (Symbol::init_base_constant): Likewise.
13929 (Symbol::init_base_undefined): New function.
13930 (Sized_symbol::init_object): Rename from init. Change all
13931 callers.
13932 (Sized_symbol::init_output_data): Likewise.
13933 (Sized_symbol::init_output_segment): Likewise.
13934 (Sized_symbol::init_constant): Likewise.
13935 (Sized_symbol::init_undefined): New function.
13936 (Symbol_table::add_undefined_symbols_from_command_line): New
13937 function.
13938 (Symbol_table::do_add_undefined_symbols_from_command_line): New
13939 function.
13940 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13941 (Symbol::output_section): Likewise.
13942 (Symbol::set_output_section): Likewise.
13943 (Symbol_table::sized_finalize_symbol): Likewise.
13944 (Symbol_table::sized_write_globals): Likewise.
13945 * resolve.cc (Symbol_table::should_override): Likewise.
13946 (Symbol::override_base_with_special): Likewise.
13947
13948 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13949 symbol, change it to have default visibility.
13950 * testsuite/protected_1.cc: New file.
13951 * testsuite/protected_2.cc: New file.
13952 * testsuite/protected_3.cc: New file.
13953 * testsuite/protected_main_1.cc: New file.
13954 * testsuite/protected_main_2.cc: New file.
13955 * testsuite/protected_main_3.cc: New file.
13956 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13957 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13958 (protected_1_LDFLAGS, protected_1_LDADD): Define.
13959 (protected_1.so): New target.
13960 (protected_1_pic.o, protected_2_pic.o): New targets.
13961 (protected_3_pic.o): New target.
13962 (check_PROGRAMS): Add protected_2.
13963 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13964 (protected_2_LDFLAGS, protected_2_LDADD): Define.
13965 * testsuite/Makefile.in: Rebuild.
13966
13967 * options.h (DEFINE_var): Add set_user_set_##varname__.
13968 (DEFINE_bool_alias): New macro.
13969 (class General_options): Define -Bstatic using DEFINE_bool_alias
13970 rather than DEFINE_special. Add --undefined as an alias for -z
13971 defs.
13972 * options.cc (General_options::parse_Bstatic): Remove.
13973
13974 * options.h (class General_options): Add --fatal-warnings.
13975 * main.cc (main): Implement --fatal-warnings.
13976 * errors.h (Errors::warning_count): New function.
13977
13978 * options.h (class General_options): Add -Bsymbolic-functions.
13979 * symtab.h (Symbol::is_preemptible): Check for
13980 -Bsymbolic-functions.
13981
13982 2008-05-05 Ian Lance Taylor <iant@google.com>
13983
13984 * options.h (DEFINE_bool): For DASH_Z, create the negative option
13985 as noVARNAME rather than no-VARNAME.
13986 (class General_options): Add option -z combreloc.
13987 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13988 get_address.
13989 (Output_reloc::sort_before) [SHT_REL]: New function.
13990 (Output_reloc::sort_before) [SHT_RELA]: New function.
13991 (class Output_data_reloc_base): Add sort_relocs_ field. Define
13992 Sort_relocs_comparison.
13993 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13994 parameter. Change all callers.
13995 (Output_data_reloc::Output_data_reloc) [both versions]: Add
13996 sort_relocs parameter. Change all callers.
13997 * output.cc (Output_reloc::get_address): New function, broken out
13998 of write_rel.
13999 (Output_reloc::write_rel): Call it.
14000 (Output_reloc::compare): New function.
14001 (Output_data_reloc_base::do_write): Optionally sort relocs.
14002
14003 * configure.ac: If targ_extra_obj is set, link it in.
14004 * configure.tgt: Initialize all variables.
14005 (x86_64*): Set targ_extra_obj and targ_extra_size.
14006 * configure: Rebuild.
14007
14008 * object.cc (Sized_relobj::include_section_group): Adjust section
14009 indexes read from group data. Build vector to pass to
14010 layout_group.
14011 * layout.cc (Layout::layout_group): Add flags and shndxes
14012 parameters. Remove contents parameter. Change caller. Update
14013 explicit instantiations.
14014 * layout.h (class Layout): Update layout_group declaration.
14015 * output.cc (Output_data_group::Output_data_group): Add flags and
14016 input_shndxes parameters. Remove contents parameter. Change
14017 caller.
14018 (Output_data_group::do_write): Change input_sections_ to
14019 input_shndxes_.
14020 * output.h (class Output_data_group): Update constructor
14021 declaration. Rename input_sections_ to input_shndxes_.
14022 * testsuite/many_sections_test.cc: Add template.
14023
14024 2008-04-30 Cary Coutant <ccoutant@google.com>
14025
14026 * target-reloc.h (relocate_section): Fix dead-pointer bug.
14027
14028 * layout.cc (Layout::include_section): Refactored check for debug
14029 info section.
14030 (Layout::add_comdat): Add new parameters. Change type
14031 of signature parameter. Add object and shndx to signatures table.
14032 (Layout::find_kept_object): New function.
14033 * layout.h: Include <cstring>.
14034 (Layout::is_debug_info_section): New function.
14035 (Layout::add_comdat): Add new parameters.
14036 (Layout::find_kept_object): New function.
14037 (Layout::Kept_section): New struct.
14038 (Layout::Signatures): Change type of map range.
14039 * object.cc (Relobj::output_section_address): New function.
14040 (Sized_relobj::include_section_group): Add new parameters. Change
14041 calls to Layout::add_comdat. Change to build table of kept comdat
14042 groups and table mapping discarded sections to kept sections.
14043 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
14044 (Sized_relobj::do_layout): Change calls to include_section_group and
14045 include_linkonce_section.
14046 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14047 value to zero when section is discarded.
14048 (Sized_relobj::map_to_kept_section): New function.
14049 * object.h (Relobj::output_section_address): New function.
14050 (Relobj::Comdat_group): New type.
14051 (Relobj::find_comdat_group): New function.
14052 (Relobj::Comdat_group_table): New type.
14053 (Relobj::Kept_comdat_section): New type.
14054 (Relobj::Kept_comdat_section_table): New type.
14055 (Relobj::add_comdat_group): New function.
14056 (Relobj::set_kept_comdat_section): New function.
14057 (Relobj::get_kept_comdat_section): New function.
14058 (Relobj::comdat_groups_): New field.
14059 (Relobj::kept_comdat_sections_): New field.
14060 (Symbol_value::input_value): Update comment.
14061 (Sized_relobj::map_to_kept_section) New function.
14062 (Sized_relobj::include_linkonce_section): Add new parameter.
14063 * target-reloc.h (Comdat_behavior): New type.
14064 (get_comdat_behavior): New function.
14065 (relocate_section): Add code to map a discarded section to the
14066 corresponding kept section when applying a relocation.
14067
14068 2008-04-30 Craig Silverstein <csilvers@google.com>
14069
14070 * dwarf_reader.cc (next_generation_count): New static var.
14071 (Addr2line_cache_entry): New struct.
14072 (addr2line_cache): New static var.
14073 (Dwarf_line_info::one_addr2line): Added caching.
14074 (Dwarf_line_info::clear_addr2line_cache): New function.
14075 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14076 cache-size parameter.
14077 (Dwarf_line_info::one_addr2line_cache): New function.
14078 * symtab.cc (Symbol_table::detect_odr_violations): Pass
14079 new cache-size argument to one_addr2line(), and clear cache.
14080
14081 2008-04-28 Cary Coutant <ccoutant@google.com>
14082
14083 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14084 R_386_PC8 relocations.
14085
14086 2008-04-23 Ian Lance Taylor <iant@google.com>
14087
14088 * object.cc (Sized_relobj::include_section_group): Check for
14089 invalid section group.
14090
14091 * object.cc (make_elf_object): Correct test for 64-bit ELF file
14092 header size.
14093
14094 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14095 than read for file header.
14096 * archive.cc (Archive::include_member): Likewise.
14097
14098 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
14099
14100 * aclocal.m4: Regenerate.
14101 * configure: Regenerate.
14102
14103 2008-04-19 Ian Lance Taylor <iant@google.com>
14104
14105 * version.cc (version_string): Bump to 1.6.
14106
14107 * testsuite/Makefile.am (many_sections_r_test): New target.
14108 (many_sections_r_test_SOURCES): Remove.
14109 (many_sections_r_test_DEPENDENCIES): Remove.
14110 (many_sections_r_test_LDFLAGS): Remove.
14111 (many_sections_r_test_LDADD): Remove.
14112
14113 * object.cc (Sized_relobj::do_add_symbols): Always pass
14114 local_symbol_count_ to add_from_relobj.
14115
14116 * testsuite/Makefile.am (many_sections_check.h): Only check one in
14117 every thousand variables.
14118 * testsuite/Makefile.in: Rebuild.
14119
14120 * object.cc (Xindex::initialize_symtab_xindex): New function.
14121 (Xindex::read_symtab_xindex): New function.
14122 (Xindex::sym_xindex_to_shndx): New function.
14123 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14124 available.
14125 (Sized_relobj::do_initialize_xindex): New function.
14126 (Sized_relobj::do_read_symbols): Adjust section links.
14127 (Sized_relobj::symbol_section_and_value): Add is_ordinary
14128 parameter. Change all callers.
14129 (Sized_relobj::include_section_group): Adjust section links and
14130 symbol section indexes.
14131 (Sized_relobj::do_layout): Adjust section links.
14132 (Sized_relobj::do_count_local_symbols): Adjust section links and
14133 symbol section indexes.
14134 (Sized_relobj::do_finalize_local_symbols): Distinguish between
14135 ordinary and special symbols.
14136 (Sized_relobj::write_local_symbols): Add symtab_xindex and
14137 dynsym_xindex parameters. Change all callers. Adjust section
14138 links. Use SHN_XINDEX when needed.
14139 (Sized_relobj::get_symbol_location_info): Adjust section links.
14140 Don't get fooled by special symbols.
14141 * object.h (class Xindex): Define.
14142 (class Object): Add xindex_ parameter. Declare virtual functoin
14143 do_initialize_xindex.
14144 (Object::adjust_sym_shndx): New function.
14145 (Object::set_xindex): New protected function.
14146 (class Symbol_value): Add is_ordinary_shndx_ field.
14147 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14148 (Symbol_value::value): Assert ordinary section.
14149 (Symbol_value::initialize_input_to_output_map): Likewise.
14150 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14151 Change all callers.
14152 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
14153 all callers.
14154 (class Sized_relobj): Update declarations.
14155 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14156 parameter. Change all callers.
14157 (Sized_relobj::adjust_shndx): New function.
14158 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14159 field.
14160 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14161 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
14162 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
14163 (Sized_dynobj::read_dynsym_section): Adjust section links.
14164 (Sized_dynobj::read_dynamic): Likewise.
14165 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
14166 section links.
14167 (Sized_dynobj::do_initialize_xindex): New function.
14168 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
14169 do_initialize_xindex.
14170 (Sized_dynobj::adjust_shndx): New function.
14171 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14172 dynsym_xindex_ fields.
14173 (Layout::finalize): Add a call to set_section_indexes before
14174 creating the symtab sections.
14175 (Layout::set_section_indexes): Don't do anything if the section
14176 already has a section index.
14177 (Layout::create_symtab_sections): Add shnum parameter. Change
14178 caller. Create .symtab_shndx section if needed.
14179 (Layout::create_shdrs): Add shstrtab_section parameter. Change
14180 caller.
14181 (Layout::allocated_output_section_count): New function.
14182 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14183 needed.
14184 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14185 fields. Update declarations.
14186 (Layout::symtab_xindex): New function.
14187 (Layout::dynsym_xindex): New function.
14188 (class Write_symbols_task): Add layout_ field.
14189 (Write_symbols_task::Write_symbols_task): Add layout parameter.
14190 Change caller.
14191 * output.cc (Output_section_headers::Output_section_headers): Add
14192 shstrtab_section parameter. Change all callers.
14193 (Output_section_headers::do_sized_write): Store overflow values
14194 for section count and section string table section index in
14195 section header zero.
14196 (Output_file_header::do_sized_write): Check for overflow of
14197 section count and section string table section index.
14198 (Output_symtab_xindex::do_write): New function.
14199 (Output_symtab_xindex::endian_do_write): New function.
14200 * output.h (class Output_section_headers): Add shstrtab_section_.
14201 Update declarations.
14202 (class Output_symtab_xindex): Define.
14203 (Output_section::has_out_shndx): New function.
14204 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14205 field.
14206 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14207 Change all callers.
14208 (Sized_symbol::init): Likewise.
14209 (Symbol::output_section): Check for ordinary symbol.
14210 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
14211 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
14212 callers.
14213 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14214 Change all callers. Simplify handling of symbols from sections
14215 not included in the link.
14216 (Symbol_table::add_from_dynobj): Handle ordinary symbol
14217 distinction.
14218 (Weak_alias_sorter::operator()): Assert that symbols are
14219 ordinary.
14220 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14221 distinction.
14222 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14223 parameters. Change all callers.
14224 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
14225 symbol distinction. Use SHN_XINDEX when needed.
14226 (Symbol_table::write_section_symbol): Add symtab_xindex
14227 parameter. Change all callers.
14228 (Symbol_table::sized_write_section_symbol): Likewise. Use
14229 SHN_XINDEX when needed.
14230 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
14231 declarations.
14232 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
14233 (Symbol::is_defined): Check is_ordinary.
14234 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14235 (Symbol::is_absolute, Symbol::is_common): Likewise.
14236 (class Sized_symbol): Update declarations.
14237 (class Symbol_table): Update declarations.
14238 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14239 parameters. Change all callers.
14240 (Sized_symbol::override): Likewise.
14241 (Symbol_table::override): Likewise.
14242 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
14243 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
14244 is_ordinary, and orig_st_shndx parameters. Change all callers.
14245 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14246 to be in an ordinary section.
14247 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14248 object and is_ordinary parameters. Change all callers.
14249 (Sized_dwarf_line_info::read_relocs): Add object parameter.
14250 Change all callers. Don't add undefined or non-ordinary symbols
14251 to reloc_map_.
14252 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14253 Change all callers.
14254 * dwarf_reader.h (class Sized_dwarf_line_info): Update
14255 declarations.
14256 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14257 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14258 (Sized_relobj::relocate_sections): Likewise.
14259 * target-reloc.h (scan_relocs): Adjust section symbol index.
14260 (scan_relocatable_relocs): Likewise.
14261 * i386.cc (Scan::local): Check for ordinary symbols.
14262 * sparc.cc (Scan::local): Likewise.
14263 * x86_64.cc (Scan::local): Likewise.
14264 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14265 to symbol_section_and_value.
14266 * testsuite/many_sections_test.cc: New file.
14267 * testsuite/Makefile.am (BUILT_SOURCES): Define.
14268 (check_PROGRAMS): Add many_sections_test.
14269 (many_sections_test_SOURCES): Define.
14270 (many_sections_test_DEPENDENCIES): Define.
14271 (many_sections_test_LDFLAGS): Define.
14272 (BUILT_SOURCES): Add many_sections_define.h.
14273 (many_sections_define.h): New target.
14274 (BUILT_SOURCES): Add many_sections_check.h.
14275 (many_sections_check.h): New target.
14276 (check_PROGRAMS): Add many_sections_r_test.
14277 (many_sections_r_test_SOURCES): Define.
14278 (many_sections_r_test_DEPENDENCIES): Define.
14279 (many_sections_r_test_LDFLAGS): Define.
14280 (many_sections_r_test_LDADD): Define.
14281 (many_sections_r_test.o): New target.
14282 * testsuite/Makefile.in: Rebuild.
14283
14284 2008-04-17 Cary Coutant <ccoutant@google.com>
14285
14286 * errors.cc (Errors::info): New function.
14287 (gold_info): New function.
14288 * errors.h (Errors::info): New function.
14289 * gold.h (gold_info): New function.
14290 * object.cc (Input_objects::add_object): Print trace output.
14291 * options.cc (options::parse_set): New function.
14292 (General_options::parse_wrap): Deleted.
14293 (General_options::General_options): Deleted initializer.
14294 * options.h (options::String_set): New typedef.
14295 (options::parse_set): New function.
14296 (DEFINE_set): New macro.
14297 (General_options::wrap): Changed to use DEFINE_set. Changed
14298 callers of any_wrap_symbols and is_wrap_symbol.
14299 (General_options::trace, General_options::trace_symbol):
14300 New options.
14301 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14302 (General_options::wrap_symbols_): Deleted.
14303 * symtab.cc (Symbol_table::add_from_object): Print trace output.
14304
14305 2008-04-17 David S. Miller <davem@davemloft.net>
14306
14307 * options.cc (General_options::parse_V): New function.
14308 * options.h: Add entries for -V and -Qy.
14309
14310 2008-04-17 Ian Lance Taylor <iant@google.com>
14311
14312 * common.cc (Symbol_table::allocate_commons): Remove options
14313 parameter. Change caller.
14314 (Symbol_table::do_allocate_commons): Remove options parameter.
14315 Change caller. Just call do_allocate_commons_list twice.
14316 (Symbol_table::do_allocate_commons_list): New function, broken out
14317 of do_allocate_commons.
14318 * common.h (class Allocate_commons_task): Remove options_ field.
14319 Update constructor.
14320 * symtab.cc (Symbol_table::Symbol_table): Initialize
14321 tls_commons_.
14322 (Symbol_table::add_from_object): Put TLS common symbols on
14323 tls_commons_ list.
14324 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14325 which are IN_OUTPUT_DATA.
14326 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
14327 allocate_commons and do_allocate_commons declarations. Declare
14328 do_allocate_commons_list.
14329 * gold.cc (queue_middle_tasks): Update creation of
14330 Allocate_commons_task to not pass options.
14331 * testsuite/Makefile.am (INCLUDES): Add -I.. .
14332 (TLS_TEST_C_FLAGS): New variable.
14333 (tls_test_c_pic.o): New target.
14334 (tls_test_shared.so): Link in tls_test_c_pic.o.
14335 (tls_test_c_pic_ie.o): New target.
14336 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14337 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14338 (tls_test_c.o): New target.
14339 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14340 (tls_pic_test_LDADD): Likewise.
14341 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14342 (tls_shared_gd_to_ie_test_LDADD): Likewise.
14343 (tls_test_c_gnu2.o): New target.
14344 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14345 tls_test_c_gnu2.o.
14346 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14347 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14348 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14349 * testsuite/tls_test.cc: Include "config.h".
14350 (t_last): Call t11_last.
14351 * testsuite/tls_test.h (t11, t11_last): Declare.
14352 * testsuite/tls_test_c.c: New file.
14353 * testsuite/tls_test_main.cc (thread_routine): Call t11.
14354 * configure.ac: Check for OpenMP support.
14355 * configure, config.in, Makefile.in: Rebuild.
14356 * testsuite/Makefile.in: Rebuild.
14357
14358 2008-04-16 Cary Coutant <ccoutant@google.com>
14359
14360 * i386.cc (Target_i386::define_tls_base_symbol): New function.
14361 (Target_i386::tls_base_symbol_defined_): New field.
14362 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14363 (Target_i386::Scan::global): Likewise.
14364 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14365 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14366 (Target_x86_64::tls_base_symbol_defined_): New field.
14367 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14368 (Target_x86_64::Scan::global): Likewise.
14369
14370 2008-04-16 Cary Coutant <ccoutant@google.com>
14371
14372 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14373 (Symbol::needs_plt_entry): Allow weak undefined symbols.
14374 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14375 building shared libraries.
14376 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14377 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14378 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14379 * testsuite/Makefile.in: Rebuild.
14380 * testsuite/weak_undef.h: New file.
14381 * testsuite/weak_undef_file1.cc: Add extra test cases.
14382 * testsuite/weak_undef_file2.cc: Likewise.
14383 * testsuite/weak_undef_test.cc: Likewise.
14384
14385 2008-04-16 David S. Miller <davem@davemloft.net>
14386
14387 * sparc.cc (Target_sparc::Scan): Change from struct to class.
14388 Add issued_non_pic_error_ field. Declare check_non_pic.
14389 (Target_sparc::Scan::check_non_pic): New function.
14390 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14391 (Target_sparc::Scan::global): Likewise.
14392
14393 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14394 * configure: Rebuild.
14395
14396 * options.h (DEFINE_enable): New macro.
14397 (new_dtags): New enable option.
14398 (initfirst, interpose, loadfltr, nodefaultlib,
14399 nodelete, nodlopen, nodump): New -z options.
14400 * layout.cc (Layout:finish_dynamic_section): If new
14401 dtags enabled, emit DT_RUNPATH. Also, emit a
14402 DT_FLAGS_1 containing any specified -z flags.
14403
14404 2008-04-16 Ian Lance Taylor <iant@google.com>
14405
14406 * copy-relocs.cc: New file.
14407 * copy-relocs.h: New file.
14408 * reloc.cc: Remove Copy_relocs code.
14409 * reloc.h: Likewise.
14410 * reloc-types.h (struct Reloc_types) [both versions]: Add
14411 get_reloc_addend_noerror.
14412 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14413 variants of add_global which take an addend which must be zero.
14414 * i386.cc: Include "copy-relocs.h".
14415 (class Target_i386): Change type of copy_relocs_ to variable,
14416 update initializer.
14417 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14418 Change all callers.
14419 (Target_i386::do_finalize_sections): Change handling of
14420 copy_relocs_.
14421 * sparc.cc: Include "copy-relocs.h".
14422 (class Target_sparc): Change type of copy_relocs_ to variable,
14423 update initializer.
14424 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14425 Change all callers.
14426 (Target_sparc::do_finalize_sections): Change handling of
14427 copy_relocs_.
14428 * x86_64.cc: Include "copy-relocs.h".
14429 (class Target_x86_64): Change type of copy_relocs_ to variable,
14430 update initializer.
14431 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14432 class. Change all callers.
14433 (Target_x86_64::do_finalize_sections): Change handling of
14434 copy_relocs_.
14435 * Makefile.am (CCFILES): Add copy-relocs.cc.
14436 (HFILES): Add copy-relocs.h.
14437
14438 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14439
14440 * testsuite/script_test_4.sh: Permit leading zeroes.
14441
14442 2008-04-15 Ian Lance Taylor <iant@google.com>
14443
14444 * script-sections.cc (Script_sections::create_segments): Use
14445 header_size_adjustment even when there is enough room for the
14446 headers.
14447 * testsuite/script_test_4.sh: New file.
14448 * testsuite/script_test_4.t: New file.
14449 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14450 (check_DATA): Add script_test_4.stdout.
14451 (MOSTLYCLEANFILES): Likewise.
14452 (script_test_4): New target.
14453 (script_test_4.stdout): New target.
14454 * testsuite/Makefile.in: Rebuild.
14455
14456 * sparc.cc: Add definitions for Output_data_plt_sparc class
14457 constants.
14458
14459 2008-04-14 David S. Miller <davem@davemloft.net>
14460
14461 * sparc.cc: New file.
14462 * Makefile.am (TARGETSOURCES): Add sparc.cc
14463 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14464 * configure.tgt: Document targ_extra_size and
14465 targ_extra_big_endian. Add entries for sparc-* and
14466 sparc64-*.
14467 * configure.ac: Handle targ_extra_size and
14468 targ_extra_big_endian.
14469 * Makefile.in: Rebuild.
14470 * configure: Likewise.
14471 * po/POTFILES.in: Likewise.
14472 * po/gold.pot: Likewise.
14473
14474 2008-04-14 Ian Lance Taylor <iant@google.com>
14475
14476 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14477 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14478 in the name/type/flags to section mapping. Don't call
14479 allocate_output_section.
14480 (Layout::choose_output_section): Change parameter from adjust_name
14481 to is_input_section. Don't permit input sections after sections
14482 are attached to segments. Don't call allocate_output_section.
14483 (Layout::layout_eh_frame): Call update_flags_for_input_section,
14484 not write_enable_output_section.
14485 (Layout::make_output_section): Don't push to
14486 unattached_section_list_ nor call attach_to_segment. Call
14487 attach_section_to_segment if sections are attached.
14488 (Layout::attach_sections_to_segments): New function.
14489 (Layout::attach_section_to_segment): New function.
14490 (Layout::attach_allocated_section_to_segment): Rename from
14491 attach_to_segment. Remove flags parameter.
14492 (Layout::allocate_output_section): Remove function.
14493 (Layout::write_enable_output_section): Remove function.
14494 * layout.h (class Layout): Update for above changes. Add new
14495 field sections_are_attached_.
14496 * output.h (Output_section::update_flags_for_input_section): New
14497 function.
14498 * output.cc (Output_section::add_input_section): Call
14499 update_flags_for_input_section.
14500 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14501
14502 2008-04-11 Cary Coutant <ccoutant@google.com>
14503
14504 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14505 thought unnecessary.
14506 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14507
14508 2008-04-11 Ian Lance Taylor <iant@google.com>
14509
14510 * output.h (class Output_section_data): Remove inline definition
14511 of set_addralign.
14512 * output.cc (Output_section_data::set_addralign): New function.
14513
14514 2008-04-11 Cary Coutant <ccoutant@google.com>
14515
14516 Add support for TLS descriptors for i386 and x86_64.
14517 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14518 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14519 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14520 GOT_TYPE_TLS_DESC.
14521 (Target_i386::got_mod_index_entry): Remove unnecessary code.
14522 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14523 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
14524 relocations.
14525 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14526 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14527 Fix problem with initial-exec relocations.
14528 (Target_i386::Relocate::relocate_tls): Likewise.
14529 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14530 relaxation.
14531 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14532 support for section-plus-offset dynamic table entries.
14533 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14534 (Output_data_dynamic::Dynamic_entry): Add support for
14535 section-plus-offset dynamic table entries.
14536 (Output_data_dynamic::Classification): Likewise.
14537 (Output_data_dynamic::classification_): Renamed offset_.
14538 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14539 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14540 (Target_x86_64::make_plt_section): New function.
14541 (Target_x86_64::reserve_tlsdesc_entries): New function.
14542 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14543 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14544 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14545 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14546 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14547 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14548 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14549 add extra PLT entry for TLS descriptors.
14550 (Output_data_plt_x86_64::got_): New field.
14551 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14552 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14553 fields.
14554 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14555 descriptors.
14556 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14557 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14558 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14559 R_386_TLS_DESC_CALL relocations.
14560 (Target_x86_64::Scan::global): Likewise.
14561 (Target_x86_64::do_finalize_sections): Add dynamic table entries
14562 for TLS descriptors.
14563 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14564 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14565 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14566 GD-to-IE relaxation.
14567 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14568 and TLS_DESCRIPTORS.
14569 * Makefile.in: Rebuild.
14570 * configure: Rebuild.
14571 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14572 (tls_test_shared2.so): New target.
14573 (tls_shared_gd_to_ie_test_SOURCES): New variable.
14574 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14575 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14576 (tls_shared_gd_to_ie_test_LDADD): New variable.
14577 (tls_shared_gnu2_gd_to_ie_test): New target.
14578 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14579 New targets.
14580 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14581 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14582 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14583 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14584 (tls_shared_gnu2_test): New target.
14585 (tls_test_gnu2_shared.so): New target.
14586 (tls_shared_gnu2_test_SOURCES): New variable.
14587 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14588 (tls_shared_gnu2_test_LDFLAGS): New variable.
14589 (tls_shared_gnu2_test_LDADD): New variable.
14590 * testsuite/Makefile.in: Rebuild.
14591 * testsuite/Makefile.
14592
14593 2008-04-11 Ian Lance Taylor <iant@google.com>
14594
14595 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14596 justsyms.t.
14597 * testsuite/Makefile.in: Rebuild.
14598
14599 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14600 long.
14601 * testsuite/script_test_2.cc (main): Adjust test.
14602
14603 2008-04-11 David S. Miller <davem@davemloft.net>
14604 Ian Lance Taylor <iant@google.com>
14605
14606 * options.h (General_options): Add entries for '-Y' and
14607 '-relax'.
14608 * options.cc (General_options:finalize): If -Y was used, add those
14609 entries to the library path instead of the default "/lib" and
14610 "/usr/lib".
14611
14612 2008-04-11 David S. Miller <davem@davemloft.net>
14613
14614 * testsuite/justsyms.t: Start at 0x100.
14615 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14616 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14617 long.
14618 * testsuite/script_test_2.cc: Adjust string and section length
14619 checks.
14620
14621 2008-04-09 Ian Lance Taylor <iant@google.com>
14622
14623 PR gold/5996
14624 * script-sections.cc (Sections_element::allocate_to_segment): Add
14625 orphan parameter.
14626 (Output_section_definition::allocate_to_segment): Likewise.
14627 (Orphan_output_section::allocate_to_segment): Likewise.
14628 (Script_sections::attach_sections_using_phdrs_clause): Don't
14629 propagate non-PT_LOAD segments to orphan sections.
14630 * testsuite/Makefile.am (script_test_3.stdout): Generate using
14631 readelf rather than objdump.
14632 * testsuite/script_test_3.sh: Adjust accordingly. Test that
14633 .interp section and PT_INTERP segment are the same size.
14634 * testsuite/Makefile.in: Rebuild.
14635
14636 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14637 aliases for symbols defined in the same object.
14638 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14639 (weak_alias_test_SOURCES): New variable.
14640 (weak_alias_test_DEPENDENCIES): New variable.
14641 (weak_alias_test_LDFLAGS): New variable.
14642 (weak_alias_test_LDADD): New variable.
14643 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14644 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14645 (weak_alias_test_3.o): New target.
14646 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14647 * testsuite/weak_alias_test_main.cc: New file.
14648 * testsuite/weak_alias_test_1.cc: New file.
14649 * testsuite/weak_alias_test_2.cc: New file.
14650 * testsuite/weak_alias_test_3.cc: New file.
14651
14652 2008-04-08 Ian Lance Taylor <iant@google.com>
14653
14654 * options.h (class General_options): Add --noinhibit-exec option.
14655 * main.cc (main): Check --noinhibit-exec.
14656
14657 * options.h (class General_options): Define --wrap as a special
14658 option. Add wrap_symbols_ field.
14659 (General_options::any_wrap_symbols): New function.
14660 (General_options::is_wrap_symbol): New function.
14661 * options.cc (General_options::parse_wrap): New function.
14662 (General_options::General_options): Initialize wrap_symbols_.
14663 * symtab.cc (Symbol_table::wrap_symbol): New function.
14664 (Symbol_table::add_from_object): Handle --wrap.
14665 * symtab.h (class Symbol_table): Declare wrap_symbol.
14666 * target.h (Target::wrap_char): New function.
14667 (Target::Target_info): Add wrap_char field.
14668 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14669 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14670 * testsuite/testfile.cc (Target_test::test_target_info):
14671 Likewise.
14672
14673 * errors.cc (Errors::undefined_symbol): Mention symbol version if
14674 there is one.
14675
14676 * layout.h (class Layout): Add added_eh_frame_data_ field.
14677 * layout.cc (Layout::Layout): Initialize new field.
14678 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14679 output section until we find a section we merged successfully.
14680 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14681 that the size be non-zero.
14682
14683 * merge.cc (Object_merge_map::get_output_offset): Remove inline
14684 qualifier.
14685
14686 2008-04-08 Craig Silverstein <csilvers@google.com>
14687
14688 * configure.ac: Export new conditional variable HAVE_ZLIB.
14689 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14690 on HAVE_ZLIB.
14691 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14692 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14693
14694 2008-04-07 Ian Lance Taylor <iant@google.com>
14695
14696 * version.cc (version_string): Set to "1.5".
14697
14698 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14699 Add issued_non_pic_error_ field. Declare check_non_pic.
14700 (Target_x86_64::Scan::check_non_pic): New function.
14701 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14702 (Target_x86_64::Scan::global): Likewise.
14703
14704 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14705 addend parameter. Change caller. Handle merge sections.
14706 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14707 Address to Addend. Don't add in the result of
14708 local_section_offset, pass down the addend and use the returned
14709 value.
14710 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14711 Update declarations of local_section_offset and symbol_value.
14712 * testsuite/two_file_test_1.cc (t18): New function.
14713 * testsuite/two_file_test_2.cc (f18): New function.
14714 * testsuite/two_file_test_main.cc (main): Call t18.
14715 * testsuite/two_file_test.h (t18, f18): Declare.
14716
14717 * configure.ac: Don't test for objdump, c++filt, or readelf.
14718 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14719 conditionals.
14720 (TEST_READELF): New variable.
14721 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14722 (check_PROGRAMS): Add two_file_strip_test.
14723 (two_file_strip_test): New target.
14724 (check_PROGRAMS): Add two_file_same_shared_strip_test.
14725 (two_file_same_shared_strip_test_SOURCES): New variable.
14726 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14727 (two_file_same_shared_strip_test_LDFLAGS): New variable.
14728 (two_file_same_shared_strip_test_LDADD): New variable.
14729 (two_file_shared_strip.so): New target.
14730 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14731 (ver_test_5.syms, ver_test_7.syms): Likewise.
14732 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14733 (strip_test_3.stdout): Use TEST_OBJDUMP.
14734 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14735
14736 2008-04-04 Cary Coutant <ccoutant@google.com>
14737
14738 * symtab.h (Symbol::is_weak_undefined): New function.
14739 (Symbol::is_strong_undefined): New function.
14740 (Symbol::is_absolute): New function.
14741 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14742 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14743 absolute symbols.
14744 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14745 (weak_undef_test): New target.
14746 * testsuite/Makefile.in: Rebuild.
14747 * testsuite/weak_undef_file1.cc: New file.
14748 * testsuite/weak_undef_file2.cc: New file.
14749 * testsuite/weak_undef_test.cc: New file.
14750
14751 2008-04-03 Craig Silverstein <csilvers@google.com>
14752
14753 * compressed_output.h (class Output_compressed_section): Use
14754 unsigned buffer.
14755 * compressed_output.cc (zlib_compress): Use unsigned buffers,
14756 add zlib header.
14757 (zlib_compressed_suffix): Removed.
14758 (Output_compressed_section::set_final_data_size): Use unsigned
14759 buffers.
14760 * testsuite/Makefile.am (flagstest_compress_debug_sections):
14761 Fix linker invocation.
14762 (flagstest_o_specialfile_and_compress_debug_sections):
14763 Likewise.
14764 * testsuite/Makefile.in: Regenerated.
14765
14766 2008-04-02 David S. Miller <davem@davemloft.net>
14767
14768 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14769 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14770
14771 2008-04-02 Craig Silverstein <csilvers@google.com>
14772
14773 * TODO: New file.
14774
14775 2008-04-02 Ian Lance Taylor <iant@google.com>
14776
14777 * fileread.cc (File_read::find_view): Add byteshift and vshifted
14778 parameters. Update for new key type to views_. Change all
14779 callers.
14780 (File_read::read): Adjust for byteshift in returned view.
14781 (File_read::add_view): New function, broken out of
14782 find_and_make_view.
14783 (File_read::make_view): New function, broken out of
14784 find_and_make_view.
14785 (File_read::find_or_make_view): Add offset and aligned
14786 parameters. Rewrite accordingly. Change all callers.
14787 (File_read::get_view): Add offset and aligned parameters. Adjust
14788 for byteshift in return value.
14789 (File_read::get_lasting_view): Likewise.
14790 * fileread.h (class File_read): Update declarations.
14791 (class File_read::View): Add byteshift_ field. Add byteshift to
14792 constructor. Add byteshift method.
14793 * archive.h (Archive::clear_uncached_views): New function.
14794 (Archive::get_view): Add aligned parameter. Change all callers.
14795 * object.h (Object::get_view): Add aligned parameter. Change all
14796 callers.
14797 (Object::get_lasting_view): Likewise.
14798
14799 * fileread.cc (File_read::release): Don't call clear_views if
14800 there are multiple objects.
14801 * fileread.h (File_read::clear_uncached_views): New function.
14802 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14803 on the archive.
14804
14805 2008-03-31 Cary Coutant <ccoutant@google.com>
14806
14807 Add thin archive support.
14808 * archive.cc (Archive::armagt): New const.
14809 (Archive::setup): Remove task parameter and calls to unlock.
14810 (Archive::unlock_nested_archives): New function.
14811 (Archive::read_header): Add nested_off parameter. Change
14812 all callers.
14813 (Archive::interpret_header): Likewise.
14814 (Archive::include_all_members): Change to handle thin
14815 archives.
14816 (Archive::include_member): Likewise.
14817 * archive.h (Archive::Archive): Add new parameters and
14818 initializers.
14819 (Archive::armagt): New const.
14820 (Archive::setup): Remove task parameter.
14821 (Archive::unlock_nested_archives): New function.
14822 (Archive::read_header): Add nested_off parameter.
14823 (Archive::interpret_header): Likewise.
14824 (Archive::Nested_archive_table): New typedef.
14825 (Archive::is_thin_archive_): New field.
14826 (Archive::nested_archives_): New field.
14827 (Archive::options_): New field.
14828 (Archive::dirpath_): New field.
14829 (Archive::task_): New field.
14830 * readsyms.cc (Read_symbols::do_read_symbols): Add check
14831 for thin archives. Pass additional parameters to
14832 Archive::Archive. Unlock the archive file after calling
14833 Archive::setup.
14834
14835 2008-03-29 Ian Lance Taylor <iant@google.com>
14836
14837 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14838 version symbol to be local.
14839 * testsuite/ver_test_4.sh: New file.
14840 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14841 (check_DATA): Add ver_test_4.syms.
14842 (ver_test_4.syms): New target.
14843 * testsuite/Makefile.in: Rebuild.
14844
14845 * output.cc
14846 (Output_section::Input_section_sort_entry::has_priority): New
14847 function.
14848 (Output_section::Input_section_sort_entry::match_file_name): New
14849 function.
14850 (Output_section::Input_section_sort_entry::match_section_name):
14851 Remove.
14852 (Output_section::Input_section_sort_entry::match_section_name_prefix):
14853 Remove.
14854 (Output_section::Input_section_sort_entry::match_section_file):
14855 Remove.
14856 (Output_section::Input_section_sort_compare::operator()): Rewrite
14857 using new Input_section_sort_entry functions. Sort crtbegin and
14858 crtend first. Sort sections with no priority before sections with
14859 a priority.
14860 * testsuite/initpri1.c (d3): Check j != 4.
14861 (cd5): New constructor/destructor function.
14862 (main): Check j != 2.
14863
14864 * symtab.cc (Symbol_table::add_from_object): If we don't use the
14865 new symbol when resolving, don't call set_is_default.
14866 * testsuite/ver_test_7.cc: New file.
14867 * testsuite/ver_test_7.sh: New file.
14868 * testsuite/Makefile.am (ver_test_7.so): New target.
14869 (ver_test_7.o): New target.
14870 (check_SCRIPTS): Add ver_test_7.sh.
14871 (check_DATA): Add ver_test_7.syms.
14872 (ver_test_7.syms): New target.
14873
14874 2008-03-28 Ian Lance Taylor <iant@google.com>
14875
14876 * layout.cc (Layout::layout): If we see an input section with a
14877 name that needs sorting, set the must_sort flag for the output
14878 section.
14879 (Layout::make_output_section): If the name of the output section
14880 indicates that it might require sorting, set the may_sort flag.
14881 * output.h (Output_section::may_sort_attached_input_sections): New
14882 function.
14883 (Output_section::set_may_sort_attached_input_sections): New
14884 function.
14885 (Output_section::must_sort_attached_input_sections): New
14886 function.
14887 (Output_section::set_must_sort_attached_input_sections): New
14888 function.
14889 (class Output_section): Declare Input_section_sort_entry. Define
14890 Input_section_sort_compare. Declare
14891 sort_attached_input_sections. Add new fields:
14892 may_sort_attached_input_sections_,
14893 must_sort_attached_input_sections_,
14894 attached_input_sections_are_sorted_.
14895 * output.cc (Output_section::Output_section): Initialize new
14896 fields.
14897 (Output_section::add_input_section): Add an entry to
14898 input_sections_ if may_sort or must_sort are true.
14899 (Output_section::set_final_data_size): Call
14900 sort_attached_input_sections if necessary.
14901 (Output_section::Input_section_sort_entry): Define new class.
14902 (Output_section::Input_section_sort_compare::operator()): New
14903 function.
14904 (Output_section::sort_attached_input_sections): New function.
14905 * configure.ac: Check whether the compiler supports constructor
14906 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
14907 * testsuite/initpri1.c: New file.
14908 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14909 CONSTRUCTOR_PRIORITY.
14910 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14911 (initpri1_LDFLAGS): New variable.
14912 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14913
14914 2008-03-27 Ian Lance Taylor <iant@google.com>
14915
14916 * common.cc (Sort_commons::operator): Correct sorting algorithm.
14917 * testsuite/common_test_1.c: New file.
14918 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14919 (common_test_1_SOURCES): New variable.
14920 (common_test_1_DEPENDENCIES): New variable.
14921 (common_test_1_LDFLAGS): New variable.
14922
14923 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14924 and commons_ correctly when NAME/VERSION does not override
14925 NAME/NULL.
14926 * testsuite/ver_test_6.c: New file.
14927 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14928 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14929 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14930
14931 2008-03-26 Ian Lance Taylor <iant@google.com>
14932
14933 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14934 of an undefined symbol from a version script.
14935 * testsuite/Makefile.am (ver_test_5.so): New target.
14936 (ver_test_5.o): New target.
14937 (check_SCRIPTS): Add ver_test_5.sh.
14938 (check_DATA): Add ver_test_5.syms.
14939 (ver_test_5.syms): New target.
14940 * testsuite/ver_test_5.cc: New file.
14941 * testsuite/ver_test_5.script: New file.
14942 * testsuite/ver_test_5.sh: New file.
14943 * Makefile.in, testsuite/Makefile.in: Rebuild.
14944
14945 PR gold/5986
14946 Fix problems building gold with gcc 4.3.0.
14947 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14948 (gold_error_at_location, gold_warning_at_location): Use it.
14949 * configure.ac: Check whether we can compile and use a template
14950 function with a printf attribute.
14951 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14952 when jumping over bytes.
14953 * object.cc: Instantiate Object::read_section_data.
14954 * debug.h: Include <cstring>
14955 * dwarf_reader.cc: Include <algorithm>
14956 * main.cc: Include <cstring>.
14957 * options.cc: Include <cstring>.
14958 * output.cc: Include <cstring>.
14959 * script.cc: Include <cstring>.
14960 * script.h: Include <string>.
14961 * symtab.cc: Include <cstring> and <algorithm>.
14962 * target-select.cc: Include <cstring>.
14963 * version.cc: Include <string>.
14964 * testsuite/testmain.cc: Include <cstdlib>.
14965 * configure, config.in: Rebuild.
14966
14967 2008-03-25 Ian Lance Taylor <iant@google.com>
14968
14969 * options.cc: Include "../bfd/bfdver.h".
14970 (options::help): Print bug reporting address.
14971
14972 * version.cc (print_version): Adjust output for current value of
14973 BFD_VERSION_STRING.
14974
14975 * NEWS: New file.
14976
14977 * options.cc (options::help): Print list of supported targets.
14978 * target-select.h: Include <vector>.
14979 (class Target_selector): Make machine_, size_, and is_big_endian_
14980 fields const. Add bfd_name_ and instantiated_target_ fields.
14981 (Target_selector::Target_selector): Add bfd_name parameter.
14982 (Target_selector::recognize): Make non-virtual, call
14983 do_recognize.
14984 (Target_selector::recognize_by_name): Make non-virtual, call
14985 do_recognize_by_name.
14986 (Target_selector::supported_names): New function.
14987 (Target_selector::bfd_name): New function.
14988 (Target_selector::do_instantiate_target): New pure virtual
14989 function.
14990 (Target_selector::do_recognize): New virtual function.
14991 (Target_selector::do_recognize_by_name): New virtual function.
14992 (Target_selector::instantiate_target): New private function.
14993 (supported_target_names): Declare.
14994 * target-select.cc (Target_selector::Target_selector): Update for
14995 new parameter and fields.
14996 (select_target_by_name): Check that the name matches before
14997 calling recognize_by_name.
14998 (supported_target_names): New function.
14999 * i386.cc (class Target_selector_i386): Update Target_selector
15000 constructor call. Remove recognize and recognize_by_name. Add
15001 do_instantiate_target.
15002 * x86_64.cc (class Target_selector_x86_64): Likewise.
15003 * testsuite/testfile.cc (class Target_selector_test): Update for
15004 changes to Target_selector.
15005
15006 * README: Rewrite, with some notes on unsupported features.
15007
15008 2008-03-24 Cary Coutant <ccoutant@google.com>
15009
15010 * i386.cc (Target_i386::Got_type): New enum declaration.
15011 (Target_i386::Scan::local): Updated callers of Output_data_got
15012 member functions.
15013 (Target_i386::Scan::global): Likewise.
15014 (Target_i386::Relocate::relocate): Likewise.
15015 (Target_i386::Relocate::relocate_tls): Likewise.
15016 * object.h (Got_offset_list): New class.
15017 (Sized_relobj::local_has_got_offset): Added got_type parameter.
15018 (Sized_relobj::local_got_offset): Likewise.
15019 (Sized_relobj::set_local_got_offset): Likewise.
15020 (Sized_relobj::local_has_tls_got_offset): Removed.
15021 (Sized_relobj::local_tls_got_offset): Removed.
15022 (Sized_relobj::set_local_tls_got_offset): Removed.
15023 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15024 * output.cc (Output_data_got::add_global): Added got_type parameter.
15025 (Output_data_got::add_global_with_rel): Likewise.
15026 (Output_data_got::add_global_with_rela): Likewise.
15027 (Output_data_got::add_global_pair_with_rel): New function.
15028 (Output_data_got::add_global_pair_with_rela): New function.
15029 (Output_data_got::add_local): Added got_type parameter.
15030 (Output_data_got::add_local_with_rel): Likewise.
15031 (Output_data_got::add_local_with_rela): Likewise.
15032 (Output_data_got::add_local_pair_with_rel): New function.
15033 (Output_data_got::add_local_pair_with_rela): New function.
15034 (Output_data_got::add_global_tls): Removed.
15035 (Output_data_got::add_global_tls_with_rel): Removed.
15036 (Output_data_got::add_global_tls_with_rela): Removed.
15037 (Output_data_got::add_local_tls): Removed.
15038 (Output_data_got::add_local_tls_with_rel): Removed.
15039 (Output_data_got::add_local_tls_with_rela): Removed.
15040 * output.h (Output_data_got::add_global): Added got_type parameter.
15041 (Output_data_got::add_global_with_rel): Likewise.
15042 (Output_data_got::add_global_with_rela): Likewise.
15043 (Output_data_got::add_global_pair_with_rel): New function.
15044 (Output_data_got::add_global_pair_with_rela): New function.
15045 (Output_data_got::add_local): Added got_type parameter.
15046 (Output_data_got::add_local_with_rel): Likewise.
15047 (Output_data_got::add_local_with_rela): Likewise.
15048 (Output_data_got::add_local_pair_with_rel): New function.
15049 (Output_data_got::add_local_pair_with_rela): New function.
15050 (Output_data_got::add_global_tls): Removed.
15051 (Output_data_got::add_global_tls_with_rel): Removed.
15052 (Output_data_got::add_global_tls_with_rela): Removed.
15053 (Output_data_got::add_local_tls): Removed.
15054 (Output_data_got::add_local_tls_with_rel): Removed.
15055 (Output_data_got::add_local_tls_with_rela): Removed.
15056 * resolve.cc (Symbol::override_base_with_special): Removed
15057 reference to has_got_offset_ field.
15058 * symtab.cc (Symbol::init_fields): Replaced initialization
15059 of got_offset_ with got_offsets_. Removed initialization
15060 of has_got_offset_
15061 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15062 (Symbol::got_offset): Likewise.
15063 (Symbol::set_got_offset): Likewise.
15064 (Symbol::has_tls_got_offset): Removed.
15065 (Symbol::tls_got_offset): Removed.
15066 (Symbol::set_tls_got_offset): Removed.
15067 (Symbol::got_offset_): Removed.
15068 (Symbol::tls_mod_got_offset_): Removed.
15069 (Symbol::tls_pair_got_offset_): Removed.
15070 (Symbol::got_offsets_): New field.
15071 (Symbol::has_got_offset): Removed.
15072 (Symbol::has_tls_mod_got_offset): Removed.
15073 (Symbol::has_tls_pair_got_offset): Removed.
15074 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15075 (Target_x86_64::Scan::local): Updated callers of Output_data_got
15076 member functions.
15077 (Target_x86_64::Scan::global): Likewise.
15078 (Target_x86_64::Relocate::relocate): Likewise.
15079 (Target_x86_64::Relocate::relocate_tls): Likewise.
15080
15081 2008-03-25 Ben Elliston <bje@au.ibm.com>
15082
15083 * yyscript.y: Fix spelling error in comment.
15084
15085 2008-03-24 Ian Lance Taylor <iant@google.com>
15086
15087 * options.h (class General_options): Define build_id option.
15088 * layout.h (class Layout): Declare write_build_id, create_note,
15089 create_build_id. Add build_id_note_ member.
15090 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15091 "libiberty.h", "md5.h", "sha1.h".
15092 (Layout::Layout): Initialize eh_frame_data_,
15093 eh_frame_hdr_section_, and build_id_note_.
15094 (Layout::finalize): Call create_build_id.
15095 (Layout::create_note): New function, broken out of
15096 Layout::create_gold_note.
15097 (Layout::create_gold_note): Call create_note.
15098 (Layout::create_build_id): New function.
15099 (Layout::write_build_id): New function.
15100 (Close_task_runner::run): Call write_build_id.
15101
15102 * x86_64.cc: Correct license to GPLv3.
15103
15104 2008-03-23 Ian Lance Taylor <iant@google.com>
15105
15106 * options.cc: Include "demangle.h".
15107 (parse_optional_string): New function.
15108 (parse_long_option): Handle takes_optional_argument.
15109 (parse_short_option): Update dash_z initializer. Handle
15110 takes_optional_argument.
15111 (General_options::General_options): Initialize do_demangle_.
15112 (General_options::finalize): Set do_demangle_. Handle demangling
15113 style.
15114 * options.h (parse_optional_string): Declare.
15115 (struct One_option): Add optional_arg field. Update constructor.
15116 Update call constructor calls. Add takes_optional_argument
15117 function.
15118 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
15119 (DEFINE_optional_string): Define.
15120 (General_options::demangle): Change from DEFINE_bool to
15121 DEFINE_optional_string.
15122 (General_options::no_demangle): New function.
15123 (General_options::do_demangle): New function.
15124 (General_options::set_do_demangle): New function.
15125 (General_options::execstack_status_): Move definition to end of
15126 class definition.
15127 (General_options::static_): Likewise.
15128 (General_options::do_demangle_): New field.
15129 * object.cc (big_endian>::get_symbol_location_info): Call
15130 Options::do_demangle, not Options::demangle.
15131 * symtab.cc (demangle): Likewise.
15132
15133 2008-03-22 Ian Lance Taylor <iant@google.com>
15134
15135 * gold.h: Include <cstddef> and <sys/types.h>
15136 * options.h: Include <cstring>.
15137
15138 2008-03-21 Ian Lance Taylor <iant@google.com>
15139
15140 * Added source code to GNU binutils.
15141 \f
15142 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15143
15144 Copying and distribution of this file, with or without modification,
15145 are permitted in any medium without royalty provided the copyright
15146 notice and this notice are preserved.
15147
15148 Local Variables:
15149 mode: change-log
15150 left-margin: 8
15151 fill-column: 74
15152 version-control: never
15153 End: