gold/
[binutils-gdb.git] / gold / ChangeLog
1 2013-05-03 Maciej W. Rozycki <macro@codesourcery.com>
2
3 PR ld/15365
4 * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
5
6 2013-05-03 Alan Modra <amodra@gmail.com>
7
8 * merge.cc (Output_merge_string::do_add_input_section): Correct
9 scan for number of strings. Rename vars to avoid shadowing.
10 Include missing terminator in input_size_.
11
12 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
13
14 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
15 Restore empty string handling.
16
17 2013-05-01 Cary Coutant <ccoutant@google.com>
18
19 * stringpool.cc (Stringpool_template::new_key_offset): Fix
20 uninitialized warning.
21
22 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
23
24 * output.cc (Output_section::add_merge_input_section): Allow
25 to merge sections if the alignment is more than character size.
26 * merge.h (Output_merge_string::Output_merge_string): Remove
27 assert.
28 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
29 only not-null strings. Check the alignment of strings.
30 * stringpool.h
31 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
32 alignment as the argument.
33 (Stringpool_template<Stringpool_char>::addralign_): New class member.
34 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
35 Align non-zero length strings according to the addralign_.
36 (Stringpool_template<Stringpool_char>::set_string_offsets):
37 Updating offsets according to the given alignment.
38 * testsuite/Makefile.am (text_section_grouping): Test if string
39 literals are getting merged.
40 * testsuite/Makefile.in: Regenerate.
41 * testsuite/merge_string_literals_1.c: New file.
42 * testsuite/merge_string_literals_2.c: Ditto.
43 * testsuite/merge_string_literals.sh: Ditto.
44
45 2013-04-26 Ian Lance Taylor <iant@google.com>
46
47 * target-reloc.h (relocate_section): If the reloc offset is out of
48 range, pass VIEW as NULL to relocate.relocate.
49 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
50 * i386.cc (Target_i386::Relocate::relocate): Likewise.
51 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
52 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
53 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
54 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
55
56 2013-04-26 Geoff Pike <gpike@chromium.org>
57
58 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
59 * layout.cc (Hash_task): New class.
60 (Layout::queue_build_id_tasks): New function.
61 (Layout::write_build_id): Handle single-thread portion of build ID
62 computation. (In some cases, all of it is single-threaded.) Replace
63 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
64 functionality in fewer lines of code.
65 * layout.h (Layout::queue_build_id_tasks): New function declaration.
66 * options.h (General_options): make "--build-id" default to tree
67 rather than sha1. Add two new options related to --build-id=tree:
68 --build-id-chunk-size-for-treehash and
69 --build-id-min-file-size-for-treehash.
70 * Makefile.am: add testing of --build-id=tree and related new options
71 (these tests will be invoked by "make check").
72 * Makefile.in: Regenerate.
73
74 2013-04-25 Alan Modra <amodra@gmail.com>
75
76 * configure.tgt: Add powerpcle and powerpc64le.
77
78 2013-04-22 Alan Modra <amodra@gmail.com>
79
80 PR gold/15355
81 * layout.cc (Layout::segment_precedes): Allow more than one
82 segment with the same type and flags.
83
84 2013-04-15 Cary Coutant <ccoutant@google.com>
85
86 * layout.cc (Layout::set_relocatable_section_offsets): Don't
87 allocate space in file for BSS sections.
88
89 2013-04-15 Cary Coutant <ccoutant@google.com>
90
91 * script-sections.cc (Orphan_output_section): Reset address
92 to zero after each orphaned section for relocatable links.
93
94 2013-04-15 Cary Coutant <ccoutant@google.com>
95
96 * symtab.cc (Symbol_table::sized_write_globals): Subtract
97 section starting address for relocatable link.
98 * testsuite/Makefile.am (script_test_11): New test.
99 * testsuite/Makefile.in: Regenerate.
100 * testsuite/script_test_11.c: New source file.
101 * testsuite/script_test_11.t: New linker script.
102
103 2013-04-13 Alan Modra <amodra@gmail.com>
104
105 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
106 owner when sections are not adjacent and exceed group size.
107 (Target_powerpc::group_sections): Handle corner case.
108 (Target_powerpc::Branch_info::make_stub): Handle case where
109 stub table doesn't exist due to branches in non-exec sections.
110 (Target_powerpc::Relocate::relocate): Likewise.
111
112 2013-04-11 Alan Modra <amodra@gmail.com>
113
114 PR gold/15354
115 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
116 .branch_lt to match bfd ld. Adjust comments throughout file.
117
118 2013-04-04 Ian Lance Taylor <iant@google.com>
119
120 GCC PR c++/56840
121 * object.cc (do_layout_deferred_sections): Handle .eh_frame
122 sections before checking whether they are included in the link.
123
124 2013-03-29 Sriraman Tallam <tmsriram@google.com>
125
126 * archive.cc (Archive::get_elf_object_for_member): Create the elf
127 object before calling the plugin claim_file handler. Pass the elf
128 object of the archive to the plugin. Delete the elf object if the
129 plugin claims the file.
130
131 2013-03-21 Alan Modra <amodra@gmail.com>
132
133 * layout.cc (Layout::set_segment_offsets): Accept writable .text
134 segment when omagic.
135
136 2013-03-21 Alan Modra <amodra@gmail.com>
137
138 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
139 comparison warning.
140 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
141 uninitialized" warning.
142
143 2013-03-20 Alan Modra <amodra@gmail.com>
144
145 * symtab.h (Symbol::clear_version): New function.
146 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
147 is_needed by weak references. Clear version for symbols defined
148 in as-needed objects that are not needed.
149
150 2013-03-15 Alan Modra <amodra@gmail.com>
151
152 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
153 static and public. Add report_err param. Return false for data refs.
154 (Target_powerpc::rela_dyn_section): New overloaded function.
155 (Target_powerpc::plt_, iplt_): Elucidate.
156 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
157 (Output_data_plt_powerpc::do_write): Don't write .iplt.
158 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
159 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
160 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
161 push_branch and make_plt_entry for ifunc syms when
162 reloc_needs_plt_for_ifunc.
163 (Target_powerpc::Relocate::relocate): Don't use plt entry value
164 for ifunc unless reloc_needs_plt_for_ifunc.
165
166 2013-03-15 Alan Modra <amodra@gmail.com>
167
168 * gc.h (gc_process_relocs): Don't look through function descriptors.
169 * icf.cc (get_section_contents): Do so here instead.
170
171 2013-03-13 Alan Modra <amodra@gmail.com>
172
173 * powerpc.cc (is_branch_reloc): Forward declare.
174 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
175 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
176 false for 64-bit, true for 32-bit non-branch relocs.
177 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
178 * testsuite/Makefile.am (icf_test): Use linker map file instead of
179 nm output.
180 (icf_safe_test): Generate linker map file as well as nm output.
181 (icf_safe_so_test): Likewise.
182 * testsuite/Makefile.in: Regenerate.
183 * testsuite/icf_test.sh: Parse linker map file to determine
184 section folding.
185 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
186 * testsuite/icf_safe_so_test.sh: Likewise.
187 (X86_32_or_ARM_specific_safe_fold): Merge into..
188 (arch_specific_safe_fold): ..this.
189 (X86_64_specific_safe_fold): Delete unused function.
190
191 2013-03-12 Alan Modra <amodra@gmail.com>
192
193 * gc.h (gc_process_relocs): Look through function descriptors
194 to determine shndx, symvalue and addend used by ICF. Tidy
195 variable duplication.
196
197 2013-03-11 Alan Modra <amodra@gmail.com>
198
199 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
200 * layout.cc (Layout_task_runner::run): ..to here.
201 * symtab.h (struct Symbol_location): Extract from..
202 (class Symbol_table): ..here.
203 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
204 * target.h (class Target): Add function_location and
205 do_function_location functions.
206 (class Sized_target): Add do_function_location.
207 * object.h (class Sized_relobj_file): Move find_shdr..
208 (class Object): ..to here.
209 * object.cc: Likewise. Update to suit. Instantiate.
210 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
211 * powerpc.cc (class Powerpc_dynobj): New.
212 (Target_powerpc::do_function_location): New function.
213 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
214 (Powerpc_dynobj::do_read_symbols): New function.
215 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
216
217 2013-03-08 Ian Lance Taylor <iant@google.com>
218
219 * options.cc (General_options::string_to_object_format): Accept
220 "default".
221
222 2013-03-08 Alan Modra <amodra@gmail.com>
223
224 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
225 pointer to Post_fde.
226 (struct Post_fde): Move definition to here..
227 * ehframe.cc (struct Post_fde): ..from here.
228 (Cie::write): Don't alloc Post_fde.
229 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
230
231 2013-03-07 Alan Modra <amodra@gmail.com>
232
233 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
234 relocation referencing .LC0.
235 * testsuite/discard_locals_test.sh: Remove FIXMEs.
236
237 2013-03-07 Alan Modra <amodra@gmail.com>
238
239 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
240 always_inline. Add assembly for powerpc to avoid GOT.
241
242 2013-03-07 Alan Modra <amodra@gmail.com>
243
244 * testsuite/script_test_10.sh: Don't test .bss section
245 header number.
246
247 2013-03-06 Alan Modra <amodra@gmail.com>
248
249 * powerpc.cc (class Powerpc_relobj): Move some member functions.
250 (Target_powerpc::symval_for_branch): Add symtab param. Update
251 all callers. Handle folded sections.
252 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
253 to Powerpc_relobj.
254 (Global_symbol_visitor_opd::operator()): Likewise.
255
256 2013-03-04 Alan Modra <amodra@gmail.com>
257
258 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
259 * testsuite/Makefile.in: Regenerate.
260
261 2013-03-01 Cary Coutant <ccoutant@google.com>
262
263 Add dwp support for v2 DWARF package file format.
264 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
265 tu_length parameter. Adjust all callers.
266 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
267 * dwp.cc: Include dwarf.h.
268 (Section_bounds): New struct type.
269 (Unit_set): New struct type.
270 (Dwo_file::Dwo_file): Initialize new data member.
271 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
272 Combine and rename to...
273 (Dwo_file::read_unit_index): ...this.
274 (Dwo_file::sized_read_compunit_index)
275 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
276 (Dwo_file::sized_read_unit_index): ...this.
277 (Dwo_file::copy_section): Remove section_name, is_str_offsets
278 parameters; add section_id parameter.
279 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
280 (Dwo_file::add_unit_set): ...this.
281 (Dwo_file::shndx_map_): Remove.
282 (Dwo_file::sect_offsets_): New data member.
283 (Dwp_output_file::Dwp_output_file): Initialize new data members.
284 (Dwp_output_file::add_section): Rename to...
285 (Dwp_output_file::add_contribution): ...this.
286 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
287 (Dwp_output_file::add_tu_set): Likewise.
288 (Dwp_output_file::Contribution): New type.
289 (Dwp_output_file::Section::contributions): New data member.
290 (Dwp_output_file::Cu_or_tu_set): Remove.
291 (Dwp_output_file::Section::Section): New ctor.
292 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
293 (Dwp_output_file::Dwp_index::Section_table): New type.
294 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
295 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
296 parameter.
297 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
298 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
299 (Dwp_output_file::Dwp_index::section_table): New member function.
300 (Dwp_output_file::Dwp_index::section_table_end): New member function.
301 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
302 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
303 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
304 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
305 (Dwp_output_file::Dwp_index::section_table_): New data member.
306 (Dwp_output_file::Dwp_index::section_mask_): New data member.
307 (Dwp_output_file::add_output_section): New member function.
308 (Dwp_output_file::write_new_section): New member function.
309 (Dwp_output_file::write_contributions): New member function.
310 (Dwp_output_file::section_id_map_): New data member.
311 (class Dwo_id_info_reader): Remove.
312 (class Unit_reader): New class.
313 (get_dwarf_section_name): New function.
314 (Dwo_file::read_executable): Adjust initializations of class data.
315 (Dwo_file::read): Add support for v2 package file format.
316 (Dwo_file::read_unit_index): Likewise.
317 (Dwo_file::sized_read_unit_index): Likewise.
318 (Dwo_file::copy_section): Likewise.
319 (Dwo_file::add_unit_set): Likewise.
320 (Dwp_output_file::add_output_section): Likewise.
321 (Dwp_output_file::add_contribution): Likewise.
322 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
323 for empty slot.
324 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
325 file format.
326 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
327 slot.
328 (Dwp_output_file::initialize): Remove unused function.
329 (Dwp_output_file::finalize): Add support for v2 package file format.
330 (Dwp_output_file::write_index): Likewise.
331 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
332 function prototype.
333
334 2013-03-01 Cary Coutant <ccoutant@google.com>
335
336 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
337 function into class definition in header file.
338 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
339 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
340 New function.
341 (Dwarf_info_reader::check_buffer): Move here from .cc file.
342
343 2013-02-28 Alan Modra <amodra@gmail.com>
344
345 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
346 * target.cc (Target::do_plt_fde_location): New function.
347 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
348 accessor function, and constructor param.
349 (struct Post_fde, Post_fdes): Declare.
350 (Cie::write): Add post_fdes param.
351 * ehframe.cc (Fde::write): Use plt_fde_location.
352 (struct Post_fde): Define.
353 (Cie::write): Stash FDEs added post merge mapping.
354 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
355 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
356 (Eh_frame::do_sized_write): Arrange to write post map FDES after
357 other FDEs.
358 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
359 (Target_powerpc::has_glink): New function.
360 (Target_powerpc::do_relax): Add eh_frame info for stubs.
361 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
362 glink_eh_frame_fde_32, default_fde): New data.
363 (Stub_table::eh_frame_added_): New var.
364 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
365 Make const.
366 (Stub_table::add_eh_frame): New function.
367 (Output_data_glink::add_eh_frame): New function.
368 (Target_powerpc::make_glink_section): Call add_eh_frame.
369
370 2013-02-15 Ian Lance Taylor <iant@google.com>
371
372 * options.h (DEFINE_uint64_alias): Define.
373 (class General_options): Add -Ttext-segment as an alias for
374 -Ttext.
375
376 2013-02-15 Alan Modra <amodra@gmail.com>
377
378 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
379 (Stub_table::do_write): ..here, two places.
380 (Stub_table::plt_call_size): Use it here too.
381
382 2013-02-11 Ian Lance Taylor <iant@google.com>
383
384 * descriptors.cc (Descriptors::close_all): New function.
385 * descriptors.h (class Descriptors): Declare close_all.
386 (close_all_descriptors): New inline function.
387 * plugin.cc: Include "descriptors.h".
388 (Plugin_manager::cleanup): Call close_all_descriptors.
389
390 2013-02-06 Alan Modra <amodra@gmail.com>
391
392 * README: Update coding style link.
393
394 2013-01-28 Cary Coutant <ccoutant@google.com>
395
396 * dwp.cc (File_list): New typedef.
397 (Dwo_name_info_reader): New class.
398 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
399 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
400 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
401 (Dwo_file::read_executable): New function.
402 (Dwo_file::read): Move common setup code to ...
403 (Dwo_file::make_object): ... here.
404 (dwp_options): Add --exec/-e.
405 (usage): Likewise.
406 (main): Likewise.
407
408 2013-01-24 Sriraman Tallam <tmsriram@google.com>
409
410 * layout.cc (Layout::layout): Check for option text_reorder.
411 (Layout::make_output_section): Ditto.
412 * options.h (text_reorder): New option.
413 * output.cc (Input_section_sort_compare): Remove special ordering
414 of section names.
415 (Output_section::
416 Input_section_sort_section_name_special_ordering_compare::
417 operator()): New function.
418 (Output_section::sort_attached_input_sections): Use new sort function
419 for .text.
420 * output.h (Input_section_sort_section_name_special_ordering_compare):
421 New struct.
422 * testsuite/Makefile.am (text_section_grouping): Test option
423 --no-text-reorder
424 * testsuite/Makefile.in: Regenerate.
425 * testsuite/text_section_grouping.sh: Check order of functions without
426 default text reordering.
427
428 2013-01-18 Mike Frysinger <vapier@gentoo.org>
429
430 * options.h (General_options): Change default to true for new_dtags.
431
432 2013-01-18 Mike Frysinger <vapier@gentoo.org>
433
434 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
435 when enable_new_dtags is false. Only add DT_RUNPATH when
436 enable_new_dtags is true.
437
438 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
439
440 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
441 used in declaration and definition consistent.
442 (Target_powerpc::symval_for_branch): Ditto.
443
444 2013-01-16 Sriraman Tallam <tmsriram@google.com>
445
446 * testsuite/plugin_final_layout.cc: Fix comment.
447
448 2013-01-16 Sriraman Tallam <tmsriram@google.com>
449
450 * layout.cc (Layout::layout): Do not do default sorting for
451 text sections when section ordering is specified.
452 (make_output_section): Ditto.
453 * testsuite/plugin_final_layout.cc: Name the function sections
454 to catch reordering issues.
455
456 2013-01-15 Alan Modra <amodra@gmail.com>
457
458 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
459 plt-thread-safe.
460
461 2013-01-15 Alan Modra <amodra@gmail.com>
462
463 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
464 * testsuite/Makefile.in: Regenerate.
465
466 2013-01-14 Alan Modra <amodra@gmail.com>
467
468 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
469 * testsuite/Makefile.in: Regenerate.
470
471 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
472
473 PR bfd/14430
474 Fix mingw gold build with plugins enabled
475 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
476 * configure.ac: Export DLOPEN_LIBS and add headers check.
477 * plugin.cc: Handle non-dlfcn case.
478 * Makefile.in: Regenerate.
479 * config.in: Regenerate.
480 * configure: Regenerate.
481 * testsuite/Makefile.in: Regenerate.
482
483 2013-01-09 Sriraman Tallam <tmsriram@google.com>
484
485 * output.h (sort_attached_input_sections): Change to be public.
486 * script-sections.cc
487 (Output_section_definition::set_section_addresses): Sort
488 attached input sections according to section order before linker
489 script assigns section addresses.
490 (Orphan_output_section::set_section_addresses): Sort
491 attached input sections according to section order before linker
492 script assigns section addresses.
493 * Makefile.am (final_layout.sh): Use a simple linker script to
494 check if section ordering still works.
495 * Makefile.in: Regenerate.
496
497 2013-01-09 Ben Cheng <bccheng@google.com>
498
499 * arm.cc (Target_arm::attributes_accept_div): New function.
500 (Target_arm::attributes_forbid_div): New function.
501 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
502 attribute using the same new functions as what bfd/elf32_arm.c
503 does.
504
505 2013-01-07 Cary Coutant <ccoutant@google.com>
506
507 PR gold/14993
508 * output.cc (Output_section::add_input_section): For incremental
509 updates, don't track input sections that are allocated from patch
510 space.
511
512 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
513 Ian Lance Taylor <iant@google.com>
514
515 PR gold/14897
516 * configure.ac (--enable-ld): Removed.
517 (install_as_default): Set to yes only for --enable-gold=default
518 or --disable-ld.
519 * configure: Regenerated.
520
521 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
522
523 * options.h (General_options): Add -fuse-ld= for GCC linker
524 option compatibility.
525
526 2013-01-04 Cary Coutant <ccoutant@google.com>
527
528 * configure.ac: Fix typo restoring CXXFLAGS.
529 * configure: Regenerate.
530
531 2013-01-04 Cary Coutant <ccoutant@google.com>
532
533 * testsuite/Makefile.am (CXXLINK_S): New macro.
534 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
535 * testsuite/Makefile.in: Regenerate.
536
537 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
538
539 * version.cc (print_version): Update copyright year to 2013.
540
541 2012-12-20 Ian Lance Taylor <iant@google.com>
542
543 * layout.cc (Layout::special_ordering_of_input_section): New
544 function.
545 (Layout::layout): If input section requires special ordering, must
546 sort input sections.
547 (Layout::make_output_section): May sort .text input sections.
548 (Layout::is_section_name_prefix_grouped): Remove.
549 * layout.h (class Layout): Declare
550 special_ordering_of_input_section. Don't declare
551 is_section_name_prefix_grouped.
552 * output.cc (Output_section::add_input_section): Revert last
553 change.
554 (Output_section::Input_section_sort::match_file_name): Don't crash
555 if called on output section data.
556 (Output_section::Input_section_sort_compare): Sort based on
557 special ordering.
558 (Output_section::Input_section_sort_section_order_index_compare):
559 Revert last patch.
560 (Output_section::sort_attached_input_sections): Likewise.
561
562 2012-12-18 Sriraman Tallam <tmsriram@google.com>
563
564 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
565 * layout.h (Layout::is_section_name_prefix_grouped): New function.
566 * output.cc (Output_section::add_input_section): Check if section
567 name contains special prefix. Keep input sections to sort such
568 sections.
569 (Output_section::Input_section_sort_section_order_index_compare
570 ::operator()): Group sections according to prefixes.
571 (Output_section::sort_attached_input_sections): Add condition to
572 Input_section_entry constructor call.
573 * testsuite/Makefile.am (text_section_grouping): New test.
574 * testsuite/Makefile.in: Regenerate.
575 * testsuite/text_section_grouping.cc: New file.
576 * testsuite/text_section_grouping.sh: New file.
577
578 2012-12-17 Nick Clifton <nickc@redhat.com>
579
580 * Makefile.am: Add copyright notice.
581 * NEWS: Likewise.
582 * README: Likewise.
583 * configure.ac: Likewise.
584 * ftruncate.c: Likewise.
585 * Makefile.in: Regenerate.
586
587 2012-12-14 Cary Coutant <ccoutant@google.com>
588
589 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
590 --no-as-needed flag.
591 (exception_separate_shared_12_test): Likewise.
592 (incremental_copy_test): Likewise.
593 * testsuite/Makefile.in: Regenerate.
594
595 2012-12-14 Cary Coutant <ccoutant@google.com>
596
597 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
598 (Dwp_output_file::Dwp_index::enter_set): Add assert.
599
600 2012-12-12 Alan Modra <amodra@gmail.com>
601
602 * powerpc.cc (class Track_tls): New.
603 (class Relocate, class Scan): Inherit Track_tls.
604 (Target_powerpc::Scan::local, global): Track tls optimization
605 and avoid creating plt entry for __tls_get_addr if all uses
606 are optimized away.
607 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
608
609 2012-12-12 Alan Modra <amodra@gmail.com>
610
611 * options.h (General_options): Add --toc-sort/--no-toc-sort.
612 Replace no_toc_optimize with toc_optimize.
613 * output.h (Output_section::input_sections): Provide non-const variant.
614 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
615 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
616 accessors.
617 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
618 (class Sort_toc_sections): New.
619 (Target_powerpc::do_finalize_sections): Sort toc sections.
620 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
621
622 2012-12-10 Roland McGrath <mcgrathr@google.com>
623
624 * testsuite/binary_unittest.cc (read_all): New function.
625 (Sized_binary_test): Use it instead of ::read.
626 * fileread.cc (do_read): Don't assume pread always reads the whole
627 amount in a single call.
628
629 2012-12-10 Alan Modra <amodra@gmail.com>
630
631 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
632 Set EM_PPC64 or EM_PPC here.
633 (Target_selector_powerpc::do_recognize): Delete.
634
635 2012-12-10 Alan Modra <amodra@gmail.com>
636
637 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
638 stub_table_.
639 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
640
641 2012-12-07 Roland McGrath <mcgrathr@google.com>
642
643 * testsuite/binary_unittest.cc (Sized_binary_test):
644 Use open_descriptor rather than ::open.
645
646 2012-12-07 Alan Modra <amodra@gmail.com>
647
648 * powerpc.cc (Stub_table::do_write): Delete redundant Address
649 typedef and invalid_address constant.
650 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
651 instantiate constants.
652
653 2012-12-06 Roland McGrath <mcgrathr@google.com>
654
655 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
656 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
657 * aclocal.m4: Regenerate.
658 * configure: Regenerate.
659 * Makefile.in: Regenerate.
660 * testsuite/Makefile.in: Regenerate.
661
662 2012-12-07 Alan Modra <amodra@gmail.com>
663
664 * options.h (General_options): Add no_toc_optimize.
665 * powerpc.cc (ok_lo_toc_insn): New function.
666 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
667
668 2012-12-06 Alan Modra <amodra@gmail.com>
669
670 * options.h (General_options): Add plt_align, plt_static_chain,
671 plt_thread_safe. Update stub_group_size help text.
672 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
673 for new plt_thread_safe_ var.
674 (use_plt_offset): Correct comments.
675 (Target_powerpc::do_relax): Look for thread creation symbols to
676 determine default plt_thread_safe value. Clear plt call stubs
677 as well as branch stubs each iteration.
678 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
679 insn constants.
680 (l, hi, ha, write_insn): Move earlier.
681 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
682 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
683 plt stubs too.
684 (Stub_table::update_size): Adjust.
685 (Stub_table::prev_size, set_prev_size): Delete.
686 (Stub_table::stub_align): Let --plt-align affect result.
687 (Stub_table::plt_call_size): Calculate sizes for various stubs.
688 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
689 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
690 (Stub_table::do_write): Support more stub variants.
691
692 2012-12-04 Alan Modra <amodra@gmail.com>
693
694 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
695 (Target_powerpc::do_define_standard_symbols): New function.
696
697 2012-12-03 Alan Modra <amodra@gmail.com>
698
699 * output.h: Formatting, whitespace.
700
701 2012-12-03 Alan Modra <amodra@gmail.com>
702
703 * layout.h (Layout::get_executable_sections): Declare.
704 * layout.cc (Layout::get_executable_sections): New function.
705 * arm.cc (Target_arm::group_sections): Use it.
706 (Arm_output_section::group_sections): Delete now redundant test.
707 * output.cc (Output_reloc::Output_reloc): Add is_relative.
708 param to handle relative relocs.
709 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
710 (Output_data_reloc::add_absolute): Adjust.
711 (Output_data_reloc::add_relative): New function.
712 (Output_data::reset_data_size): New function.
713 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
714 (Output_section::set_addralign): New function.
715 (Output_section::checkpoint_set_addralign): New function.
716 (Output_section::clear_section_offsets_need_adjustment): New function.
717 (Output_section::input_sections): Make public.
718 * powerpc.cc (class Output_data_brlt_powerpc): New.
719 (class Stub_table, class Stub_control): New.
720 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
721 stub_table_, set_stub_table, stub_table): New vectors and accessor
722 functions.
723 (Target_powerpc::do_may_relax, do_relax, push_branch,
724 new_stub_table, stub_tables, brlt_section, group_sections,
725 add_branch_lookup_table, find_branch_lookup_table,
726 write_branch_lookup_table, make_brlt_section): New functions.
727 (Target_powerpc::struct Sort_sections, class Branch_info): New.
728 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
729 branch_info_): New vars.
730 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
731 make call stubs here.
732 (Output_data_glink): Remove all call stub handling from this class.
733 (Target_powerpc::Scan::local, global): Save interesting branch
734 relocs and relocs for ifunc. Adjust calls to plt entry functions.
735 (Target_powerpc::do_finalize_sections): Only make reg save/restore
736 functions on final link.
737 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
738 Handle long branch destinations too.
739 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
740 do_plt_address_for_local): Adjust lookup of plt call stubs.
741
742 2012-11-30 Alan Modra <amodra@gmail.com>
743
744 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
745 relocs against protected symbols when building 32-bit shared libs.
746
747 2012-11-30 Alan Modra <amodra@gmail.com>
748
749 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
750 param. Call got_section() to make .got. Update all callers
751 and their callers and so on.
752
753 2012-11-30 Alan Modra <amodra@gmail.com>
754
755 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
756 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
757 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
758 value if it already exists.
759
760 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
761
762 PR gold/14858
763 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
764
765 2012-11-14 Roland McGrath <mcgrathr@google.com>
766
767 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
768 than bfc instruction for data sandboxing.
769
770 2012-11-08 Alan Modra <amodra@gmail.com>
771
772 * po/POTFILES.in: Regenerate.
773
774 2012-11-05 Alan Modra <amodra@gmail.com>
775
776 * configure.ac: Apply 2012-09-10 change to config.in here.
777 * configure: Regenerate.
778
779 2012-11-05 Alan Modra <amodra@gmail.com>
780
781 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
782 (struct Opd_ent): Use "Address" rather than "Offset".
783 (Output_data_got_powerpc::got_base_offset): Return Valtype.
784 (Target_powerpc::got_section): Make public.
785 (Target_powerpc::scan_relocs): Move code setting symbols..
786 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
787 Create _SDA_BASE_ only when referenced.
788
789 2012-11-02 Roland McGrath <mcgrathr@google.com>
790
791 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
792 from last change.
793
794 2012-11-01 Roland McGrath <mcgrathr@google.com>
795
796 * target.h (Sized_target::relocate_relocs): Use Elf_Off
797 for offset_in_output_section parameter.
798 (Sized_target::relocate_special_relocatable): Likewise.
799 * arm.cc (Target_arm::relocate_relocs): Likewise.
800 (Target_arm::relocate_special_relocatable): Likewise.
801 * i386.cc (Target_i386::relocate_relocs): Likewise.
802 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
803 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
804 * target-reloc.h (relocate_relocs): Likewise.
805 * testsuite/testfile.cc (Target_test): Likewise.
806 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
807 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
808
809 * system.h: Move inclusion of <clocale> to after <libintl.h> in
810 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
811
812 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
813 parameter, which is unused in the [!F_SETFD] case.
814
815 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
816 SYMNDX to off_t before comparing it to this->data_size().
817 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
818 * incremental.cc (Output_section_incremental_inputs::do_write):
819 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
820
821 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
822
823 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
824
825 * gold.cc (Target_arm::do_adjust_elf_header): Add the
826 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
827 in EABI_VER5.
828
829 2012-10-29 Cary Coutant <ccoutant@google.com>
830
831 * dwp.cc (usage): Add file and exit status parameters;
832 add --help and --version options.
833 (print_version): New function.
834 (main): Add --help and --version options.
835
836 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
837
838 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
839 final_layout_sequence.txt.
840 * testsuite/Makefile.in: Regenerated.
841
842 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
843
844 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
845 COMPILE generated by automake.
846 (LINK1): Likewise.
847 (CXXCOMPILE1): Likewise.
848 (CXXLINK1): Likewise.
849 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
850 (LINK): Likewise.
851 (CXXCOMPILE): Likewise.
852 (CXXLINK): Likewise.
853 * testsuite/Makefile.in: Regenerated.
854
855 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
856
857 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
858 on bad fwrite return.
859
860 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
861
862 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
863 on val.
864
865 2012-10-23 Cary Coutant <ccoutant@google.com>
866
867 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
868 * testsuite/Makefile.in: Regenerate.
869 * testsuite/dwp_test.h: New source file.
870 * testsuite/dwp_test_1.cc: New source file.
871 * testsuite/dwp_test_1.s: New source file.
872 * testsuite/dwp_test_1.sh: New source file.
873 * testsuite/dwp_test_1b.cc: New source file.
874 * testsuite/dwp_test_1b.s: New source file.
875 * testsuite/dwp_test_2.cc: New source file.
876 * testsuite/dwp_test_2.s: New source file.
877 * testsuite/dwp_test_2.sh: New source file.
878 * testsuite/dwp_test_main.cc: New source file.
879 * testsuite/dwp_test_main.s: New source file.
880
881 2012-10-23 Cary Coutant <ccoutant@google.com>
882
883 * dwp.h: New header file.
884 * dwp.cc: New source file.
885 * gold.h: Move shared declarations to system.h.
886 * system.h: New header file.
887 * Makefile.am: Add dwp.
888 * Makefile.in: Regenerate.
889
890 2012-10-23 Cary Coutant <ccoutant@google.com>
891
892 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
893 Dwarf_info_reader::read_from_pointer.
894 (Dwarf_pubnames_table::read_header): Likewise.
895 (Dwarf_pubnames_table::next_name): Likewise.
896 (Dwarf_die::read_attributes): Likewise.
897 (Dwarf_die::skip_attributes): Likewise.
898 (Dwarf_info_reader::read_from_pointer): New function template.
899 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
900 (Dwarf_pubnames_table): Likewise.
901 (Dwarf_info_reader::read_from_pointer): New function template.
902 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
903 Dwarf_pubnames_table ctor.
904
905 2012-10-23 Cary Coutant <ccoutant@google.com>
906
907 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
908 abbrev_shndx.
909 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
910 abbrev_shndx_.
911 (Dwarf_info_reader::set_abbrev_shndx): New method.
912 (Dwarf_info_reader::abbrev_shndx_): New data member.
913
914 2012-10-23 Cary Coutant <ccoutant@google.com>
915
916 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
917 from object, not parameters.
918 (Dwarf_info_reader::parse): Likewise.
919 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
920 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
921 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
922 methods.
923
924 2012-10-23 Cary Coutant <ccoutant@google.com>
925
926 * fileread.cc (Input_file::Input_file): New constructor.
927 * fileread.h (class Input_file): Add new constructor.
928
929 2012-10-18 Alan Modra <amodra@gmail.com>
930
931 PR gold/14727
932 * object.cc (Relobj::is_section_name_included): Also match
933 .sdata personality section.
934
935 2012-10-18 Alan Modra <amodra@gmail.com>
936
937 * target-reloc.h (class Default_comdat_behavior): New, package up..
938 (get_comdat_behaviour): ..this.
939 (relocate_section): Add Relocate_comdat_behavior template arg,
940 adjust code to suit.
941 * arm.cc (Target_arm::relocate_section): Adjust to suit.
942 (Target_arm::scan_reloc_section): Likewise.
943 * i386.cc (Target_i386::relocate_section): Likewise.
944 * sparc.cc (Target_sparc::relocate_section): Likewise.
945 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
946 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
947 * powerpc.cc (class Relocate_comdat_behavior): New.
948 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
949 gold::relocate_section with new template arg.
950
951 2012-10-18 Alan Modra <amodra@gmail.com>
952
953 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
954 dynamic relocs for GOT_TPREL got entries, without symbol if
955 resolving locally.
956 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
957 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
958 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
959
960 2012-10-17 Alan Modra <amodra@gmail.com>
961
962 PR gold/14726
963 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
964
965 2012-10-16 Sriraman Tallam <tmsriram@google.com>
966
967 * layout.cc (Layout::include_section): Keep sections marked
968 SHF_EXCLUDE when doing relocatable links.
969
970 2012-10-16 Alan Modra <amodra@gmail.com>
971
972 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
973 (Target_powerpc::do_finalize_sections): Call it.
974 (Output_data_save_res): New class and supporting functions.
975 (Target_powerpc::symval_for_branch): Only look up .opd entry for
976 normal symbols defined in object files.
977
978 2012-10-12 Alan Modra <amodra@gmail.com>
979
980 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
981 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
982 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
983 section if scan_opd_relocs not yet called.
984 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
985
986 2012-10-12 Alan Modra <amodra@gmail.com>
987
988 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
989 add_local_ifunc_entry): Revert last change.
990 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
991
992 2012-10-05 Alan Modra <amodra@gmail.com>
993
994 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
995 do_plt_address_for_global): New functions.
996 (Output_data_got_powerpc::do_write): Don't segfault when linking
997 statically.
998 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
999 add_local_ifunc_entry): Return true on adding entry..
1000 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1001 glink->add_entry call. Remove unused symtab param. Adjust calls.
1002 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1003 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
1004 set up symbols here.
1005 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1006 syms here. Do so even when no .iplt. Don't segfault when linking
1007 statically.
1008 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
1009 new variants without reloc param.
1010 (Glink_sym_ent::Glink_sym_ent): Likewise.
1011 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1012 reloc when refs will resolve to plt call stub.
1013 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
1014 R_PPC_PLTREL24 to resolve locally.
1015 (Target_powerpc::Scan::global): Correct ifunc handling.
1016 (Target_powerpc::Relocate::relocate): Correct local sym glink
1017 lookup. Don't destroy "value" when we have a plt call stub,
1018 and when checking plt call validity.
1019 (Target_powerpc::do_dynsym_value): Simplify.
1020
1021 2012-10-05 Alan Modra <amodra@gmail.com>
1022
1023 * i386.cc (Output_data_plt_i386::address_for_global,
1024 address_for_local): Add plt offset to returned value. Adjust uses.
1025 * sparc.cc (Output_data_plt_sparc::address_for_global,
1026 address_for_local): Likewise.
1027 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1028 address_for_local): Likewise.
1029 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1030 address_for_local): Likewise.
1031 * target.h (Target::plt_address_for_global, plt_address_for_local):
1032 Update comment.
1033 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1034 (Output_data_got::Got_entry::write): Nor here.
1035 * output.h: Comment fix.
1036
1037 2012-10-02 Jiong Wang <jiwang@tilera.com>
1038
1039 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1040 global_offset_table_ value for larget got.
1041 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1042
1043 2012-09-29 Alan Modra <amodra@gmail.com>
1044
1045 * powerpc.cc (Target_powerpc::iplt_): New output section.
1046 (Target_powerpc::iplt_section, make_iplt_section,
1047 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1048 (Target_powerpc::make_plt_entry): Handle ifunc syms.
1049 Target_powerpc::plt_entry_count): Count iplt entries too.
1050 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1051 reloc section in constructor. New params.
1052 (Target_powerpc::make_plt_section): Create reloc section here instead.
1053 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1054 functions.
1055 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1056 (Output_data_glink::add_entry, find_entry): New functions to
1057 deal with local syms.
1058 (Glink_sym_ent): Add support for local syms.
1059 (Output_data_glink::do_write): Handle ifunc plt entries.
1060 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1061 (Target_powerpc::Scan::local, global): Handle ifunc syms.
1062 (Target_powerpc::Relocate::relocate): Likewise.
1063 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1064
1065 2012-09-25 Alan Modra <amodra@gmail.com>
1066
1067 * object.h (Sized_relobj_file::adjust_local_symbol,
1068 do_adjust_local_symbol): New functions.
1069 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1070 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1071 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1072 and irregular opd entry spacing.
1073 (Powerpc_relobj::do_read_relocs): Add opd size checks.
1074 (Global_symbol_visitor_opd): New functor.
1075 (Target_powerpc::do_finalize_sections): Omit global symbols defined
1076 on deleted opd entries.
1077
1078 2012-09-15 Jiong Wang <jiwang@tilera.com>
1079
1080 * tilegx.cc: New file.
1081 * Makefile.am (TARGETSOURCES): Add tilegx.cc
1082 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1083 * configure.tgt: Add entries for tilegx*.
1084 * configure.ac: Likewise.
1085 * Makefile.in: Rebuild.
1086 * configure: Likewise.
1087 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1088 tilegx.
1089
1090 2012-09-13 Alan Modra <amodra@gmail.com>
1091
1092 * target-reloc.h (scan_relocs): Call scan.local for relocs
1093 against symbols in discarded sections. Pass is_discarded
1094 param.
1095 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1096 Add is_discarded param.
1097 * powerpc (Target_powerpc::Scan::local): Likewise. Use
1098 is_discarded to flag opd entry as discarded. Don't emit dyn
1099 relocs on such entries.
1100 (Target_powerpc::Scan::global): Similarly detect and handle
1101 such opd entries.
1102 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1103 opd_ent_. Update all uses.
1104 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1105 (Target_powerpc::relocate_section): Zero out discarded opd
1106 entry relocs.
1107
1108 2012-09-12 Ian Lance Taylor <iant@google.com>
1109
1110 PR gold/14570
1111 * output.cc: Rename Output_data_got template parameter from size
1112 to got_size for all functions. Compile all variants of
1113 Output_data_got.
1114 (Output_data_got::Got_entry::write): Correct use of size for
1115 symbol value. Use local_is_tls rather than casting to
1116 Sized_relobj_file.
1117 * object.h (class Object): Add local_is_tls and do_local_is_tls.
1118 (class Sized_relobj_file): Add do_local_is_tls.
1119 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1120
1121 2012-09-11 Alan Modra <amodra@gmail.com>
1122
1123 PR gold/14566
1124 * layout.cc (Layout::set_segment_offsets): When using
1125 common-page-size alignment, ensure we are on a new max-page-size
1126 page.
1127 * output.cc (Output_segment::set_section_addresses): Use
1128 abi_pagesize, not common_pagesize for relro boundary.
1129 (Output_segment::set_offset): Likewise.
1130
1131 2012-09-11 Alan Modra <amodra@gmail.com>
1132
1133 * output.h (Output_data_got::add_global_tls, add_local_tls,
1134 add_local_tls_pair): New functions.
1135 (Output_data_got::add_local_pair_with_rel): Remove second
1136 reloc param. Expand comment.
1137 (Output_data_got::Got_entry): Rename use_plt_offset_ to
1138 use_plt_or_tls_offset_, similarly for constructor param.
1139 (Output_data_got::Got_entry::write): Add got_index param.
1140 * output.cc (Output_data_got::add_global_tls, add_local_tls,
1141 add_local_tls_pair): New functions.
1142 (Output_data_got::Got_entry::write): Handle tls symbols
1143 with use_plt_or_tls_offset_ set specially.
1144 (Output_data_got::add_local_pair_with_rel): Only one reloc.
1145 (Output_data_got::do_write): Replace iterator with index, pass
1146 index to entry write function.
1147 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1148 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1149 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1150 call.
1151 * i386.cc (Target_i386::Scan::local): Likewise.
1152 * sparc.cc (Target_sparc::Scan::local): Likewise.
1153 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1154 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1155 do_tls_offset_for_global): New functions.
1156 (Target_powerpc::Scan::local): Correct TLS relocations and got
1157 entry values.
1158 (Target_powerpc::Scan::global): Don't emit unnecessary
1159 dynamic relocations on TLS GOT entries.
1160
1161 2012-09-10 Matthias Klose <doko@ubuntu.com>
1162
1163 * config.in: Disable sanity check for kfreebsd.
1164
1165 2012-09-10 Sterling Augustine <saugustine@google.com>
1166
1167 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1168 (Gdb_index::pubtypes_read): New parameter.
1169 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1170 to calls.
1171 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1172 pubtypes_object_.
1173
1174 2012-09-09 Alan Modra <amodra@gmail.com>
1175
1176 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1177 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1178 * gc.h (gc_process_relocs): Call target gc_add_reference.
1179 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1180 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1181 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1182 unnecessary cast.
1183 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1184 to cater for when we don't need code offset. Update use.
1185 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1186 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1187 set_opd_valid): New functions.
1188 (Target_powerpc::do_gc_add_reference): New function.
1189 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1190 stashed refs.
1191 (Target_powerpc::do_gc_mark_symbol): New function.
1192
1193 2012-09-06 Cary Coutant <ccoutant@google.com>
1194
1195 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1196 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1197 (Dwarf_die::skip_attributes): Likewise.
1198 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1199 * testsuite/gdb_index_test.cc (inline_func_1): New function.
1200 (main): Call it.
1201 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1202
1203 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
1204
1205 * testsuite/script_test_3.t: Add .got.plt output section
1206 statement.
1207 * testsuite/script_test_4.t: Likewise.
1208
1209 2012-09-05 Alan Modra <amodra@gmail.com>
1210
1211 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1212 update all uses and lose "enum" when using type.
1213
1214 2012-09-05 Alan Modra <amodra@gmail.com>
1215
1216 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1217 * configure: Regenerate.
1218 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1219 (plugin_final_layout.stdout): Likewise.
1220 (memory_test): Set page sizes to 0x1000.
1221 * testsuite/Makefile.in: Regenerate.
1222 * testsuite/discard_locals_test.sh: Add FIXME comment.
1223 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1224 * testsuite/pr14265.t: Add .got output section statement.
1225 * testsuite/script_test_2.t: Likewise.
1226 * testsuite/script_test_3.t: Likewise.
1227 * testsuite/script_test_4.t: Likewise.
1228 * testsuite/script_test_5.t: Likewise.
1229 * testsuite/script_test_6.t: Likewise.
1230 * testsuite/script_test_7.t: Likewise.
1231 * testsuite/script_test_9.t: Likewise.
1232
1233 2012-09-05 Alan Modra <amodra@gmail.com>
1234
1235 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1236 (Powerpc_relocate_functions::Status): New typedef.
1237 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1238 (Target_powerpc::Scan::local): Handle REL64.
1239 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1240 for REL32 and REL64.
1241 (Target_powerpc::symval_for_branch): New function, extracted from..
1242 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
1243 checks. Report overflow errors.
1244
1245 2012-09-05 Alan Modra <amodra@gmail.com>
1246
1247 * object.h (Sized_relobj_file::emit_relocs): Delete.
1248 (Sized_relobj_file::emit_relocs_reltype): Delete.
1249 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1250 relocate_relocs for --emit-relocs.
1251 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1252 * output.h: Update comment.
1253 (Output_segment::first_section): New function.
1254 (Output_segment::first_section_load_address): Use first_section.
1255 * output.cc (Output_segment::first_section): New function extracted..
1256 (Output_segment::first_section_load_address): ..from here. Delete.
1257 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1258 * target.h (Sized_target::relocate_for_relocatable): Likewise.
1259 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1260 adjust call to target.h function.
1261 * i386.cc (Target_i386): Likewise.
1262 * sparc.cc (Target_sparc): Likewise.
1263 * x86_64.cc (Target_x86_64): Likewise.
1264 * powerpc.cc (Target_powerpc): Likewise.
1265 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
1266 first tls section has section symbol for optimised local dynamic
1267 output relocs.
1268 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1269 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1270 optimised tls code.
1271 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1272 Rename to relocate_relocs. Update error message.
1273
1274 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
1275
1276 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1277 --just-symbols.
1278
1279 2012-08-31 Alan Modra <amodra@gmail.com>
1280
1281 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1282 (Powerpc_relobj::toc_base_offset): New stub function.
1283 (Target_powerpc): Add tp_offset, dtp_offset. Rename
1284 got_mod_index_offset to tlsld_got_offset. Update all refs.
1285 (Target_powerpc::Relocate::enum skip_tls): New.
1286 (Target_powerpc::call_tls_get_addr_): New var.
1287 (Target_powerpc::is_branch_reloc): Move to file scope.
1288 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1289 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1290 New functions.
1291 (Target_powerpc::enum Got_type): Delete old values, add new ones.
1292 (powerpc_info): Correct common_pagesize for ppc64.
1293 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1294 (Powerpc_relocate_functions): Add overflow check enums and functions.
1295 Add non-shift version of rela, rela_ua. Delete all rel public
1296 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
1297 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1298 addr16_ha3, addr14 functions.
1299 (Output_data_got_powerpc::add_constant_pair): New function.
1300 (Output_data_got_powerpc::got_base_offset): Likewise.
1301 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1302 (instruction constants): Sort, add some more.
1303 (Output_data_glink::do_write): Add and use Address typedef. Use
1304 object->toc_base_offset() stub for 64-bit.
1305 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1306 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1307 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1308 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
1309 Always treat .opd relocs as against locally defined symbol.
1310 Correct condition for RELATIVE relocs.
1311 (Target_powerpc::do_finalize_sections): Test for NULL sections.
1312 (Target_powerpc::Relocate::relocate): Use plt call stub as value
1313 for 32-bit syms with a plt entry. Correct ppc64 toc base
1314 calculations. Handle TLS relocs, and more. Add overflow
1315 checking and adjust for Powerpc_relocate_functions changes.
1316 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1317 Reinstate --emit-relocs code with FIXME.
1318
1319 2012-08-30 Alan Modra <amodra@gmail.com>
1320
1321 * layout.cc (Layout::set_segment_offsets): Set p_align to
1322 abi_pagesize, not common_pagesize.
1323 (Layout::relaxation_loop_body): Similarly use abi_pagesize
1324 to determine whether file header can go in segment.
1325
1326 2012-08-30 Alan Modra <amodra@gmail.com>
1327
1328 * output.h (Output_reloc::Output_reloc <output section>): Add
1329 is_relative param. Adjust calls.
1330 (Output_reloc::add_output_section_relative): New functions.
1331 * output.cc (Output_reloc::Output_reloc <output section>): Handle
1332 is_relative.
1333 (Output_reloc::symbol_value): Handle SECTION_CODE.
1334
1335 2012-08-24 Sriraman Tallam <tmsriram@google.com>
1336
1337 * gold.cc (queue_middle_tasks): Call layout again when unique
1338 segments for sections is desired.
1339 * layout.cc (Layout::Layout): Initialize new members.
1340 (Layout::get_output_section_flags): New function.
1341 (Layout::choose_output_section): Call get_output_section_flags.
1342 (Layout::layout): Make output section for mapping to a unique segment.
1343 (Layout::insert_section_segment_map): New function.
1344 (Layout::attach_allocated_section_to_segment): Make unique segment for
1345 output sections marked so.
1346 (Layout::segment_precedes): Check for unique segments when sorting.
1347 * layout.h (Layout::Unique_segment_info): New struct.
1348 (Layout::Section_segment_map): New typedef.
1349 (Layout::insert_section_segment_map): New function.
1350 (Layout::get_output_section_flags): New function.
1351 (Layout::is_unique_segment_for_sections_specified): New function.
1352 (Layout::set_unique_segment_for_sections_specified): New function.
1353 (Layout::unique_segment_for_sections_specified_): New member.
1354 (Layout::section_segment_map_): New member.
1355 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1356 Rename is_gc_pass_one to is_pass_one.
1357 Rename is_gc_pass_two to is_pass_two.
1358 Rename is_gc_or_icf to is_two_pass.
1359 Check for which pass based on whether symbols data is present.
1360 Make it two pass when unique segments for sections is desired.
1361 * output.cc (Output_section::Output_section): Initialize new
1362 members.
1363 * output.h (Output_section::is_unique_segment): New function.
1364 (Output_section::set_is_unique_segment): New function.
1365 (Output_section::is_unique_segment_): New member.
1366 (Output_section::extra_segment_flags): New function.
1367 (Output_section::set_extra_segment_flags): New function.
1368 (Output_section::extra_segment_flags_): New member.
1369 (Output_section::segment_alignment): New function.
1370 (Output_section::set_segment_alignment): New function.
1371 (Output_section::segment_alignment_): New member.
1372 (Output_segment::Output_segment): Initialize is_unique_segment_.
1373 (Output_segment::is_unique_segment): New function.
1374 (Output_segment::set_is_unique_segment): New function.
1375 (Output_segment::is_unique_segment_): New member.
1376 * plugin.cc (allow_unique_segment_for_sections): New function.
1377 (unique_segment_for_sections): New function.
1378 (Plugin::load): Add new functions to transfer vector.
1379 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1380 * Makefile.in: Regenerate.
1381 * testsuite/plugin_final_layout.sh: Check if unique segment
1382 functionality works.
1383 * testsuite/plugin_section_order.c (onload): Check if new interfaces
1384 are available.
1385 (allow_unique_segment_for_sections): New global.
1386 (unique_segment_for_sections): New global.
1387 (claim_file_hook): Call allow_unique_segment_for_sections.
1388 (all_symbols_read_hook): Call unique_segment_for_sections.
1389
1390 2012-08-22 Cary Coutant <ccoutant@google.com>
1391
1392 * layout.cc (Layout::include_section): Don't assert on GROUP
1393 sections with --emit-relocs.
1394
1395 2012-08-21 Cary Coutant <ccoutant@google.com>
1396
1397 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1398 if --export-dynamic-symbol names an undef symbol.
1399
1400 2012-08-18 Alan Modra <amodra@gmail.com>
1401
1402 * powerpc.cc: Formatting and white space.
1403 (Powerpc_relobj): Rename got2_section_ to special_.
1404 Add opd_ent_shndx_ and opd_ent_off_ vectors.
1405 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1406 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1407 (Target_powerpc): Add Address typedef and invalid_address. Use
1408 throughout.
1409 (Target_powerpc::is_branch_reloc): New function.
1410 (Powerpc_relocate_functions): Add Address typedef, use throughout.
1411 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1412 for dst_mask, value and addend.
1413 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1414 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1415 (Output_data_glink::do_write): Correct toc base. Don't try to use
1416 uint16_t for 24-bit offset. Use get_output_section_offset and
1417 check return.
1418 (Target_powerpc::Scan::local): Handle more relocs.
1419 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1420 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1421 Plug in toc restoring insn after plt calls. Translate branches
1422 to function descriptor symbols to corresponding entry point.
1423 (Target_powerpc::relocate_for_relocatable): Check return from
1424 get_output_section_offset.
1425 * symtab.h: Comment typo.
1426
1427 2012-08-14 Ian Lance Taylor <iant@google.com>
1428
1429 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1430 unsupported_relocal_local to call unsupported_reloc_global.
1431
1432 2012-08-14 Nick Clifton <nickc@redhat.com>
1433
1434 PR ld/14265
1435 * script-sections.cc (Sections_element::output_section_name): Add
1436 keep return parameter.
1437 (Output_section_element::match_name): Add keep return parameter.
1438 Return the value of the keep_ member.
1439 * script-sections.h (class Output_section): Update
1440 output_section_name prototype.
1441 * layout.cc (Layout::keep_input_section): New public member
1442 function.
1443 (Layout::choose_output_section): Pass keep parameter to
1444 output_section_name.
1445 * layout.h (class Layout): Add keep_input_section.
1446 * object.cc (Sized_relobj_file::do_layout): Check for kept input
1447 sections.
1448 * testsuite/Makefile.am: Add a test.
1449 * testsuite/Makefile.in: Regenerate.
1450 * testsuite/pr14265.c: Source file for the test.
1451 * testsuite/pr14265.t: Linker script for the test.
1452 * testsuite/pr14265.sh: Shell script for the test.
1453
1454 2012-08-14 Alan Modra <amodra@gmail.com>
1455
1456 * target.h (Target::output_section_name): New function.
1457 (Target::do_output_section_name): New function.
1458 * layout.cc (Layout::choose_output_section): Call the above.
1459 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1460
1461 2012-08-14 Alan Modra <amodra@gmail.com>
1462
1463 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1464 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1465 for replace_constant call.
1466 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1467 (Output_data_glink::do_print_to_mapfile): New function.
1468 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1469 (Target_powerpc::Relocate::relocate): Likewise.
1470
1471 2012-08-14 Alan Modra <amodra@gmail.com>
1472
1473 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1474 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1475 (Output_data_glink::add_entry,find_entry): Remove shndx param.
1476 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
1477 all references to shndx_. Handle special case for R_PPC_PLTREL24
1478 here.
1479 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1480 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1481 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1482 here.
1483 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1484 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1485
1486 2012-08-12 Alan Modra <amodra@gmail.com>
1487
1488 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
1489 (glink insn constants): Use uint32_t.
1490 (Output_data_glink::add_entry): Use insert, not [] operator.
1491
1492 2012-08-11 Alan Modra <amodra@gmail.com>
1493
1494 * object.h (Sized_relobj_file::find_shdr): New function.
1495 (Sized_relobj_file::find_special_sections): New function.
1496 * object.cc (Sized_relobj_file::find_shdr): New function.
1497 (Sized_relobj_file::find_eh_frame): Use find_shdr.
1498 (Sized_relobj_file::find_special_sections): New function, split out..
1499 (Sized_relobj_file::do_read_symbols): ..from here.
1500 * output.h (Output_data_got::replace_constant): New function.
1501 (Output_data_got::num_entries): New function.
1502 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1503 (Output_data_got::got_offset): Protected rather than private.
1504 (Output_data_got::replace_got_entry): New function.
1505 * output.cc (Output_data_got::replace_got_entry): New function.
1506 * powerpc.cc (class Powerpc_relobj): New.
1507 (class Powerpc_relocate_functions): Delete all psymval variants or
1508 convert to value,addend type. Delete pcrela, pcrela_unaligned.
1509 Implement _ha functions using corresponding _hi function.
1510 (Powerpc_relobj::find_special_sections): New function.
1511 (Target_powerpc::do_make_elf_object): New function.
1512 (class Output_data_got_powerpc): New.
1513 (class Output_data_glink): New.
1514 (class Powerpc_scan_relocatable_reloc): New.
1515 Many more changes througout file.
1516
1517 2012-08-09 Nick Clifton <nickc@redhat.com>
1518
1519 * po/vi.po: Updated Vietnamese translation.
1520
1521 2012-08-07 Ian Lance Taylor <iant@google.com>
1522
1523 * layout.cc (Layout::add_target_dynamic_tags): If
1524 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1525 plt_rel.
1526
1527 2012-07-30 Nick Clifton <nickc@redhat.com>
1528
1529 * po/gold.pot: Updated template.
1530 * po/es.po: Updated Spanish translation.
1531
1532 2012-07-18 Cary Coutant <ccoutant@google.com>
1533
1534 PR gold/14344
1535 * configure.ac: Add check for -gpubnames support.
1536 * configure: Regenerate.
1537 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1538 support; force -gno-pubnames.
1539 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1540 support.
1541 (gdb_index_test_4): New test.
1542 * testsuite/Makefile.in: Regenerate.
1543 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1544 * testsuite/gdb_index_test_2.sh: Likewise.
1545 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1546 * testsuite/gdb_index_test_4.sh: New script.
1547 * testsuite/gdb_index_test_comm.sh: New script with common code;
1548 don't look for space after colon.
1549
1550 2012-07-16 Sriraman Tallam <tmsriram@google.com>
1551
1552 * gold.cc (queue_middle_tasks): Update function order only after
1553 deferred objects due to plugins are processed.
1554
1555 2012-07-11 Ian Lance Taylor <iant@google.com>
1556
1557 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1558 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1559 (Target_arm::scan_reloc_for_stub): Likewise.
1560 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1561 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1562 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1563 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1564 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1565
1566 2012-07-10 Dodji Seketeli <dodji@redhat.com>
1567 Ian Lance Taylor <iant@google.com>
1568
1569 PR gold/14309
1570 * configure.ac: Test whether std::tr1::hash<off_t> works.
1571 * gold.h: Add a specialization for std::tr1::hash<off_t> if
1572 needed.
1573 * output.h (class Output_fill): Add virtual destructor.
1574 * configure, config.in: Rebuild.
1575
1576 2012-06-22 Roland McGrath <mcgrathr@google.com>
1577
1578 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1579
1580 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
1581
1582 * plugin.cc (Plugin::load): Handle position independent executables.
1583
1584 2012-06-06 Cary Coutant <ccoutant@google.com>
1585
1586 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1587 add .debug_macro.
1588 (lines_only_debug_sections): Likewise.
1589 (gdb_fast_lookup_sections): New static array.
1590 (is_gdb_debug_section): Rename formal parameter.
1591 (is_lines_only_debug_section): Likewise.
1592 (is_gdb_fast_lookup_section): New function.
1593 (Layout::include_section): Check for ".zdebug_" prefix; pass
1594 section name suffix to is_gdb_debug_section, et al.; check for
1595 fast-lookup sections when building .gdb_index.
1596 * options.h (--strip-debug-gdb): Update GDB version number.
1597
1598 2012-06-06 Cary Coutant <ccoutant@google.com>
1599
1600 * configure.ac: Add check for fallocate.
1601 * configure: Regenerate.
1602 * config.in: Regenerate.
1603
1604 * options.h (class General_options): Add --mmap-output-file and
1605 --posix-fallocate options.
1606 * output.cc: (posix_fallocate): Remove; replace with...
1607 (gold_fallocate): New function.
1608 (Output_file::map_no_anonymous): Call gold_fallocate.
1609 (Output_file::map): Check --mmap-output-file option.
1610
1611 2012-06-05 Jing Yu <jingyu@google.com>
1612
1613 * gold.h (textdomain): Add do {} to empty while(0).
1614 (bindtextdomain): Likewise.
1615
1616 2012-06-04 Cary Coutant <ccoutant@google.com>
1617
1618 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1619 has_dynsym_index.
1620
1621 2012-05-25 Sriraman Tallam <tmsriram@google.com>
1622
1623 * symtab.cc (Symbol_table::define_special_symbol):
1624 Initialize *poldsym to prevent uninitialized variable errors.
1625
1626 2012-05-23 Cary Coutant <ccoutant@google.com>
1627
1628 * layout.cc (Layout::section_name_mapping): Add rules to handle
1629 exact match on .data.rel.ro.local or .data.rel.ro.
1630 (Layout::output_section_name): Check for exact matches.
1631
1632 2012-05-23 Cary Coutant <ccoutant@google.com>
1633
1634 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1635 more carefully.
1636
1637 2012-05-22 Cary Coutant <ccoutant@google.com>
1638
1639 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1640 object before exporting symbol.
1641
1642 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
1643
1644 * testsuite/tls_test.cc: Include "config.h" first.
1645 * testsuite/tls_test_c.c: Likewise.
1646
1647 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
1648 Nick Clifton <nickc@redhat.com>
1649
1650 PR 14072
1651 * configure.in: Add check that sysdep.h has been included before
1652 any system header files.
1653 * configure: Regenerate.
1654 * config.in: Regenerate.
1655
1656 2012-05-14 Cary Coutant <ccoutant@google.com>
1657
1658 * layout.cc (Layout::make_output_section): Mark .tdata section
1659 as RELRO.
1660 * testsuite/relro_test.cc: Add a TLS variable.
1661
1662 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
1663
1664 PR gold/14091
1665 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1666 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1667 R_X86_64_64.
1668
1669 2012-05-08 Cary Coutant <ccoutant@google.com>
1670
1671 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1672 (lines_only_debug_sections): Likewise.
1673
1674 2012-05-02 Roland McGrath <mcgrathr@google.com>
1675
1676 * nacl.cc: New file.
1677 * nacl.h: New file.
1678 * Makefile.am (CCFILES, HFILES): Add them.
1679 * Makefile.in: Regenerate.
1680 * i386.cc (Output_data_plt_i386_nacl): New class.
1681 (Output_data_plt_i386_nacl_exec): New class.
1682 (Output_data_plt_i386_nacl_dyn): New class.
1683 (Target_i386_nacl): New class.
1684 (Target_selector_i386_nacl): New class.
1685 (target_selector_i386): Use it instead of Target_selector_i386.
1686 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1687 (Target_x86_64_nacl): New class.
1688 (Target_selector_x86_64_nacl): New class.
1689 (target_selector_x86_64, target_selector_x32): Use it instead of
1690 Target_selector_x86_64.
1691 * arm.cc (Output_data_plt_arm_nacl): New class.
1692 (Target_arm_nacl): New class.
1693 (Target_selector_arm_nacl): New class.
1694 (target_selector_arm, target_selector_armbe): Use it instead of
1695 Target_selector_arm.
1696
1697 * target-select.cc (select_target): Take new Input_file* and off_t
1698 arguments, pass them on to recognize method of selector.
1699 * object.cc (make_elf_sized_object): Update caller.
1700 * parameters.cc (parameters_force_valid_target): Likewise.
1701 * incremental.cc (make_sized_incremental_binary): Likewise.
1702 * target-select.h: Update decl.
1703 (Target_selector::recognize): Take new Input_file* argument,
1704 pass it on to do_recognize.
1705 (Target_selector::do_recognize): Take new Input_file* argument.
1706 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1707 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1708 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1709 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1710
1711 * target.h (Target::Target_info): New members isolate_execinstr
1712 and rosegment_gap.
1713 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1714 * arm.cc (Target_arm::arm_info): Update initializer.
1715 * i386.cc (Target_i386::i386_info): Likewise.
1716 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1717 * sparc.cc (Target_sparc::sparc_info): Likewise.
1718 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1719 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1720 * layout.cc (Layout::attach_allocated_section_to_segment):
1721 Take new const Target* argument. If target->isolate_execinstr(), act
1722 like --rosegment.
1723 (Layout::find_first_load_seg): Take new const Target* argument;
1724 if target->isolate_execinstr(), reject PF_X segments.
1725 (Layout::relaxation_loop_body): Update caller.
1726 (Layout::set_segment_offsets): If target->isolate_execinstr(),
1727 reset file offset to zero when we hit LOAD_SEG, and then do a second
1728 loop over the segments before LOAD_SEG to reassign offsets after
1729 addresses have been determined. Handle target->rosegment_gap().
1730 (Layout::attach_section_to_segment): Take new const Target* argument;
1731 pass it to attach_allocated_section_to_segment.
1732 (Layout::make_output_section): Update caller.
1733 (Layout::attach_sections_to_segments): Take new const Target* argument;
1734 pass it to attach_section_to_segment.
1735 * gold.cc (queue_middle_tasks): Update caller.
1736 * layout.h (Layout): Update method decls with new arguments.
1737
1738 * arm.cc (Target_arm::Target_arm): Take optional argument for the
1739 Target_info pointer to use.
1740 (Target_arm::do_make_data_plt): New virtual method.
1741 (Target_arm::make_data_plt): New method that calls it.
1742 (Target_arm::make_plt_entry): Use it.
1743 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1744 for the section alignment.
1745 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1746 method.
1747 (Output_data_plt_arm::first_plt_entry_offset): Call it.
1748 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1749 method.
1750 (Output_data_plt_arm::get_plt_entry_size): Call it.
1751 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1752 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1753 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1754 method.
1755 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1756 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1757 method instead of sizeof(plt_entry).
1758 (Output_data_plt_arm::add_entry): Likewise.
1759 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1760 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1761 than static method.
1762 (Target_arm::plt_entry_size): Likewise.
1763 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1764 Move to ...
1765 (Output_data_plt_arm_standard): ... here, new class.
1766 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1767 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1768 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1769
1770 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1771 Take additional argument for the PLT entry size.
1772 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1773 Use get_plt_entry_size method rather than plt_entry_size variable.
1774 (Output_data_plt_x86_64::reserve_slot): Likewise.
1775 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1776 (Output_data_plt_x86_64::add_entry): Likewise.
1777 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1778 (Output_data_plt_x86_64::address_for_global): Likewise.
1779 (Output_data_plt_x86_64::address_for_local): Likewise.
1780 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1781 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1782 Make method non-static.
1783 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1784 method.
1785 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1786 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1787 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1788 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1789 virtual method.
1790 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1791 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1792 virtual method.
1793 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1794 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1795 virtual method.
1796 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1797 (Output_data_plt_x86_64::plt_entry_size)
1798 (Output_data_plt_x86_64::first_plt_entry)
1799 (Output_data_plt_x86_64::plt_entry)
1800 (Output_data_plt_x86_64::tlsdesc_plt_entry)
1801 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1802 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1803 (Output_data_plt_x86_64_standard): ... here, new class.
1804 (Target_x86_64::Target_x86_64): Take optional argument for the
1805 Target_info pointer to use.
1806 (Target_x86_64::do_make_data_plt): New virtual method.
1807 (Target_x86_64::make_data_plt): New method to call it.
1808 (Target_x86_64::init_got_plt_for_update): Use that.
1809 Call this->plt_->add_eh_frame method here.
1810 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1811 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1812 rather than static method.
1813 (Target_x86_64::plt_entry_size): Likewise.
1814 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1815 rather than plt_entry_size variable. Move guts of PLT filling to...
1816 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1817 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1818 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1819
1820 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1821 additional argument for the section alignment.
1822 Don't do add_eh_frame_for_plt here.
1823 (Output_data_plt_i386::first_plt_entry_offset): Make the method
1824 non-static. Use get_plt_entry_size method rather than plt_entry_size
1825 variable.
1826 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1827 method.
1828 (Output_data_plt_i386::get_plt_entry_size): Call it.
1829 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1830 (Output_data_plt_i386::add_eh_frame): New method to call it.
1831 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1832 method.
1833 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1834 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1835 method.
1836 (Output_data_plt_i386::fill_plt_entry): New method to call it.
1837 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1838 method instead of plt_entry_size.
1839 (Output_data_plt_i386::plt_entry_size)
1840 (Output_data_plt_i386::plt_eh_frame_fde_size)
1841 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1842 (Output_data_plt_i386_standard): ... here, new class.
1843 (Output_data_plt_i386_exec): New class.
1844 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1845 (Output_data_plt_i386_exec::first_plt_entry): ... here.
1846 (Output_data_plt_i386::exec_plt_entry): Move to ...
1847 (Output_data_plt_i386_exec::plt_entry): ... here.
1848 (Output_data_plt_i386_dyn): New class.
1849 (Output_data_plt_i386::first_plt_entry): Move to ...
1850 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1851 (Output_data_plt_i386::dyn_plt_entry): Move to ...
1852 (Output_data_plt_i386_dyn::plt_entry): ... here.
1853 (Target_i386::Target_i386): Take optional argument for the Target_info
1854 pointer to use.
1855 (Target_i386::do_make_data_plt): New virtual method.
1856 (Target_i386::make_data_plt): New method to call it.
1857 (Target_i386::make_plt_section): Use that.
1858 Call this->plt_->add_eh_frame method here.
1859 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1860 rather than plt_entry_size variable.
1861 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1862 (Output_data_plt_i386::address_for_local): Likewise.
1863 (Output_data_plt_i386::do_write): Likewise.
1864 Move guts of PLT filling to...
1865 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1866 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1867 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1868 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1869
1870 2012-05-01 Cary Coutant <ccoutant@google.com>
1871
1872 * dwarf_reader.cc (Dwarf_die::read_attributes)
1873 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1874 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1875 * reduced_debug_output.cc
1876 (Output_reduced_debug_info_section::get_die_end): Remove
1877 DW_FORM_GNU_ref_index. Add default case.
1878
1879 2012-04-26 Mark Wielaard <mjw@redhat.com>
1880
1881 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1882 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1883 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1884 DW_AT_high_pc as offset from DW_AT_low_pc.
1885
1886 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1887 * testsuite/Makefile.in: Regenerate.
1888 * testsuite/gdb_index_test_3.c: New test source file.
1889 * testsuite/gdb_index_test_3.sh: New test source file.
1890
1891 2012-04-25 Ian Lance Taylor <iant@google.com>
1892
1893 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1894 pointer.
1895 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1896 as a class, not a struct.
1897 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1898 (Target_arm::apply_cortex_a8_workaround): Likewise.
1899 * gc.h: Declare Reloc_types as a struct, not a class.
1900 * object.h: Declare Symbols_data as a struct.
1901 * reloc.h: Declare Read_relocs_data as a struct.
1902 * target.h: Declare Relocate_info as a struct.
1903
1904 2012-04-24 David S. Miller <davem@davemloft.net>
1905
1906 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1907 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1908 and R_SPARC_WPLT30.
1909
1910 2012-04-24 Cary Coutant <ccoutant@google.com>
1911
1912 * incremental-dump.cc (find_input_containing_global): Replace
1913 magic number with symbolic constant.
1914 (dump_incremental_inputs): Update version number.
1915 * incremental.cc (Output_section_incremental_inputs): Update version
1916 number; import symbolic constants from Incremental_inputs_reader.
1917 (Incremental_inputs::create_data_sections): Align relocations
1918 section correctly for 64-bit targets.
1919 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1920 constants; add padding.
1921 (Output_section_incremental_inputs::write_header): Add assert for
1922 header_size.
1923 (Output_section_incremental_inputs::write_input_files): Add assert
1924 for input_entry_size.
1925 (Output_section_incremental_inputs::write_info_blocks): Add padding;
1926 add assert for object_info_size, input_section_entry_size,
1927 global_sym_entry_size.
1928 * incremental.h (Incremental_inputs_reader): Add symbolic constants
1929 for data structure sizes; use them.
1930 (Incremental_input_entry_reader): Import symbolic constants from
1931 Incremental_inputs_reader; use them.
1932
1933 2012-04-23 David S. Miller <davem@davemloft.net>
1934
1935 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1936 and elf_flags_set_.
1937 (Target_sparc::Target_sparc): Initialize new fields.
1938 (Target_sparc::do_make_elf_object): New function.
1939 (Target_sparc::do_adjust_elf_header): New function.
1940
1941 2012-04-23 Cary Coutant <ccoutant@google.com>
1942
1943 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1944 CU range table of gdb index.
1945
1946 2012-04-20 David S. Miller <davem@davemloft.net>
1947
1948 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1949 instead of false.
1950
1951 2012-04-16 David S. Miller <davem@davemloft.net>
1952
1953 * sparc.cc (Target_sparc::got_address): New function.
1954 (Sparc_relocate_functions::gdop_hix22): New function.
1955 (Sparc_relocate_functions::gdop_lox10): New function.
1956 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1957 relocs.
1958 (Target_sparc::Scan::local): Likewise if the global symbol is not
1959 preemptible and is not IFUNC.
1960 (Target_sparc::Relocate::relocate): Perform GOTDATA code
1961 transformations for local and non-preemptible non-IFUNC global
1962 symbols.
1963
1964 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1965 writing out 64-bit part of ranges.
1966
1967 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1968 -fpic and -fpie respectively.
1969 * Makefile.in: Regenerate.
1970
1971 * sparc.cc (class Target_sparc): Add rela_ifunc_.
1972 (Target_sparc::Target_sparc): Initialize new field.
1973 (Target_sparc::do_plt_section_for_global): New function.
1974 (Target_sparc::do_plt_section_for_local): New function.
1975 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1976 (Target_sparc::make_plt_section): New function, broken out of
1977 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
1978 (Target_sparc::make_plt_entry): Call make_plt_section.
1979 (Target_sparc::make_local_ifunc_plt_entry): New function.
1980 (Target_sparc::rela_ifunc_section): New function.
1981 (Target_sparc::plt_section): Remove const.
1982 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
1983 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1984 and ifunc_count_ fields.
1985 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1986 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1987 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1988 (Output_data_plt_sparc::rela_ifunc): New function.
1989 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1990 (Output_data_plt_sparc::has_ifunc_section): New function.
1991 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1992 (Output_data_plt_sparc::address_for_global): New function.
1993 (Output_data_plt_sparc::address_for_local): New function.
1994 (Output_data_plt_sparc::plt_index_to_offset): New function.
1995 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1996 and entry_count.
1997 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1998 entry_count.
1999 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2000 R_SPARC_JMP_IREL to switch.
2001 (Target_sparc::Scan::check_non_pic): Likewise.
2002 (Target_sparc::Scan::local): Handle IFUNC symbols.
2003 (Target_sparc::Scan::local): Likewise.
2004 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2005 and plt_address_for_local.
2006 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2007 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2008
2009 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2010 (class Output_data_reloc): Adjust calls to Output_reloc_type.
2011 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2012 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2013 global relocs too.
2014 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2015 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2016 calls.
2017 * sparc.cc (Target_sparc::Scan::global): Likewise.
2018 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2019
2020 2012-04-16 Cary Coutant <ccoutant@google.com>
2021
2022 * archive.cc (Library_base::should_include_member): Check for
2023 --export-dynamic-symbol.
2024 * options.h (class General_options): Add --export-dynamic-symbol.
2025 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2026 --export-dynamic-symbol.
2027 (Symbol_table::gc_mark_undef_symbols): Likewise.
2028 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2029
2030 2012-04-12 David S. Miller <davem@davemloft.net>
2031
2032 * sparc.cc (Reloc::wdisp10): New relocation method.
2033 (Reloc::h34): Likewise.
2034 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2035 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2036 R_SPARC_WDISP10.
2037 (Target_sparc::Scan::local): Likewise.
2038 (Target_sparc::Scan::global): Likewise.
2039 (Target_sparc::Relocate::relocate): Likewise.
2040
2041 2012-04-09 Cary Coutant <ccoutant@google.com>
2042
2043 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2044 low_pc == 0.
2045
2046 2012-04-06 Ian Lance Taylor <iant@google.com>
2047
2048 * timer.cc: #include <unistd.h>.
2049
2050 2012-04-06 Roland McGrath <mcgrathr@google.com>
2051
2052 * configure.in (AC_CHECK_HEADERS): Add locale.h.
2053 * config.in: Regenerate.
2054 * configure: Regenerate.
2055
2056 2012-04-05 Nick Clifton <nickc@redhat.com>
2057
2058 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2059 (AM_LC_MESSAGES): Add.
2060 * aclocal.m4: Regenerate.
2061 * config.in: Regenerate.
2062 * configure: Regenerate.
2063
2064 2012-03-21 Cary Coutant <ccoutant@google.com>
2065
2066 * Makefile.am: Add gdb-index.cc, gdb-index.h.
2067 * Makefile.in: Regenerate.
2068 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2069 (Sized_elf_reloc_mapper::symbol_section): New function.
2070 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2071 (make_elf_reloc_mapper): New function.
2072 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2073 (Dwarf_abbrev_table::do_read_abbrevs): New function.
2074 (Dwarf_abbrev_table::do_get_abbrev): New function.
2075 (Dwarf_ranges_table::read_ranges_table): New function.
2076 (Dwarf_ranges_table::read_range_list): New function.
2077 (Dwarf_pubnames_table::read_section): New function.
2078 (Dwarf_pubnames_table::read_header): New function.
2079 (Dwarf_pubnames_table::next_name): New function.
2080 (Dwarf_die::Dwarf_die): New function.
2081 (Dwarf_die::read_attributes): New function.
2082 (Dwarf_die::skip_attributes): New function.
2083 (Dwarf_die::set_name): New function.
2084 (Dwarf_die::set_linkage_name): New function.
2085 (Dwarf_die::attribute): New function.
2086 (Dwarf_die::string_attribute): New function.
2087 (Dwarf_die::int_attribute): New function.
2088 (Dwarf_die::uint_attribute): New function.
2089 (Dwarf_die::ref_attribute): New function.
2090 (Dwarf_die::child_offset): New function.
2091 (Dwarf_die::sibling_offset): New function.
2092 (Dwarf_info_reader::check_buffer): New function.
2093 (Dwarf_info_reader::parse): New function.
2094 (Dwarf_info_reader::do_parse): New function.
2095 (Dwarf_info_reader::do_read_string_table): New function.
2096 (Dwarf_info_reader::lookup_reloc): New function.
2097 (Dwarf_info_reader::get_string): New function.
2098 (Dwarf_info_reader::visit_compilation_unit): New function.
2099 (Dwarf_info_reader::visit_type_unit): New function.
2100 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2101 Sized_elf_reloc_mapper.
2102 (Sized_dwarf_line_info::symbol_section): Remove function.
2103 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2104 (Sized_dwarf_line_info::read_line_mappings): Remove object
2105 parameter, adjust callers.
2106 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2107 * dwarf_reader.h: Include <sys/types.h>.
2108 (class Track_relocs): Remove forward declaration.
2109 (class Elf_reloc_mapper): New class.
2110 (class Sized_elf_reloc_mapper): New class.
2111 (class Dwarf_abbrev_table): New class.
2112 (class Dwarf_range_list): New class.
2113 (class Dwarf_ranges_table): New class.
2114 (class Dwarf_pubnames_table): New class.
2115 (class Dwarf_die): New class.
2116 (class Dwarf_info_reader): New class.
2117 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2118 (Sized_dwarf_line_info::symbol_section): Remove member function.
2119 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2120 base class.
2121 * gdb-index.cc: New source file.
2122 * gdb-index.h: New source file.
2123 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2124 and .debug_types sections, call Layout::add_to_gdb_index.
2125 (Sized_relobj_incr::do_section_name): Implement.
2126 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2127 return type; Implement.
2128 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2129 return type.
2130 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2131 parameter list and return type.
2132 (Sized_incr_dynobj::do_section_contents): Likewise.
2133 * layout.cc: Include gdb-index.h.
2134 (Layout::Layout): Initialize gdb_index_data_.
2135 (Layout::init_fixed_output_section): Check for .gdb_index section.
2136 (Layout::add_to_gdb_index): New function. Instantiate.
2137 * layout.h: Add forward declaration for class Gdb_index.
2138 (Layout::add_to_gdb_index): New member function.
2139 (Layout::gdb_index_data_): New data member.
2140 * main.cc: Include gdb-index.h.
2141 (main): Print statistics for gdb index.
2142 * object.cc (Object::section_contents): Move code into
2143 do_section_contents.
2144 (need_decompressed_section): Check for sections needed when building
2145 gdb index.
2146 (build_compressed_section_map): Likewise.
2147 (Sized_relobj_file::do_read_symbols): Need local symbols when building
2148 gdb index.
2149 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2150 sections; call Layout::add_to_gdb_index.
2151 (Sized_relobj_file::do_decompressed_section_contents): Call
2152 do_section_contents directly.
2153 * object.h (Object::do_section_contents): Adjust parameter list and
2154 return type.
2155 (Object::do_decompressed_section_contents): Call do_section_contents
2156 directly.
2157 (Sized_relobj_file::do_section_contents): Adjust parameter list and
2158 return type.
2159 * options.h (class General_options): Add --gdb-index option.
2160 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2161 list and return type.
2162 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2163 * reloc.h (Track_relocs::checkpoint): New function.
2164 (Track_relocs::reset): New function.
2165
2166 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2167 New test cases.
2168 * testsuite/Makefile.in: Regenerate.
2169 * testsuite/gdb_index_test.cc: New test source file.
2170 * testsuite/gdb_index_test_1.sh: New test source file.
2171 * testsuite/gdb_index_test_2.sh: New test source file.
2172
2173 2012-03-19 Doug Kwan <dougkwan@google.com>
2174
2175 * arm.cc (Target_arm::do_define_standard_symbols): New method.
2176 (Target_arm::do_finalize_sections): Remove code which defines
2177 __exidx_start and __exidx_end. Make symbol table parameter
2178 anonymous as it is not used.
2179 * gold.cc (queue_middle_tasks): Call target hook to define any
2180 target-specific symbols.
2181 * target.h (Target::define_standard_symbols): New method.
2182 (Target::do_define_standard_symbols): Same.
2183 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2184 * testsuite/Makefile.in: Regenerate.
2185 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2186 and __exidx_end.
2187 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2188 relocations are generated for __exidx_start and __exidx_end.
2189
2190 2012-03-16 Doug Kwan <dougkwan@google.com>
2191
2192 * testsuite/Makefile.am: Disable test initpri3b.
2193 * testsuite/Makefile.in: Regenerate.
2194
2195 2012-03-15 Doug Kwan <dougkwan@google.com>
2196
2197 * arm.cc (Target_arm::got_section): Make .got section read-only
2198 if -z now is given.
2199
2200 2012-03-15 Ian Lance Taylor <iant@google.com>
2201
2202 PR gold/13850
2203 * layout.cc (Layout::make_output_section): Correctly mark
2204 SHT_INIT_ARRAY, et. al., as relro.
2205
2206 2012-03-14 Doug Kwan <dougkwan@google.com>
2207
2208 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2209 dynamic relocations for protected symbols in shared objects.
2210
2211 2012-03-13 Ian Lance Taylor <iant@google.com>
2212
2213 * resolve.cc (Symbol_table::resolve): When merging common symbols,
2214 keep the larger alignment.
2215
2216 2012-03-12 Cary Coutant <ccoutant@google.com>
2217
2218 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2219 handling of DW_LNE_define_file.
2220
2221 2012-03-12 Cary Coutant <ccoutant@google.com>
2222
2223 * reduced_debug_output.cc
2224 (Output_reduced_debug_info_section::get_die_end): Add new FORM
2225 codes to switch.
2226
2227 2012-02-29 Cary Coutant <ccoutant@google.com>
2228
2229 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2230
2231 2012-02-29 Cary Coutant <ccoutant@google.com>
2232
2233 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2234 Call Object::decompressed_section_contents.
2235 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2236 New dtor.
2237 (Sized_dwarf_line_info::buffer_start_): New data member.
2238 * merge.cc (Output_merge_data::do_add_input_section): Call
2239 Object::decompressed_section_contents.
2240 (Output_merge_string::do_add_input_section): Likewise.
2241 * object.cc (need_decompressed_section): New function.
2242 (build_compressed_section_map): Decompress sections needed later.
2243 (Sized_relobj_file::do_decompressed_section_contents): New function.
2244 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2245 * object.h (Object::decompressed_section_contents): New function.
2246 (Object::discard_decompressed_sections): New function.
2247 (Object::do_decompressed_section_contents): New function.
2248 (Object::do_discard_decompressed_sections): New function.
2249 (Compressed_section_info): New type.
2250 (Compressed_section_map): Include decompressed section contents.
2251 (Sized_relobj_file::do_decompressed_section_contents): New function.
2252 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2253
2254 2012-02-16 Cary Coutant <ccoutant@google.com>
2255
2256 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2257 * testsuite/Makefile.in: Regenerate.
2258
2259 2012-02-14 Cary Coutant <ccoutant@google.com>
2260
2261 * options.cc (General_options::finalize): Disallow -pie and -static.
2262
2263 2012-02-03 Doug Kwan <dougkwan@google.com>
2264
2265 * arm.cc (Arm_relocate_functions::abs8,
2266 Arm_relocate_functions::abs16): Use
2267 Bits::has_signed_unsigned_overflow32.
2268 (Arm_relocate_functions::thm_abs8): Correct range of
2269 overflow check.
2270 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2271 in assertions.
2272
2273 2012-02-02 Doug Kwan <dougkwan@google.com>
2274
2275 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2276 position independent outputs, not just shared objects.
2277
2278 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
2279
2280 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2281 * configure: Regenerated.
2282
2283 2012-01-27 Ian Lance Taylor <iant@google.com>
2284
2285 * reloc.h (Bits): New class with static functions, copied from
2286 namespace utils in arm.cc.
2287 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
2288 instead.
2289
2290 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2291
2292 * incremental.cc (write_info_blocks): Correct relocation offset.
2293
2294 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2295
2296 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2297 (Relocate::tls_gd_to_le): Likewise.
2298
2299 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2300
2301 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2302
2303 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2304
2305 * configure.ac: Check if -mcmodel=medium works.
2306 * configure: Regenerated.
2307
2308 2012-01-24 Cary Coutant <ccoutant@google.com>
2309
2310 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2311 definition and ...
2312 (read_unsigned_LEB_128_x): ... this new function.
2313 (read_signed_LEB_128): Replaced with inline definition and ...
2314 (read_signed_LEB_128_x): ... this new function.
2315 * int_encoding.h (read_unsigned_LEB_128_x): New function.
2316 (read_unsigned_LEB_128): Add inline definition.
2317 (read_signed_LEB_128_x): New function.
2318 (read_signed_LEB_128): Add inline definition.
2319 * testsuite/Makefile.am (leb128_unittest): New unit test.
2320 * testsuite/Makefile.in: Regenerate.
2321 * testsuite/leb128_unittest.cc: New unit test.
2322
2323 2012-01-23 Ian Lance Taylor <iant@google.com>
2324
2325 PR gold/13617
2326 * i386.cc (Target_i386::do_code_fill): When using a jmp
2327 instruction, pad with nop instructions.
2328 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2329
2330 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
2331
2332 * x86_64.cc (gc_process_relocs): Add typename on types used in
2333 template.
2334 (scan_relocs): Likewise.
2335 (relocate_section): Likewise.
2336 (apply_relocation): Likewise.
2337
2338 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
2339
2340 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2341 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2342 under x32.
2343
2344 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
2345
2346 * x86_64.cc: Initial support for x32.
2347
2348 2012-01-03 Cary Coutant <ccoutant@google.com>
2349
2350 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2351 Use abstract base class for GOT.
2352 * gold/output.h (class Output_data_got_base): New abstract base class.
2353 (class Output_data_got): Derive from new base class, adjust ctors.
2354 (Output_data_got::reserve_slot): Make virtual; rename to
2355 do_reserve_slot; Adjust callers.
2356 * gold/target.h (Sized_target::init_got_plt_for_update): Return
2357 pointer to abstract base class.
2358 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2359
2360 2011-12-18 Ian Lance Taylor <iant@google.com>
2361
2362 * object.h (Relobj::local_symbol_value): New function.
2363 (Relobj::local_plt_offset): New function.
2364 (Relobj::local_has_got_offset): New function.
2365 (Relobj::local_got_offset): New function.
2366 (Relobj::set_local_got_offset): New function.
2367 (Relobj::do_local_symbol_value): New pure virtual function.
2368 (Relobj::do_local_plt_offset): Likewise.
2369 (Relobj::do_local_has_got_offset): Likewise.
2370 (Relobj::do_local_got_offset): Likewise.
2371 (Relobj::do_set_local_got_offset): Likewise.
2372 (Sized_relobj::do_local_has_got_offset): Rename from
2373 local_has_got_offset.
2374 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2375 (Sized_relobj::do_set_local_got_offset): Rename from
2376 set_local_got_offset.
2377 (Sized_relobj_file::do_local_plt_offset): Rename from
2378 local_plt_offset.
2379 (Sized_relobj_file::do_local_symbol_value): New function.
2380 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2381 local_plt_offset.
2382 * output.cc (Output_data_got::Got_entry::write): Change object to
2383 Relobj. Use local_symbol_value.
2384 (Output_data_got::add_global_with_rel): Change rel_dyn to
2385 Output_data_reloc_generic*. Use add_global_generic.
2386 (Output_data_got::add_global_with_rela): Remove. Change all
2387 callers to use add_global_with_rel.
2388 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2389 Output_data_reloc_generic*. Use add_global_generic.
2390 (Output_data_got::add_global_pair_with_rela): Remove. Change all
2391 callers to use add_global_pair_with_rel.
2392 (Output_data_got::add_local): Change object to Relobj*.
2393 (Output_data_got::add_local_plt): Likewise.
2394 (Output_data_got::add_local_with_rel): Change object to Relobj*,
2395 change rel_dyn to Output_data_reloc_generic*. Use
2396 add_local_generic.
2397 (Output_data_got::add_local_with_rela): Remove. Change all
2398 callers to use all_local_with_rel.
2399 (Output_data_got::add_local_pair_with_rel): Change object to
2400 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
2401 add_output_section_generic.
2402 (Output_data_got::add_local_pair_with_rela): Remove. Change all
2403 callers to use add_local_pair_with_rel.
2404 (Output_data_got::reserve_local): Change object to Relobj*.
2405 * output.h: (class Output_data_reloc_generic): Add pure virtual
2406 declarations for add_global_generic, add_local_generic,
2407 add_output_section_generic.
2408 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2409 functions for Output_data_reloc_generic. Update declarations for
2410 changes listed in output.cc.
2411 (class Output_data_got): Change template parameter to got_size.
2412 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
2413 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2414 function.
2415 (Sized_relobj_incr::do_local_plt_offset): New function.
2416 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2417 add_global_generic.
2418
2419 2011-12-17 Cary Coutant <ccoutant@google.com>
2420
2421 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2422 * resolve.cc (Symbol_table::resolve): Likewise.
2423 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2424 arrays.
2425 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2426
2427 2011-12-16 Ian Lance Taylor <iant@google.com>
2428
2429 * output.h (Output_data_reloc_generic::add): Only call
2430 add_dynamic_reloc if this is a dynamic reloc section.
2431
2432 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
2433
2434 PR gold/13505
2435 * target-reloc.h (apply_relocation): Replace <64, false> with
2436 <size, big_endian>.
2437
2438 2011-11-25 Nick Clifton <nickc@redhat.com>
2439
2440 * po/it.po: New Italian translation.
2441
2442 2011-11-17 Sterling Augustine <saugustine@google.com>
2443
2444 * script.cc (script_include_directive): Implement.
2445 (read_script_file): New local variables name and search_path. Update
2446 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2447 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2448 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2449
2450 2011-11-11 Sterling Augustine <saugustine@google.com>
2451
2452 * yyscript.y (section_cmd): Add support for INCLUDE directive.
2453 (file_or_sections_cmd): Likewise.
2454
2455 2011-11-11 Doug Kwan <dougkwan@google.com>
2456
2457 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2458 if --just-symbols is given.
2459
2460 2011-11-10 Doug Kwan <dougkwan@google.com>
2461
2462 PR gold/13362
2463 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2464 when processing data relocs.
2465 * reloc.h (Relocate_functions::rel_unaligned): New method.
2466 (Relocate_functions::pcrel_unaligned): Ditto.
2467 (Relocate_functions::rel32_unaligned): Ditto.
2468 (Relocate_functions::pcrel32_unaligned): Ditto.
2469
2470 2011-11-09 Doug Kwan <dougkwan@google.com>
2471
2472 PR gold/13362
2473 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2474 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2475 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2476 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2477 (Relocate_functions::rel_unaligned): New.
2478 (Relocate_functions::rel32_unaligned): New.
2479 * target-reloc.h (relocate_for_relocatable): Add code to handle
2480 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2481 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2482 arm_unaligned_reloc_r): New targets.
2483 * testsuite/Makefile.in: Regenerate.
2484 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2485 linking.
2486
2487 2011-11-02 Ian Lance Taylor <iant@google.com>
2488
2489 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
2490 NATIVE_LINKER.
2491 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2492 * options.cc (General_options::finalize): Use library search path
2493 from configure script if specified. If not native and no sysroot,
2494 only search TOOLLIBDIR.
2495 * options.h (Search_directory::Search_directory): Change name to
2496 const std::string&.
2497 (General_options::add_to_library_path_with_sysroot): Change arg to
2498 const std::string&.
2499 * configure, Makefile.in, config.in: Rebuild.
2500
2501 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2502
2503 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2504 we are working around the ARM1176 Erratum.
2505 * options.h (General_options::fix_arm1176): Add option.
2506 * testsuite/Makefile.am: Add testcases, and keep current ones
2507 working.
2508 * testsuite/Makefile.in: Regenerate.
2509 * testsuite/arm_fix_1176.s: New file.
2510 * testsuite/arm_fix_1176.sh: Likewise.
2511
2512 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2513
2514 * arm.cc (Target_arm::Target_arm): Remove initialisation of
2515 may_use_blx_.
2516 (Target_arm::may_use_blx): Remove method.
2517 (Target_arm::set_may_use_blx): Likewise.
2518 (Target_arm::may_use_v4t_interworking): New method.
2519 (Target_arm::may_use_v5t_interworking): Likewise.
2520 (Target_arm::may_use_blx_): Remove member variable.
2521 (Arm_relocate_functions::arm_branch_common): Check for v5T
2522 interworking.
2523 (Arm_relocate_functions::thumb_branch_common): Likewise.
2524 (Reloc_stub::stub_type_for_reloc): Likewise.
2525 (Target_arm::do_finalize_sections): Correct interworking checks.
2526 * testsuite/Makefile.am: Add new tests.
2527 * testsuite/Makefile.in: Regenerate.
2528 * testsuite/arm_farcall_arm_arm.s: New test.
2529 * testsuite/arm_farcall_arm_arm.sh: Likewise.
2530 * testsuite/arm_farcall_arm_thumb.s: Likewise.
2531 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2532 * testsuite/arm_farcall_thumb_arm.s: Likewise.
2533 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2534 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2535 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2536
2537 2011-10-31 Cary Coutant <ccoutant@google.com>
2538
2539 PR gold/13023
2540 * expression.cc (Expression::eval_with_dot): Add
2541 is_section_dot_assignment parameter.
2542 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
2543 absolute and assigning to dot within a section.
2544 * script-sections.cc
2545 (Output_section_element_assignment::set_section_addresses): Pass
2546 dot_section to set_if_absolute.
2547 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2548 as is_section_dot_assignment flag to eval_with_dot.
2549 (Output_section_element_dot_assignment::set_section_addresses):
2550 Likewise.
2551 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2552 parameter. Also set value if relative to dot_section; set the
2553 symbol's output_section.
2554 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2555 parameter. Adjust all callers.
2556 (Expression::eval_maybe_dot): Likewise.
2557 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2558 Adjust all callers.
2559 * testsuite/script_test_2.t: Test assignment of an absolute value
2560 to dot within an output section element.
2561
2562 2011-10-31 Cary Coutant <ccoutant@google.com>
2563
2564 * options.h (class General_options): Add --[no-]gnu-unique options.
2565 * symtab.cc (Symbol_table::sized_write_globals): Convert
2566 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2567
2568 2011-10-31 Cary Coutant <ccoutant@google.com>
2569
2570 PR gold/13359
2571 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2572 unnecessary assertion.
2573 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2574
2575 2011-10-31 Sriraman Tallam <tmsriram@google.com>
2576
2577 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2578 gc_mark_symbol.
2579 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2580 gc_mark_symbol.
2581 Change to just keep the section associated with symbol.
2582 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2583 they are externally visible and --export-dynamic is turned on.
2584 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2585
2586 2011-10-19 Ian Lance Taylor <iant@google.com>
2587
2588 PR gold/13163
2589 * script-sections.cc
2590 (Output_section_element_dot_assignment::needs_output_section): New
2591 function.
2592
2593 2011-10-19 Ian Lance Taylor <iant@google.com>
2594
2595 PR gold/13204
2596 * layout.cc (Layout::segment_precedes): Don't assert failure if a
2597 --section-start option was seen.
2598 * options.h (General_options::any_section_start): New function.
2599
2600 2011-10-18 David S. Miller <davem@davemloft.net>
2601
2602 PR binutils/13301
2603 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2604 member to track relocation locations that have moved during TLS
2605 reloc optimizations.
2606 (Target_sparc::Relocate::Relocate): Initialize to NULL.
2607 (Target_sparc::Relocate::relocate): Adjust view down by 4
2608 bytes if it matches reloc_adjust_addr_.
2609 (Target_sparc::Relocate::relocate_tls): Always move the
2610 __tls_get_addr call delay slot instruction forward 4 bytes when
2611 performing relaxation.
2612
2613 2011-10-18 Cary Coutant <ccoutant@google.com>
2614
2615 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2616 (Output_file::map_no_anonymous): Check for non-zero
2617 return code from posix_fallocate.
2618
2619 2011-10-17 Cary Coutant <ccoutant@google.com>
2620
2621 PR gold/13245
2622 * plugin.cc (is_visible_from_outside): Check for symbols
2623 referenced from dynamic objects.
2624 * resolve.cc (Symbol_table::resolve): Don't count references
2625 from dynamic objects as references from real ELF files.
2626 * testsuite/plugin_test_2.sh: Adjust expected result.
2627
2628 2011-10-17 Cary Coutant <ccoutant@google.com>
2629
2630 * gold.cc: Include timer.h.
2631 (queue_middle_tasks): Stamp time.
2632 (queue_final_tasks): Likewise.
2633 * main.cc (main): Store timer in parameters. Print timers
2634 for each pass.
2635 * parameters.cc (Parameters::Parameters): Initialize timer_.
2636 (Parameters::set_timer): New function.
2637 (set_parameters_timer): New function.
2638 * parameters.h (Parameters::set_timer): New function.
2639 (Parameters::timer): New function.
2640 (Parameters::timer_): New data member.
2641 (set_parameters_timer): New function.
2642 * timer.cc (Timer::stamp): New function.
2643 (Timer::get_pass_time): New function.
2644 * timer.h (Timer::stamp): New function.
2645 (Timer::get_pass_time): New function.
2646 (Timer::pass_times_): New data member.
2647
2648 2011-10-17 Cary Coutant <ccoutant@google.com>
2649
2650 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2651 task for members of lib groups.
2652
2653 2011-10-17 Cary Coutant <ccoutant@google.com>
2654
2655 PR gold/13288
2656 * fileread.cc (File_read::find_view): Add assert.
2657 (File_read::make_view): Move bounds check (replace with assert)...
2658 (File_read::find_or_make_view): ... to here.
2659
2660 2011-10-12 Cary Coutant <ccoutant@google.com>
2661
2662 * output.cc (Output_file::open_base_file): Handle case where
2663 ::read returns less than requested size.
2664
2665 2011-10-10 Cary Coutant <ccoutant@google.com>
2666
2667 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2668 Initialize defined_count_.
2669 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2670 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2671 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2672 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2673 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2674 * incremental.h (Sized_relobj_incr::defined_count_): New data
2675 member.
2676 (Sized_incr_dynobj::defined_count_): New data member.
2677 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2678 Return zeroes instead of internal error.
2679
2680 2011-10-10 Cary Coutant <ccoutant@google.com>
2681
2682 PR gold/13249
2683 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2684 (Output_reloc::symbol_value): Return PLT offset if flag is set.
2685 * output.h (class Output_reloc): Add use_plt_offset flag.
2686 (Output_reloc::type_): Adjust size of bit field.
2687 (Output_reloc::use_plt_offset_): New bit field.
2688 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2689 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2690 flag. Adjust all callers.
2691 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2692 creating RELATIVE relocations.
2693
2694 2011-10-10 Nick Clifton <nickc@redhat.com>
2695
2696 * po/es.po: Updated Spanish translation.
2697 * po/fi.po: Updated Finnish translation.
2698
2699 2011-10-03 Diego Novillo <dnovillo@google.com>
2700
2701 * options.cc (parse_uint): Fix dereference of RETVAL.
2702
2703 2011-09-29 Sriraman Tallam <tmsriram@google.com>
2704
2705 * layout.h (section_order_map_): New member.
2706 (get_section_order_map): New member function.
2707 * output.cc (Output_section::add_input_section): Check for patterns
2708 only when --section-ordering-file is specified.
2709 * gold.cc (queue_middle_tasks): Delay updating order of sections till
2710 output_sections have been formed.
2711 * layout.cc (Layout_Layout): Initialize section_order_map_.
2712 * plugin.cc (update_section_order): Store order in order_map. Do not
2713 update the order.
2714 * testsuite/Makefile.am: Add test case for plugin_final_layout.
2715 * testsuite/Makefile.in: Regenerate.
2716 * testsuite/plugin_section_order.c: New file.
2717 * testsuite/plugin_final_layout.cc: New file.
2718 * testsuite/plugin_final_layout.sh: New file.
2719
2720 2011-09-29 Cary Coutant <ccoutant@google.com>
2721
2722 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2723 Check for NULL.
2724 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2725 symbols during incremental update.
2726 (Symbol_table::add_from_dynobj): Likewise.
2727
2728 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2729 Ian Lance Taylor <iant@google.com>
2730
2731 * symtab.cc (Symbol_table::define_special_symbol): Always
2732 canonicalize version string.
2733
2734 2011-09-26 Cary Coutant <ccoutant@google.com>
2735
2736 * gold.cc (queue_initial_tasks): Move option checks ...
2737 * options.cc (General_options::finalize): ... to here. Disable
2738 some options; make others fatal.
2739
2740 2011-09-26 Cary Coutant <ccoutant@google.com>
2741
2742 gcc PR lto/47247
2743 * plugin.cc (get_symbols_v2): New function.
2744 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2745 (is_referenced_from_outside): New function.
2746 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2747 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2748 (get_symbols): Pass version parameter.
2749 (get_symbols_v2): New function.
2750 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2751 parameter.
2752 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2753 (onload): Add LDPT_GET_SYMBOLS_V2.
2754 (all_symbols_read_hook): Use get_symbols_v2; check for
2755 LDPR_PREVAILING_DEF_IRONLY_EXP.
2756 * testsuite/plugin_test_3.sh: Update expected results.
2757
2758 2011-09-23 Simon Baldwin <simonb@google.com>
2759
2760 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2761 configuration options.
2762 * configure: Regenerate.
2763 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2764 * Makefile.in: Regenerate.
2765 * testsuite/Makefile.in: Regenerate.
2766
2767 2011-09-19 Sriraman Tallam <tmsriram@google.com>
2768
2769 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2770
2771 2011-09-19 Cary Coutant <ccoutant@google.com>
2772
2773 * incremental.cc (can_incremental_update): Fix typo in comment.
2774 * incremental.h (can_incremental_update): Likewise.
2775
2776 2011-09-18 Cary Coutant <ccoutant@google.com>
2777
2778 * incremental.cc (can_incremental_update): New function.
2779 * incremental.h (can_incremental_update): New function.
2780 * layout.cc (Layout::init_fixed_output_section): Call it.
2781 (Layout::make_output_section): Don't allow patch space in .eh_frame.
2782 * object.cc (Sized_relobj_file::do_layout): Call
2783 can_incremental_update.
2784
2785 2011-09-13 Cary Coutant <ccoutant@google.com>
2786
2787 * configure.ac: Check for glibc support for gnu_indirect_function
2788 support with static linking, setting automake conditional
2789 IFUNC_STATIC.
2790 * Makefile.in: Regenerate.
2791 * configure: Regenerate.
2792
2793 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2794 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2795 for IFUNC_STATIC.
2796 * testsuite/Makefile.in: Regenerate.
2797
2798 2011-09-13 Cary Coutant <ccoutant@google.com>
2799
2800 * incremental.cc (Sized_relobj_incr::do_layout): Call
2801 report_comdat_group for kept comdat sections.
2802 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2803 * testsuite/Makefile.in: Regenerate.
2804 * testsuite/incr_comdat_test_1.cc: New source file.
2805 * testsuite/incr_comdat_test_2_v1.cc: New source file.
2806 * testsuite/incr_comdat_test_2_v2.cc: New source file.
2807 * testsuite/incr_comdat_test_2_v3.cc: New source file.
2808
2809 2011-09-13 Ian Lance Taylor <iant@google.com>
2810
2811 * object.cc (Sized_relobj_file::do_layout): Remove unused local
2812 variable external_symbols_offset.
2813
2814 2011-09-12 Ian Lance Taylor <iant@google.com>
2815
2816 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2817 triggered if object has no symbols.
2818
2819 2011-09-09 David S. Miller <davem@davemloft.net>
2820
2821 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2822 (Output_fill_debug_line::do_write): Likewise.
2823
2824 2011-08-29 Cary Coutant <ccoutant@google.com>
2825
2826 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2827 casts to match formatting specs.
2828 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2829
2830 2011-08-26 Cary Coutant <ccoutant@google.com>
2831
2832 * layout.cc (Free_list::allocate): Provide guarantee of minimum
2833 remaining hole size when allocating.
2834 (Layout::make_output_section): Set fill methods for debug sections.
2835 * layout.h (Free_list::Free_list_node): Move from private to
2836 public.
2837 (Free_list::set_min_hole_size): New function.
2838 (Free_list::begin, Free_list::end): New functions.
2839 (Free_list::min_hole_): New data member.
2840 * output.cc: Include dwarf.h.
2841 (Output_fill_debug_info::do_minimum_hole_size): New function.
2842 (Output_fill_debug_info::do_write): New function.
2843 (Output_fill_debug_line::do_minimum_hole_size): New function.
2844 (Output_fill_debug_line::do_write): New function.
2845 (Output_section::Output_section): Initialize new data member.
2846 (Output_section::set_final_data_size): Ensure patch space is larger
2847 than minimum hole size.
2848 (Output_section::do_write): Fill holes in debug sections.
2849 * output.h (Output_fill): New class.
2850 (Output_fill_debug_info): New class.
2851 (Output_fill_debug_line): New class.
2852 (Output_section::set_free_space_fill): New function.
2853 (Output_section::free_space_fill_): New data member.
2854 * testsuite/Makefile.am (incremental_test_3): Add
2855 --incremental-patch option.
2856 (incremental_test_4): Likewise.
2857 (incremental_test_5): Likewise.
2858 (incremental_test_6): Likewise.
2859 (incremental_copy_test): Likewise.
2860 (incremental_common_test_1): Likewise.
2861 * testsuite/Makefile.in: Regenerate.
2862
2863 2011-08-26 Nick Clifton <nickc@redhat.com>
2864
2865 * po/es.po: Updated Spanish translation.
2866
2867 2011-08-01 Cary Coutant <ccoutant@google.com>
2868
2869 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2870 * gold/testsuite/Makefile.in: Regenerate.
2871 * gold/testsuite/justsyms_exec.c: New source file.
2872 * gold/testsuite/justsyms_lib.c: New source file.
2873
2874 2011-08-01 Cary Coutant <ccoutant@google.com>
2875
2876 * layout.cc (Layout::set_segment_offsets): Don't realign text
2877 segment if -Ttext was specified.
2878 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2879 file type.
2880 * object.h (Sized_relobj_file::e_type): New function.
2881 (Sized_relobj_file::e_type_): New data member.
2882 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2883 base address for ET_EXEC files.
2884 * target.cc (Target::do_make_elf_object_implementation): Allow
2885 ET_EXEC files with --just-symbols option.
2886
2887 2011-07-28 Cary Coutant <ccoutant@google.com>
2888
2889 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2890 Add thread_number parameter.
2891 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2892 * workqueue-threads.cc
2893 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2894 current thread if its thread number is greater than desired thread
2895 count.
2896 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2897 Add thread_number parameter.
2898 (Workqueue::should_cancel_thread): Likewise.
2899 (Workqueue::find_runnable_or_wait): Pass thread_number to
2900 should_cancel_thread.
2901 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2902 parameter.
2903
2904 2011-07-22 Sriraman Tallam <tmsriram@google.com>
2905
2906 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2907 only after checking if it cannot be forced local.
2908 * symtab.h (is_externally_visible): Check if the symbol is not forced
2909 local.
2910
2911 2011-07-15 Ian Lance Taylor <iant@google.com>
2912
2913 * options.h (class General_options): Add --print-output-format.
2914 Move -EL next to -EB, for better --help output.
2915 * target-select.cc: Include <cstdio>, "options.h", and
2916 "parameters.h".
2917 (Target_selector::do_target_bfd_name): New function.
2918 (print_output_format): New function.
2919 * target-select.h (class Target_selector): Update declarations.
2920 (Target_selector::target_bfd_name): New function.
2921 (print_output_format): Declare.
2922 * main.cc: Include "target-select.h".
2923 (main): Handle --print-output-format.
2924 * gold.cc: Include "target-select.h".
2925 (queue_initial_tasks): Handle --print-output-format when there are
2926 no input files.
2927 * parameters.cc (parameters_force_valid_target): Give a better
2928 error message if -EB/-EL does not match target.
2929 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2930 function.
2931
2932 2011-07-15 Ian Lance Taylor <iant@google.com>
2933
2934 * i386.cc (class Output_data_plt_i386): Add layout_ field.
2935 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2936 (Output_data_plt_i386::do_write): Write address of .dynamic
2937 section to first entry in .got.plt section.
2938 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2939 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2940 Initialize layout_.
2941 (Output_data_plt_x86_64::do_write): Write address of .dynamic
2942 section to first entry in .got.plt section.
2943 * layout.h (Layout::dynamic_section): New function.
2944
2945 2011-07-13 Sriraman Tallam <tmsriram@google.com>
2946
2947 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2948 to claim_file call.
2949 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2950 input_section_position_, and input_section_glob_.
2951 (read_layout_from_file): Call function section_ordering_specified.
2952 * layout.h (is_section_ordering_specified): New function.
2953 (section_ordering_specified): New function.
2954 (section_ordering_specified_): New boolean member.
2955 * main.cc(main): Call load_plugins after layout object is defined.
2956 * output.cc (Output_section::add_input_section): Use
2957 function section_ordering_specified to check if section ordering is
2958 needed.
2959 * output.cc (Output_section::add_relaxed_input_section): Use
2960 function section_ordering_specified to check if section ordering is
2961 needed.
2962 (Output_section::update_section_layout): New function.
2963 (Output_section::sort_attached_input_sections): Check if input section
2964 must be reordered.
2965 * output.h (Output_section::update_section_layout): New function.
2966 * plugin.cc (get_section_count): New function.
2967 (get_section_type): New function.
2968 (get_section_name): New function.
2969 (get_section_contents): New function.
2970 (update_section_order): New function.
2971 (allow_section_ordering): New function.
2972 (Plugin::load): Add the new interfaces to the transfer vector.
2973 (Plugin_manager::load_plugins): New parameter.
2974 (Plugin_manager::all_symbols_read): New parameter.
2975 (Plugin_manager::claim_file): New parameter. Save the elf object for
2976 unclaimed objects.
2977 (Plugin_manager::get_elf_object): New function.
2978 (Plugin_manager::get_view): Change to directly use the bool to check
2979 if get_view is called from claim_file_hook.
2980 * plugin.h (input_objects): New function
2981 (Plugin__manager::load_plugins): New parameter.
2982 (Plugin_manager::claim_file): New parameter.
2983 (Plugin_manager::get_elf_object): New function.
2984 (Plugin_manager::in_claim_file_handler): New function.
2985 (Plugin_manager::in_claim_file_handler_): New member.
2986 (layout): New function.
2987 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2988 handler with an extra parameter. Make the elf object before calling
2989 claim_file handler.
2990 * testsuite/plugin_test.c (get_section_count): New function pointer.
2991 (get_section_type): New function pointer.
2992 (get_section_name): New function pointer.
2993 (get_section_contents): New function pointer.
2994 (update_section_order): New function pointer.
2995 (allow_section_ordering): New function pointer.
2996 (onload): Check if the new interfaces exist.
2997
2998 2011-07-13 Ian Lance Taylor <iant@google.com>
2999
3000 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3001 relro section.
3002 * x86_64.cc (Target_x86_64::got_section): Likewise.
3003 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3004 (relro_now_test_SOURCES): New variable.
3005 (relro_now_test_DEPENDENCIES): New variable.
3006 (relro_now_test_LDFLAGS): New variable.
3007 (relro_now_test_LDADD): New variable.
3008 (relro_now_test.so): New target.
3009 * testsuite/Makefile.in: Rebuild.
3010
3011 2011-07-12 Ian Lance Taylor <iant@google.com>
3012
3013 PR gold/12980
3014 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3015 GLOB_DAT relocation rather than a RELATIVE relocation for a
3016 protected symbol when creating a shared library.
3017 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3018 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3019 * testsuite/protected_main_1.cc (main): Test that protected
3020 function has same address.
3021
3022 2011-07-11 Ian Lance Taylor <iant@google.com>
3023
3024 PR gold/12979
3025 * options.h (class General_options): Add -Bgroup.
3026 * options.cc (General_options::finalize): If -Bgroup is set,
3027 default to --unresolved-symbols=report-all.
3028 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3029 * target-reloc.h (issue_undefined_symbol_error): Handle
3030 --unresolved-symbols=report-all.
3031
3032 2011-07-08 Ian Lance Taylor <iant@google.com>
3033
3034 PR gold/11985
3035 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3036 if linker script discards key sections.
3037 (Layout::create_dynamic_symtab): Likewise.
3038 (Layout::assign_local_dynsym_offsets): Likewise.
3039 (Layout::sized_create_version_sections): Likewise.
3040 (Layout::create_interp): Likewise.
3041 (Layout::finish_dynamic_section): Likewise.
3042 (Layout::set_dynamic_symbol_size): Likewise.
3043
3044 2011-07-08 Ian Lance Taylor <iant@google.com>
3045
3046 PR gold/12386
3047 * options.h (class General_options): Add --unresolved-symbols.
3048 * target-reloc.h (issue_undefined_symbol_error): Check
3049 --unresolved-symbols. Add comments.
3050
3051 2011-07-08 Ian Lance Taylor <iant@google.com>
3052
3053 * testsuite/odr_violation2.cc (Ordering::operator()): Make
3054 expression more complex.
3055
3056 2011-07-08 Ian Lance Taylor <iant@google.com>
3057
3058 PR gold/11317
3059 * target-reloc.h (issue_undefined_symbol_error): New inline
3060 function, broken out of relocate_section.
3061 (relocate_section): Call issue_undefined_symbol_error.
3062 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3063 there is no TLS segment if we are about to issue an undefined
3064 symbol error.
3065 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3066
3067 2011-07-08 Ian Lance Taylor <iant@google.com>
3068
3069 PR gold/12279
3070 * resolve.cc (Symbol_table::should_override): Add fromtype
3071 parameter. Change all callers. Give error when linking together
3072 TLS and non-TLS symbol.
3073 (Symbol_table::should_override_with_special): Add fromtype
3074 parameter. Change all callers.
3075 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3076 there is no TLS segment if we have reported some errors.
3077 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3078
3079 2011-07-08 Ian Lance Taylor <iant@google.com>
3080
3081 PR gold/12372
3082 * target.h (Target::plt_address_for_global): New function.
3083 (Target::plt_address_for_local): New function.
3084 (Target::plt_section_for_global): Remove.
3085 (Target::plt_section_for_local): Remove.
3086 (Target::do_plt_address_for_global): New virtual function.
3087 (Target::do_plt_address_for_local): New virtual function.
3088 (Target::do_plt_section_for_global): Remove.
3089 (Target::do_plt_section_for_local): Remove.
3090 (Target::register_global_plt_entry): Add Symbol_table and Layout
3091 parameters.
3092 * output.cc (Output_data_got::Got_entry::write): Use
3093 plt_address_for_global and plt_address_for_local.
3094 * layout.cc (Layout::add_target_dynamic_tags): Use size and
3095 address of output section.
3096 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3097 got_irelative_, and irelative_count_ fields. Update
3098 declarations.
3099 (Output_data_plt_i386::has_irelative_section): New function.
3100 (Output_data_plt_i386::entry_count): Add irelative_count_.
3101 (Output_data_plt_i386::set_final_data_size): Likewise.
3102 (class Target_i386): Add got_irelative_ and rel_irelative_
3103 fields. Update declarations.
3104 (Target_i386::Target_i386): Initialize new fields.
3105 (Target_i386::do_plt_address_for_global): New function replacing
3106 do_plt_section_for_global.
3107 (Target_i386::do_plt_address_for_local): New function replacing
3108 do_plt_section_for_local.
3109 (Target_i386::got_section): Create got_irelative_.
3110 (Target_i386::rel_irelative_section): New function.
3111 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3112 fields. Don't define __rel_iplt_{start,end}.
3113 (Output_data_plt_i386::add_entry): Add symtab and layout
3114 parameters. Change all callers. Use different PLT and GOT for
3115 IFUNC symbols.
3116 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3117 layout parameters. Change all callers. Use different PLT and
3118 GOT.
3119 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3120 (Output_data_plt_i386::rel_irelative): New function.
3121 (Output_data_plt_i386::address_for_global): New function.
3122 (Output_data_plt_i386::address_for_local): New function.
3123 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
3124 IRELATIVE GOT when changing IFUNC GOT entries.
3125 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3126 reloc.
3127 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3128 if we didn't create an IRELATIVE GOT.
3129 (Target_i386::Relocate::relocate): Use plt_address_for_global and
3130 plt_address_for_local.
3131 (Target_i386::do_dynsym_value): Use plt_address_for_global.
3132 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3133 got_irelative_, and irelative_count_ fields. Update
3134 declarations.
3135 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3136 Initialize new fields. Remove symtab parameter. Change all
3137 callers.
3138 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3139 irelative_count_.
3140 (Output_data_plt_x86_64::has_irelative_section): New function.
3141 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3142 (class Target_x86_64): Add got_irelative_ and rel_irelative_
3143 fields. Update declarations.
3144 (Target_x86_64::Target_x86_64): Initialize new fields.
3145 (Target_x86_64::do_plt_address_for_global): New function replacing
3146 do_plt_section_for_global.
3147 (Target_x86_64::do_plt_address_for_local): New function replacing
3148 do_plt_section_for_local.
3149 (Target_x86_64::got_section): Create got_irelative_.
3150 (Target_x86_64::rela_irelative_section): New function.
3151 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
3152 all callers. Don't create __rel_iplt_{start,end}.
3153 (Output_data_plt_x86_64::add_entry): Add symtab and layout
3154 parameters. Change all callers. Use different PLT and GOT for
3155 IFUNC symbols.
3156 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3157 layout parameters. Change all callers. Use different PLT and
3158 GOT.
3159 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3160 parameters. Change all callers. Use different PLT and GOT for
3161 IFUNC symbols.
3162 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3163 (Output_data_plt_x86_64::rela_irelative): New function.
3164 (Output_data_plt_x86_64::address_for_global): New function.
3165 (Output_data_plt_x86_64::address_for_local): New function.
3166 (Output_data_plt_x86_64::set_final_data_size): Likewise.
3167 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3168 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3169 (Target_x86_64::register_global_plt_entry): Add symtab and layout
3170 parameters.
3171 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3172 reloc.
3173 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3174 symbols if we didn't create an IRELATIVE GOT.
3175 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3176 plt_address_for_local.
3177 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3178 * testsuite/ifuncvar1.c: New test file.
3179 * testsuite/ifuncvar2.c: New test file.
3180 * testsuite/ifuncvar3.c: New test file.
3181 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3182 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3183 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3184 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3185 * testsuite/Makefile.in: Rebuild.
3186
3187 2011-07-07 Cary Coutant <ccoutant@google.com>
3188
3189 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3190 (two_file_test_1_ndebug.o): Likewise.
3191 (two_file_test_1b_ndebug.o): Likewise.
3192 (two_file_test_2_ndebug.o): Likewise.
3193 (two_file_test_main_ndebug.o): Likewise.
3194 (incremental_test_2): Link with no-debug versions.
3195
3196 2011-07-06 Cary Coutant <ccoutant@google.com>
3197
3198 * gold/incremental.cc
3199 (Output_section_incremental_inputs::write_info_blocks): Check for
3200 hidden and internal symbols.
3201
3202 2011-07-06 Cary Coutant <ccoutant@google.com>
3203
3204 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3205 Check disposition for startup file.
3206 (Incremental_inputs::report_command_line): Ignore
3207 --incremental-startup-unchanged option.
3208 * options.cc (General_options::parse_incremental_startup_unchanged):
3209 New function.
3210 (General_options::General_options): Initialize new data member.
3211 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3212 (General_options): Add --incremental-startup-unchanged option.
3213 (General_options::incremental_startup_disposition): New function.
3214 (General_options::incremental_startup_disposition_): New data member.
3215
3216 2011-07-06 Cary Coutant <ccoutant@google.com>
3217
3218 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3219 input file index to Script_info ctor.
3220 (Sized_incremental_binary::do_file_has_changed): Find the
3221 command-line argument for files named in scripts.
3222 * incremental.h (Script_info::Script_info): New ctor
3223 with input file index.
3224 (Script_info::input_file_index): New function.
3225 (Script_info::input_file_index_): New data member.
3226 (Incremental_binary::get_library): Add const.
3227 (Incremental_binary::get_script_info): Add const.
3228 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3229 * testsuite/Makefile.am (incremental_test_5): New test case.
3230 (incremental_test_6): New test case.
3231 * testsuite/Makefile.in: Regenerate.
3232
3233 2011-07-06 Cary Coutant <ccoutant@google.com>
3234
3235 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3236 debug output when command lines differ.
3237
3238 2011-07-06 Cary Coutant <ccoutant@google.com>
3239
3240 * incremental.cc (Incremental_inputs::report_command_line): Ignore
3241 --incremental-patch option.
3242 * layout.cc (Free_list::allocate): Extend allocation beyond original
3243 end if enabled.
3244 (Layout::make_output_section): Mark sections that should get
3245 patch space.
3246 * options.cc (parse_percent): New function.
3247 * options.h (parse_percent): New function.
3248 (DEFINE_percent): New macro.
3249 (General_options): Add --incremental-patch option.
3250 * output.cc (Output_section::Output_section): Initialize new data
3251 members.
3252 (Output_section::add_input_section): Print section name when out
3253 of patch space.
3254 (Output_section::add_output_section_data): Likewise.
3255 (Output_section::set_final_data_size): Add patch space when
3256 doing --incremental-full.
3257 (Output_section::do_reset_address_and_file_offset): Remove patch
3258 space.
3259 (Output_segment::set_section_list_addresses): Print debug output
3260 only if --incremental-update.
3261 * output.h (Output_section::set_is_patch_space_allowed): New function.
3262 (Output_section::is_patch_space_allowed_): New data member.
3263 (Output_section::patch_space_): New data member.
3264 * parameters.cc (Parameters::incremental_full): New function.
3265 * parameters.h (Parameters::incremental_full): New function
3266 * testsuite/Makefile.am (incremental_test_2): Add test for
3267 --incremental-patch option.
3268 * testsuite/Makefile.in: Regenerate.
3269 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3270 (t18): Remove function body.
3271
3272 2011-07-05 Doug Kwan <dougkwan@google.com>
3273
3274 PR gold/12771
3275 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3276 Arm_Address type for relocation result.
3277 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
3278 overflow check.
3279 (Arm_relocate_functions::abs32): Use unaligned access.
3280 (Arm_relocate_functions::rel32): Ditto.
3281 (Arm_relocate_functions::prel31): Ditto.
3282 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3283 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3284 static data relocations.
3285 * testsuite/Makefile.in: Regnerate.
3286 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3287
3288 2011-07-05 Ian Lance Taylor <iant@google.com>
3289
3290 PR gold/12392
3291 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3292 symbols if necessary.
3293 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3294
3295 2011-07-05 Ian Lance Taylor <iant@google.com>
3296
3297 PR gold/12952
3298 * resolve.cc (Symbol::override_base_with_special): Simply override
3299 version with special symbol version, ignoring previous version.
3300
3301 2011-07-05 Ian Lance Taylor <iant@google.com>
3302
3303 * object.cc (Sized_relobj_file::include_section_group): Add
3304 information to comment about signature location.
3305
3306 2011-07-02 Ian Lance Taylor <iant@google.com>
3307
3308 PR gold/12957
3309 * options.h (class General_options): Add -f and -F.
3310 * options.cc (General_options::finalize): Fatal error if -f/-F
3311 are used without -shared.
3312 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3313
3314 2011-07-02 Ian Lance Taylor <iant@google.com>
3315
3316 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3317
3318 2011-07-01 Ian Lance Taylor <iant@google.com>
3319
3320 PR gold/12525
3321 PR gold/12952
3322 * resolve.cc (Symbol::override_base_with_special): Don't override
3323 the version if the overriding symbol has a different name.
3324 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
3325 all callers. If we give an error about an undefined version,
3326 define the base version if necessary.
3327 * dynobj.h (class Versions): Update declaration.
3328 * testsuite/weak_alias_test_5.cc: New file.
3329 * testsuite/weak_alias_test.script: New file.
3330 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3331 and versioned_alias have the right value, and call t2.
3332 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3333 weak_alias_test_5.so.
3334 (weak_alias_test_LDADD): Likewise.
3335 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3336 * testsuite/Makefile.in: Rebuild.
3337
3338 2011-07-01 Ian Lance Taylor <iant@google.com>
3339
3340 PR gold/12525
3341 * options.h (class General_options): Support -z notext.
3342 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3343 -Wl,-z,notext.
3344 (two_file_shared_nonpic.so): Likewise.
3345 (two_file_shared_mixed.so): Likewise.
3346 (two_file_shared_mixed_1.so): Likewise.
3347 (weak_undef_lib_nonpic.so): Likewise.
3348 (alt/weak_undef_lib_nonpic.so): Likewise.
3349 (tls_test_shared_nonpic.so): Likewise.
3350 * testsuite/Makefile.in: Rebuild.
3351
3352 2011-07-01 Ian Lance Taylor <iant@google.com>
3353
3354 PR gold/12525
3355 * configure.ac: Test whether static linking works, setting
3356 the automake conditional HAVE_STATIC.
3357 * testsuite/Makefile.am: Disable tests using -static if
3358 HAVE_STATIC is not true.
3359 * configure, testsuite/Makefile.in: Rebuild.
3360
3361 2011-07-01 Ian Lance Taylor <iant@google.com>
3362
3363 PR gold/12525
3364 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3365 Assert if we see DW_EH_PE_indirect.
3366 * target.h (Target::ehframe_datarel_base): New function.
3367 (Target::do_ehframe_datarel_base): New target function.
3368 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3369 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3370 function.
3371
3372 2011-07-01 Ian Lance Taylor <iant@google.com>
3373
3374 PR gold/12571
3375 * options.h (class General_options): Add
3376 --ld-generated-unwind-info.
3377 * ehframe.cc (Fde::write): Add address parameter. Change all
3378 callers. If associated with PLT, fill in address and size.
3379 (Cie::set_output_offset): Only add merge mapping if there is an
3380 object.
3381 (Cie::write): Add address parameter. Change all callers.
3382 (Eh_frame::add_ehframe_for_plt): New function.
3383 * ehframe.h (class Fde): Update declarations. Move shndx_ and
3384 input_offset_ fields into union u_, with new plt field.
3385 (Fde::Fde): Adjust for new union field.
3386 (Fde::Fde) [Output_data version]: New constructor.
3387 (Fde::add_mapping): Only add merge mapping if there is an object.
3388 (class Cie): Update declarations.
3389 (class Eh_frame): Declare add_ehframe_for_plt.
3390 * layout.cc (Layout::layout_eh_frame): Break out code into
3391 make_eh_frame_section, and call it.
3392 (Layout::make_eh_frame_section): New function.
3393 (Layout::add_eh_frame_for_plt): New function.
3394 * layout.h (class Layout): Update declarations.
3395 * merge.cc (Merge_map::add_mapping): Add assertion.
3396 * i386.cc: Include "dwarf.h".
3397 (class Output_data_plt_i386): Make first_plt_entry,
3398 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
3399 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3400 and plt_eh_frame_fde.
3401 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3402 boundary. Call add_eh_frame_for_plt if appropriate.
3403 * x86_64.cc: Include "dwarf.h".
3404 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
3405 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
3406 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3407 and plt_eh_frame_fde.
3408 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3409 appropriate.
3410
3411 2011-06-29 Ian Lance Taylor <iant@google.com>
3412
3413 PR gold/12629
3414 * object.cc (Sized_relobj_file::layout_section): Change shdr
3415 parameter to be const.
3416 (Sized_relobj_file::layout_eh_frame_section): New function, broken
3417 out of do_layout.
3418 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3419 appropriate. Call layout_eh_frame_section.
3420 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3421 sections.
3422 * object.h (class Sized_relobj_file): Update declarations.
3423
3424 2011-06-29 Ian Lance Taylor <iant@google.com>
3425
3426 PR gold/12652
3427 * script.cc (Token::integer_value): Accept trailing M/m/K/k
3428 modifier.
3429 (Lex::gather_token): Accept trailing M/m/K/k for integers.
3430
3431 2011-06-29 Ian Lance Taylor <iant@google.com>
3432
3433 PR gold/12675
3434 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3435 SHT_X86_64_UNWIND.
3436 * layout.cc (Layout::layout_eh_frame): Likewise.
3437
3438 2011-06-29 Ian Lance Taylor <iant@google.com>
3439
3440 PR gold/12695
3441 * layout.cc (Layout::symtab_section_shndx): New function.
3442 * layout.h (class Layout): Declare symtab_section_shndx.
3443 * output.cc (Output_section::write_header): Call it.
3444
3445 2011-06-29 Ian Lance Taylor <iant@google.com>
3446
3447 PR gold/12818
3448 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3449 symbols which are not used in a relocation.
3450
3451 2011-06-28 Ian Lance Taylor <iant@google.com>
3452
3453 PR gold/12898
3454 * layout.cc (Layout::segment_precedes): Don't crash if a linker
3455 script create indistinguishable segments.
3456 (Layout::set_segment_offsets): Use stable_sort when sorting
3457 segments. Pass this to Compare_segments constructor.
3458 * layout.h (class Layout): Make segment_precedes non-static.
3459 (class Compare_segments): Change from struct to class. Add
3460 layout_ field. Add constructor.
3461 * script-sections.cc
3462 (Script_sections::attach_sections_using_phdrs_clause): Rename
3463 local orphan to is_orphan. Don't report failure to put empty
3464 section in segment. On attachment failure, report name of
3465 section, and attach to first PT_LOAD segment.
3466
3467 2011-06-28 Ian Lance Taylor <iant@google.com>
3468
3469 PR gold/12934
3470 * target-select.cc (Target_selector::Target_selector): Add
3471 emulation parameter. Change all callers.
3472 (select_target_by_bfd_name): Rename from select_target_by_name.
3473 Change all callers.
3474 (select_target_by_emulation): New function.
3475 (supported_emulation_names): New function.
3476 * target-select.h (class Target_selector): Add emulation_ field.
3477 Update declarations.
3478 (Target_selector::recognize_by_bfd_name): Rename from
3479 recognize_by_name. Change all callers.
3480 (Target_selector::supported_bfd_names): Rename from
3481 supported_names. Change all callers.
3482 (Target_selector::recognize_by_emulation): New function.
3483 (Target_selector::supported_emulations): New function.
3484 (Target_selector::emulation): New function.
3485 (Target_selector::do_recognize_by_bfd_name): Rename from
3486 do_recognize_by_name. Change all callers.
3487 (Target_selector::do_supported_bfd_names): Rename from
3488 do_supported_names. Change all callers.
3489 (Target_selector::do_recognize_by_emulation): New function.
3490 (Target_selector::do_supported_emulations): New function.
3491 (select_target_by_bfd_name): Change name in declaration.
3492 (select_target_by_emulation): Declare.
3493 (supported_emulation_names): Declare.
3494 * parameters.cc (parameters_force_valid_target): Try to find
3495 target based on emulation from -m option.
3496 * options.h (class General_options): Change doc string for -m.
3497 * options.cc (help): Print emulations.
3498 (General_options::parse_V): Likewise.
3499 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3500 Add emulation parameter. Change all callers.
3501
3502 2011-06-28 Ian Lance Taylor <iant@google.com>
3503
3504 * target.h (class Target): Add osabi_ field.
3505 (Target::osabi): New function.
3506 (Target::set_osabi): New function.
3507 (Target::Target): Initialize osabi_.
3508 (Target::do_adjust_elf_header): Make pure virtual.
3509 (Sized_target::do_adjust_elf_header): Declare.
3510 * target.cc (Sized_target::do_adjust_elf_header): New function.
3511 (class Sized_target): Instantiate all versions.
3512 * freebsd.h (class Target_freebsd): Remove.
3513 (Target_selector_freebsd::do_recognize): Call set_osabi on
3514 Target.
3515 (Target_selector_freebsd::do_recognize_by_name): Likewise.
3516 (Target_selector_freebsd::set_osabi): Remove.
3517 * i386.cc (class Target_i386): Inherit from Sized_target rather
3518 than Target_freebsd.
3519 * x86_64.cc (class Target_x86_64): Likewise.
3520
3521 2011-06-28 Ian Lance Taylor <iant@google.com>
3522
3523 * target.h (Target::can_check_for_function_pointers): Rewrite.
3524 Make non-virtual.
3525 (Target::can_icf_inline_merge_sections): Likewise.
3526 (Target::section_may_have_icf_unsafe_poineters): Likewise.
3527 (Target::Target_info): Add can_icf_inline_merge_sections field.
3528 (Target::do_can_check_for_function_pointers): New virtual
3529 function.
3530 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3531 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3532 from can_check_for_function_pointers, move in file.
3533 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3534 section_may_have_icf_unsafe_poineters, move in file.
3535 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3536 * i386.cc (Target_i386::do_can_check_for_function_pointers):
3537 Rename from can_check_for_function_pointers, move in file.
3538 (Target_i386::can_icf_inline_merge_sections): Remove.
3539 (Target_i386::i386_info): Initialize
3540 can_icf_inline_merge_sections.
3541 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3542 Initialize can_icf_inline_merge_sections.
3543 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3544 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3545 Rename from can_check_for_function_pointers, move in file.
3546 (Target_x86_64::can_icf_inline_merge_sections): Remove.
3547 (Target_x86_64::x86_64_info): Initialize
3548 can_icf_inline_merge_sections.
3549 * testsuite/testfile.cc (Target_test::test_target_info):
3550 Likewise.
3551 * icf.cc (get_section_contents): Correct formatting.
3552
3553 2011-06-27 Ian Lance Taylor <iant@google.com>
3554
3555 * symtab.cc (Symbol::versioned_name): New function.
3556 (Symbol_table::add_to_final_symtab): Use versioned_name when
3557 appropriate.
3558 (Symbol_table::sized_write_symbol): Likewise.
3559 * symtab.h (class Symbol): Declare versioned_name.
3560 * stringpool.h (class Stringpool_template): Add variant of add
3561 which takes a std::basic_string.
3562 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3563 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3564 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3565 (ver_test_12.o): New target.
3566 * testsuite/Makefile.in: Rebuild.
3567
3568 2011-06-27 Doug Kwan <dougkwan@google.com>
3569
3570 * arm.cc (Arm_relocate_functions::thm_jump8,
3571 Arm_relocate_functions::thm_jump11): Use a wider signed
3572 type to compute offset.
3573 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3574 arm_thm_jump8.
3575 * testsuite/Makefile.in: Regenerate.
3576 * testsuite/arm_branch_in_range.sh: Check test results of
3577 arm_thm_jump11 and arm_thm_jump8.
3578 * testsuite/arm_thm_jump11.s: New test source file.
3579 * testsuite/arm_thm_jump11.t: New linker script.
3580 * testsuite/arm_thm_jump8.s: New test source file.
3581 * testsuite/arm_thm_jump8.t: New linker script.
3582
3583 2011-06-24 Ian Lance Taylor <iant@google.com>
3584
3585 * layout.cc: Include "object.h".
3586 (ctors_sections_in_init_array): New static variable.
3587 (Layout::is_ctors_in_init_array): New function.
3588 (Layout::layout): Add entry to ctors_sections_in_init_array if
3589 appropriate.
3590 * layout.h (class Layout): Declare is_ctors_in_init_array.
3591 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3592 is_ctors_reverse_view is set.
3593 (Sized_relobj_file::write_sections): Add layout parameter. Change
3594 all callers. Set is_ctors_reverse_view field of View_size.
3595 (Sized_relobj_file::reverse_words): New function.
3596 * object.h (Sized_relobj_file::View_size): Add
3597 is_ctors_reverse_view field.
3598 (class Sized_relobj_file): Update declarations.
3599 * testsuite/initpri3.c: New test.
3600 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3601 initpri3b.
3602 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3603 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3604 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3605 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3606 * testsuite/Makefile.in: Rebuild.
3607
3608 2011-06-24 Cary Coutant <ccoutant@google.com>
3609
3610 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3611 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3612 (debug_msg_cdebug.err): New targets.
3613 * testsuite/Makefile.in: Regenerate.
3614 * testsuite/debug_msg.sh: Check output of link with compressed debug.
3615 Fix checks for link with shared library.
3616
3617 2011-06-24 Doug Kwan <dougkwan@google.com>
3618
3619 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3620 skip empty text sections.
3621 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3622
3623 2011-06-22 Ian Lance Taylor <iant@google.com>
3624
3625 PR gold/12910
3626 * options.h (class General_options): Add --ctors-in-init-array.
3627 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3628 friends as SHT_PROGBITS for merging sections.
3629 (Layout::layout): Remove special handling of .init_array and
3630 friends. Don't sort if doing relocatable link. Sort for .ctors
3631 and .dtors if ctors_in_init_array.
3632 (Layout::make_output_section): Force correct section types for
3633 .init_array and friends. Don't sort if doing relocatable link,
3634 Don't sort .ctors and .dtors if ctors_in_init_array.
3635 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3636 (Layout::output_section_name): Add relobj parameter. Change all
3637 callers. Handle .ctors. and .dtors. in code rather than table.
3638 Handle .ctors and .dtors if ctors_in_init_array.
3639 (Layout::match_file_name): New function, moved from output.cc.
3640 * layout.h (class Layout): Update declarations.
3641 * output.cc: Include "layout.h".
3642 (Input_section_sort_entry::get_priority): New function.
3643 (Input_section_sort_entry::match_file_name): Just call
3644 Layout::match_file_name.
3645 (Output_section::Input_section_sort_init_fini_compare::operator()):
3646 Handle .ctors and .dtors. Sort by explicit priority rather than
3647 by name.
3648 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3649 * testsuite/initpri2.c: New test.
3650 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3651 (check_PROGRAMS): Add initpri2.
3652 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3653 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3654 * configure, testsuite/Makefile.in: Rebuild.
3655
3656 2011-06-19 Ian Lance Taylor <iant@google.com>
3657
3658 PR gold/12880
3659 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3660 .interp section to a PT_INTERP segment even if we have seen a
3661 --dynamic-linker option. Don't do it if we have seen a PHDRS
3662 clause in a linker script.
3663 (Layout::finalize): Don't create a .interp section if we've
3664 already create a PT_INTERP segment.
3665 (Layout::create_interp): Always call choose_output_section (revert
3666 patch of 2011-06-17). Don't create PT_INTERP segment.
3667 * script-sections.cc
3668 (Script_sections::create_note_and_tls_segments): Add a .interp
3669 section to a PT_INTERP segment even if we have seen a
3670 --dynamic-linker option.
3671
3672 2011-06-18 Ian Lance Taylor <iant@google.com>
3673
3674 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3675 merely because a non-PT_LOAD segment has a dynamic reloc.
3676
3677 2011-06-18 Ian Lance Taylor <iant@google.com>
3678
3679 * layout.cc (Layout::finish_dynamic_section): Don't create
3680 DT_FLAGS entry if not needed.
3681
3682 2011-06-18 Ian Lance Taylor <iant@google.com>
3683
3684 PR gold/12745
3685 * layout.cc (Layout::layout_eh_frame): Correct handling of
3686 writable .eh_frame section.
3687
3688 2011-06-17 Ian Lance Taylor <iant@google.com>
3689
3690 PR gold/12893
3691 * resolve.cc (Symbol_table::resolve): Don't give an error if a
3692 symbol is redefined with the exact same object and value.
3693
3694 2011-06-17 Ian Lance Taylor <iant@google.com>
3695
3696 PR gold/12880
3697 * layout.h (class Layout): Add interp_segment_ field.
3698 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3699 (Layout::attach_allocated_section_to_segment): If making shared
3700 library, put .interp section in PT_INTERP segment.
3701 (Layout::finalize): Also call create_interp if -dynamic-linker
3702 option was used.
3703 (Layout::create_interp): Assert that there is no PT_INTERP
3704 segment. If not using a SECTIONS clause, use make_output_section.
3705 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3706 * script-sections.cc
3707 (Script_sections::create_note_and_tls_segments): If making shared
3708 library, put .interp section in PT_INTERP segment.
3709
3710 2011-06-17 Ian Lance Taylor <iant@google.com>
3711
3712 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3713 when making a shared library.
3714
3715 2011-06-17 Ian Lance Taylor <iant@google.com>
3716
3717 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3718 parameter. Change all callers. Don't issue warning about PC32
3719 against locally defined symbol.
3720
3721 2011-06-16 Ian Lance Taylor <iant@google.com>
3722
3723 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3724 occurs in same object.
3725
3726 2011-06-14 Alan Modra <amodra@gmail.com>
3727
3728 * po/POTFILES.in: Regenerate.
3729
3730 2011-06-09 Ian Lance Taylor <iant@google.com>
3731
3732 * script-sections.cc
3733 (Orphan_output_section::set_section_addresses): For a relocatable
3734 link set address to 0.
3735
3736 2011-06-09 Cary Coutant <ccoutant@google.com>
3737
3738 PR gold/12804
3739 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3740 used with --compress-debug-sections.
3741 * gold/object.cc (Sized_relobj_file::do_layout): Report
3742 uncompressed size of compressed input sections.
3743
3744 2011-06-08 Cary Coutant <ccoutant@google.com>
3745
3746 PR gold/12804
3747 * testsuite/two_file_test_2_v1.cc: Change initialization of
3748 v2 to keep it in .data.
3749
3750 2011-06-07 Cary Coutant <ccoutant@google.com>
3751
3752 * common.cc (Symbol_table::do_allocate_commons_list): Call
3753 gold_fallback.
3754 * errors.cc (Errors::fatal): Adjust call to gold_exit.
3755 (Errors::fallback): New function.
3756 (gold_fallback): New function.
3757 * errors.h (Errors::fallback): New function.
3758 * gold.cc (gold_exit): Change status parameter to enum; adjust
3759 all callers.
3760 (queue_initial_tasks): Call gold_fallback.
3761 * gold.h: Include cstdlib.
3762 (Exit_status): New enum type.
3763 (gold_exit): Change status parameter to enum.
3764 (gold_fallback): New function.
3765 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3766 (Layout::create_symtab_sections): Likewise.
3767 (Layout::create_shdrs): Likewise.
3768 * main.cc (main): Adjust call to gold_exit.
3769 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3770 (Output_data_got::add_got_entry_pair): Likewise.
3771 (Output_section::add_input_section): Likewise.
3772 (Output_section::add_output_section_data): Likewise.
3773 (Output_segment::set_section_list_addresses): Likewise.
3774 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3775
3776 2011-06-07 Cary Coutant <ccoutant@google.com>
3777
3778 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3779 for incremental links.
3780 * output.cc (Output_segment::set_section_list_addresses): Remove
3781 FIXME and test for TLS or BSS.
3782
3783 2011-06-07 Cary Coutant <ccoutant@google.com>
3784
3785 * testsuite/Makefile.am: Add incremental_copy_test,
3786 incremental_common_test_1.
3787 * testsuite/Makefile.in: Regenerate.
3788 * testsuite/common_test_1_v1.c: New source file.
3789 * testsuite/common_test_1_v2.c: New source file.
3790 * testsuite/copy_test_v1.cc: New source file.
3791
3792 2011-06-07 Cary Coutant <ccoutant@google.com>
3793
3794 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3795 update, allocate common from bss section's free list.
3796 * incremental-dump.cc (dump_incremental_inputs): Print flag for
3797 linker-defined symbols.
3798 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3799 Skip GOT and PLT entries that are no longer referenced.
3800 (Output_section_incremental_inputs::write_info_blocks): Mark
3801 linker-defined symbols.
3802 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3803 * output.cc (Output_section::allocate): New function.
3804 * output.h (Output_section::allocate): New function.
3805 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3806 linker-defined symbols.
3807 (Symbol::override_base_with_special): Copy is_predefined_ flag.
3808 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3809 (Symbol::init_base_output_data): Likewise.
3810 (Symbol::init_base_output_segment): Likewise.
3811 (Symbol::init_base_constant): Likewise.
3812 (Sized_symbol::init_output_data): Likewise.
3813 (Sized_symbol::init_output_segment): Likewise.
3814 (Sized_symbol::init_constant): Likewise.
3815 (Symbol_table::do_define_in_output_data): Likewise.
3816 (Symbol_table::do_define_in_output_segment): Likewise.
3817 (Symbol_table::do_define_as_constant): Likewise.
3818 * symtab.h (Symbol::is_predefined): New function.
3819 (Symbol::init_base_output_data): Add is_predefined parameter.
3820 (Symbol::init_base_output_segment): Likewise.
3821 (Symbol::init_base_constant): Likewise.
3822 (Symbol::is_predefined_): New data member.
3823 (Sized_symbol::init_output_data): Add is_predefined parameter.
3824 (Sized_symbol::init_output_segment): Likewise.
3825 (Sized_symbol::init_constant): Likewise.
3826 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3827
3828 2011-06-07 Cary Coutant <ccoutant@google.com>
3829
3830 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3831 instead of emit_copy_reloc.
3832 (Copy_relocs::emit_copy_reloc): Refactor.
3833 (Copy_relocs::make_copy_reloc): New function.
3834 (Copy_relocs::add_copy_reloc): Remove.
3835 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3836 section.
3837 (Copy_relocs::make_copy_reloc): New function.
3838 (Copy_relocs::add_copy_reloc): Remove.
3839 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3840 unchanged input files.
3841 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3842 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3843 Reserve BSS space for COPY relocations.
3844 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3845 (Output_section_incremental_inputs::write_info_blocks): Record
3846 whether a symbol is copied from a shared object.
3847 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3848 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3849 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3850 (Incremental_input_entry_reader::get_output_symbol_index): Add
3851 is_copy parameter.
3852 (Incremental_binary::emit_copy_relocs): New function.
3853 (Incremental_binary::do_emit_copy_relocs): New function.
3854 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3855 new data member.
3856 (Sized_incremental_binary::add_copy_reloc): New function.
3857 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3858 (Sized_incremental_binary::Copy_reloc): New struct.
3859 (Sized_incremental_binary::Copy_relocs): New typedef.
3860 (Sized_incremental_binary::copy_relocs_): New data member.
3861 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3862 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3863 * target.h (Sized_target::emit_copy_reloc): New function.
3864 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3865
3866 2011-06-02 Cary Coutant <ccoutant@google.com>
3867
3868 PR gold/12163
3869 * gold/archive.cc (Archive::Archive): Initialize new data member.
3870 (Archive::include_all_members): Return if archive has already been
3871 included.
3872 * gold/archive.h (Archive::include_all_members_): New data member.
3873
3874 2011-06-02 Nick Clifton <nickc@redhat.com>
3875
3876 * dynobj.h: Fix spelling mistake in comment.
3877 * output.cc: Likewise.
3878
3879 2011-05-31 Doug Kwan <dougkwan@google.com>
3880 Asier Llano
3881
3882 PR gold/12826
3883 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3884 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3885 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
3886 redundant arm_exidx_test.so.
3887 * testsuite/Makefile.in: Regenerate.
3888 (check_SCRIPTS): Add pr12826.sh
3889 (check_DATA): Add pr12826.stdout
3890 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3891 * testsuite/pr12826.sh: New file.
3892 * testsuite/pr12826_1.s: Ditto.
3893 * testsuite/pr12826_1.s: Ditto.
3894
3895 2011-05-30 Ian Lance Taylor <iant@google.com>
3896
3897 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3898 sections.
3899
3900 2011-05-29 Ian Lance Taylor <iant@google.com>
3901
3902 PR gold/12804
3903 * testsuite/Makefile.am: Use different file name for two_file_test
3904 temporary file for each incremental test.
3905 * testsuite/Makefile.in: Rebuild.
3906
3907 2011-05-29 Ian Lance Taylor <iant@google.com>
3908
3909 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3910 binary input file is empty.
3911
3912 2011-05-27 Ian Lance Taylor <iant@google.com>
3913
3914 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3915 (ver_test_9.so): Likewise.
3916 * testsuite/Makefile.in: Rebuild.
3917
3918 2011-05-26 Cary Coutant <ccoutant@google.com>
3919
3920 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3921 * incremental.cc (Incremental_inputs::report_input_section): Fix
3922 comment, indentation.
3923 (Incremental_inputs::report_comdat_group): New function.
3924 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3925 of data for incremental input file entry.
3926 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3927 group count, COMDAT group signatures.
3928 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3929 an unchanged input file.
3930 * incremental.h (Incremental_object_entry::Incremental_object_entry):
3931 Initialize new data member.
3932 (Incremental_object_entry::add_comdat_group): New function.
3933 (Incremental_object_entry::get_comdat_group_count): New function.
3934 (Incremental_object_entry::get_comdat_signature_key): New function.
3935 (Incremental_object_entry::groups_): New data member.
3936 (Incremental_inputs::report_comdat_group): New function.
3937 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3938 data for incremental input file entry.
3939 (Incremental_input_entry_reader::get_comdat_group_count): New function.
3940 (Incremental_input_entry_reader::get_input_section): Adjust size of
3941 data for incremental input file entry.
3942 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3943 (Incremental_input_entry_reader::get_comdat_group_signature): New
3944 function.
3945 * object.cc (Sized_relobj::include_section_group): Report kept
3946 COMDAT groups for incremental links.
3947
3948 2011-05-24 David Meyer <pdox@google.com>
3949
3950 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3951 with name parameter. Add found_name parameter.
3952 * fileread.cc (Input_file::find_file): Adjust code accordingly.
3953 * dirsearch.h (class Dirsearch): Update declaration.
3954
3955 2011-05-24 Ian Lance Taylor <iant@google.com>
3956
3957 * archive.cc (Library_base::should_include_member): Pull in object
3958 from archive if it defines the entry symbol.
3959 * parameters.cc (Parameters::entry): New function.
3960 * parameters.h (class Parameters): Declare entry.
3961 * output.h (class Output_file_header): Remove entry_ field.
3962 * output.cc (Output_file_header::Output_file_header): Remove entry
3963 parameter. Change all callers.
3964 (Output_file_header::entry): Use parameters->entry.
3965 * gold.cc (queue_middle_tasks): Likewise.
3966 * plugin.cc (Plugin_hook::run): Likewise.
3967
3968 2011-05-24 Cary Coutant <ccoutant@google.com>
3969
3970 * gold.cc (queue_initial_tasks): Pass incremental base filename
3971 to Output_file::open_base_file; don't print error message.
3972 * incremental-dump.cc (main): Adjust call to
3973 Output_file::open_for_modification.
3974 * incremental-dump.cc (main): Likewise.
3975 * incremental.cc (Incremental_inputs::report_command_line):
3976 Ignore --incremental-base option when comparing command lines.
3977 Ignore parameter when given as separate argument.
3978 * options.h (class General_options): Add --incremental-base.
3979 * output.cc (Output_file::Output_file):
3980 (Output_file::open_base_file): Add base_name and writable parameters;
3981 read base file into new file; print error message here.
3982 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3983 callers.
3984 * output.h (Output_file::open_for_modification): Rename to...
3985 (Output_file::open_base_file): ...this; add base_name and
3986 writable parameters; adjust all callers.
3987 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3988 callers.
3989 * testsuite/Makefile.am (incremental_test_4): Test
3990 --incremental-base.
3991 * testsuite/Makefile.in: Regenerate.
3992
3993 2011-05-24 Cary Coutant <ccoutant@google.com>
3994
3995 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3996 incremental_test_4.
3997 * testsuite/Makefile.in: Regenerate.
3998 * testsuite/two_file_test_1_v1.cc: New test source file.
3999 * testsuite/two_file_test_1b_v1.cc: New test source file.
4000 * testsuite/two_file_test_2_v1.cc: New test source file.
4001
4002 2011-05-24 Cary Coutant <ccoutant@google.com>
4003
4004 * dynobj.h (Dynobj::do_dynobj): New function.
4005 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4006 flag and soname for shared objects.
4007 * incremental.cc (Incremental_inputs::report_object): Make
4008 either Incremental_object_entry or Incremental_dynobj_entry; add
4009 soname to string table.
4010 (Incremental_inputs::report_input_section): Add assertion.
4011 (Output_section_incremental_inputs::set_final_data_size): Adjust
4012 type of input file entry for shared libraries; adjust size of
4013 shared library info entry.
4014 (Output_section_incremental_inputs::write_input_files): Write
4015 as_needed flag for shared libraries.
4016 (Output_section_incremental_inputs::write_info_blocks): Adjust type
4017 of input file entry for shared libraries; write soname.
4018 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4019 soname from incremental info.
4020 * incremental.h (enum Incremental_input_flags): Add
4021 INCREMENTAL_INPUT_AS_NEEDED.
4022 (Incremental_input_entry::Incremental_input_entry): Initialize new
4023 data member.
4024 (Incremental_input_entry::set_as_needed): New function.
4025 (Incremental_input_entry::as_needed): New function.
4026 (Incremental_input_entry::do_dynobj_entry): New function.
4027 (Incremental_input_entry::as_needed_): New data member.
4028 (Incremental_object_entry::Incremental_object_entry): Don't check
4029 for shared library.
4030 (Incremental_object_entry::do_type): Likewise.
4031 (class Incremental_dynobj_entry): New class.
4032 (Incremental_input_entry_reader::as_needed): New function.
4033 (Incremental_input_entry_reader::get_soname): New function.
4034 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4035 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4036 size of shared library info entry.
4037 * layout.cc (Layout::finish_dynamic_section): Don't test for
4038 incremental link when adding DT_NEEDED entries.
4039 * object.h (Object::Object): Initialize new data member.
4040 (Object::dynobj): New function.
4041 (Object::set_as_needed): New function.
4042 (Object::as_needed): New function.
4043 (Object::do_dynobj): New function.
4044 (Object::as_needed_): New data member.
4045
4046 2011-05-24 Cary Coutant <ccoutant@google.com>
4047
4048 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4049 info; adjust display of GOT entries.
4050 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4051 vector of input objects; remove file_status_.
4052 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4053 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4054 got_plt reader; call target hooks to reserve GOT entries.
4055 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4056 of input file info header and GOT info entry.
4057 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4058 relocation info.
4059 (Got_plt_view_info::got_descriptor): Remove.
4060 (Got_plt_view_info::sym_index): New data member.
4061 (Got_plt_view_info::input_index): New data member.
4062 (Local_got_offset_visitor::visit): Write input file index.
4063 (Global_got_offset_visitor::visit): Write 0 for input file index.
4064 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4065 with sym_index and input_index.
4066 (Output_section_incremental_inputs::write_got_plt): Adjust size of
4067 incremental info GOT entry; replace got_descriptor with input_index.
4068 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4069 map from input file index to object.
4070 (Sized_relobj_incr::do_layout): Replace direct data member reference
4071 with accessor function.
4072 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4073 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4074 Adjust size of input file info header.
4075 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4076 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4077 (Incremental_input_entry_reader::get_input_section): Adjust size of
4078 input file info header.
4079 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4080 of incremental info GOT entry.
4081 (Incremental_got_plt_reader::get_got_desc): Remove.
4082 (Incremental_got_plt_reader::get_got_symndx): New function.
4083 (Incremental_got_plt_reader::get_got_input_index): New function.
4084 (Sized_incremental_binary::Sized_incremental_binary): Remove
4085 file_status_; add input_objects_.
4086 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4087 (Sized_incremental_binary::set_file_is_unchanged): Remove.
4088 (Sized_incremental_binary::file_is_unchanged): Remove.
4089 (Sized_incremental_binary::set_input_object): New function.
4090 (Sized_incremental_binary::input_object): New function.
4091 (Sized_incremental_binary::file_status_): Remove.
4092 (Sized_incremental_binary::input_objects_): New data member.
4093 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4094 references.
4095 (Sized_relobj_incr::invalid_address): Move to base class.
4096 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4097 class.
4098 (Sized_relobj_incr::do_output_section_offset): Likewise.
4099 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4100 (Sized_relobj_incr::section_offsets_): Likewise.
4101 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4102 function.
4103 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4104 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4105 with accessor function.
4106 (Sized_relobj_file::do_layout): Likewise.
4107 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4108 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4109 (Sized_relobj_file::compute_final_local_value): Replace refs to
4110 section_offsets_ with accessor function.
4111 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4112 * object.h (Relobj::Relobj): Initialize new data members.
4113 (Relobj::add_dyn_reloc): New function.
4114 (Relobj::first_dyn_reloc): New function.
4115 (Relobj::dyn_reloc_count): New function.
4116 (Relobj::first_dyn_reloc_): New data member.
4117 (Relobj::dyn_reloc_count_): New data member.
4118 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4119 references.
4120 (Sized_relobj::Address): New typedef.
4121 (Sized_relobj::invalid_address): Move here from child class.
4122 (Sized_relobj::Sized_relobj): Initialize new data members.
4123 (Sized_relobj::sized_relobj): New function.
4124 (Sized_relobj::is_output_section_offset_invalid): Move here from
4125 child class.
4126 (Sized_relobj::get_output_section_offset): Likewise.
4127 (Sized_relobj::local_has_got_offset): Likewise.
4128 (Sized_relobj::local_got_offset): Likewise.
4129 (Sized_relobj::set_local_got_offset): Likewise.
4130 (Sized_relobj::do_for_all_local_got_entries): Likewise.
4131 (Sized_relobj::clear_got_offsets): New function.
4132 (Sized_relobj::section_offsets): Move here from child class.
4133 (Sized_relobj::do_output_section_offset): Likewise.
4134 (Sized_relobj::do_set_section_offset): Likewise.
4135 (Sized_relobj::Local_got_offsets): Likewise.
4136 (Sized_relobj::local_got_offsets_): Likewise.
4137 (Sized_relobj::section_offsets_): Likewise.
4138 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4139 references.
4140 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4141 class.
4142 (Sized_relobj_file::sized_relobj): New function
4143 (Sized_relobj_file::local_has_got_offset): Move to base class.
4144 (Sized_relobj_file::local_got_offset): Likewise.
4145 (Sized_relobj_file::set_local_got_offset): Likewise.
4146 (Sized_relobj_file::get_output_section_offset): Likewise.
4147 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4148 (Sized_relobj_file::do_output_section_offset): Likewise.
4149 (Sized_relobj_file::do_set_section_offset): Likewise.
4150 (Sized_relobj_file::Local_got_offsets): Likewise.
4151 (Sized_relobj_file::local_got_offsets_): Likewise.
4152 (Sized_relobj_file::section_offsets_): Likewise.
4153 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4154 (all constructors).
4155 (set_needs_dynsym_index): Convert relobj to derived class pointer.
4156 (Output_reloc::get_symbol_index): Likewise.
4157 (Output_reloc::local_section_offset): Likewise.
4158 (Output_reloc::get_address): Likewise.
4159 (Output_reloc::symbol_value): Likewise.
4160 (Output_data_got::reserve_slot): Move to class definition.
4161 (Output_data_got::reserve_local): New function.
4162 (Output_data_got::reserve_slot_for_global): Remove.
4163 (Output_data_got::reserve_global): New function.
4164 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4165 (all constructors, two instantiations).
4166 (Output_reloc::get_relobj): New function (two instantiations).
4167 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4168 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4169 (Output_data_reloc::add_global): Adjust type of relobj.
4170 (Output_data_reloc::add_global_relative): Likewise.
4171 (Output_data_reloc::add_symbolless_global_addend): Likewise.
4172 (Output_data_reloc::add_local): Likewise.
4173 (Output_data_reloc::add_local_relative): Likewise.
4174 (Output_data_reloc::add_symbolless_local_addend): Likewise.
4175 (Output_data_reloc::add_local_section): Likewise.
4176 (Output_data_reloc::add_output_section): Likewise.
4177 (Output_data_reloc::add_absolute): Likewise.
4178 (Output_data_reloc::add_target_specific): Likewise.
4179 (Output_data_got::reserve_slot): Move definition here.
4180 (Output_data_got::reserve_local): New function.
4181 (Output_data_got::reserve_global): New function.
4182 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4183 section_offsets_ with accessor function.
4184 (Sized_relobj_file::write_sections): Likewise.
4185 (Sized_relobj_file::do_relocate_sections): Likewise.
4186 * target.h (Sized_target::reserve_local_got_entry): New function.
4187 (Sized_target::reserve_global_got_entry): New function.
4188 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4189 (Target_x86_64::reserve_global_got_entry): New function.
4190 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4191
4192 2011-05-23 Cary Coutant <ccoutant@google.com>
4193
4194 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4195 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4196 bit when checking got_type.
4197 * incremental.cc (Sized_incremental_binary::setup_readers):
4198 Store symbol table and string table locations; initialize bit vector
4199 of file status flags.
4200 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4201 unchanged files.
4202 (Sized_incremental_binary::do_process_got_plt): New function.
4203 (Sized_incremental_binary::get_symtab_view): Use stored locations.
4204 (Output_section_incremental_inputs::set_final_data_size): Record
4205 file index for each input file.
4206 (Output_section_incremental_inputs::write_got_plt): Store file index
4207 instead of input entry offset for each GOT entry.
4208 * incremental.h
4209 (Incremental_input_entry::Incremental_input_entry): Initialize new
4210 data member.
4211 (Incremental_input_entry::set_offset): Store file index.
4212 (Incremental_input_entry::get_file_index): New function.
4213 (Incremental_input_entry::file_index_): New data member.
4214 (Incremental_binary::process_got_plt): New function.
4215 (Incremental_binary::do_process_got_plt): New function.
4216 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4217 data members.
4218 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4219 (Sized_incremental_binary::set_file_is_unchanged): New function.
4220 (Sized_incremental_binary::file_is_unchanged): New function.
4221 (Sized_incremental_binary::do_process_got_plt): New function.
4222 (Sized_incremental_binary::file_status_): New data member.
4223 (Sized_incremental_binary::main_symtab_loc_): New data member.
4224 (Sized_incremental_binary::main_strtab_loc_): New data member.
4225 * output.cc (Output_data_got::Got_entry::write): Add case
4226 RESERVED_CODE.
4227 (Output_data_got::add_global): Call add_got_entry.
4228 (Output_data_got::add_global_plt): Likewise.
4229 (Output_data_got::add_global_with_rel): Likewise.
4230 (Output_data_got::add_global_with_rela): Likewise.
4231 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4232 (Output_data_got::add_global_pair_with_rela): Likewise.
4233 (Output_data_got::add_local): Call add_got_entry.
4234 (Output_data_got::add_local_plt): Likewise.
4235 (Output_data_got::add_local_with_rel): Likewise.
4236 (Output_data_got::add_local_with_rela): Likewise.
4237 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4238 (Output_data_got::add_local_pair_with_rela): Likewise.
4239 (Output_data_got::reserve_slot): New function.
4240 (Output_data_got::reserve_slot_for_global): New function.
4241 (Output_data_got::add_got_entry): New function.
4242 (Output_data_got::add_got_entry_pair): New function.
4243 (Output_section::add_output_section_data): Edit FIXME.
4244 * output.h
4245 (Output_section_data_build::Output_section_data_build): New
4246 constructor with size parameter.
4247 (Output_data_space::Output_data_space): Likewise.
4248 (Output_data_got::Output_data_got): Initialize new data member; new
4249 constructor with size parameter.
4250 (Output_data_got::add_constant): Call add_got_entry.
4251 (Output_data_got::reserve_slot): New function.
4252 (Output_data_got::reserve_slot_for_global): New function.
4253 (class Output_data_got::Got_entry): Add RESERVED_CODE.
4254 (Output_data_got::add_got_entry): New function.
4255 (Output_data_got::add_got_entry_pair): New function.
4256 (Output_data_got::free_list_): New data member.
4257 * target.h (Sized_target::init_got_plt_for_update): New function.
4258 (Sized_target::register_global_plt_entry): New function.
4259 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4260 Initialize new data member; call init; add constructor with PLT count.
4261 (Output_data_plt_x86_64::init): New function.
4262 (Output_data_plt_x86_64::add_relocation): New function.
4263 (Output_data_plt_x86_64::reserve_slot): New function.
4264 (Output_data_plt_x86_64::free_list_): New data member.
4265 (Target_x86_64::init_got_plt_for_update): New function.
4266 (Target_x86_64::register_global_plt_entry): New function.
4267 (Output_data_plt_x86_64::add_entry): Allocate from free list for
4268 incremental updates.
4269 (Output_data_plt_x86_64::add_relocation): New function.
4270 * testsuite/object_unittest.cc (Object_test): Set default options.
4271
4272 2011-05-16 Ian Lance Taylor <iant@google.com>
4273
4274 * options.h (class General_options): Make -i a synonym for -r.
4275
4276 2011-05-16 Ian Lance Taylor <iant@google.com>
4277
4278 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4279
4280 2011-05-10 Cary Coutant <ccoutant@google.com>
4281
4282 * object.cc (Sized_relobj::do_count_local_symbols): Check for
4283 strip_all (-s).
4284
4285 2011-05-06 Ian Lance Taylor <iant@google.com>
4286
4287 * layout.cc (Layout::layout): If the output section flags change,
4288 update the ordering.
4289
4290 2011-04-25 Cary Coutant <ccoutant@google.com>
4291
4292 * incremental-dump.cc (dump_incremental_inputs): Print local
4293 symbol info for each input file.
4294 * incremental.cc
4295 (Output_section_incremental_inputs::set_final_data_size): Add local
4296 symbol info to input file entries in incremental info.
4297 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4298 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4299 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4300 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4301 implementation.
4302 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4303 (Sized_incr_relobj::do_relocate): Write the local symbols.
4304 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4305 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4306 Adjust size of input file header.
4307 (Incremental_inputs_reader::get_local_symbol_offset): New function.
4308 (Incremental_inputs_reader::get_local_symbol_count): New function.
4309 (Incremental_inputs_reader::get_input_section): Adjust size of input
4310 file header.
4311 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4312 (Sized_incr_relobj::This): New typedef.
4313 (Sized_incr_relobj::sym_size): New const data member.
4314 (Sized_incr_relobj::Local_symbol): New struct.
4315 (Sized_incr_relobj::do_output_local_symbol_count): New function.
4316 (Sized_incr_relobj::do_local_symbol_offset): New function.
4317 (Sized_incr_relobj::local_symbol_count_): New data member.
4318 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4319 (Sized_incr_relobj::local_symbol_index_): New data member.
4320 (Sized_incr_relobj::local_symbol_offset_): New data member.
4321 (Sized_incr_relobj::local_dynsym_offset_): New data member.
4322 (Sized_incr_relobj::local_symbols_): New data member.
4323 * object.h (Relobj::output_local_symbol_count): New function.
4324 (Relobj::local_symbol_offset): New function.
4325 (Relobj::do_output_local_symbol_count): New function.
4326 (Relobj::do_local_symbol_offset): New function.
4327 (Sized_relobj::do_output_local_symbol_count): New function.
4328 (Sized_relobj::do_local_symbol_offset): New function.
4329
4330 2011-04-22 Vladimir Simonov <sv@sw.ru>
4331
4332 * descriptors.cc (set_close_on_exec): New function.
4333 (Descriptors::open): Use set_close_on_exec.
4334 * output.cc (S_ISLNK): Define if not defined.
4335
4336 2011-04-22 Cary Coutant <ccoutant@google.com>
4337
4338 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4339 global symbol map.
4340 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4341 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4342 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4343 relocations.
4344 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4345 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4346 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4347 * incremental.h
4348 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4349 function.
4350 (Incremental_binary::apply_incremental_relocs): New function.
4351 (Incremental_binary::do_apply_incremental_relocs): New function.
4352 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4353 data member.
4354 (Sized_incremental_binary::add_global_symbol): New function.
4355 (Sized_incremental_binary::global_symbol): New function.
4356 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4357 (Sized_incremental_binary::symbol_map_): New data member.
4358 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4359 * target.h (Sized_target::apply_relocation): New function.
4360 * target-reloc.h (apply_relocation): New function.
4361 * x86_64.cc (Target_x86_64::apply_relocation): New function.
4362
4363 2011-04-22 Doug Kwan <dougkwan@google.com>
4364
4365 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4366 flag of a SHT_ARM_EXIDX section.
4367 * testsuite/Makefile.am (arm_exidx_test): New test rules.
4368 * testsuite/Makefile.in: Regenerate.
4369 * testsuite/arm_exidx_test.s: New file.
4370 * testsuite/arm_exidx_test.sh: Same.
4371
4372 2011-04-20 Cary Coutant <ccoutant@google.com>
4373
4374 PR gold/12689
4375 * archive.h (Incremental_archive_entry::Archive_member):
4376 Initialize arg_serial_ (second constructor).
4377
4378 2011-04-17 Ian Lance Taylor <iant@google.com>
4379
4380 * object.cc (Relocate_info::location): Simplify location string.
4381 * errors.cc (Errors::error_at_location): Don't print program
4382 name.
4383 (Errors::warning_at_location): Likewise.
4384 (Errors::undefined_symbol): Likewise.
4385 * testsuite/debug_msg.sh: Update accordingly.
4386
4387 2011-04-14 Cary Coutant <ccoutant@google.com>
4388
4389 * gold/layout.cc (Layout::symtab_section_offset): New function.
4390 * gold/layout.h (Layout::symtab_section_offset): New function.
4391 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4392
4393 2011-04-12 Ian Lance Taylor <iant@google.com>
4394
4395 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
4396 with MREMAP_MAYMOVE.
4397 * output.h (class Output_file): Add map_is_allocated_ field.
4398 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
4399 not available, provide stubs. If mremap is not available, #define
4400 it to gold_mremap.
4401 (MREMAP_MAYMOVE): Define if not defined.
4402 (Output_file::Output_file): Initialize map_is_allocated_.
4403 (Output_file::resize): Check map_is_allocated_.
4404 (Output_file::map_anonymous): If mmap fails, use malloc.
4405 (Output_file::unmap): Don't do anything for an anonymous map.
4406 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
4407 is not available, provide stubs.
4408 (File_read::View::~View): Use free rather than delete[].
4409 (File_read::make_view): Use malloc rather than new[]. If mmap
4410 fails, use malloc.
4411 (File_read::find_or_make_view): Use malloc rather than new[].
4412 * gold.h: Remove HAVE_REMAP code.
4413 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
4414 exists. Rename mremap to gold_mremap. If mmap is not available
4415 don't do anything.
4416 * configure, config.in: Rebuild.
4417
4418 2011-04-11 Ian Lance Taylor <iant@google.com>
4419
4420 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4421 initialize local variable v.
4422
4423 2011-04-11 Cary Coutant <ccoutant@google.com>
4424
4425 * archive.cc (Archive::include_member): Adjust call to
4426 report_object.
4427 (Add_archive_symbols::run): Track argument serial numbers.
4428 (Lib_group::include_member): Likewise.
4429 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4430 * archive.h (Incremental_archive_entry::Archive_member):
4431 Initialize arg_serial_.
4432 (Archive_member::arg_serial_): New data member.
4433 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4434 (Sized_dynobj::do_add_symbols): Track symbols when doing an
4435 incremental link.
4436 (Sized_dynobj::do_for_all_local_got_entries): New function.
4437 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4438 function.
4439 * fileread.cc (get_mtime): New function.
4440 * fileread.h (get_mtime): New function.
4441 * gold.cc (queue_initial_tasks): Check for incremental update.
4442 (process_incremental_input): New function.
4443 (queue_middle_tasks): Don't force valid target for incremental
4444 update.
4445 * incremental-dump.cc (find_input_containing_global): Adjust
4446 size of symbol info entry.
4447 (dump_incremental_inputs): Dump argument serial number and
4448 in_system_directory flag; bias shndx by 1; print symbol names
4449 when dumping per-file symbol lists; use new symbol info readers.
4450 * incremental.cc
4451 (Output_section_incremental_inputs:update_data_size): New function.
4452 (Sized_incremental_binary::setup_readers): Setup input readers
4453 for each input file; build maps for files added from libraries
4454 and scripts.
4455 (Sized_incremental_binary::check_input_args): New function.
4456 (Sized_incremental_binary::do_check_inputs): Build map of argument
4457 serial numbers to input arguments.
4458 (Sized_incremental_binary::do_file_has_changed): Rename
4459 do_file_is_unchanged to this; compare file modification times.
4460 (Sized_incremental_binary::do_init_layout): New function.
4461 (Sized_incremental_binary::do_reserve_layout): New function.
4462 (Sized_incremental_binary::do_get_input_reader): Remove.
4463 (Sized_incremental_binary::get_symtab_view): New function.
4464 (Incremental_checker::can_incrementally_link_output_file): Remove.
4465 (Incremental_inputs::report_command_line): Exclude --debug options.
4466 (Incremental_inputs::report_archive_begin): Add parameter; track
4467 argument serial numbers; don't put input file entry for archive
4468 before archive members.
4469 (Incremental_inputs::report_archive_end): Put input file entry
4470 for archive after archive members.
4471 (Incremental_inputs::report_object): Add parameter; track argument
4472 serial numbers and in_system_directory flag.
4473 (Incremental_inputs::report_script): Add parameter; track argument
4474 serial numbers.
4475 (Output_section_incremental_inputs::set_final_data_size): Adjust
4476 size of symbol info entry; check for forwarding symbols.
4477 (Output_section_incremental_inputs::write_input_files): Write
4478 in_system_directory flag and argument serial number.
4479 (Output_section_incremental_inputs::write_info_blocks): Map section
4480 indices between incremental info and original input file; store
4481 input section index for each symbol.
4482 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4483 change operator() to visit().
4484 (class Global_got_offset_visitor): Likewise.
4485 (class Global_symbol_visitor_got_plt):
4486 (Output_section_incremental_inputs::write_got_plt): Use new visitor
4487 classes.
4488 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4489 (Sized_incr_relobj::do_read_symbols): New function.
4490 (Sized_incr_relobj::do_layout): New function.
4491 (Sized_incr_relobj::do_layout_deferred_sections): New function.
4492 (Sized_incr_relobj::do_add_symbols): New function.
4493 (Sized_incr_relobj::do_should_include_member): New function.
4494 (Sized_incr_relobj::do_for_all_global_symbols): New function.
4495 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4496 (Sized_incr_relobj::do_section_size): New function.
4497 (Sized_incr_relobj::do_section_name): New function.
4498 (Sized_incr_relobj::do_section_contents): New function.
4499 (Sized_incr_relobj::do_section_flags): New function.
4500 (Sized_incr_relobj::do_section_entsize): New function.
4501 (Sized_incr_relobj::do_section_address): New function.
4502 (Sized_incr_relobj::do_section_type): New function.
4503 (Sized_incr_relobj::do_section_link): New function.
4504 (Sized_incr_relobj::do_section_info): New function.
4505 (Sized_incr_relobj::do_section_addralign): New function.
4506 (Sized_incr_relobj::do_initialize_xindex): New function.
4507 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4508 (Sized_incr_relobj::do_read_relocs): New function.
4509 (Sized_incr_relobj::do_gc_process_relocs): New function.
4510 (Sized_incr_relobj::do_scan_relocs): New function.
4511 (Sized_incr_relobj::do_count_local_symbols): New function.
4512 (Sized_incr_relobj::do_finalize_local_symbols): New function.
4513 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4514 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4515 (Sized_incr_relobj::do_relocate): New function.
4516 (Sized_incr_relobj::do_set_section_offset): New function.
4517 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4518 (Sized_incr_dynobj::do_read_symbols): New function.
4519 (Sized_incr_dynobj::do_layout): New function.
4520 (Sized_incr_dynobj::do_add_symbols): New function.
4521 (Sized_incr_dynobj::do_should_include_member): New function.
4522 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4523 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4524 (Sized_incr_dynobj::do_section_size): New function.
4525 (Sized_incr_dynobj::do_section_name): New function.
4526 (Sized_incr_dynobj::do_section_contents): New function.
4527 (Sized_incr_dynobj::do_section_flags): New function.
4528 (Sized_incr_dynobj::do_section_entsize): New function.
4529 (Sized_incr_dynobj::do_section_address): New function.
4530 (Sized_incr_dynobj::do_section_type): New function.
4531 (Sized_incr_dynobj::do_section_link): New function.
4532 (Sized_incr_dynobj::do_section_info): New function.
4533 (Sized_incr_dynobj::do_section_addralign): New function.
4534 (Sized_incr_dynobj::do_initialize_xindex): New function.
4535 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4536 (make_sized_incremental_object): New function.
4537 (Incremental_library::copy_unused_symbols): New function.
4538 (Incremental_library::do_for_all_unused_symbols): New function.
4539 * incremental.h (enum Incremental_input_flags): New type.
4540 (class Incremental_checker): Remove.
4541 (Incremental_input_entry::Incremental_input_entry): Add argument
4542 serial number.
4543 (Incremental_input_entry::arg_serial): New function.
4544 (Incremental_input_entry::set_is_in_system_directory): New function.
4545 (Incremental_input_entry::is_in_system_directory): New function.
4546 (Incremental_input_entry::arg_serial_): New data member.
4547 (Incremental_input_entry::is_in_system_directory_): New data member.
4548 (class Script_info): Move here from script.h.
4549 (Script_info::Script_info): Add filename parameter.
4550 (Script_info::filename): New function.
4551 (Script_info::filename_): New data member.
4552 (Incremental_script_entry::Incremental_script_entry): Add argument
4553 serial number.
4554 (Incremental_object_entry::Incremental_object_entry): Likewise.
4555 (Incremental_object_entry::add_input_section): Build list of input
4556 sections with map to original shndx.
4557 (Incremental_object_entry::get_input_section_index): New function.
4558 (Incremental_object_entry::shndx_): New data member.
4559 (Incremental_object_entry::name_key_): Rename; adjust all refs.
4560 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4561 (Incremental_archive_entry::Incremental_archive_entry): Add argument
4562 serial number.
4563 (Incremental_inputs::report_archive_begin): Likewise.
4564 (Incremental_inputs::report_object): Likewise.
4565 (Incremental_inputs::report_script): Likewise.
4566 (class Incremental_global_symbol_reader): New class.
4567 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4568 and store flags and input file type.
4569 (Incremental_input_entry_reader::arg_serial): New function.
4570 (Incremental_input_entry_reader::type): Extract type from flags.
4571 (Incremental_input_entry_reader::is_in_system_directory): New function.
4572 (Incremental_input_entry_reader::get_input_section_count): Call
4573 accessor function for type.
4574 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4575 function for type; adjust size of global symbol entry.
4576 (Incremental_input_entry_reader::get_global_symbol_count): Call
4577 accessor function for type.
4578 (Incremental_input_entry_reader::get_object_count): Likewise.
4579 (Incremental_input_entry_reader::get_object_offset): Likewise.
4580 (Incremental_input_entry_reader::get_member_count): Likewise.
4581 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4582 (Incremental_input_entry_reader::get_member_offset): Likewise.
4583 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4584 (Incremental_input_entry_reader::Global_symbol_info): Remove.
4585 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4586 (Incremental_input_entry_reader::get_global_symbol_reader): New
4587 function.
4588 (Incremental_input_entry_reader::get_output_symbol_index): New
4589 function.
4590 (Incremental_input_entry_reader::type_): Remove.
4591 (Incremental_input_entry_reader::flags_): New data member.
4592 (Incremental_inputs_reader::input_file_offset): New function.
4593 (Incremental_inputs_reader::input_file_index): New function.
4594 (Incremental_inputs_reader::input_file): Call input_file_offset.
4595 (Incremental_inputs_reader::input_file_at_offset): New function.
4596 (Incremental_relocs_reader::get_r_type): Reformat.
4597 (Incremental_relocs_reader::get_r_shndx): Reformat.
4598 (Incremental_relocs_reader::get_r_offset): Reformat.
4599 (Incremental_relocs_reader::data): New function.
4600 (Incremental_binary::Incremental_binary): Initialize new data members.
4601 (Incremental_binary::check_inputs): Add cmdline parameter.
4602 (Incremental_binary::file_is_unchanged): Remove.
4603 (Input_reader::arg_serial): New function.
4604 (Input_reader::get_unused_symbol_count): New function.
4605 (Input_reader::get_unused_symbol): New function.
4606 (Input_reader::do_arg_serial): New function.
4607 (Input_reader::do_get_unused_symbol_count): New function.
4608 (Input_reader::do_get_unused_symbol): New function.
4609 (Incremental_binary::input_file_count): New function.
4610 (Incremental_binary::get_input_reader): Change signature to use
4611 index instead of filename.
4612 (Incremental_binary::file_has_changed): New function.
4613 (Incremental_binary::get_input_argument): New function.
4614 (Incremental_binary::get_library): New function.
4615 (Incremental_binary::get_script_info): New function.
4616 (Incremental_binary::init_layout): New function.
4617 (Incremental_binary::reserve_layout): New function.
4618 (Incremental_binary::output_file): New function.
4619 (Incremental_binary::do_check_inputs): New function.
4620 (Incremental_binary::do_file_is_unchanged): Remove.
4621 (Incremental_binary::do_file_has_changed): New function.
4622 (Incremental_binary::do_init_layout): New function.
4623 (Incremental_binary::do_reserve_layout): New function.
4624 (Incremental_binary::do_input_file_count): New function.
4625 (Incremental_binary::do_get_input_reader): Change signature.
4626 (Incremental_binary::input_args_map_): New data member.
4627 (Incremental_binary::library_map_): New data member.
4628 (Incremental_binary::script_map_): New data member.
4629 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4630 new data members.
4631 (Sized_incremental_binary::output_section): New function.
4632 (Sized_incremental_binary::inputs_reader): Add const.
4633 (Sized_incremental_binary::symtab_reader): Add const.
4634 (Sized_incremental_binary::relocs_reader): Add const.
4635 (Sized_incremental_binary::got_plt_reader): Add const.
4636 (Sized_incremental_binary::get_symtab_view): New function.
4637 (Sized_incremental_binary::Inputs_reader): New typedef.
4638 (Sized_incremental_binary::Input_entry_reader): New typedef.
4639 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4640 (Sized_incremental_binary::do_file_is_unchanged): Remove.
4641 (Sized_incremental_binary::do_file_has_changed): New function.
4642 (Sized_incremental_binary::do_init_layout): New function.
4643 (Sized_incremental_binary::do_reserve_layout): New function.
4644 (Sized_input_reader::Inputs_reader): Remove.
4645 (Sized_input_reader::Input_entry_reader): Remove.
4646 (Sized_input_reader::do_arg_serial): New function.
4647 (Sized_input_reader::do_get_unused_symbol_count): New function.
4648 (Sized_input_reader::do_get_unused_symbol): New function.
4649 (Sized_incremental_binary::do_input_file_count): New function.
4650 (Sized_incremental_binary::do_get_input_reader): Change signature;
4651 use index instead of filename.
4652 (Sized_incremental_binary::section_map_): New data member.
4653 (Sized_incremental_binary::input_entry_readers_): New data member.
4654 (class Sized_incr_relobj): New class.
4655 (class Sized_incr_dynobj): New class.
4656 (make_sized_incremental_object): New function.
4657 (class Incremental_library): New class.
4658 * layout.cc (Free_list::num_lists): New static data member.
4659 (Free_list::num_nodes): New static data member.
4660 (Free_list::num_removes): New static data member.
4661 (Free_list::num_remove_visits): New static data member.
4662 (Free_list::num_allocates): New static data member.
4663 (Free_list::num_allocate_visits): New static data member.
4664 (Free_list::init): New function.
4665 (Free_list::remove): New function.
4666 (Free_list::allocate): New function.
4667 (Free_list::dump): New function.
4668 (Free_list::print_stats): New function.
4669 (Layout_task_runner::run): Resize output file for incremental updates.
4670 (Layout::Layout): Initialize new data members.
4671 (Layout::set_incremental_base): New function.
4672 (Layout::init_fixed_output_section): New function.
4673 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4674 incremental updates.
4675 (Layout::create_gold_note): Do not create gold note section for
4676 incremental updates.
4677 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4678 for incremental updates.
4679 (Layout::set_section_offsets): For incremental updates, allocate space
4680 from free list.
4681 (Layout::create_symtab_sections): Layout with offsets relative to
4682 start of section; for incremental updates, allocate space from free
4683 list.
4684 (Layout::create_shdrs): For incremental updates, allocate space from
4685 free list.
4686 (Layout::finish_dynamic_section): For incremental updates, do not
4687 check --as-needed (fixed in subsequent patch).
4688 * layout.h (class Free_list): New class.
4689 (Layout::set_incremental_base): New function.
4690 (Layout::incremental_base): New function.
4691 (Layout::init_fixed_output_section): New function.
4692 (Layout::allocate): New function.
4693 (Layout::incremental_base_): New data member.
4694 (Layout::free_list_): New data member.
4695 * main.cc (main): Print Free_list statistics.
4696 * object.cc (Relobj::finalize_incremental_relocs): Add
4697 clear_counts parameter; clear counts only when clear_counts is set.
4698 (Sized_relobj::Sized_relobj): Initialize new base class.
4699 (Sized_relobj::do_layout): Don't report special sections.
4700 (Sized_relobj::do_for_all_local_got_entries): New function.
4701 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4702 symtab_off to all symbol table offsets.
4703 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4704 * object.h (class Got_offset_list): Move to top of file.
4705 (Object::Object): Allow case where input_file == NULL.
4706 (Object::~Object): Likewise.
4707 (Object::input_file): Assert that input_file != NULL.
4708 (Object::lock): Allow case where input_file == NULL.
4709 (Object::unlock): Likewise.
4710 (Object::is_locked): Likewise.
4711 (Object::token): Likewise.
4712 (Object::release): Likewise.
4713 (Object::is_incremental): New function.
4714 (Object::get_mtime): New function.
4715 (Object::for_all_local_got_entries): New function.
4716 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4717 (Object::set_is_in_system_directory): New function.
4718 (Object::is_in_system_directory): New function.
4719 (Object::do_is_incremental): New function.
4720 (Object::do_get_mtime): New function.
4721 (Object::do_for_all_local_got_entries): New function.
4722 (Object::is_in_system_directory_): New data member.
4723 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4724 (class Sized_relobj_base): New class.
4725 (class Sized_relobj): Derive from Sized_relobj_base.
4726 (class Sized_relobj::Symbols): Redeclare from base class.
4727 (class Sized_relobj::local_got_offset_list): Remove.
4728 (class Sized_relobj::Output_sections): Redeclare from base class.
4729 (class Sized_relobj::do_for_all_local_got_entries): New function.
4730 (class Sized_relobj::write_local_symbols): Add offset parameter.
4731 (class Sized_relobj::local_symbol_offset_): Update comment.
4732 (class Sized_relobj::local_dynsym_offset_): Update comment.
4733 * options.cc (Input_arguments::add_file): Remove const.
4734 * options.h (Input_file_argument::Input_file_argument):
4735 Initialize arg_serial_ (all constructors).
4736 (Input_file_argument::set_arg_serial): New function.
4737 (Input_file_argument::arg_serial): New function.
4738 (Input_file_argument::arg_serial_): New data member.
4739 (Input_arguments::Input_arguments): Initialize file_count_.
4740 (Input_arguments::add_file): Remove const.
4741 (Input_arguments::number_of_input_files): New function.
4742 (Input_arguments::file_count_): New data member.
4743 (Command_line::number_of_input_files): Call
4744 Input_arguments::number_of_input_files.
4745 * output.cc (Output_segment_headers::Output_segment_headers):
4746 Set current size.
4747 (Output_section::Input_section::current_data_size): New function.
4748 (Output_section::Output_section): Initialize new data members.
4749 (Output_section::add_input_section): Don't do merge sections for
4750 an incremental link; allocate space from free list for an
4751 incremental update.
4752 (Output_section::add_output_section_data): Allocate space from
4753 free list for an incremental update.
4754 (Output_section::update_data_size): New function.
4755 (Output_section::set_fixed_layout): New function.
4756 (Output_section::reserve): New function.
4757 (Output_segment::set_section_addresses): Remove const.
4758 (Output_segment::set_section_list_addresses): Remove const; allocate
4759 space from free list for an incremental update.
4760 (Output_segment::set_offset): Adjust size of RELRO segment for an
4761 incremental update.
4762 * output.h (Output_data::current_data_size): Move here from
4763 child classes.
4764 (Output_data::pre_finalize_data_size): New function.
4765 (Output_data::update_data_size): New function.
4766 (Output_section_headers::update_data_size): new function.
4767 (Output_section_data_build::current_data_size): Move to Output_data.
4768 (Output_data_strtab::update_data_size): New function.
4769 (Output_section::current_data_size): Move to Output_data.
4770 (Output_section::set_fixed_layout): New function.
4771 (Output_section::has_fixed_layout): New function.
4772 (Output_section::reserve): New function.
4773 (Output_section::update_data_size): New function.
4774 (Output_section::has_fixed_layout_): New data member.
4775 (Output_section::free_list_): New data member.
4776 (Output_segment::set_section_addresses): Remove const.
4777 (Output_segment::set_section_list_addresses): Remove const.
4778 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4779 New function.
4780 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4781 New function.
4782 * readsyms.cc (Read_symbols::do_read_symbols): Add library
4783 parameter when calling Add_symbols constructor; store argument
4784 serial number for members of a lib group.
4785 (Add_symbols::locks): Allow case where token == NULL.
4786 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4787 (Read_member::~Read_member): New function.
4788 (Read_member::is_runnable): New function.
4789 (Read_member::locks): New function.
4790 (Read_member::run): New function.
4791 (Check_script::~Check_script): New function.
4792 (Check_script::is_runnable): New function.
4793 (Check_script::locks): New function.
4794 (Check_script::run): New function.
4795 (Check_library::~Check_library): New function.
4796 (Check_library::is_runnable): New function.
4797 (Check_library::locks): New function.
4798 (Check_library::run): New function.
4799 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4800 (Add_symbols::library_): New data member.
4801 (class Read_member): New class.
4802 (class Check_script): New class.
4803 (class Check_library): New class.
4804 * reloc.cc (Read_relocs::is_runnable): Allow case where
4805 token == NULL.
4806 (Read_relocs::locks): Likewise.
4807 (Scan_relocs::locks): Likewise.
4808 (Relocate_task::locks): Likewise.
4809 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4810 to clear counters.
4811 (Sized_relobj::incremental_relocs_scan): Fix comment.
4812 (Sized_relobj::do_relocate): Pass output file offset to
4813 write_local_symbols.
4814 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4815 from class declaration.
4816 * script.cc (read_input_script): Allocate Script_info; pass
4817 argument serial number to report_script.
4818 * script.h (class Script_info): Move to incremental.h.
4819 * symtab.cc (Symbol_table::add_from_incrobj): New function.
4820 * symtab.h (Symbol_table::add_from_incrobj): New function.
4821 (Symbol_table::set_file_offset): New function.
4822
4823 2011-04-05 Cary Coutant <ccoutant@google.com>
4824
4825 * incremental-dump.cc (dump_incremental_inputs): Change signature
4826 to take a Sized_incremental_binary; change caller. Use readers
4827 in Sized_incremental_binary.
4828 * incremental.cc
4829 (Sized_incremental_binary::find_incremental_inputs_sections):
4830 Rename do_find_incremental_inputs_sections to this.
4831 (Sized_incremental_binary::setup_readers): New function.
4832 (Sized_incremental_binary::do_check_inputs): Check
4833 has_incremental_info_ flag; move setup code to setup_readers;
4834 use input readers.
4835 (Sized_incremental_binary::do_file_is_unchanged): New function.
4836 (Sized_incremental_binary::do_get_input_reader): New function.
4837 * incremental.h (class Incremental_binary): Move to end of file.
4838 (Incremental_binary::file_is_unchanged): New function.
4839 (Incremental_binary::do_file_is_unchanged): New function.
4840 (Incremental_binary::Input_reader): New class.
4841 (Incremental_binary::get_input_reader): New function.
4842 (class Sized_incremental_binary): Move to end of file.
4843 (Sized_incremental_binary::Sized_incremental_binary): Setup the
4844 input section reader classes.
4845 (Sized_incremental_binary::has_incremental_info): New function.
4846 (Sized_incremental_binary::inputs_reader): New function.
4847 (Sized_incremental_binary::symtab_reader): New function.
4848 (Sized_incremental_binary::relocs_reader): New function.
4849 (Sized_incremental_binary::got_plt_reader): New function.
4850 (Sized_incremental_binary::do_file_is_unchanged): New function.
4851 (Sized_incremental_binary::Sized_input_reader): New class.
4852 (Sized_incremental_binary::get_input_reader): New function.
4853 (Sized_incremental_binary::find_incremental_inputs_sections):
4854 Rename do_find_incremental_inputs_sections to this.
4855 (Sized_incremental_binary::setup_readers): New function.
4856 (Sized_incremental_binary::has_incremental_info_): New data member.
4857 (Sized_incremental_binary::inputs_reader_): New data member.
4858 (Sized_incremental_binary::symtab_reader_): New data member.
4859 (Sized_incremental_binary::relocs_reader_): New data member.
4860 (Sized_incremental_binary::got_plt_reader_): New data member.
4861 (Sized_incremental_binary::current_input_file_): New data member.
4862
4863 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
4864
4865 PR gold/12640
4866 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4867 violation.
4868
4869 2011-03-30 Cary Coutant <ccoutant@google.com>
4870
4871 * archive.cc (Archive::include_member): Adjust call to report_object.
4872 (Add_archive_symbols::run): Add script_info to call to
4873 report_archive_begin.
4874 (Lib_group::include_member): Adjust call to report_object.
4875 (Add_lib_group_symbols::run): Adjust call to report_object.
4876 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4877 blocks. Add object count for script input files.
4878 * incremental.cc (Incremental_inputs::report_archive_begin): Add
4879 script_info parameter; change all callers.
4880 (Incremental_inputs::report_object): Add script_info parameter;
4881 change all callers.
4882 (Incremental_inputs::report_script): Store backpointer to
4883 incremental info entry.
4884 (Output_section_incremental_inputs::set_final_data_size): Record
4885 additional information for scripts.
4886 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4887 * incremental.h (Incremental_script_entry::add_object): New function.
4888 (Incremental_script_entry::get_object_count): New function.
4889 (Incremental_script_entry::get_object): New function.
4890 (Incremental_script_entry::objects_): New data member; adjust
4891 constructor.
4892 (Incremental_inputs::report_archive_begin): Add script_info parameter.
4893 (Incremental_inputs::report_object): Add script_info parameter.
4894 (Incremental_inputs_reader::get_object_count): New function.
4895 (Incremental_inputs_reader::get_object_offset): New function.
4896 * options.cc (Input_arguments::add_file): Return reference to
4897 new input argument.
4898 * options.h (Input_argument::set_script_info): New function.
4899 (Input_argument::script_info): New function.
4900 (Input_argument::script_info_): New data member; adjust all
4901 constructors.
4902 (Input_file_group::add_file): Return reference to new input argument.
4903 (Input_file_lib::add_file): Likewise.
4904 (Input_arguments::add_file): Likewise.
4905 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4906 * script.cc (Parser_closure::Parser_closure): Add script_info
4907 parameter; adjust all callers.
4908 (Parser_closure::script_info): New function.
4909 (Parser_closure::script_info_): New data member.
4910 (read_input_script): Report scripts earlier to incremental info.
4911 (script_add_file): Set script_info in Input_argument.
4912 (script_add_library): Likewise.
4913 * script.h (Script_options::Script_info): Rewrite class.
4914
4915 2011-03-29 Cary Coutant <ccoutant@google.com>
4916
4917 * archive.cc (Library_base::should_include_member): Move
4918 method here from class Archive.
4919 (Archive::Archive): Initialize base class.
4920 (Archive::should_include_member): Move to base class.
4921 (Archive::do_for_all_unused_symbols): New function.
4922 (Add_archive_symbols::run): Remove redundant access to
4923 incremental_inputs.
4924 (Lib_group::Lib_group): Initialize base class.
4925 (Lib_group::do_filename): New function.
4926 (Lib_group::include_member): Pass pointer to Lib_group to
4927 report_object.
4928 (Lib_group::do_for_all_unused_symbols): New function.
4929 (Add_lib_group_symbols::run): Report archive information for
4930 incremental links.
4931 * archive.h (class Library_base): New base class.
4932 (class Archive): Derive from Library_base.
4933 (Archive::filename): Move to base class.
4934 (Archive::set_incremental_info): Likewise.
4935 (Archive::incremental_info): Likewise.
4936 (Archive::Should_include): Likewise.
4937 (Archive::should_include_member): Likewise.
4938 (Archive::Armap_entry): Remove.
4939 (Archive::Unused_symbol_iterator): Remove.
4940 (Archive::unused_symbols_begin): Remove.
4941 (Archive::unused_symbols_end): Remove.
4942 (Archive::do_filename): New function.
4943 (Archive::do_get_mtime): New function.
4944 (Archive::do_for_all_unused_symbols): New function.
4945 (Archive::task_): Move to base class.
4946 (Archive::incremental_info_): Likewise.
4947 (class Lib_group): Derive from Library_base.
4948 (Lib_group::do_filename): New function.
4949 (Lib_group::do_get_mtime): New function.
4950 (Lib_group::do_for_all_unused_symbols): New function.
4951 (Lib_group::task_): Move to base class.
4952 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4953 function.
4954 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4955 function.
4956 * incremental.cc (Incremental_inputs::report_archive_begin):
4957 Use Library_base; call library's get_mtime; add incremental inputs
4958 entry before members.
4959 (class Unused_symbol_visitor): New class.
4960 (Incremental_inputs::report_archive_end): Use Library_base; use
4961 visitor class to record unused symbols; don't add incremental inputs
4962 entry after members.
4963 (Incremental_inputs::report_object): Use Library_base.
4964 * incremental.h
4965 (Incremental_archive_entry::Incremental_archive_entry): Remove
4966 unused Archive parameter.
4967 (Incremental_inputs::report_archive_begin): Use Library_base.
4968 (Incremental_inputs::report_archive_end): Likewise.
4969 (Incremental_inputs::report_object): Likewise.
4970 * object.cc (Sized_relobj::do_for_all_global_symbols): New
4971 function.
4972 * object.h (Object::for_all_global_symbols): New function.
4973 (Object::do_for_all_global_symbols): New function.
4974 (Sized_relobj::do_for_all_global_symbols): New function.
4975 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
4976 function.
4977 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
4978 function.
4979
4980 2011-03-27 Ian Lance Taylor <iant@google.com>
4981
4982 * archive.cc (Archive::interpret_header): Return -1 if something
4983 goes wrong. Change callers accordingly.
4984
4985 2011-03-25 Cary Coutant <ccoutant@google.com>
4986
4987 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4988 * testsuite/Makefile.in: Regenerate.
4989
4990 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
4991
4992 * plugin.cc (get_view): New.
4993 (Plugin::load): Pass get_view to the plugin.
4994 (Plugin_manager::get_view): New.
4995
4996 2011-03-21 Ian Lance Taylor <iant@google.com>
4997
4998 * testsuite/final_layout.sh: Rewrite to not use dc.
4999 * testsuite/relro_test.sh: Fail if dc is not present.
5000
5001 2011-03-21 Sriraman Tallam <tmsriram@google.com>
5002
5003 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5004 Change == to -eq.
5005 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5006 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5007 Change == to -eq.
5008 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5009 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5010
5011 2011-03-14 Ian Lance Taylor <iant@google.com>
5012
5013 * script-sections.cc (Sort_output_sections::script_compare):
5014 Rename from is_before, change return type.
5015 (Sort_output_sections::operator()): Adjust accordingly.
5016
5017 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
5018
5019 PR gold/12572
5020 * testsuite/odr_violation2.cc: Add comment to make all error line
5021 numbers double digits.
5022 * testsuite/debug_msg.sh: Adjust expected errors.
5023
5024 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
5025
5026 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5027 but mark earlier ones as non-canonical
5028 (offset_to_iterator): Update search target and example
5029 (do_addr2line): Return extra lines in a vector*
5030 (format_file_lineno): Extract from do_addr2line
5031 (one_addr2line): Add vector* out-param
5032 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5033 when a lineno entry appeared last for its instruction
5034 (Dwarf_line_info): Add vector* out-param
5035 * object.cc (Relocate_info): Pass NULL for the vector* out-param
5036 * symtab.cc (Odr_violation_compare): Include the lineno in the
5037 comparison again.
5038 (linenos_from_loc): New. Combine the canonical line for an
5039 address with its other lines.
5040 (True_if_intersect): New. Helper functor to make
5041 std::set_intersection a query.
5042 (detect_odr_violations): Compare sets of lines instead of just
5043 one line for each function. This became less deterministic, but
5044 has fewer false positives.
5045 * symtab.h: Declarations.
5046 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5047 mix an optimized and non-optimized object in the same binary
5048 (odr_violation2.so): Same.
5049 * testsuite/Makefile.in: Regenerate from Makefile.am.
5050 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5051 * testsuite/debug_msg.sh: Update line numbers and add
5052 assertions.
5053 * testsuite/odr_violation1.cc: Use OdrDerived, in a
5054 non-optimized context.
5055 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5056 isn't inlined, and use OdrDerived in an optimized context.
5057 * testsuite/odr_header1.h: Defines OdrDerived, where
5058 optimization will change the
5059 first-instruction-in-the-destructor's file and line number.
5060 * testsuite/odr_header2.h: Defines OdrBase.
5061
5062 2011-03-09 Ian Lance Taylor <iant@google.com>
5063
5064 * fileread.cc (File_read::clear_views): Don't delete the whole
5065 file view.
5066
5067 2011-03-08 Ian Lance Taylor <iant@google.com>
5068
5069 PR gold/12525
5070 * fileread.cc: #include <climits>.
5071 (GOLD_IOV_MAX): Define.
5072 (File_read::read_multiple): Limit number of entries by iov_max.
5073 * fileread.h (class File_read): Always set max_readv_entries to
5074 128.
5075
5076 2011-03-07 Ian Lance Taylor <iant@google.com>
5077
5078 PR gold/12525
5079 * options.h (class General_options): Add -dy and -dn.
5080
5081 2011-03-02 Cary Coutant <ccoutant@google.com>
5082
5083 * testsuite/script_test_9.t: Add TLS segment.
5084
5085 2011-03-02 Simon Baldwin <simonb@google.com>
5086
5087 * configure.ac: Add check for gnu_indirect_function support in
5088 the toolchain building binutils.
5089 * configure: Rebuild.
5090
5091 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
5092
5093 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5094 plugin only symbols.
5095 (Symbol_table::sized_finalize_symbol) Mark symbol only present
5096 in plugin files as not needed in the symbol table.
5097
5098 2011-02-11 Sriraman Tallam <tmsriram@google.com>
5099
5100 * output.cc (Output_section::add_input_section): Delay fill
5101 generation for section ordering.
5102
5103 2011-02-09 Ian Lance Taylor <iant@google.com>
5104
5105 PR gold/12316
5106 * object.h (class Sized_relobj): Remove clear_local_symbols.
5107 * reloc.cc (Sized_relobj::do_relocate): Don't call
5108 clear_local_symbols.
5109
5110 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
5111
5112 * plugin.cc (is_visible_from_outside): Return true for symbols
5113 in the -u option.
5114
5115 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
5116
5117 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5118 filename.
5119
5120 2011-02-02 Sriraman Tallam <tmsriram@google.com>
5121
5122 * icf.h (is_section_foldable_candidate): Change type of parameter
5123 to std::string.
5124 * icf.cc (Icf::find_identical_sections): Change type of local variable
5125 section_name to be std::string.
5126 (is_function_ctor_or_dtor): Change type of parameter to std::string.
5127
5128 2011-01-25 Ian Lance Taylor <iant@google.com>
5129
5130 * script.cc (script_add_extern): Rewrite to use
5131 add_symbol_reference.
5132
5133 2011-01-25 Doug Kwan <dougkwan@google.com>
5134
5135 * icf.cc (get_section_contents): Always lock section's object.
5136
5137 2011-01-24 Ian Lance Taylor <iant@google.com>
5138
5139 * options.h (class General_options): Accept
5140 --no-detect-odr-violations.
5141
5142 2011-01-24 Ian Lance Taylor <iant@google.com>
5143
5144 * version.cc (version_string): Bump to 1.11.
5145
5146 2011-01-24 Ian Lance Taylor <iant@google.com>
5147
5148 * plugin.cc (class Plugin_rescan): Define new class.
5149 (Plugin_manager::claim_file): Set any_claimed_.
5150 (Plugin_manager::save_archive): New function.
5151 (Plugin_manager::save_input_group): New function.
5152 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5153 necessary.
5154 (Plugin_manager::new_undefined_symbol): New function.
5155 (Plugin_manager::rescan): New function.
5156 (Plugin_manager::rescannable_defines): New function.
5157 (Plugin_manager::add_input_file): Set any_added_.
5158 * plugin.h (class Plugin_manager): define new fields rescannable_,
5159 undefined_symbols_, any_claimed_, and any_added_. Declare
5160 Plugin_rescan as friend. Declare new functions.
5161 (Plugin_manager::Rescannable): Define type.
5162 (Plugin_manager::Rescannable_list): Define type.
5163 (Plugin_manager::Undefined_symbol_list): Define type.
5164 (Plugin_manager::Plugin_manager): Initialize new fields.
5165 * archive.cc (Archive::defines_symbol): New function.
5166 (Add_archive_symbols::run): Pass archive to plugins if any.
5167 * archive.h (class Archive): Declare defines_symbol.
5168 * readsyms.cc (Input_group::~Input_group): New function.
5169 (Finish_group::run): Pass input_group to plugins if any.
5170 * readsyms.h (class Input_group): Declare destructor.
5171 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5172 any.
5173
5174 2011-01-10 Ian Lance Taylor <iant@google.com>
5175
5176 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5177 section as relro.
5178 (Layout::set_segment_offsets): Reset increase_relro before calling
5179 set_section_addresses a second time.
5180
5181 2011-01-04 Cary Coutant <ccoutant@google.com>
5182
5183 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5184 sections before NOBITS sections.
5185
5186 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
5187
5188 * version.cc (print_version): Update copyright to 2011.
5189
5190 2010-12-23 Cary Coutant <ccoutant@google.com>
5191
5192 * output.h (Output_data_reloc::add_output_section): Pass OD instead
5193 of OS to this->add. Add OD parameter to second form of the function.
5194
5195 2010-12-20 Ian Lance Taylor <iant@google.com>
5196
5197 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5198 second of two consecutive entries with same offset.
5199
5200 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5201
5202 * testsuite/Makefile.am (ifuncmain2static_LDADD)
5203 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5204 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5205 to avoid unneeded links against $(LDADD).
5206 * testsuite/Makefile.in: Regenerate.
5207
5208 2010-12-15 Ian Lance Taylor <iant@google.com>
5209
5210 PR gold/12324
5211 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5212 for R_X86_64_32 and R_X86_64_PC32.
5213 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5214 ver_matching_def_pic.o.
5215 (ver_matching_def_pic.o): New target.
5216
5217 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5218
5219 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5220 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5221 Move definition before File_read::View member definitions.
5222 (File_read::View::~View): Initialize and hold lock before
5223 updating current_mapped_bytes.
5224
5225 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5226
5227 * dwarf_reader.cc: Remove outdated comment.
5228 * gold-threads.cc: Fix typo in error message.
5229 * archive.cc: Fix typos in comments.
5230 * archive.h: Likewise.
5231 * arm-reloc-property.cc: Likewise.
5232 * arm-reloc-property.h: Likewise.
5233 * arm-reloc.def: Likewise.
5234 * arm.cc: Likewise.
5235 * attributes.h: Likewise.
5236 * cref.cc: Likewise.
5237 * ehframe.cc: Likewise.
5238 * fileread.h: Likewise.
5239 * gold.h: Likewise.
5240 * i386.cc: Likewise.
5241 * icf.cc: Likewise.
5242 * incremental.h: Likewise.
5243 * int_encoding.cc: Likewise.
5244 * layout.h: Likewise.
5245 * main.cc: Likewise.
5246 * merge.h: Likewise.
5247 * object.cc: Likewise.
5248 * object.h: Likewise.
5249 * options.cc: Likewise.
5250 * readsyms.cc: Likewise.
5251 * reduced_debug_output.cc: Likewise.
5252 * reloc.cc: Likewise.
5253 * script-sections.cc: Likewise.
5254 * sparc.cc: Likewise.
5255 * symtab.h: Likewise.
5256 * target-reloc.h: Likewise.
5257 * target.cc: Likewise.
5258 * target.h: Likewise.
5259 * timer.cc: Likewise.
5260 * timer.h: Likewise.
5261 * x86_64.cc: Likewise.
5262
5263 2010-12-09 Cary Coutant <ccoutant@google.com>
5264
5265 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5266 stack.
5267 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5268 parameter; change all callers.
5269 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5270 * options.h (warn_execstack): New option.
5271
5272 2010-12-07 Doug Kwan <dougkwan@google.com>
5273
5274 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5275 like function call relocations.
5276
5277 2010-12-07 Ian Lance Taylor <iant@google.com>
5278
5279 * archive.cc (Archive::get_elf_object_for_member): Permit
5280 punconfigured to be NULL.
5281 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5282 (Archive::include_member): Pass NULL to get_elf_object_for_member
5283 if we searched for the archive and this is the first included
5284 object.
5285
5286 2010-12-01 Ian Lance Taylor <iant@google.com>
5287
5288 * dwarf_reader.h (class Sized_dwarf_line_info): Add
5289 track_relocs_type_ field.
5290 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5291 Set track_relocs_type_.
5292 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5293 contents when using RELA relocs.
5294 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5295 reloc_map_.
5296 * reloc.cc (Track_relocs::next_addend): New function.
5297 * reloc.h (class Track_relocs): Declare next_addend.
5298
5299 2010-12-01 Ian Lance Taylor <iant@google.com>
5300
5301 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5302 virtual destructor.
5303
5304 2010-12-01 Ian Lance Taylor <iant@google.com>
5305
5306 * README: Update compilers known to work and fail.
5307
5308 2010-11-23 Matthias Klose <doko@ubuntu.com>
5309
5310 * configure.in: For --enable-gold, handle value `default' instead of
5311 `both*'. Always install ld as ld.bfd, install as ld if gold is
5312 not the default.
5313 * configure: Regenerate.
5314
5315 2010-11-18 Doug Kwan <dougkwan@google.com>
5316
5317 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5318 and right_alignment to be zero. Store result alignment only if it is
5319 greater than existing alignment.
5320
5321 2010-11-16 Cary Coutant <ccoutant@google.com>
5322
5323 PR gold/12220
5324 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5325 Check for ".zdebug_line".
5326
5327 2010-11-16 Doug Kwan <dougkwan@google.com>
5328 Cary Coutant <ccoutant@google.com>
5329
5330 * output.h (Output_segment::set_section_addresses): Pass increase_relro
5331 by reference; adjust all callers.
5332 * output.cc (Output_segment::set_section_addresses): Adjust references
5333 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5334 list is empty.
5335 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5336 end at page boundary.
5337
5338 2010-11-16 Cary Coutant <ccoutant@google.com>
5339
5340 PR gold/12220
5341 * layout.cc (Layout::choose_output_section): Transform names of
5342 compressed sections even when using a script with a SECTIONS clause.
5343 (Layout::output_section_name): Remove code to transform
5344 compressed debug section names.
5345 * output.cc (Output_section::add_input_section): Use uncompressed
5346 section size when tracking input sections.
5347
5348 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
5349
5350 * symtab.h (Symbol::NON_PIC_REF): Remove.
5351 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5352 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
5353 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5354 (Symbol::use_plt_offset): Take a flags argument and pass it
5355 directly to needs_dynamic_reloc. Restrict check for undefined
5356 weak symbols to function calls.
5357 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5358 (Target_arm::Scan::global): Use it.
5359 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5360 (Target_arm::Relocate::relocate): Likewise.
5361 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5362 parameter with an r_type parameter. Use get_reference_flags
5363 to get the flags.
5364 (Target_arm::Relocate::relocate): Update accordingly.
5365 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5366 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5367 (Target_i386::Scan::global): Likewise.
5368 (Target_i386::Relocate::relocate): Likewise.
5369 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5370 parameter with an r_type parameter. Use get_reference_flags
5371 to get the flags.
5372 (Target_i386::Relocate::relocate): Update accordingly.
5373 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5374 (Target_powerpc::Scan::global): Use it.
5375 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5376 (Target_powerpc::Relocate::relocate): Likewise.
5377 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5378 (Target_sparc::Scan::global): Use it.
5379 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5380 (Target_sparc::Relocate::relocate): Likewise.
5381 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5382 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5383 (Target_x86_64::Scan::global): Likewise.
5384 (Target_x86_64::Relocate::relocate): Likewise.
5385
5386 2010-11-08 Doug Kwan <dougkwan@google.com>
5387 Cary Coutant <ccoutant@google.com>
5388
5389 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5390 (Arm_exidx_merge_section::section_contents_): New data member.
5391 (Arm_input_section::Arm_input_section): Initialize original_contents_.
5392 (Arm_input_section::~Arm_input_section): De-allocate memory.
5393 (Arm_input_section::original_contents_): New data member.
5394 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5395 in parameters instead of calling Object::section_contents without
5396 locking.
5397 (Arm_output_section::group_section): New parameter TASK. Pass it
5398 to callees that need locking objects.
5399 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
5400 to lock EXIDX input sections. Fix a formatting issue. Call
5401 Arm_exidx_merged_section::build_contents to create merged section
5402 contents.
5403 (Arm_output_section::create_stub_group): New parameter TASK. Use it
5404 to lock object of stub table owner.
5405 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5406 TEXT_SIZE to initialize data member TEXT_SIZE_.
5407 (Arm_exidx_input_section::addralign): Fix typo in comment.
5408 (Arm_exidx_input_section::text_size): New method.
5409 (Target_arm::do_relax): New parameter TASK. Pass it to callees
5410 that require locking objects. Lock objects before scanning for stubs
5411 and updating local symbols.
5412 (Arm_input_section<big_endian>::init): Copy contents of original
5413 input section.
5414 (Arm_input_section<big_endian>::do_write): Use saved contents of
5415 original input section instead of calling Object::section_contents
5416 without locking.
5417 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5418 size without calling Object::section_size().
5419 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5420 for size. Allocate a buffer for merged EXIDX entries.
5421 (Arm_exidx_merged_section::build_contents): New method.
5422 (Arm_exidx_merged_section::do_write): Move merge section contents
5423 building code to Arm_exidx_merged_section::build_contetns. Write
5424 out contetns in buffer instead of building it on the fly.
5425 (Arm_relobj::make_exidx_input_section): Also pass text section size
5426 to Arm_exidx_input_section constructor.
5427 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
5428 (Arm_dynobj::do_read_symbols): Fix memory leak.
5429 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5430 * target.h: (class Task): Add forward declaration.
5431 (Target::relax): Add new parameter TASK and pass it to
5432 Target::do_relax().
5433 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
5434
5435 2010-11-05 Cary Coutant <ccoutant@google.com>
5436
5437 PR gold/10708
5438 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5439 object when reading from the file.
5440 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5441 second layout pass.
5442 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5443 when reading section contents.
5444 (get_section_contents): Likewise.
5445 (icf::find_identical_sections): Likewise.
5446 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5447 object when reading from the file.
5448 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5449 the object when doing deferred section layout.
5450
5451 2010-11-03 Nick Clifton <nickc@redhat.com>
5452
5453 PR gold/12001
5454 * script.h (class Symbol_assignment: name): New member. Returns
5455 the name of the symbol.
5456 * scrfipt.cc (Script_options::is_pending_assignment): New member.
5457 Returns true if the given symbol name is on the list of
5458 assignments wating to be processed.
5459 * archive.cc (should_incldue_member): If the symbol is undefined,
5460 check to see if it is on the list of symbols pending assignment.
5461
5462 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
5463
5464 * script-sections.cc (Script_sections::find_memory_region): Check
5465 for a NULL output section pointer.
5466
5467 2010-10-29 Doug Kwan <dougkwan@google.com>
5468
5469 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5470 Output_section::add_relaxed_input_section.
5471 * output.cc (Output_section::add_relaxed_input_section): Add new
5472 arguments LAYOUT and NAME. Set section order index.
5473 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5474 Copy section order index.
5475 * output.h (Output_section::add_relaxed_input_section): Add new
5476 arguments LAYOUT and NAME.
5477
5478 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5479
5480 * testsuite/Makefile.am: Move gcctestdir/ld rule to
5481 NATIVE_OR_CROSS_LINKER.
5482 * testsuite/Makefile.in: Regenerate.
5483
5484 2010-10-20 Doug Kwan <dougkwan@google.com>
5485
5486 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5487 without SHF_LINK_ORDER flags.
5488 * layout.cc (Layout::choose_output_section): Do not filter
5489 SHF_LINK_ORDER flag in a relocatable link.
5490
5491 2010-10-17 Cary Coutant <ccoutant@google.com>
5492
5493 * output.h (Output_segment::set_section_addresses): Change function
5494 signature. Update all callers.
5495 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5496 sections.
5497 (Output_segment::set_section_addresses): Align after last TLS
5498 section. Add padding before last relro section instead of after.
5499
5500 2010-10-17 Doug Kwan <dougkwan@google.com>
5501
5502 * gold/arm.cc (Target_arm::got_section): Use correct order and set
5503 GOT output section to be writable.
5504
5505 2010-10-14 Cary Coutant <ccoutant@google.com>
5506
5507 * debug.h (DEBUG_INCREMENTAL): New flag.
5508 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5509 * gold.cc (queue_initial_tasks): Check parameters for incremental link
5510 mode.
5511 * incremental.cc (report_command_line): Ignore all forms of
5512 --incremental.
5513 * layout.cc (Layout::Layout): Check parameters for incremental link
5514 mode.
5515 * options.cc (General_options::parse_incremental): New function.
5516 (General_options::parse_no_incremental): New function.
5517 (General_options::parse_incremental_full): New function.
5518 (General_options::parse_incremental_update): New function.
5519 (General_options::incremental_mode_): New data member.
5520 (General_options::finalize): Check incremental_mode_.
5521 * options.h (General_options): Update help text for --incremental.
5522 Add --no-incremental, --incremental-full, --incremental-update.
5523 (General_options::Incremental_mode): New enum type.
5524 (General_options::incremental_mode): New function.
5525 (General_options::incremental_mode_): New data member.
5526 * parameters.cc (Parameters::incremental_mode_): New data member.
5527 (Parameters::set_options): Set incremental_mode_.
5528 (Parameters::set_incremental_full): New function.
5529 (Parameters::incremental): New function.
5530 (Parameters::incremental_update): New function.
5531 (set_parameters_incremental_full): New function.
5532 * parameters.h (Parameters::set_incremental_full): New function.
5533 (Parameters::incremental): New function.
5534 (Parameters::incremental_update): New function.
5535 (Parameters::incremental_mode_): New data member.
5536 (set_parameters_incremental_full): New function.
5537 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5538 incremental link mode.
5539 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5540 (Sized_relobj::do_relocate_sections): Likewise.
5541 * testsuite/Makefile.am (incremental_test): Use --incremental-full
5542 option.
5543 * testsuite/Makefile.in: Regenerate.
5544 * testsuite/incremental_test.sh: Filter all forms of --incremental.
5545
5546 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5547
5548 * script-sections.h (class Script_sections): Make
5549 Sections_elements typedef public.
5550 * script-sections.cc (class Sort_output_sections): Add elements_
5551 field. Add constructor which sets it; change all callers.
5552 (Sort_output_sections::is_before): New function.
5553 (Sort_output_sections::operator()): Call is_before.
5554 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5555 conditional.
5556 * testsuite/script_test_10.sh: New test. Test script section
5557 order.
5558 * testsuite/script_test_10.t: Likewise.
5559 * testsuite/script_test_10.s: Likewise.
5560 * testsuite/Makefile.am: Wrap the cross linker tests and the
5561 common tests into NATIVE_OR_CROSS_LINKER.
5562 (check_SCRIPTS): Add script_test_10.sh.
5563 (check_DATA): Add script_test_10.stdout.
5564 (script_test_10.o, script_test_10): New targets.
5565 (script_test_10.stdout): New target.
5566 * configure, testsuite/Makefile.in: Regenerate.
5567
5568 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5569
5570 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5571 error for the deprecated relocations.
5572 (Target_arm::Scan::global): Likewise.
5573 (Target_arm::Relocate::relocate): Likewise.
5574
5575 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
5576
5577 * fileread.cc (Input_file::find_file): Initialize *found_name
5578 and *namep when using the fallback search for case 4.
5579
5580 2010-10-11 Cary Coutant <ccoutant@google.com>
5581
5582 * options.h (class General_options): Redefine -z lazy as an alias for
5583 the negation of -z now.
5584
5585 2010-10-11 Ian Lance Taylor <iant@google.com>
5586
5587 * resolve.cc (symbol_to_bits): Report the value of the unsupported
5588 binding.
5589
5590 2010-10-06 Nick Clifton <nickc@redhat.com>
5591
5592 * script-sections.cc(class Memory_region): Remove
5593 current_lma_offset_ field. Rename current_vma_offset_ to
5594 current_offset_. Add last_section_ field.
5595 (Memory_region::get_current_vma_address): Rename to
5596 get_current_address.
5597 (Memory_region::get_current_lma_address): Delete.
5598 (Memory_region::increment_vma_offset): Rename to
5599 increment_offset.
5600 (Memory_region::increment_lma_offset): Delete.
5601 (Memory_region::attributes_compatible): New method. Returns
5602 true if the provided section is compatible with the region.
5603 (Memory_region::get_last_section): New method. Returns the last
5604 section to use the region.
5605 (Memory_region::set_last_section): New method. Stores the last
5606 section to use the region.
5607 (Script_sections::block_in_region): New method. Returns true if
5608 a block of memory is contained within a region.
5609 (Script_sections::find_memory_region): New method. Locates a
5610 memory region to be used to set a VMA or LMA address.
5611 (Output_section_definition::set_section_addresses): Add code to
5612 check for addresses set by memory regions.
5613 (Output_segment::set_section_addresses): Remove memory region
5614 walking code.
5615 (Script_sections::create_segment): Add a warning if a header
5616 segment is created outside of any region.
5617 * script-sections.h (class Script_sections): Add prototypes for
5618 find_memory_region and block_in_region methods.
5619 * testsuite/memory_test.s: Use .long instead of .word.
5620 * testsuite/memory_test.t: Add some more output sections.
5621 * testsuite/memory_test.sh: Update expected output.
5622
5623 2010-10-02 Doug Kwan <dougkwan@google.com>
5624
5625 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5626 defintion to symtab.h
5627 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5628 declaration to defintion.
5629
5630 2010-10-01 Nick Clifton <nickc@redhat.com>
5631
5632 * expression.cc (eval): Replace dummy argument with NULL.
5633 (eval_maybe_dot): Check for a NULL result section pointer.
5634 (Symbol_expression::value): Likewise.
5635 (Dot_expression::value): Likewise.
5636 (BINARY_EXPRESSION): Likewise.
5637 (Max_expression::value): Likewise.
5638 (Min_expression::value): Likewise.
5639 (Absolute_expression::value): Likewise.
5640 (Addr_expression::value_from_output_section): Likewise.
5641 (Loaddddr_expression::value_from_output_section): Likewise.
5642 (Segment_start_expression::value): Likewise.
5643 * script-sections.cc
5644 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5645 argument with NULL.
5646 (Sections_elememt_dot_assignment::set_section_addresses):
5647 Likewise.
5648 (Output_data_expression::do_write_to_buffer): Likewise.
5649 (Output_section_definition::finalize_symbols): Likewise.
5650 (Output_section_definition::set_section_addresses): Likewise.
5651
5652 2010-09-30 Doug Kwan <dougkwan@google.com>
5653
5654 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5655
5656 2010-09-28 Sriraman Tallam <tmsriram@google.com>
5657
5658 * target.h (Target::can_icf_inline_merge_sections): New virtual
5659 function.
5660 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5661 virtual function.
5662 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5663 virtual function.
5664 * icf.cc (get_section_contents): Inline merge sections only when
5665 target allows it.
5666
5667 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5668
5669 * configure: Regenerate.
5670
5671 2010-09-17 Ian Lance Taylor <iant@google.com>
5672
5673 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5674 * testsuite/Makefile.am (memory_test.o): New target.
5675 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5676 memory_test.t.
5677 * testsuite/Makefile.in: Rebuild.
5678
5679 2010-09-17 Doug Kwan <dougkwan@google.com>
5680
5681 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5682 defintion if relocation uses GOT entries of the symbol.
5683 * testsuite/icf_safe_test.sh: Fix test.
5684 * testsuite/icf_safe_so_test.sh: Fix test.
5685
5686 2010-09-16 Cary Coutant <ccoutant@google.com>
5687
5688 * script_sections.cc (class Memory_region): Remove "NULL" from
5689 vector initializations.
5690
5691 2010-09-15 Cary Coutant <ccoutant@google.com>
5692
5693 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5694 Resolve forwarding symbols.
5695
5696 2010-09-15 Doug Kwan <dougkwan@google.com>
5697
5698 * gold/testsuite/script_test_3.t: Add ARM special sections.
5699 * gold/testsuite/script_test_4.t: Same.
5700 * gold/testsuite/script_test_5.t: Same.
5701 * gold/testsuite/script_test_6.t: Same.
5702 * gold/testsuite/script_test_7.t: Same.
5703 * gold/testsuite/script_test_7.t: Same.
5704 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5705
5706 2010-09-14 Cary Coutant <ccoutant@google.com>
5707
5708 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5709 (Target_x86_64::Relocate::relocate_tls): Replace check for
5710 saw_tls_block_reloc_ with test for executable section.
5711
5712 2010-09-12 Cary Coutant <ccoutant@google.com>
5713
5714 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5715 position-independent executables to shared libraries need dynamic
5716 relocations.
5717 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5718 position-independent executables.
5719 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5720 * testsuite/Makefile.in: Regenerate.
5721
5722 2010-09-10 Nick Clifton <nickc@redhat.com>
5723
5724 PR gold/11997
5725 * testsuite/memory_test.t: Discard any sections that are not
5726 needed.
5727
5728 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
5729
5730 PR gold/11996
5731 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5732 "This::" to work around a bug in gcc 4.2.
5733
5734 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5735
5736 2010-09-09 Rafael Espindola <espindola@google.com>
5737
5738 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5739 sections with different PF_X flags in the same segment.
5740 (Layout::find_first_load_seg): Search all segments to find the first
5741 one.
5742 * options.h (rosegment): New.
5743
5744 2010-09-08 Rafael Espindola <espindola@google.com>
5745
5746 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5747
5748 2010-09-08 Doug Kwan <dougkwan@google.com>
5749
5750 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5751 (Arm_relobj::do_relocate_sections): Add new parameter for output
5752 file to match the parent.
5753 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5754 of local symbols instead of input values. Update code to track
5755 changes in gold::relocate_section.
5756 * object.cc (Sized_relobj::compute_final_local_value): New methods.
5757 (Sized_relobj::compute_final_local_value_internal): New methods.
5758 (Sized_relobj::do_finalize_local_symbols): Move code from loop
5759 body into private version of Sized_relobj::compute_final_local_value.
5760 Call the inline method.
5761 * object.h (Symbol_value::Symbol_value): Define destructor. Free
5762 merged symbol value if there is one.
5763 (Symbol_value::has_output_value): New method defintiion.
5764 (Sized_relobj::Compute_final_local_value_status): New enum type.
5765 (Sized_relobj::compute_final_local_value): New methods.
5766 (Sized_relobj::compute_final_local_value_internal): New methods.
5767 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5768 and arm_cortex_a8.sh.
5769 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5770 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5771 New tests.
5772 * Makefile.in: Regenerate.
5773 * testsuite/arm_bl_out_of_range.s: Update test.
5774 * testsuite/thumb_bl_out_of_range.s: Ditto.
5775 * testsuite/thumb_blx_out_of_range.s: Ditto.
5776 * testsuite/arm_branch_out_of_range.sh: New file.
5777 * testsuite/arm_cortex_a8.sh: Ditto.
5778 * testsuite/arm_cortex_a8_b.s: Ditto.
5779 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5780 * testsuite/arm_cortex_a8_b_local.s: Ditto.
5781 * testsuite/arm_cortex_a8_bl.s: Ditto.
5782 * testsuite/arm_cortex_a8_blx.s: Ditto.
5783 * testsuite/arm_cortex_a8_local.s: Ditto.
5784 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5785 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5786
5787 2010-09-08 Rafael Espindola <espindola@google.com>
5788
5789 * Makefile.am (memory_test.stdout): Run readelf with -W.
5790 * Makefile.in: Regenerate.
5791 * testsuite/memory_test.sh: Make the regexps accept both 32 and
5792 64 bit output.
5793
5794 2010-09-08 Rafael Espindola <espindola@google.com>
5795
5796 * script-sections.cc (Script_sections::add_memory_region): Convert
5797 field precision to int.
5798 * script.cc (script_set_section_region, script_set_section_region):
5799 Convert field precision to int.
5800
5801 2010-09-08 Rafael Espindola <espindola@google.com>
5802
5803 * arm.cc (do_finalize_sections): Create the __exidx_start and
5804 __exdix_end symbols even when the section is missing.
5805
5806 2010-09-08 Nick Clifton <nickc@redhat.com>
5807
5808 * README: Remove claim that MEMORY is not supported.
5809 * expression.cc (script_exp_function_origin)
5810 (script_exp_function_length): Move from here to ...
5811 * script.cc: ... here.
5812 (script_set_section_region, script_add_memory)
5813 (script_parse_memory_attr, script_include_directive): New
5814 functions.
5815 * script-sections.cc
5816 (class Memory_region): New class.
5817 (class Output_section_definition): Add set_memory_region,
5818 set_section_vma, set_section_lma and get_section_name methods.
5819 (class Script_Sections): Add add_memory_region,
5820 find_memory_region, find_memory_region_origin,
5821 find_memory_region_length and set_memory_region methods.
5822 Have set_section_addresses method walk the list of set memory
5823 regions.
5824 Extend the print methos to display memory regions.
5825 * script-sections.h: Add prototypes for new methods.
5826 Add enum for MEMORY region attributes.
5827 * yyscript.y: Add support for parsing MEMORY regions.
5828 * script-c.h: Add prototypes for new functions.
5829 * testsuite/Makefile.am: Add test of MEMORY region functionality.
5830 * testsuite/Makefile.in: Regenerate.
5831 * testsuite/memory_test.sh: New script.
5832 * testsuite/memory_test.s: New assembler source file.
5833 * testsuite/memory_test.t: New linker script.
5834
5835 2010-08-27 Doug Kwan <dougkwan@google.com>
5836
5837 * gold/resolve.cc (Symbol_table::should_override): Let a weak
5838 reference override an existing dynamic weak reference.
5839 * testsuite/Makefile.am: Add new test dyn_weak_ref.
5840 * testsuite/Makefile.in: Regenerate.
5841 * testsuite/dyn_weak_ref.sh: New file.
5842 * testsuite/dyn_weak_ref_1.c: Ditto.
5843 * testsuite/dyn_weak_ref_2.c: Ditto.
5844
5845 2010-08-27 Ian Lance Taylor <iant@google.com>
5846
5847 * incremental.h (class Incremental_input_entry): Add virtual
5848 destructor.
5849
5850 2010-08-27 Ian Lance Taylor <iant@google.com>
5851
5852 * testsuite/start_lib_test_3.c: Mark t3 as used.
5853
5854 2010-08-27 Nick Clifton <nickc@redhat.com>
5855
5856 * options.cc (version_script): Fix small typo in previous
5857 whitespace tidyup.
5858
5859 2010-08-25 Nick Clifton <nickc@redhat.com>
5860
5861 * archive.cc: Formatting fixes: Remove whitespace between
5862 typename and following asterisk. Remove whitespace between
5863 function name and opening parenthesis.
5864 * archive.h: Likewise.
5865 * arm.cc: Likewise.
5866 * attributes.cc: Likewise.
5867 * attributes.h: Likewise.
5868 * common.cc: Likewise.
5869 * copy-relocs.cc: Likewise.
5870 * dirsearch.h: Likewise.
5871 * dynobj.cc: Likewise.
5872 * ehframe.cc: Likewise.
5873 * ehframe.h: Likewise.
5874 * expression.cc: Likewise.
5875 * fileread.cc: Likewise.
5876 * fileread.h: Likewise.
5877 * gc.h: Likewise.
5878 * gold-threads.cc: Likewise.
5879 * gold.cc: Likewise.
5880 * i386.cc: Likewise.
5881 * icf.h: Likewise.
5882 * incremental-dump.cc: Likewise.
5883 * incremental.cc: Likewise.
5884 * layout.cc: Likewise.
5885 * layout.h: Likewise.
5886 * main.cc: Likewise.
5887 * merge.cc: Likewise.
5888 * merge.h: Likewise.
5889 * object.cc: Likewise.
5890 * object.h: Likewise.
5891 * options.cc: Likewise.
5892 * options.h: Likewise.
5893 * output.cc: Likewise.
5894 * output.h: Likewise.
5895 * plugin.cc: Likewise.
5896 * plugin.h: Likewise.
5897 * powerpc.cc: Likewise.
5898 * reloc.cc: Likewise.
5899 * script-c.h: Likewise.
5900 * script-sections.cc: Likewise.
5901 * script.cc: Likewise.
5902 * stringpool.cc: Likewise.
5903 * symtab.cc: Likewise.
5904 * symtab.h: Likewise.
5905 * target.cc: Likewise.
5906 * timer.cc: Likewise.
5907 * timer.h: Likewise.
5908 * version.cc: Likewise.
5909 * x86_64.cc: Likewise.
5910
5911 2010-08-24 Nick Clifton <nickc@redhat.com>
5912
5913 PR 11899
5914 * layout.cc (segment_precedes): Sort segments by their physical
5915 addresses, if they have been set.
5916
5917 2010-08-23 Cary Coutant <ccoutant@google.com>
5918
5919 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5920 symbols data.
5921 (Lib_group::include_member): Unlock object after deleting its
5922 symbols data.
5923 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5924 the bug fixed here.
5925
5926 2010-08-19 Neil Vachharajani <nvachhar@google.com>
5927 Cary Coutant <ccoutant@google.com>
5928
5929 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5930 constructor, and set_blocker.
5931 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5932 readsyms_blocker_.
5933 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5934 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5935 * testsuite/Makefile.am (start_lib_test): New test case.
5936 * testsuite/Makefile.in: Regenerate.
5937 * testsuite/start_lib_test_main.c: New file.
5938 * testsuite/start_lib_test_1.c: New file.
5939 * testsuite/start_lib_test_2.c: New file.
5940 * testsuite/start_lib_test_3.c: New file.
5941
5942 2010-08-19 Ian Lance Taylor <iant@google.com>
5943
5944 * Makefile.in: Rebuild with automake 1.11.1.
5945 * aclocal.m4: Likewise.
5946 * testsuite/Makefile.in: Likewise.
5947
5948 2010-08-19 Ian Lance Taylor <iant@google.com>
5949
5950 PR 10893
5951 * i386.cc (class Output_data_plt_i386): Update declarations.
5952 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
5953 local_ifuncs_ fields.
5954 (Target_i386::do_plt_section_for_global): New function.
5955 (Target_i386::do_plt_section_for_local): New function.
5956 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5957 parameter; change all callers. Initialize global_ifuncs_ and
5958 local_ifuncs_. If doing a static link define __rel_iplt_start and
5959 __rel_iplt_end.
5960 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5961 (Output_data_plt_i386::add_local_ifunc_entry): New function.
5962 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5963 symbols.
5964 (Target_i386::make_plt_section): New function, broken out of
5965 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
5966 (Target_i386::make_plt_entry): Call make_plt_section.
5967 (Target_i386::make_local_ifunc_plt_entry): New function.
5968 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5969 (Target_i386::Scan::local): Handle IFUNC symbols. Add
5970 R_386_IRELATIVE to switch.
5971 (Target_i386::Scan::global): Likewise.
5972 (Target_i386::Relocate::relocate): Likewise.
5973 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5974 switch.
5975 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5976 (Target_x86_64::do_plt_section_for_global): New function.
5977 (Target_x86_64::do_plt_section_for_local): New function.
5978 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5979 parameter; change all callers. If doing a static link define
5980 __rela_iplt_start and __rela_iplt_end.
5981 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5982 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5983 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5984 to point to .plt.
5985 (Target_x86_64::make_local_ifunc_plt_entry): New function.
5986 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5987 switch.
5988 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5989 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
5990 R_X86_64_IRELATIVE to switch.
5991 (Target_x86_64::Scan::global): Likewise.
5992 (Target_x86_64::Relocate::relocate): Likewise.
5993 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5994 switch.
5995 * target.h (class Target): Add plt_section_for_global and
5996 plt_section_for_local functions. Add do_plt_section_for_global
5997 and do_plt_section_for_local virtual functions.
5998 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
5999 clarifying comments.
6000 (Symbol::use_plt_offset): Handle IFUNC symbol.
6001 * object.cc (Sized_relobj::Sized_relobj): Initialize
6002 local_plt_offsets_.
6003 (Sized_relobj::local_has_plt_offset): New function.
6004 (Sized_relobj::local_plt_offset): New function.
6005 (Sized_relobj::set_local_plt_offset): New function.
6006 (Sized_relobj::do_count): Handle IFUNC symbol.
6007 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
6008 a bit away from input_shndx_ field. Add set_is_func_symbol and
6009 is_ifunc_symbol functions.
6010 (class Sized_relobj): Update declarations. Remove Tls_got_entry
6011 and Local_tls_got_offsets. Define Local_plt_offsets. Add
6012 local_plt_offsets_ field.
6013 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6014 * output.h (class Output_section_data): Add non-const
6015 output_section function.
6016 (class Output_data_got): Update declarations.
6017 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6018 Add use_plt_offset parameter to global and local constructors.
6019 Change all callers. Change local_sym_index_ field to 31 bits.
6020 Change GSYM_CODE and CONSTANT_CODE accordingly.
6021 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6022 doing a static link don't set sh_link field.
6023 (Output_data_got::Got_entry::write): Use PLT offset if
6024 appropriate.
6025 (Output_data_got::add_global_plt): New function.
6026 (Output_data_got::add_local_plt): New function.
6027 * target-reloc.h (relocate_section): Handle IFUNC symbol.
6028 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6029 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6030 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6031 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6032 IFUNC conditional.
6033 * testsuite/ifunc-sel.h: New file.
6034 * testsuite/ifuncmain1.c: New file.
6035 * testsuite/ifuncmain1vis.c: New file.
6036 * testsuite/ifuncmod1.c: New file.
6037 * testsuite/ifuncdep2.c: New file.
6038 * testsuite/ifuncmain2.c: New file.
6039 * testsuite/ifuncmain3.c: New file.
6040 * testsuite/ifuncmod3.c: New file.
6041 * testsuite/ifuncmain4.c: New file.
6042 * testsuite/ifuncmain5.c: New file.
6043 * testsuite/ifuncmod5.c: New file.
6044 * testsuite/ifuncmain6pie.c: New file.
6045 * testsuite/ifuncmod6.c: New file.
6046 * testsuite/ifuncmain7.c: New file.
6047 * configure, testsuite/Makefile.in: Rebuild.
6048
6049 2010-08-18 Ian Lance Taylor <iant@google.com>
6050
6051 * incremental.cc
6052 (Output_section_incremental_inputs::write_input_files): Add cast
6053 to avoid signed/unsigned comparison warning.
6054 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6055
6056 2010-08-12 Cary Coutant <ccoutant@google.com>
6057
6058 * common.cc (Sort_commons::operator()): Remove unnecessary code.
6059
6060 2010-08-13 Ian Lance Taylor <iant@google.com>
6061
6062 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6063
6064 2010-08-12 Cary Coutant <ccoutant@google.com>
6065 Doug Kwan <dougkwan@google.com>
6066
6067 * resolve.cc (Symbol_table::should_override): When a weak dynamic
6068 defintion overrides non-weak undef, remember that the original undef
6069 is not weak.
6070 * symtab.cc (Symbol_table::sized_write_global): For undef without
6071 an original weak binding, set binding to global in output.
6072 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6073 * testsuite/Makefile.in: Regenerate.
6074 * testsuite/strong_ref_weak_def.sh: New file.
6075 * testsuite/strong_ref_weak_def_1.c: Ditto.
6076 * testsuite/strong_ref_weak_def_2.c: Ditto.
6077
6078 2010-08-12 Cary Coutant <ccoutant@google.com>
6079
6080 * testsuite/incremental_test.sh: Rewrite.
6081 * testsuite/incremental_test_1.c: Rewrite.
6082 * testsuite/incremental_test_2.c: Rewrite.
6083
6084 2010-08-12 Cary Coutant <ccoutant@google.com>
6085
6086 * arm.cc (Target_arm::got_size): Add const.
6087 (Target_arm::got_entry_count): New function.
6088 (Target_arm::plt_entry_count): New function.
6089 (Target_arm::first_plt_entry_offset): New function.
6090 (Target_arm::plt_entry_size): New function.
6091 (Output_data_plt_arm::entry_count): New function.
6092 (Output_data_plt_arm::first_plt_entry_offset): New function.
6093 (Output_data_plt_arm::get_plt_entry_size): New function.
6094 * i386.cc (Target_i386::got_size): Add const.
6095 (Target_i386::got_entry_count): New function.
6096 (Target_i386::plt_entry_count): New function.
6097 (Target_i386::first_plt_entry_offset): New function.
6098 (Target_i386::plt_entry_size): New function.
6099 (Output_data_plt_i386::entry_count): New function.
6100 (Output_data_plt_i386::first_plt_entry_offset): New function.
6101 (Output_data_plt_i386::get_plt_entry_size): New function.
6102 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6103 find_incremental_inputs_sections. Dump incremental_got_plt section.
6104 * incremental.cc: Include target.h.
6105 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6106 parameter. Adjust all callers. Find incremental_got_plt section.
6107 (Incremental_inputs::create_data_sections): Create incremental_got_plt
6108 section.
6109 (Output_section_incremental_inputs::set_final_data_size): Calculate
6110 size of incremental_got_plt section.
6111 (Output_section_incremental_inputs::do_write): Write the
6112 incremental_got_plt section.
6113 (Got_plt_view_info): New struct.
6114 (Local_got_offset_visitor): New class.
6115 (Global_got_offset_visitor): New class.
6116 (Global_symbol_visitor_got_plt): New class.
6117 (Output_section_incremental_inputs::write_got_plt): New function.
6118 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6119 Add parameter. Adjust all callers.
6120 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6121 (Incremental_inputs::got_plt_section): New function.
6122 (Incremental_inputs::got_plt_section_): New data member.
6123 (Incremental_got_plt_reader): New class.
6124 * layout.cc (Layout::create_incremental_info_sections): Add the
6125 incremental_got_plt section.
6126 * object.h (Got_offset_list::get_list): New function.
6127 (Got offset_list::for_all_got_offsets): New function.
6128 (Sized_relobj::local_got_offset_list): New function.
6129 * powerpc.cc (Target_powerpc::got_size): Add const.
6130 (Target_powerpc::got_entry_count): New function.
6131 (Target_powerpc::plt_entry_count): New function.
6132 (Target_powerpc::first_plt_entry_offset): New function.
6133 (Target_powerpc::plt_entry_size): New function.
6134 (Output_data_plt_powerpc::entry_count): New function.
6135 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6136 (Output_data_plt_powerpc::get_plt_entry_size): New function.
6137 * sparc.cc (Target_sparc::got_size): Add const.
6138 (Target_sparc::got_entry_count): New function.
6139 (Target_sparc::plt_entry_count): New function.
6140 (Target_sparc::first_plt_entry_offset): New function.
6141 (Target_sparc::plt_entry_size): New function.
6142 (Output_data_plt_sparc::entry_count): New function.
6143 (Output_data_plt_sparc::first_plt_entry_offset): New function.
6144 (Output_data_plt_sparc::get_plt_entry_size): New function.
6145 * symtab.h (Symbol::got_offset_list): New function.
6146 (Symbol_table::for_all_symbols): New function.
6147 * target.h (Sized_target::got_entry_count): New function.
6148 (Sized_target::plt_entry_count): New function.
6149 (Sized_target::plt_entry_size): New function.
6150 * x86_64.cc (Target_x86_64::got_size): Add const.
6151 (Target_x86_64::got_entry_count): New function.
6152 (Target_x86_64::plt_entry_count): New function.
6153 (Target_x86_64::first_plt_entry_offset): New function.
6154 (Target_x86_64::plt_entry_size): New function.
6155 (Output_data_plt_x86_64::entry_count): New function.
6156 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6157 (Output_data_plt_x86_64::get_plt_entry_size): New function.
6158
6159 2010-08-12 Cary Coutant <ccoutant@google.com>
6160
6161 * archive.cc: Include incremental.h.
6162 (Archive::Archive): Initialize incremental_info_.
6163 (Archive::include_member): Record archive members in incremental info.
6164 (Add_archive_symbols::run): Record begin and end of an archive in
6165 incremental info.
6166 (Lib_group::include_member): Record objects in incremental info.
6167 * archive.h (Incremental_archive_entry): Forward declaration.
6168 (Archive::set_incremental_info): New member function.
6169 (Archive::incremental_info): New member function.
6170 (Archive::Unused_symbol_iterator): New class.
6171 (Archive::unused_symbols_begin): New member function.
6172 (Archive::unused_symbols_end): New member function.
6173 (Archive::incremental_info_): New data member.
6174 * incremental-dump.cc (find_input_containing_global): New function.
6175 (dump_incremental_inputs): Dump new incremental info sections.
6176 * incremental.cc: Include symtab.h.
6177 (Output_section_incremental_inputs): New class.
6178 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6179 new incremental info sections.
6180 (Sized_incremental_binary::do_check_inputs): Likewise.
6181 (Incremental_inputs::report_archive): Remove.
6182 (Incremental_inputs::report_archive_begin): New function.
6183 (Incremental_inputs::report_archive_end): New function.
6184 (Incremental_inputs::report_object): New function.
6185 (Incremental_inputs::finalize_inputs): Remove.
6186 (Incremental_inputs::report_input_section): New function.
6187 (Incremental_inputs::report_script): Rewrite.
6188 (Incremental_inputs::finalize): Do nothing but finalize string table.
6189 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6190 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6191 (Incremental_inputs::create_data_sections): New function.
6192 (Incremental_inputs::relocs_entsize): New function.
6193 (Output_section_incremental_inputs::set_final_data_size): New function.
6194 (Output_section_incremental_inputs::do_write): New function.
6195 (Output_section_incremental_inputs::write_header): New function.
6196 (Output_section_incremental_inputs::write_input_files): New function.
6197 (Output_section_incremental_inputs::write_info_blocks): New function.
6198 (Output_section_incremental_inputs::write_symtab): New function.
6199 * incremental.h (Incremental_script_entry): Forward declaration.
6200 (Incremental_object_entry): Forward declaration.
6201 (Incremental_archive_entry): Forward declaration.
6202 (Incremental_inputs): Forward declaration.
6203 (Incremental_inputs_header_data): Remove.
6204 (Incremental_inputs_header): Remove.
6205 (Incremental_inputs_header_write): Remove.
6206 (Incremental_inputs_entry_data): Remove.
6207 (Incremental_inputs_entry): Remove.
6208 (Incremental_inputs_entry_write): Remove.
6209 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6210 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6211 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6212 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6213 Likewise.
6214 (Incremental_input_entry): New class.
6215 (Incremental_script_entry): New class.
6216 (Incremental_object_entry): New class.
6217 (Incremental_archive_entry): New class.
6218 (Incremental_inputs::Incremental_inputs): Initialize new data members.
6219 (Incremental_inputs::report_inputs): Remove.
6220 (Incremental_inputs::report_archive): Remove.
6221 (Incremental_inputs::report_archive_begin): New function.
6222 (Incremental_inputs::report_archive_end): New function.
6223 (Incremental_inputs::report_object): Change prototype.
6224 (Incremental_inputs::report_input_section): New function.
6225 (Incremental_inputs::report_script): Change prototype.
6226 (Incremental_inputs::get_reloc_count): New function.
6227 (Incremental_inputs::set_reloc_count): New function.
6228 (Incremental_inputs::create_data_sections): New function.
6229 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6230 (Incremental_inputs::inputs_section): New function.
6231 (Incremental_inputs::symtab_section): New function.
6232 (Incremental_inputs::relocs_section): New function.
6233 (Incremental_inputs::get_stringpool): Add const.
6234 (Incremental_inputs::command_line): Add const.
6235 (Incremental_inputs::inputs): Remove.
6236 (Incremental_inputs::command_line_key): New function.
6237 (Incremental_inputs::input_file_count): New function.
6238 (Incremental_inputs::input_files): New function.
6239 (Incremental_inputs::relocs_entsize): New function.
6240 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6241 (Incremental_inputs::finalize_inputs): Remove.
6242 (Incremental_inputs::Input_info): Remove.
6243 (Incremental_inputs::lock_): Remove.
6244 (Incremental_inputs::inputs_): Change type.
6245 (Incremental_inputs::inputs_map_): Remove.
6246 (Incremental_inputs::current_object_entry_): New data member.
6247 (Incremental_inputs::inputs_section_): New data member.
6248 (Incremental_inputs::symtab_section_): New data member.
6249 (Incremental_inputs::relocs_section_): New data member.
6250 (Incremental_inputs::reloc_count_): New data member.
6251 (Incremental_inputs_reader): New class.
6252 (Incremental_symtab_reader): New class.
6253 (Incremental_relocs_reader): New class.
6254 * layout.cc (Layout::finalize): Move finalization of incremental info
6255 and creation of incremental info sections to follow finalization of
6256 symbol table. Set offsets for postprocessing sections.
6257 (Layout::create_incremental_info_sections): Call
6258 Incremental_inputs::create_data_sections. Add incremental symtab
6259 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
6260 sections to layout after input sections.
6261 * layout.h (struct Timespec): Forward declaration.
6262 (Layout::incremental_inputs): Add const.
6263 (Layout::create_incremental_info_sections): Add parameter.
6264 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6265 * object.cc: Include incremental.h.
6266 (Relobj::finalize_incremental_relocs): New function.
6267 (Sized_relobj::do_layout): Record input sections in incremental info.
6268 * object.h (Object::output_section): New function.
6269 (Object::output_section_offset): Moved from Relobj.
6270 (Object::get_incremental_reloc_base): New function.
6271 (Object::get_incremental_reloc_count): New function.
6272 (Object::do_output_section): New function.
6273 (Object::do_output_section_offset): Moved from Relobj.
6274 (Object::do_get_incremental_reloc_base): New function.
6275 (Object::do_get_incremental_reloc_count): New function.
6276 (Object::Object): Initialize new data members.
6277 (Relobj::output_section): Renamed do_output_section and moved to
6278 protected.
6279 (Relobj::output_section_offset): Moved to Object.
6280 (Relobj::do_get_incremental_reloc_base): New function.
6281 (Relobj::do_get_incremental_reloc_count): New function.
6282 (Relobj::allocate_incremental_reloc_counts): New function.
6283 (Relobj::count_incremental_reloc): New function.
6284 (Relobj::finalize_incremental_relocs): New function.
6285 (Relobj::next_incremental_reloc_index): New function.
6286 (Relobj::reloc_counts_): New data member.
6287 (Relobj::reloc_bases_): New data member.
6288 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
6289 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
6290 (Sized_relobj::incremental_relocs_scan): New function.
6291 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6292 (Sized_relobj::incremental_relocs_write): New function.
6293 (Sized_relobj::incremental_relocs_write_reltype): New function.
6294 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6295 incremental link.
6296 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6297 archives and object files elsewhere.
6298 (Add_symbols::run): Report object files here.
6299 (Finish_group::run): Report end of archive at end of group.
6300 * reloc.cc: Include layout.h, incremental.h.
6301 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6302 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6303 (Sized_relobj::incremental_relocs_scan): New function.
6304 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6305 (Sized_relobj::do_relocate_sections): Write incremental relocations.
6306 (Sized_relobj::incremental_relocs_write): New function.
6307 (Sized_relobj::incremental_relocs_write_reltype): New function.
6308 * script.cc (read_input_script): Rewrite test for incremental link.
6309 Change call to Incremental_inputs::report_script.
6310 * symtab.h (Symbol_table::first_global_index): New function.
6311 (Symbol_table::output_count): New function.
6312
6313 2010-08-12 Doug Kwan <dougkwan@google.com>
6314
6315 * arm.cc (Target_arm::merge_object_attributes): Check command line
6316 options --no-wchar-size-warning and --no-enum-size-warning.
6317 * options.h (General_options): Add ld-compatible options
6318 --no-enum-size-warning and --no-wchar-size-warning.
6319
6320 2010-08-04 Ian Lance Taylor <iant@google.com>
6321
6322 * x86_64.cc (Target_x86_64::Scan::local): Use
6323 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6324 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6325 (Target_x86_64::Scan::global): Likewise.
6326 (Target_x86_64::Relocate::relocate): Likewise.
6327 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6328 Likewise.
6329
6330 2010-08-03 Cary Coutant <ccoutant@google.com>
6331
6332 * merge.cc (Output_merge_string::do_add_input_section): Count strings
6333 to reserve space in merged_strings vector. Keep total input size
6334 for stats.
6335 (Output_merge_string::do_print_merge_stats): Print total input size.
6336 * merge.h (Output_merge_string): Add input_size_ field.
6337 * stringpool.cc (Stringpool_template::string_length): Move
6338 implementations out of Stringpool_template class and place in
6339 stringpool.h.
6340 * stringpool.h (string_length): Move out of Stringpool_template.
6341
6342 2010-08-03 Ian Lance Taylor <iant@google.com>
6343
6344 PR 11712
6345 * layout.cc (relaxation_loop_body): If address of load segment is
6346 set, adjust address to include headers if possible.
6347
6348 2010-08-03 Ian Lance Taylor <iant@google.com>
6349
6350 * version.cc (version_string): Bump to 1.10.
6351
6352 2010-08-03 Ian Lance Taylor <iant@google.com>
6353
6354 PR 11805
6355 * layout.h (enum Output_section_order): Define.
6356 (class Layout): Update declarations.
6357 * layout.cc (Layout::get_output_section): Add order parameter.
6358 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6359 is_first_non_relro parameters. Change all callers.
6360 (Layout::choose_output_section): Likewise.
6361 (Layout::add_output_section_data): Likewise.
6362 (Layout::make_output_section): Likewise. Set order.
6363 (Layout::default_section_order): New function.
6364 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6365 * output.cc (Output_section::Output_section): Initialize order_.
6366 Don't initialize deleted fields.
6367 (Output_segment::Output_segment): Don't initialize deleted
6368 fields.
6369 (Output_segment::add_output_section_to_load): New function
6370 replacing add_output_section. Change all callers to call this or
6371 add_output_section_to_nonload.
6372 (Output_segment::add_output_section_to_nonload): New function.
6373 (Output_segment::remove_output_section): Rewrite.
6374 (Output_segment::add_initial_output_data): Likewise.
6375 (Output_segment::has_any_data_sections): Likewise.
6376 (Output_segment::is_first_section_relro): Likewise.
6377 (Output_segment::maximum_alignment): Likewise.
6378 (Output_segment::has_dynamic_reloc): New function replacing
6379 dynamic_reloc_count. Change all callers.
6380 (Output_segment::has_dynamic_reloc_list): New function replacing
6381 dynamic_reloc_count_list. Change all callers.
6382 (Output_segment::set_section_addresses): Rewrite.
6383 (Output_segment::set_offset): Rewrite.
6384 (Output_segment::find_first_and_last_list): Remove.
6385 (Output_segment::set_tls_offsets): Rewrite.
6386 (Output_segment::first_section_load_address): Likewise.
6387 (Output_segment::output_section_count): Likewise.
6388 (Output_segment::section_with_lowest_load_address): Likewise.
6389 (Output_segment::write_section_headers): Likewise.
6390 (Output_segment::print_sections_to_map): Likewise.
6391 * output.h (class Output_data): Remove dynamic_reloc_count_
6392 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
6393 (Output_data::add_dynamic_reloc): Rewrite.
6394 (Output_data::has_dynamic_reloc): New function.
6395 (Output_data::dynamic_reloc_count): Remove.
6396 (class Output_section): Add order_ field. Remvoe is_relro_local_,
6397 is_last_relro_, is_first_non_relro_, is_interp_,
6398 is_dynamic_linker_section_ fields. Add order and set_order
6399 functions. Remove is_relro_local, set_is_relro_local,
6400 is_last_relro, set_is_last_relro, is_first_non_relro,
6401 set_is_first_non_relro functions, is_interp, set_is_interp,
6402 is_dynamic_linker_section, and set_is_dynamic_linker_section
6403 functions.
6404 (class Output_segment): Change Output_data_list from std::list to
6405 std:;vector. Add output_lists_ field. Remove output_data_ and
6406 output_bss_ fields. Update declarations.
6407
6408 2010-08-02 Ian Lance Taylor <iant@google.com>
6409
6410 * arm.cc (Target_arm::gc_process_relocs): Use typename.
6411 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6412 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6413
6414 2010-08-02 Ian Lance Taylor <iant@google.com>
6415
6416 PR 11855
6417 * script.cc (Script_options::Script_options): Initialize
6418 symbol_definitions_ and symbol_references_.
6419 (Script_options::add_symbol_assignment): Update
6420 symbol_definitions_ and symbol_references_.
6421 (Script_options::add_symbol_reference): New function.
6422 (script_symbol): New function.
6423 * script.h (class Script_options): Add symbol_definitions_ and
6424 symbol_references_ fields.
6425 (Script_options::referenced_const_iterator): New type.
6426 (Script_options::referenced_begin): New function.
6427 (Script_options::referenced_end): New function.
6428 (Script_options::is_referenced): New function.
6429 (Script_options::any_unreferenced): New function.
6430 * script-c.h (script_symbol): Declare.
6431 * yyscript.y (exp): Call script_symbol.
6432 * symtab.cc: Include "script.h".
6433 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6434 Change all callers. Check symbols referenced by scripts.
6435 (Symbol_table::add_undefined_symbols_from_command_line): Add
6436 layout parameter. Change all callers.
6437 (Symbol_table::do_add_undefined_symbols_from_command_line):
6438 Likewise. Break out loop body. Check symbols referenced by
6439 scripts.
6440 (Symbol_table::add_undefined_symbol_from_command_line): New
6441 function broken out of
6442 do_add_undefined_symbols_from_command_line.
6443 * symtab.h (class Symbol_table): Update declarations.
6444 * archive.cc: Include "layout.h".
6445 (Archive::should_include_member): Add layout parameter. Change
6446 all callers. Check for symbol mentioned in expression.
6447 * archive.h (class Archive): Update declaration.
6448 * object.cc (Sized_relobj::do_should_include_member): Add layout
6449 parameter.
6450 * object.h (Object::should_include_member): Add layout parameter.
6451 Change all callers.
6452 (Object::do_should_include_member): Add layout parameter.
6453 (class Sized_relobj): Update declaration.
6454 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6455 parameter.
6456 * dynobj.h (class Sized_dynobj): Update declaration.
6457 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6458 layout parameter.
6459 * plugin.h (class Sized_pluginobj): Update declaration.
6460
6461 2010-08-02 Ian Lance Taylor <iant@google.com>
6462
6463 PR 11866
6464 * output.cc (Output_segment::set_offset): Search for the first and
6465 last sections rather than assuming that the list is in order.
6466 (Output_segment::find_first_and_last_list): New function.
6467 * output.h (class Output_segment): Update declarations.
6468 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6469 (relro_strip_test_SOURCES): New variable.
6470 (relro_strip_test_DEPENDENCIES): New variable.
6471 (relro_strip_test_LDFLAGS): New variable.
6472 (relro_strip_test_LDADD): New variable.
6473 (relro_strip_test.so): New target.
6474
6475 2010-08-02 Ian Lance Taylor <iant@google.com>
6476
6477 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6478 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6479 (Target_i386::got_tlsdesc_section): New function.
6480 (Target_i386::got_section): Create space for GOT entries for
6481 TLSDESC relocations.
6482 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6483 R_386_TLS_GOTDESC.
6484 (Target_i386::Scan::global): Likewise.
6485 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6486 using TLSDESC GOT.
6487 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6488 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6489 (Target_x86_64::got_tlsdesc_section): New function.
6490 (Target_x86_64::got_section): Create space for GOT entries for
6491 TLSDESC relocations.
6492 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6493 R_386_TLS_GOTDESC.
6494 (Target_x86_64::Scan::global): Likewise.
6495 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6496 using TLSDESC GOT.
6497
6498 2010-08-02 Ian Lance Taylor <iant@google.com>
6499
6500 * testsuite/final_layout.sh: Use dc to convert from hex to
6501 decimal.
6502
6503 2010-07-29 Sriraman Tallam <tmsriram@google.com>
6504
6505 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6506 paramter to the call to gold::gc_process_relocs.
6507 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6508 paramter to the call to gold::gc_process_relocs.
6509 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6510 parameter to the call to gold::gc_process_relocs.
6511 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6512 template parameter to the call to gold::gc_process_relocs.
6513 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6514 paramter to the call to gold::gc_process_relocs.
6515 * gc.h (get_embedded_addend_size): New function.
6516 (gc_process_relocs): Save the size of the reloc for use by ICF.
6517 * icf.cc (get_section_contents): Get the addend from the text section
6518 for SHT_REL relocation sections.
6519 * icf.h (Icf::Reloc_addend_size_info): New typedef.
6520 (Icf::Reloc_info): Add new member reloc_addend_size_info.
6521 * int_encoding.h (read_from_pointer): New overloaded function.
6522 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6523 * testsuite/icf_sht_rel_addend_test.sh: New file.
6524 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6525 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6526
6527 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6528
6529 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6530 * Makefile.in: Regenerate.
6531 * testsuite/Makefile.in: Regenerate.
6532
6533 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
6534
6535 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6536 * gold/testsuite/debug_msg.cc: Likewise.
6537 * gold/testsuite/odr_violation1.cc
6538 * gold/testsuite/odr_violation2.cc
6539
6540 2010-07-21 Cary Coutant <ccoutant@google.com>
6541
6542 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6543 string, and length fields.
6544 (Output_merge_string::Merged_strings_list): New type.
6545 (Output_merge_string::Merged_strings_lists): New typedef.
6546 (Output_merge_string): Replace merged_strings_ with
6547 merged_strings_lists_.
6548 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6549 Merged_strings_list per input object and section. Don't store pointer
6550 to the string. Don't store length with each merged string entry.
6551 (Output_merge_string::finalize_merged_data): Loop over list of merged
6552 strings lists. Recompute length of each merged string.
6553
6554 2010-07-15 Cary Coutant <ccoutant@google.com>
6555
6556 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6557 here.
6558
6559 2010-07-14 Ian Lance Taylor <iant@google.com>
6560
6561 * descriptors.cc (Descriptors::open): Report correct name in error
6562 message.
6563
6564 2010-07-13 Doug Kwan <dougkwan@google.com>
6565
6566 * arm.cc (Arm_input_section::Arm_input_section): For a
6567 SHT_ARM_EXIDX section, always keeps the input sections.
6568 (Arm_input_section::set_exidx_section_link): New method.
6569 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6570 has_errors_ to false.
6571 (Arm_exidx_input_section::has_errors,
6572 Arm_exidx_input_section::set_has_errors): New methods.
6573 (Arm_exidx_input_section::has_errors_): New data member.
6574 (Arm_relobj::get_exidx_shndx_list): New method.
6575 (Arm_output_section::append_text_sections_to_list): Do not skip
6576 section without SHF_EXECINSTR.
6577 (Arm_output_section::fix_exidx_coverage): Skip input sections with
6578 errors.
6579 (Arm_relobj::make_exidx_input_section): Add new parameter for text
6580 section header. Make error messages more verbose. Check for
6581 a non-executable section linked to an EXIDX section.
6582 (Arm_relobj::do_read_symbols): Remove error checking, which has been
6583 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
6584 check that there is no deferred EXIDX section if we exit early.
6585 Instead of not making an EXIDX section in case of an error, make one
6586 and set the has_errors flag of it.
6587 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6588 in a relocatable link.
6589 (Target_arm::do_relax): Look for the EXIDX output section instead of
6590 assuming that it is called .ARM.exidx.
6591 (Target_arm::fix_exidx_coverage): Add a new parameter for input
6592 section list. Do not check for SHF_EXECINSTR section flags but
6593 skip any input section with errors.
6594 * output.cc (Output_section::Output_section): Initialize
6595 always_keeps_input_sections_ to false.
6596 (Output_section::add_input_section): Check for
6597 always_keeps_input_sections_.
6598 * output.h (Output_section::always_keeps_input_sections,
6599 Output_section::set_always_keeps_input_sections): New methods.
6600 (Output_section::always_keeps_input_sections): New data member.
6601
6602 2010-07-13 Rafael Espindola <espindola@google.com>
6603
6604 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6605 * fileread.h (Input_file): Add try_extra_search_path and find_file.
6606
6607 2010-07-13 Philip Herron <herron.philip@googlemail.com>
6608 Ian Lance Taylor <iant@google.com>
6609
6610 * output.h (Output_section_lookup_maps::add_merge_section):
6611 Correct check of whether value was inserted.
6612 (Output_section_lookup_maps::add_merge_input_section): Likewise.
6613 (Output_section_lookup_maps::add_relaxed_input_section):
6614 Likewise.
6615 * arm.cc (Target_arm::got_section): Remove used local os.
6616 * i386.cc (Target_i386::got_section): Likewise.
6617 * x86_64.cc (Target_x86_64::got_section): Likewise.
6618 * sparc.cc (Target_sparc::got_section): Likewise.
6619 (Target_sparc::relocate): Remove unused local have_got_offset.
6620 * powerpc.cc (Target_powerpc::relocate): Likewise.
6621
6622 2010-07-13 Ian Lance Taylor <iant@google.com>
6623
6624 * compressed_output.cc (zlib_decompress): Fix signature in
6625 !HAVE_ZLIB_H case.
6626
6627 * archive.cc (Archive::include_member): Unlock an external member
6628 of a thin archive. Don't bother to delete an object we know is
6629 NULL.
6630
6631 2010-07-12 Cary Coutant <ccoutant@google.com>
6632
6633 * compressed_output.cc (zlib_decompress): New function.
6634 (get_uncompressed_size): New function.
6635 (decompress_input_section): New function.
6636 * compressed_output.h (get_uncompressed_size): New function.
6637 (decompress_input_section): New function.
6638 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6639 Handle compressed debug sections.
6640 * layout.cc (is_compressed_debug_section): New function.
6641 (Layout::output_section_name): Map compressed section names to
6642 canonical names.
6643 * layout.h (is_compressed_debug_section): New function.
6644 (is_debug_info_section): Recognize compressed debug sections.
6645 * merge.cc: Include compressed_output.h.
6646 (Output_merge_data::do_add_input_section): Handle compressed
6647 debug sections.
6648 (Output_merge_string::do_add_input_section): Handle compressed
6649 debug sections.
6650 * object.cc: Include compressed_output.h.
6651 (Sized_relobj::Sized_relobj): Initialize new data members.
6652 (build_compressed_section_map): New function.
6653 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6654 * object.h (Object::section_is_compressed): New method.
6655 (Object::do_section_is_compressed): New method.
6656 (Sized_relobj::Compressed_section_map): New type.
6657 (Sized_relobj::do_section_is_compressed): New method.
6658 (Sized_relobj::compressed_sections_): New data member.
6659 * output.cc (Output_section::add_input_section): Handle compressed
6660 debug sections.
6661 * reloc.cc: Include compressed_output.h.
6662 (Sized_relobj::write_sections): Handle compressed debug sections.
6663
6664 2010-07-08 Cary Coutant <ccoutant@google.com>
6665
6666 * resolve.cc (Symbol_table::resolve): Remember whether undef was
6667 weak when resolving to a dynamic def.
6668 (Symbol_table::should_override): Add adjust_dyndef flag; set it
6669 for weak undef/dynamic def cases. Adjust callers.
6670 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6671 undef_binding_weak_.
6672 (Symbol_table::sized_write_globals): Adjust symbol binding.
6673 (Symbol_table::sized_write_symbol): Add binding parameter.
6674 * symtab.h (Symbol::set_undef_binding): New method.
6675 (Symbol::is_undef_binding_weak): New method.
6676 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6677 (Symbol_table::should_override): Add new parameter.
6678 (Symbol_table::sized_write_symbol): Add new parameter.
6679
6680 * testsuite/weak_undef_file1.cc: Add new test case.
6681 * testsuite/weak_undef_file2.cc: Fix header comment.
6682 * testsuite/weak_undef_test.cc: Add new test case.
6683
6684 2010-06-29 Doug Kwan <dougkwan@google.com>
6685
6686 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6687 Initialize USE_SYMBOL_.
6688 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6689 definition.
6690 (Arm_reloc_property::uses_symbol_): New data member declaration.
6691 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6692 uses symbol value and symbol is undefined but not weakly undefined.
6693
6694 2010-06-28 Rafael Espindola <espindola@google.com>
6695
6696 * plugin.cc (Plugin::load): Use dlerror.
6697
6698 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
6699
6700 * symtab.cc (detect_odr_violations): When reporting an ODR
6701 violation, report an object where the symbol is defined.
6702
6703 2010-06-25 Doug Kwan <dougkwan@google.com>
6704
6705 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6706 (Target_arm::section_may_have_icf_unsafe_pointers): New method
6707 definition.
6708 (Target_arm::Scan::local_reloc_may_be_function_pointer,
6709 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6710 target hook to detect function points.
6711 (Target_arm::Scan::possible_function_pointer_reloc): New method.
6712 * icf.h (Icf::check_section_for_function_pointers): Change type of
6713 parameter SECTION_NAME to const reference to std::string. Use
6714 target hook to determine if section may have unsafe pointers.
6715 * target.h (Target::section_may_have_icf_unsafe_pointers): New
6716 method definition.
6717
6718 2010-06-21 Rafael Espindola <espindola@google.com>
6719
6720 * fileread.cc (Input_file::find_fie): New
6721 (Input_file::open): Use Input_file::find_fie.
6722 * fileread.h (Input_file::find_fie): New
6723 * plugin.cc (set_extra_library_path): New.
6724 (Plugin::load): Add set_extra_library_path to the transfer vector.
6725 (Plugin_manager::set_extra_library_path): New.
6726 (Plugin_manager::add_input_file): Use the extra search path if set.
6727 (set_extra_library_path(): New.
6728 * plugin.h (Plugin_manager): Add set_extra_library_path and
6729 extra_search_path_.
6730
6731 2010-06-19 Cary Coutant <ccoutant@google.com>
6732
6733 * layout.cc (gdb_sections): Add .debug_types.
6734 (lines_only_debug_sections): Likewise.
6735
6736 2010-06-18 Rafael Espindola <espindola@google.com>
6737
6738 * plugin.cc (add_input_file,add_input_library)
6739 (Plugin_manager::add_input_file): Make filename arguments const.
6740 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6741 const.
6742
6743 2010-06-16 Doug Kwan <dougkwan@google.com>
6744
6745 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6746 .ARM.attributes section if we have not merged any input
6747 attributes sections.
6748
6749 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6750
6751 * arm.cc: Allow combining objects with no EABI version
6752 information.
6753
6754 2010-06-15 Rafael Espindola <espindola@google.com>
6755
6756 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6757
6758 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6759
6760 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6761 (struct iovec): Correct !HAVE_READV definition.
6762
6763 2010-06-10 Cary Coutant <ccoutant@google.com>
6764
6765 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6766 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6767 reloc sections.
6768 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6769
6770 PR 11683
6771 * symtab.h (Symbol::is_placeholder): New member function.
6772 * target-reloc.h (relocate_section): Check for placeholder symbols.
6773
6774 * testsuite/Makefile.am (plugin_test_8): New test.
6775 (plugin_test_9): New test.
6776 * testsuite/Makefile.in: Regenerate.
6777
6778 2010-06-09 Nick Clifton <nickc@redhat.com>
6779
6780 * yyscript.y (input_list_element): Allow strings prefixed with
6781 the '-' character. Treat these as libraries.
6782 * script.cc (script_add_library): New function. Adds a library
6783 specified by "-l<name>" found in an input script.
6784 * script-c.h: Add prototype for script_add_library.
6785
6786 2010-06-07 Doug Kwan <dougkwan@google.com>
6787
6788 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6789 Restrict stub-group size to be within long conditional branch
6790 range when working around cortex-A8 erratum.
6791
6792 2010-06-07 Damien Diederen <dd@crosstwine.com>
6793
6794 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6795 #ifdef typo.
6796
6797 2010-06-03 Sriraman Tallam <tmsriram@google.com>
6798
6799 PR gold/11658
6800 * output.cc
6801 (Output_section::Input_section_sort_entry::compare_section_ordering):
6802 Change to return non-zero correctly.
6803 (Output_section::Input_section_sort_section_order_index_compare
6804 ::operator()): Change to fix ambiguity in comparisons.
6805
6806 2010-06-01 Sriraman Tallam <tmsriram@google.com>
6807
6808 * gold.h (is_wildcard_string): New function.
6809 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6810 (Layout::layout_eh_frame): Ditto.
6811 (Layout::find_section_order_index): New method.
6812 (Layout::read_layout_from_file): New method.
6813 * layout.h (Layout::find_section_order_index): New method.
6814 (Layout::read_layout_from_file): New method.
6815 (Layout::input_section_position_): New private member.
6816 (Layout::input_section_glob_): New private member.
6817 * main.cc (main): Call read_layout_from_file here.
6818 * options.h (--section-ordering-file): New option.
6819 * output.cc (Output_section::input_section_order_specified_): New
6820 member.
6821 (Output_section::Output_section): Initialize new member.
6822 (Output_section::add_input_section): Add new parameter.
6823 Keep input sections when --section-ordering-file is used.
6824 (Output_section::set_final_data_size): Sort input sections when
6825 section ordering file is specified.
6826 (Output_section::Input_section_sort_entry): Add new parameter.
6827 Check sorting type.
6828 (Output_section::Input_section_sort_entry::compare_section_ordering):
6829 New method.
6830 (Output_section::Input_section_sort_compare::operator()): Change to
6831 consider section_order_index.
6832 (Output_section::Input_section_sort_init_fini_compare::operator()):
6833 Change to consider section_order_index.
6834 (Output_section::Input_section_sort_section_order_index_compare
6835 ::operator()): New method.
6836 (Output_section::sort_attached_input_sections): Change to sort
6837 according to section order when specified.
6838 (Output_section::add_input_section<32, true>): Add new parameter.
6839 (Output_section::add_input_section<64, true>): Add new parameter.
6840 (Output_section::add_input_section<32, false>): Add new parameter.
6841 (Output_section::add_input_section<64, false>): Add new parameter.
6842 * output.h (Output_section::add_input_section): Add new parameter.
6843 (Output_section::input_section_order_specified): New
6844 method.
6845 (Output_section::set_input_section_order_specified): New method.
6846 (Input_section::Input_section): Initialize section_order_index_.
6847 (Input_section::section_order_index): New method.
6848 (Input_section::set_section_order_index): New method.
6849 (Input_section::section_order_index_): New member.
6850 (Input_section::Input_section_sort_section_order_index_compare): New
6851 struct.
6852 (Output_section::input_section_order_specified_): New member.
6853 * script-sections.cc (is_wildcard_string): Delete and move modified
6854 method to gold.h.
6855 (Output_section_element_input::Output_section_element_input): Modify
6856 call to is_wildcard_string.
6857 (Output_section_element_input::Input_section_pattern
6858 ::Input_section_pattern): Ditto.
6859 (Output_section_element_input::Output_section_element_input): Ditto.
6860 * testsuite/Makefile.am (final_layout): New test case.
6861 * testsuite/Makefile.in: Regenerate.
6862 * testsuite/final_layout.cc: New file.
6863 * testsuite/final_layout.sh: New file.
6864
6865 2010-06-01 Rafael Espindola <espindola@google.com>
6866
6867 * plugin.cc (Plugin::load): Pass the output name to the plugin.
6868
6869 2010-06-01 Rafael Espindola <espindola@google.com>
6870
6871 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6872 visibility of symbols.
6873
6874 2010-05-27 Doug Kwan <dougkwan@google.com>
6875
6876 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6877 from start of output section instead of address for a local symbol
6878 in a merged or relaxed section when doing a relocatable link.
6879
6880 2010-05-26 Rafael Espindola <espindola@google.com>
6881
6882 PR 11604
6883 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6884 adding sections the garbage collector removed.
6885 * gold/testsuite/Makefile.am: Add test.
6886 * gold/testsuite/Makefile.in: Regenerate.
6887 * gold/testsuite/plugin_test_7.sh: New.
6888 * gold/testsuite/plugin_test_7_1.c: New.
6889 * gold/testsuite/plugin_test_7_2.c: New.
6890
6891 2010-05-26 Rafael Espindola <espindola@google.com>
6892
6893 * script-sections.cc (Output_section_definition::set_section_addresses):
6894 Check for --section-start.
6895
6896 2010-05-26 Doug Kwan <dougkwan@google.com>
6897
6898 * arm.cc (Arm_scan_relocatable_relocs): New class.
6899 (Target_arm::relocate_special_relocatable): New method.
6900 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6901 (Arm_relocate_functions::thumb_branch_common): Same.
6902 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6903 instead of Default_scan_relocatable_relocs.
6904 * target-reloc.h (relocate_for_relocatable): Let target handle
6905 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6906 * target.h (Sized_target::relocate_special_relocatable): New method.
6907
6908 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6909
6910 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6911
6912 2010-05-23 Doug Kwan <dougkwan@google.com>
6913
6914 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6915 instead of a cast.
6916 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6917 with a direct branch, not a conditional branch, to a stub.
6918 * merge.cc (Output_merge_base::record_input_section): New method
6919 defintion.
6920 (Output_merge_data::do_add_input_section): Record input section if
6921 keeps-input-sections flag is set.
6922 (Output_merge_string::do_add_input_section): Ditto.
6923 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6924 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6925 INPUT_SECTIONS_.
6926 (Output_merge_base::keeps_input_sections,
6927 Output_merge_base::set_keeps_input_sections,
6928 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6929 method definitions.
6930 (Output_merge_base::Input_sections): New type declaration.
6931 (Output_merge_base::input_sections_begin,
6932 Output_merge_base::input_sections_end,
6933 Output_merge_base::do_set_keeps_input_sections): New method definitions.
6934 (Output_merge_base::bool keeps_input_sections_,
6935 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6936 Output_merge_base::input_sections_): New data members.
6937 (Output_merge_data::do_set_keeps_input_sections): New method
6938 defintion.
6939 (Output_merge_string::do_set_keeps_input_sections): Ditto.
6940 * output.cc (Output_section::Input_section::relobj): Move method
6941 defintion from class declaration to here and handle merge sections.
6942 (Output_section::Input_section::shndx): Ditto.
6943 (Output_section::Output_section): Remove initializations of removed
6944 data members and initialize new data member LOOKUP_MAPS_.
6945 (Output_section::add_input_section): Set keeps-input-sections flag
6946 for a newly created merge output section as appropriate. Adjust code
6947 to use Output_section_lookup_maps class.
6948 (Output_section::add_relaxed_input_section): Adjst code for lookup
6949 maps code refactoring.
6950 (Output_section::add_merge_input_section): Add a new parameter
6951 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
6952 class. If adding input section to a newly created merge output
6953 section fails, remove the new merge section.
6954 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6955 Adjust code for use of the Output_section_lookup_maps class.
6956 (Output_section::find_merge_section): Ditto.
6957 (Output_section::build_lookup_maps): New method defintion.
6958 (Output_section::find_relaxed_input_section): Adjust code to use
6959 Output_section_lookup_maps class.
6960 (Output_section::get_input_sections): Export merge sections. Adjust
6961 code to use Output_section_lookup_maps class.
6962 (Output_section:::add_script_input_section): Adjust code to use
6963 Output_section_lookup_maps class. Update lookup maps for merge
6964 sections also.
6965 (Output_section::discard_states): Use Output_section_lookup_maps.
6966 (Output_section::restore_states): Same.
6967 * output.h (Merge_section_properties): Move class defintion out of
6968 Output_section.
6969 (Output_section_lookup_maps): New class.
6970 (Output_section::Input_section::is_merge_section): New method
6971 defintion.
6972 (Output_section::Input_section::relobj): Move defintion out of class
6973 defintion. Declare method only.
6974 (Output_section::Input_section::shndx): Ditto.
6975 (Output_section::Input_section::output_merge_base): New method defintion.
6976 (Output_section::Input_section::u2_.pomb): New union field.
6977 (Output_section::Merge_section_by_properties_map,
6978 Output_section::Output_section_data_by_input_section_map,
6979 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6980 Remove types.
6981 (Output_section::add_merge_input_section): Add new parameter
6982 KEEPS_INPUT_SECTIONS.
6983 (Output_section::build_lookup_maps): New method declaration.
6984 (Output_section::merge_section_map_,
6985 Output_section::merge_section_by_properties_map_,
6986 Output_section::relaxed_input_section_map_,
6987 Output_section::is_relaxed_input_section_map_valid_): Remove data
6988 members.
6989 (Output_section::lookup_maps_): New data member.
6990
6991 2010-05-21 Doug Kwan <dougkwan@google.com>
6992
6993 PR gold/11619
6994 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6995 avoid a compilation error.
6996
6997 2010-05-19 Rafael Espindola <espindola@google.com>
6998
6999 * script-sections.cc (Output_section_definition::allocate_to_segment):
7000 Update the phdrs_list even when the output section is NULL.
7001 * testsuite/Makefile.am: Add test.
7002 * testsuite/Makefile.in: Regenerate.
7003 * testsuite/script_test_9.cc: New.
7004 * testsuite/script_test_9.sh: New.
7005 * testsuite/script_test_9.t: New.
7006
7007 2010-05-19 Doug Kwan <dougkwan@google.com>
7008
7009 * arm.cc (Arm_input_section::original_size): New method.
7010 (Arm_input_section::do_addralign): Add a cast.
7011 (Arm_input_section::do_output_offset): Remove static cast.
7012 (Arm_input_section::original_addralign,
7013 Arm_input_section::original_size_): Change type to uint32_t.
7014 (Arm_input_section::init): Add safe casts for section alignment
7015 and size.
7016 (Arm_input_section::set_final_data_size): Do not set address and
7017 offset of stub table.
7018 (Arm_output_section::fix_exidx_coverage): Change use of of
7019 Output_section::Simple_input_section to that of
7020 Output_section::Input_section.
7021 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7022 except for the first pass.
7023 * output.cc (Output_section::get_input_sections): Change type of
7024 input_sections to std::list<Input_section>.
7025 (Output_section::add_script_input_section): Rename from
7026 Output_section::add_simple_input_section. Change type of SIS
7027 parameter from Simple_input_section to Input_section.
7028 * output.h (Output_section::Simple_input_section): Remove class.
7029 (Output_section::Input_section): Change class visibility to public.
7030 (Output_section::Input_section::addralign): Use stored alignments
7031 for special input sections if set.
7032 (Output_section::Input_section::set_addralign): New method.
7033 (Output_section::get_input_sections): Change parameter type from
7034 list of Simple_input_section to list of Input_section.
7035 (Output_section::add_script_input_section): Rename from
7036 Output_section::add_simple_input_section. Change first parameter's
7037 type from Simple_input_section to Input_section and remove the
7038 second and third parameters.
7039 * script-sections.cc (Input_section::Input_section_list): Change
7040 type to list of Output_section::Input_section/
7041 (Input_section_info::Input_section_info): Change parameter type of
7042 INPUT_SECTION to Output_section::Input_section.
7043 (Input_section_info::input_section): Change return type.
7044 (Input_section_info::input_section_): Change type to
7045 Output_section::Input_section.
7046 (Output_section_element_input::set_section_addresses): Adjust code
7047 to use Output_section::Input_section instead of
7048 Output_section::Simple_input_section. Adjust code for renaming
7049 of Output_section::add_simple_input_section.
7050 (Orphan_output_section::set_section_addresses): Ditto.
7051
7052 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7053
7054 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7055 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7056
7057 2010-05-18 Rafael Espindola <espindola@google.com>
7058
7059 * options.cc (General_options::finalize): Handle -nostdlib.
7060 * options.h (nostdlib): New option.
7061 * script.cc (script_add_search_dir): Handle -nostdlib.
7062
7063 2010-05-12 Doug Kwan <dougkwan@google.com>
7064
7065 * arm.cc (Target_arm::do_finalize_sections): Create an empty
7066 attributes section only if there no attributes section after merging.
7067 (Target_arm::merge_object_attributes): Move value of
7068 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7069 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7070 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7071 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7072 and arm_attr_merge_7.stdout.
7073 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7074 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7075 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7076 arm_attr_merge_7b.o): New rules.
7077 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7078 arm_attr_merge_7
7079 * testsuite/Makefile.in: Regenerate.
7080 * testsuite/arm_attr_merge.sh: New file.
7081 * testsuite/arm_attr_merge_[67][ab].s: Same.
7082
7083 2010-05-05 Nick Clifton <nickc@redhat.com>
7084
7085 * po/es.po: Updated Spanish translation.
7086
7087 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7088
7089 * Makefile.am (install-exec-local): Properly install gold as
7090 default cross linker.
7091 * Makefile.in: Regenerated.
7092
7093 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7094 Nick Clifton <nickc@redhat.com>
7095
7096 * configure.ac (install_as_default): Define and set to false
7097 unless --enable-gold or --enable-gold=both/gold has been
7098 specified.
7099 * configure: Regenerate.
7100
7101 * Makefile.am (install-exec-local): Install the executable as
7102 'ld.gold'. If install_as_default is true then also install it as
7103 'ld'.
7104 * Makefile.in: Regenerated.
7105
7106 2010-04-24 Ian Lance Taylor <iant@google.com>
7107
7108 * layout.cc (Layout::layout_reloc): In relocatable link don't
7109 combine reloc sections for grouped sections.
7110
7111 2010-04-23 Sriraman Tallam <tmsriram@google.com>
7112
7113 * gc.h (gc_process_relocs): Pass information on relocs pointing to
7114 sections that are not ordinary to icf.
7115 * icf.cc (get_section_contents): Handle relocation pointing to section
7116 with no object or shndx information.
7117 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7118 * testsuite/Makefile.in: Regenerate.
7119 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7120 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7121
7122 2010-04-22 Ian Lance Taylor <iant@google.com>
7123
7124 * expression.cc (Expression::Expression_eval_info): Add
7125 result_alignment_pointer field.
7126 (Expression::eval_with_dot): Add result_alignment_pointer
7127 parameter. Change all callers.
7128 (Expression::eval_maybe_dot): Likewise.
7129 (class Binary_expression): Add alignment_pointer parameter to
7130 left_value and right_value. Change all callers.
7131 (BINARY_EXPRESSION): Set result alignment.
7132 (class Trinary_expression): Add alignment_pointer parameter to
7133 arg2_value and arg3_value. Change all callers.
7134 (Trinary_cond::value): Set result alignment.
7135 (Max_expression::value, Min_expression::value): Likewise.
7136 (Align_expression::value): Likewise.
7137 * script-sections.cc (class Sections_element): Add dot_alignment
7138 parameter to set_section_addresses virtual function. Update
7139 instantiations.
7140 (class Output_section_element): Likewise.
7141 (Script_sections::create_segments): Add dot_alignment parameter.
7142 Change all callers.
7143 (Script_sections::create_segments_from_phdrs_clause): Likewise.
7144 (Script_sections::set_phdrs_clause_addresses): Likewise.
7145 * script-sections.h: Update declarations.
7146 * script.h: Update declarations.
7147 * output.h (Output_segment::set_minimum_p_align): Don't decrease
7148 min_p_align.
7149 * testsuite/script_test_3.t: Set large alignment.
7150 * testsuite/script_test_3.sh: Make sure that at least one LOAD
7151 segment has expected alignment.
7152
7153 2010-04-22 Nick Clifton <nickc@redhat.com>
7154
7155 * po/gold.pot: Updated by the Translation project.
7156 * po/vi.po: Updated Vietnamese translation.
7157
7158 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
7159
7160 * testsuite/Makefile.am (check_PROGRAMS): Add
7161 icf_virtual_function_folding_test.
7162 * testsuite/Makefile.in: Regenerated.
7163
7164 2010-04-15 Andrew Haley <aph@redhat.com>
7165
7166 * options.h (merge_exidx_entries): New option.
7167 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7168 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7169 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7170 (Target_arm::merge_exidx_entries): New function.
7171 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7172 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7173 to Arm_exidx_fixup constructor.
7174 Add new arg, merge_exidx_entries.
7175 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7176 Arm_output_section::fix_exidx_coverage.
7177
7178 2010-04-18 Sriraman Tallam <tmsriram@google.com>
7179
7180 * icf.cc (get_section_contents): Check for preemptible functions.
7181 Ignore addend when appropriate.
7182 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
7183 section folded.
7184 (add_from_relobj): Check for section folded.
7185 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7186 * symtab.h (should_add_dynsym_entry): Add new parameter.
7187 * target-reloc.h (scan_relocs): Check for section folded.
7188 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7189 Check reloc types for function pointers in shared objects.
7190 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7191 case.
7192 (icf_preemptible_functions_test): New test case.
7193 (icf_string_merge_test): New test case.
7194 * testsuite.Makefile.in: Regenerate.
7195 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7196 bar_glob. Refactor code.
7197 * testsuite/icf_preemptible_functions_test.cc: New file.
7198 * testsuite/icf_preemptible_functions_test.sh: New file.
7199 * testsuite/icf_string_merge_test.cc: New file.
7200 * testsuite/icf_string_merge_test.sh: New file.
7201 * testsuite/icf_virtual_function_folding_test.cc: New file.
7202 * testsuite/icf_virtual_function_folding_test.sh: New file.
7203
7204 2010-04-14 Doug Kwan <dougkwan@google.com>
7205
7206 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7207 for local symbol recounting if we remove a section due to ICF.
7208 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7209 there are no regular objects in input.
7210
7211 2010-04-13 Doug Kwan <dougkwan@google.com>
7212
7213 * arm.cc (Arm_input_section::set_final_data_size): Compute
7214 accurate final data size instead of using current data size.
7215
7216 2010-04-09 Doug Kwan <dougkwan@google.com>
7217
7218 * layout.cc (Layout::choose_output_section): Handle script section
7219 types.
7220 (Layout::make_output_section_for_script): Add section type parameter.
7221 Handle script section types.
7222 * layout.h (Layout::make_output_section_for_script): Add section
7223 type parameter.
7224 * output.cc (Output_section::Output_section): Initialize data member
7225 is_noload_.
7226 (Output_section::do_reset_address_and_file_offset): Do not set address
7227 to 0 if section is a NOLOAD section.
7228 * output.h (Output_section::is_noload): New method.
7229 (Output_section::set_is_noload): Ditto.
7230 (Output_section::is_noload_): New data member.
7231 * script-c.h (Script_section_type): New enum type.
7232 (struct Parser_output_section_header): Add new file section_type.
7233 * script-sections.cc (Sections_element::output_section_name): Add
7234 parameter for returning script section type.
7235 (Output_section_definition::output_section_name): Ditto.
7236 (Output_section_definition::section_type)P; New method.
7237 (Output_section_definiton::script_section_type_name): Ditto.
7238 (Output_section_definition::script_section_type_): New data member.
7239 (Output_section_definition::Output_section_definition): Initialize
7240 data member Output_section_definition::script_section_type_.
7241 (Output_section_definition::create_sections): Pass script section type
7242 to Layout::make_output_section_for_script.
7243 (Output_section_definition::output_section_name): Return script
7244 section type to caller.
7245 (Output_section_definition::set_section_address): Do not advance
7246 dot value and load address if section type is NOLOAD. Set address
7247 of NOLOAD sections regardless of section flags.
7248 (Output_section_definition::print): Print section type if it is
7249 not SCRIPT_SECTION_TYPE_NONE.
7250 (Output_section_definition::section_type): New method.
7251 (Output_section_definition::script_section_type_name): Ditto.
7252 (Script_sections::output_section_name): Add new parameter
7253 PSECTION_TYPE for returning script section type. Pass it to
7254 section elements. Handle discard sections.
7255 (Sort_output_sections::operator()): Handle NOLOAD sections.
7256 * script-sections.h (Script_sections::Section_type): New enum type.
7257 (Script_sections::output_section_name): Add a new parameter for
7258 returning script section type.
7259 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7260 INFO and NOLOAD.
7261 * yyscript.y (union): Add new field SECTION_TYPE.
7262 (COPY, DSECT, INFO, NOLOAD): New tokens.
7263 (opt_address_and_section_type): Change type to output_section_header.
7264 (section_type): New non-terminal
7265 (section_header): Handle section type.
7266 (opt_address_and_section_type): Return section type value.
7267
7268 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
7269
7270 * testsuite/plugin_common_test_1.c (foo): Add prototype.
7271 * testsuite/plugin_common_test_2.c (foo): Likewise.
7272
7273 2010-04-08 Doug Kwan <dougkwan@google.com>
7274
7275 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7276 Output_merge_data.
7277 * output.cc (Output_section::add_merge_input_section): Simplify
7278 code and return status of Output_merge_base::add_input_section.
7279 Update merge section map only if Output_merge_base::add_input_section
7280 returns true.
7281
7282 2010-04-07 Doug Kwan <dougkwan@google.com>
7283
7284 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7285 if section is marked as containing instructions but has no mapping
7286 symbols.
7287 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7288 correct section index.
7289 (Arm_relobj::find_linked_text_section): Ditto.
7290
7291 2010-04-07 Cary Coutant <ccoutant@google.com>
7292
7293 * archive.cc (include_member): Destroy Read_symbols_data object before
7294 releasing file.
7295 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7296 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7297 (Read_symbols_data::~Read_symbols_data) New destructor.
7298 (Section_relocs::Section_relocs) New constructor.
7299 (Section_relocs::~Section_relocs) New destructor.
7300 (Read_relocs_data::Read_relocs_data) New constructor.
7301 (Read_relocs_data::~Read_relocs_data) New destructor.
7302 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7303 pointers to NULL after deleting.
7304
7305 2010-04-07 Doug Kwan <dougkwan@google.com>
7306
7307 * arm.cc: Replace "endianity" with "endianness" in comments.
7308 (Arm_exidx_cantunwind): Ditto.
7309 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7310 (Arm_relobj::merge_flags_and_attributes): New method.
7311 (Arm_relobj::merge_flags_and_attributes_): New data member.
7312 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7313 (Arm_relobj::scan_sections_for_stubs): Ditto.
7314 (Arm_relobj::do_read_symbols): Check to see if we really want to
7315 merge processor-specific flags and attributes. Exit early if
7316 an object is empty except for section names and the undefined symbol.
7317 (Target_arm::do_finalize_sections): Move check for ELF format to
7318 Arm_relobj::do_read_symbols. Merge processor specific flags and
7319 attributes from a regular object only when we have determined that
7320 it is aapropriate. Do not create an .ARM.attributes section in
7321 output if there is no regular input object.
7322 (Target_arm::merge_processor_specific_flags): Check
7323 --warn-mismatch before printing any error.
7324 (Target_arm::merge_object_attributes): Ditto.
7325 * gold.cc (queue_middle_tasks): Handle the case in which there is
7326 no regular object in input.
7327 * options.cc (General_options::parse_EB): New method.
7328 (General_options::parse_EL): Same.
7329 (General_options::General_options): Initialize endianness_.
7330 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7331 New options.
7332 (General_options::Endianness): New enum.
7333 (General_options::endianness): New method.
7334 (General_options::endianness_): New data member.
7335 * parameters.cc (Parameters::set_options): Check target endianness.
7336 (Parameters::set_target_once): Ditto.
7337 (Parameters::check_target_endianness): New method.
7338 (parameters_force_valid_target): If either -EL or -EB is specified,
7339 use it to define endianness of default target.
7340 * parameters.h (Parameters::check_target_endianness): New method
7341 declaration.
7342 * target.h (class Target): Change "endianity" to "endianness"
7343 in comments.
7344
7345 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7346
7347 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7348 * configure: Regenerate.
7349 * Makefile.in: Regenerate.
7350 * testsuite/Makefile.in: Regenerate.
7351
7352 2010-04-06 Cary Coutant <ccoutant@google.com>
7353
7354 gcc PR lto/42757
7355 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7356 prevailing definitions of common symbols.
7357 * testsuite/plugin_test_6.sh: New test case.
7358 * testsuite/plugin_common_test_1.c: New test case.
7359 * testsuite/plugin_common_test_2.c: New test case.
7360 * testsuite/Makefile.am (plugin_test_6): New test case.
7361 * testsuite/Makefile.in: Regenerate.
7362
7363 2010-04-06 Nick Clifton <nickc@redhat.com>
7364
7365 * po/vi.po: New Vietnamese translation.
7366
7367 2010-03-30 Doug Kwan <dougkwan@google.com>
7368
7369 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7370
7371 2010-03-25 Doug Kwan <dougkwan@google.com>
7372
7373 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7374 to avoid a conversion warning on a 32-bit host.
7375
7376 2010-03-24 Ian Lance Taylor <iant@google.com>
7377
7378 * testsuite/script_test_3.t: Add a TLS segment.
7379 * testsuite/Makefile.am (check_PROGRAMS): Add
7380 tls_phdrs_script_test.
7381 (tls_phdrs_script_test_SOURCES): Define.
7382 (tls_phdrs_script_test_DEPENDENCIES): Define.
7383 (tls_phdrs_script_test_LDFLAGS): Define.
7384 (tls_phdrs_script_test_LDADD): Define.
7385 * testsuite/Makefile.in: Rebuild.
7386
7387 2010-03-23 Cary Coutant <ccoutant@google.com>
7388
7389 * fileread.cc (find_or_make_view): Fix comment.
7390
7391 2010-03-23 Ian Lance Taylor <iant@google.com>
7392
7393 * script-sections.cc (class Orphan_section_placement): Define
7394 PLACE_TLS and PLACE_TLS_BSS.
7395 (Orphan_section_placement::Orphan_section_placement): Initialize
7396 new places.
7397 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7398 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7399 (tls_script_test_SOURCES): Define.
7400 (tls_script_test_DEPENDENCIES): Define.
7401 (tls_script_test_LDFLAGS): Define.
7402 (tls_script_test_LDADD): Define.
7403 * testsuite/Makefile.in: Rebuild.
7404
7405 2010-03-22 Doug Kwan <dougkwan@google.com>
7406
7407 * arm.cc (Arm_relocate_functions::abs8,
7408 Arm_relocate_functions::abs16): Use correct check for overflow
7409 specified in the ARM ELF specs.
7410 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
7411 target of a BLX instruction specially.
7412 (Reloc_stub::stub_type_for_reloc): Ditto.
7413 (Relocate::relocate): Use symbolic names instead of numeric relocation
7414 codes to report error.
7415 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7416 workaround.
7417 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7418 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7419 thumb2_blx_out_of_range.stdout
7420 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7421 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7422 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7423 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7424 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7425 thumb2_blx_in_range, thumb2_blx_in_range.o,
7426 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7427 thumb2_blx_out_of_range.o): New rules.
7428 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7429 thumb2_blx_in_range and thumb2_blx_out_of_range.
7430 * testsuite/Makefile.in: Regenerate.
7431 * arm_branch_in_range.sh: Add tests for THUMB BLX.
7432 * testsuite/thumb_blx_in_range.s: New file.
7433 * testsuite/thumb_blx_out_of_range.s: New file.
7434
7435 2010-03-22 Rafael Espindola <espindola@google.com>
7436
7437 * archive.cc (Should_include): Move to archive.h.
7438 (should_include_member): Make it a member of Archive.
7439 (Lib_group): New.
7440 (Add_lib_group_symbols): New.
7441 * archive.h: Include options.h.
7442 (Archive_member): Moved from Archive.
7443 (Should_include): Moved from archive.cc.
7444 (Lib_group): New.
7445 (Add_lib_group_symbols): New.
7446 * dynobj.cc (do_should_include_member): New.
7447 * dynobj.h (do_should_include_member): New.
7448 * gold.cc (queue_initial_tasks): Update call to queue.
7449 * main.cc (main): Print lib group stats.
7450 * object.cc (do_should_include_member): New.
7451 * object.h: Include archive.h.
7452 (Object::should_include_member): New.
7453 (Object::do_should_include_member): New.
7454 (Sized_relobj::do_should_include_member): New.
7455 * options.cc (General_options::parse_start_lib): New.
7456 (General_options::parse_end_lib): New.
7457 (Input_arguments::add_file): Handle lib groups.
7458 (Input_arguments::start_group): Check we are not in a lib.
7459 (Input_arguments::start_lib): New.
7460 (Input_arguments::end_lib): New.
7461 * options.h (General_options): Add start_lib and end_lib.
7462 (Input_argument::lib_): New.
7463 (Input_argument::lib): New.
7464 (Input_argument::is_lib): New.
7465 (Input_file_lib): New.
7466 (Input_arguments::in_lib_): New.
7467 (Input_arguments::in_lib): New.
7468 (Input_arguments::start_lib): New.
7469 (Input_arguments::end_lib_): New.
7470 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7471 in unused members as preempted.
7472 (Sized_pluginobj::do_should_include_member): New.
7473 * plugin.h (Sized_pluginobj::do_should_include_member): New.
7474 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7475 return the blocker.
7476 (Read_symbols::do_whole_lib_group): New.
7477 (Read_symbols::do_lib_group): New.
7478 (Read_symbols::do_read_symbols): Handle lib groups.
7479 (Read_symbols::get_name): Handle lib groups.
7480 * readsyms.h (Read_symbols): Add an archive member pointer.
7481 (Read_symbols::do_whole_lib_group): New.
7482 (Read_symbols::do_lib_group): New.
7483 (Read_symbols::member_): New.
7484 * script.cc (read_input_script): Update call to queue_soon.
7485
7486 2010-03-19 Doug Kwan <dougkwan@google.com>
7487
7488 * arm.cc (Stub_table::Stub_table): Initialize new data members
7489 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7490 (Stub_table::add_reloc_stub): Assign stub offset and update
7491 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7492 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7493 New data members.
7494 (Stub_table::update_data_size_and_addralign): Use
7495 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7496 instead of going over all reloc stubs.
7497 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7498 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7499 Stringpool_template::offset_ to size of Stringpool_char.
7500 (Stringpool_template::new_key_offset): Remove code to initialize
7501 Stringpool_template::offset_.
7502 * stringpool.h (Stringpool_template::set_no_zero_null): Set
7503 Stringpool_template::offset_ to zero.
7504
7505 2010-03-15 Doug Kwan <dougkwan@google.com>
7506
7507 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7508 offset_.
7509 (Stringpool_template::new_key_offset): New method.
7510 (Stringpool_template::add_string): Assign offsets when adding new
7511 strings.
7512 (Stringpool_template::set_string_offsets): Do not set string offsets
7513 when not optimizing.
7514 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7515 member size_.
7516 (Chunked_vector::clear): Clear size_.
7517 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7518 (Chunked_vector::size): Return size_.
7519 (Chunked_vector::push_back): Use size_ to find insert position.
7520 (Chunked_vector::size_): New data member.
7521 (Stringpool_template::set_no_zero_null): Assert string set is empty.
7522 (Stringpool_template::new_key_offset): New method declaration.
7523 (Stringpool_template::offset_): New data member.
7524
7525 2010-03-15 Rafael Espindola <espindola@google.com>
7526
7527 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7528 Add_symbols' constructor.
7529 * readsyms.h (Add_symbols): Remove the input_group member.
7530
7531 2010-03-10 Ian Lance Taylor <iant@google.com>
7532
7533 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7534 target to ask whether a reference to a symbol requires a stack
7535 split.
7536 * target.h (Target::is_call_to_non_split): New function.
7537 (Target::do_is_call_to_non_split): Declare virtual function.
7538 * target.cc: Include "symtab.h".
7539 (Target::do_is_call_to_non_split): New function.
7540 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7541
7542 2010-03-10 Cary Coutant <ccoutant@google.com>
7543
7544 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7545 (File_read::open[1]): Remove initial mapping of whole_file_view_.
7546 (File_read::open[2]): Add whole_file_view_ to list of views.
7547 (File_read::make_view): Remove test of whole_file_view_.
7548 (File_read::find_or_make_view): Create whole_file_view_ if
7549 necessary.
7550 (File_read::clear_views): Replace bool parameter with enum;
7551 adjust all callers. Don't delete views with permanent data;
7552 do delete cached views and views from archives if
7553 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
7554 if clearing the corresponding view.
7555 * fileread.h (File_read::Clear_views_mode): New enum.
7556 (File_read::View::is_permanent_view): New method.
7557 (File_read::clear_views): Replace bool parameter
7558 with enum; adjust all callers.
7559 * options.h (General_options): Change keep_files_mapped option;
7560 add map_whole_files.
7561 * readsyms.cc (Add_symbols::run): Delete sd_ object before
7562 releasing the file.
7563 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7564 the file.
7565
7566 2010-03-10 David S. Miller <davem@davemloft.net>
7567
7568 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7569
7570 2010-03-09 Sriraman Tallam <tmsriram@google.com>
7571
7572 * icf.cc (get_section_contents): Add '@' marker after processing the
7573 merge reloc.
7574
7575 2010-03-08 Doug Kwan <dougkwan@google.com>
7576
7577 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7578 due to a conversion warning.
7579 (Arm_relobj::update_output_local_symbol_count): Check for local
7580 symbol with unset output index.
7581
7582 2010-03-05 Ian Lance Taylor <iant@google.com>
7583
7584 * options.h (class General_options): Add --spare-dynamic-tags.
7585 * output.cc (Output_data_dynamic::set_final_data_size): Implement
7586 --spare-dynamic-tags.
7587
7588 2010-03-05 Ian Lance Taylor <iant@google.com>
7589
7590 * incremental.cc: Include "libiberty.h".
7591
7592 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
7593
7594 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7595 function, is_info_ member.
7596 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7597 (Versions::Versions): Update caller.
7598 (Versions::define_base_version): Likewise.
7599 (Versions::add_def): Likewise.
7600
7601 2010-03-03 Sriraman Tallam <tmsriram@google.com>
7602
7603 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7604 (Scan::possible_function_pointer_reloc): New function.
7605 (Scan::local_reloc_may_be_function_pointer): Change to call
7606 possible_function_pointer_reloc.
7607 (Scan::global_reloc_may_be_function_pointer): Ditto.
7608 * icf.h (Icf::check_section_for_function_pointers): Change to reject
7609 relocations in ".data.rel.ro._ZTV" section.
7610 * testsuite/icf_safe_so_test.sh: Change to pass i386.
7611 * testsuite/icf_safe_so_test.cc: Ditto.
7612 * testsuite/icf_safe_test.cc: Ditto.
7613 * testsuite/icf_safe_test.sh: Ditto.
7614
7615 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7616 Ian Lance Taylor <iant@google.com>
7617
7618 * target-reloc.h (relocate_section): Check the symbol table index
7619 for -1U before setting the local symbol index.
7620 (scan_relocatable_relocs): If copying the relocation, record that
7621 the local symbol is required.
7622 * object.h (Symbol_value::is_output_symtab_index_set): New
7623 function.
7624 (Symbol_value::may_be_discarded_from_output_symtab): New
7625 function.
7626 (Symbol_value::has_output_symtab_entry): New function.
7627 (Symbol_value::needs_output_symtab_entry): Remove.
7628 (Symbol_value::output_symtab_index): Make sure the symbol index is
7629 set.
7630 (Symbol_value::set_output_symtab_index): Make sure the symbol
7631 index is not set. Make sure the new index is valid.
7632 (Symbol_value::set_must_have_output_symtab_entry): New function.
7633 (Symbol_value::has_output_dynsym_entry): New function.
7634 (Symbol_value::set_output_dynsym_index): Make sure the new index
7635 is valid.
7636 (Sized_relobj::set_must_have_output_symtab_entry): New function.
7637 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7638 local symbol if permitted.
7639 (Sized_relobj::do_finalize_local_symbols): Call
7640 is_output_symtab_index_set rather than needs_output_symtab_entry.
7641 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7642 rather than needs_output_symtab_entry. Call
7643 has_output_dynsym_entry rather than needs_output_dynsym_entry.
7644 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7645 is_output_symtab_index_set rather than needs_output_symtab_entry.
7646 * testsuite/discard_locals_relocatable_test.c: New file.
7647 * testsuite/discard_locals_test.sh: Test -r.
7648 * testsuite/Makefile.am (check_DATA): Add
7649 discard_locals_relocatable_test1.syms,
7650 discard_local_relocatable_test2.syms.
7651 (MOSTLYCLEANFILES): Likewise. Also add
7652 discard_locals_relocatable_test1.lout and
7653 discard_locals_relocatable_test2.out.
7654 (discard_locals_relocatable_test1.syms): New target.
7655 (discard_locals_relocatable_test.o): New target.
7656 (discard_locals_relocatable_test1.out): New target.
7657 (discard_locals_relocatable_test2.syms): New target.
7658 (discard_locals_relocatable_test2.out): New target.
7659 (various): Add missing ../ld-new dependencies.
7660 * testsuite/Makefile.in: Rebuild.
7661
7662 2010-03-03 Nick Clifton <nickc@redhat.com>
7663
7664 * po/fi.po: New Finnish translation.
7665
7666 2010-03-01 Doug Kwan <dougkwan@google.com>
7667
7668 * layout.cc (Layout::Layout): Force section types of .init_array*,
7669 .preinit_array* and .fini_array* sections.
7670 * output.cc (Output_section::Input_section_sort_entry::has_priority):
7671 Fix check of return value of std::string::find.().
7672 (Output_section::Input_section_sort_compare::operator()): Remove
7673 comment about .init_array.
7674 (Output_section::Input_section_sort_init_fini_compare::operator()):
7675 New method.
7676 (Output_section::sort_attached_input_sections): Handle .init_array
7677 and .fini_array specially.
7678 * output.h (Output_section::Inut_section_sort_compare): Update
7679 comment.
7680 (Output_section::Input_section_sort_init_fini_compare): New struct.
7681
7682 2010-02-26 Doug Kwan <dougkwan@google.com>
7683
7684 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7685 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7686 * testsuite/debug_msg.sh: Avoid matching source line number for
7687 use of global variable undef_int.
7688
7689 2010-02-26 Doug Kwan <dougkwan@google.com>
7690
7691 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7692 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7693 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7694 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7695 * options.cc (General_options::General_options): Initialize member
7696 fix_v4bx_.
7697 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7698 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7699 and rm_no_fix_v4bx.stdout
7700 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7701 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7702 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7703 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7704 and arm_no_fix_v4bx.
7705 * Makefile.in: Regenerate.
7706 * testsuite/arm_fix_v4bx.s: New file.
7707 * testsuite/arm_fix_v4bx.sh: Ditto.
7708
7709 2010-02-24 Doug Kwan <dougkwan@google.com>
7710
7711 * arm.cc (Target_arm::got_section): Make the .got section the first
7712 non RELRO section in the data segment.
7713 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7714 suffixes of section names.
7715
7716 2010-02-24 Doug Kwan <dougkwan@google.com>
7717
7718 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7719 flags and attributes merging if an input file is a binary file.
7720 * fileread.cc (Input_file::open): Record format of original file.
7721 * fileread.h (Input_file::Format): New enum type.
7722 (Input_file::Input_file): Initialize data member format_.
7723 (Input_file::format): New method definition.
7724 (Input_file::format_):: New data member.
7725
7726 2010-02-24 Doug Kwan <dougkwan@google.com>
7727
7728 * arm.cc (Arm_output_data_got): New class.
7729 (ARM_TCB_SIZE): New constant
7730 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7731 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7732 If user uses a script with a SECTIONS clause, issue only a warning
7733 for a misplaced EXIDX input section. Otherwise, issue an error.
7734 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7735 garbage collection.
7736 (Target_arm::got_mode_index_entry): Handle static linking.
7737 (Target_arm::Scan::local): Ditto.
7738 (Target_arm::Scan::global): Ditto.
7739 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
7740 all incorrectly implemented relocations.
7741 (Target_arm::fix_exidx_coverage): Pass layout to
7742 Arm_output_section::fix_exidx_coverage.
7743 * layout.cc (Layout::section_name_mapping): Remove trailing dots
7744 from ".ARM.exidx." and ".ARM.extab.".
7745
7746 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7747
7748 * arm.cc (Target_arm::do_finalize_sections): Create attribute
7749 section if it does not already exist.
7750 * attributes.cc (Attributes_section_data::Attributes_section_data):
7751 Don't crash if size is zero.
7752
7753 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7754 Ian Lance Taylor <iant@google.com>
7755
7756 * gold.cc (queue_middle_tasks): If no input files were opened,
7757 exit.
7758 * workqueue.h (Task_function::Task_function): Assert that there is
7759 a blocker.
7760
7761 2010-02-22 Doug Kwan <dougkwan@google.com>
7762
7763 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7764 * icf.cc (get_section_contents): Cast snprintf arguments to long long
7765 types to avoid warnings due to different uint64_t implementations
7766 on different hosts.
7767
7768 2010-02-21 Doug Kwan <dougkwan@google.com>
7769
7770 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7771 handling of the maximum backward branch offset.
7772 (Arm_relocate_functions::thumb_branch_common): Ditto.
7773 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7774 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7775 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7776 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7777 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7778 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7779 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7780 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7781 thumb_bl_out_of_range thumb_bl_out_of_range.o,
7782 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7783 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7784 thumb2_bl_out_of_range.o): New rules.
7785 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7786 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7787 thumb2_bl_out_of_range
7788 * testsuite/Makefile.in: Regenerate.
7789 * testsuite/arm_bl_in_range.s: New file.
7790 * testsuite/arm_bl_out_of_range.s: Ditto.
7791 * testsuite/arm_branch_in_range.sh: Ditto.
7792 * testsuite/arm_branch_range.t: Ditto.
7793 * testsuite/thumb2_branch_range.t: Ditto.
7794 * testsuite/thumb_bl_in_range.s: Ditto.
7795 * testsuite/thumb_bl_out_of_range.s: Ditto.
7796 * testsuite/thumb_branch_range.t: Ditto.
7797
7798 2010-02-20 Sriraman Tallam <tmsriram@google.com>
7799
7800 * gc.h (gc_process_relocs): Change vectors to point to the new list.
7801 Add reloc offset information.
7802 * icf.cc (get_section_contents): Change iterators to point to the new
7803 vectors. Add reloc offset information to the contents.
7804 * icf.h (Icf::Sections_reachable_info): New typedef.
7805 (Icf::Sections_reachable_list): New typedef.
7806 (Icf::Offset_info): New typedef.
7807 (Icf::Reloc_info): New struct typedef.
7808 (Icf::Reloc_info_list): New typedef.
7809 (Icf::symbol_reloc_list): Delete method.
7810 (Icf::addend_reloc_list): Delete method.
7811 (Icf::section_reloc_list): Delete method.
7812 (Icf::reloc_info_list): New method.
7813 (Icf::reloc_info_list_): New member.
7814
7815 2010-02-19 Doug Kwan <dougkwan@google.com>
7816
7817 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7818 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7819 * arm.cc (Arm_relocation_functions): New forward declaration.
7820 (Target_arm::Target_arm): Initialize new data members
7821 got_mod_index_offset_ and tls_base_symbol_defined_.
7822 (Target_arm::Relocate::relocate_tls): New method.
7823 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7824 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7825 New methods.
7826 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7827 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7828 (Target_arm::got_mod_index_offset_,
7829 Target_arm::tls_base_symbol_defined_): New data members.
7830 (Target_arm::Scan::local, Target::Scan::global,
7831 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7832 relocations.
7833
7834 2010-02-18 Doug Kwan <dougkwan@google.com>
7835
7836 * arm.cc (Arm_relobj::find_linked_text_section): New method.
7837 (Arm_relobj::make_exidx_input_section): Pass section index of linked
7838 text section as a parameter becuase some broken tools may not set
7839 the link in section header.
7840 (Target_arm::has_got_section): New method.
7841 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7842 without any mapping symbol as data only. Remove warning.
7843 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7844 link in its section header, try to discover the link by inspecting the
7845 REL31 relocation at the beginning of the section.
7846 (Target_arm::Scan::check_non_pic): Report name of offending relocation
7847 in error message.
7848 (Target_arm::Scan::global): Treat any reference to the symbol
7849 _GLOBAL_OFFSET_TABLE_ as a GOT access.
7850
7851 2010-02-12 Sriraman Tallam <tmsriram@google.com>
7852
7853 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7854 (Scan::global_reloc_may_be_function_pointer): New function.
7855 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7856 (Scan::global_reloc_may_be_function_pointer): New function.
7857 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7858 (Scan::global_reloc_may_be_function_pointer): New function.
7859 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7860 (Scan::global_reloc_may_be_function_pointer): New function.
7861 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7862 (Scan::global_reloc_may_be_function_pointer): New function.
7863 (Scan::possible_function_pointer_reloc): New function.
7864 (Target_x86_64::can_check_for_function_pointers): New function.
7865 * gc.h (gc_process_relocs): Scan relocation types to determine if
7866 function pointers were taken for targets that support it.
7867 * icf.cc (Icf::find_identical_sections): Include functions for
7868 folding in safe ICF whose pointer is not taken.
7869 * icf.h (Secn_fptr_taken_set): New typedef.
7870 (fptr_section_id_): New member.
7871 (section_has_function_pointers): New function.
7872 (set_section_has_function_pointers): New function.
7873 (check_section_for_function_pointers): New function.
7874 * options.h: Fix comment for safe ICF option.
7875 * target.h (can_check_for_function_pointers): New function.
7876 * testsuite/Makefile.am: Add icf_safe_so_test test case.
7877 Modify icf_safe_test for X86-64.
7878 * testsuite/Makefile.in: Regenerate.
7879 * testsuite/icf_safe_so_test.cc: New file.
7880 * testsuite/icf_safe_so_test.sh: New file.
7881 * testsuite/icf_safe_test.cc (kept_func_3): New function.
7882 (main): Change to take pointer to function kept_func_3.
7883 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7884 folding is done correctly for X86-64.
7885
7886 2010-02-12 David S. Miller <davem@davemloft.net>
7887
7888 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7889 is_symbolless parameter.
7890 (Output_reloc<SHT_REL>::is_symbolless): New.
7891 (Output_reloc<SHT_REL>::is_symbolless_): New.
7892 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7893 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7894 (Output_reloc<SHT_RELA>::is_symbolless): New.
7895 (Output_data_reloc::add_global): Handle is_symbolless.
7896 (Output_data_reloc::add_global_relative): Likewise.
7897 (Output_data_reloc::add_local): Likewise.
7898 (Output_data_reloc::add_local_relative): Likewise.
7899 (Output_data_reloc::add_symbolless_global_addend): New.
7900 (Output_data_reloc::add_symbolless_local_addend): New.
7901 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7902 is_symbolless.
7903 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7904 instead of ->is_relative_
7905 (Output_reloc::write): Likewise.
7906 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7907 (Output_reloc::write_rel): Simplify.
7908
7909 * sparc.cc (Target_sparc::Scan::local): Use
7910 ->add_symbolless_local_addend as needed.
7911 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7912 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
7913 based upon relocation offset.
7914
7915 2010-02-11 Doug Kwan <dougkwan@google.com>
7916
7917 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7918 (Target_arm::Scan::global): Ditto. Also remove a comment before the
7919 beginning of function.
7920 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7921 and MOVT_ABS relocations. Those are non issued in scanning. Fix
7922 parameter is_32bit in calls to should_apply_static_reloc.
7923 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7924 (check_DATA): Add arm_abs_global.stdout.
7925 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7926 arm_abs_global.stdout): New rules.
7927 (MOSTLLYCLEANFILES): Add arm_abs_global
7928 * Makefile.in: Regenerate.
7929 * testsuite/arm_abs_global.s: New file.
7930 * testsuite/arm_abs_global.sh: Ditto.
7931 * testsuite/arm_abs_lib.s: Ditto.
7932
7933 2010-02-11 Ian Lance Taylor <iant@google.com>
7934
7935 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7936 Read_relocs task.
7937 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
7938 Allocate_commons_task first.
7939 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7940 task, rather than symtab_lock_.
7941 (Gc_process_relocs::~Gc_process_relocs): New function.
7942 (Gc_process_relocs::is_runnable): Check this_blocker_.
7943 (Gc_process_relocs::locks): Use next_blocker_ rather than
7944 blocker_.
7945 (Scan_relocs::~Scan_relocs): New function.
7946 (Scan_relocs::is_runnable): Check this_blocker_ rather than
7947 symtab_lock_.
7948 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
7949 next_blocker_.
7950 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7951 fields. Add this_blocker_ and next_blocker_ fields. Adjust
7952 constructor accordingly.
7953 (class Gc_process_relocs): Likewise.
7954 (class Scan_relocs): Likewise.
7955 * common.h (class Allocate_commons_task): Remove symtab_lock_
7956 field, and corresponding constructor parameter.
7957 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7958 symtab_lock_.
7959 (Allocate_commons_task::locks): Likewise.
7960
7961 2010-02-11 Ian Lance Taylor <iant@google.com>
7962
7963 * gold-threads.h (class Once): Define.
7964 (class Initialize_lock): Rewrite as child of Once.
7965 * gold-threads.cc (class Once_initialize): Define.
7966 (once_pointer_control): New static variable.
7967 (once_pointer, once_arg): New static variables.
7968 (c_run_once): New static function.
7969 (Once::Once, Once::run_once, Once::internal_run): New functions.
7970 (class Initialize_lock_once): Remove.
7971 (initialize_lock_control): Remove.
7972 (initialize_lock_pointer): Remove.
7973 (initialize_lock_once): Remove.
7974 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7975 (Initialize_lock::initialize): Rewrite.
7976 (Initialize_lock::do_run_once): New function.
7977 * archive.cc (Archive::interpret_header): Only clear name if it is
7978 not already empty.
7979 * fileread.cc: Include "gold-threads.h"
7980 (file_counts_lock): New static variable.
7981 (file_counts_initialize_lock): Likewise.
7982 (File_read::release): Only increment counts when using --stats.
7983 Use a lock around the increment.
7984 * parameters.cc (class Set_parameters_target_once): Define.
7985 (set_parameters_target_once): New static variable.
7986 (Parameters::Parameters): Move here from parameters.h.
7987 (Parameters::set_target): Rewrite.
7988 (Parameters::set_target_once): New function.
7989 (Parameters::clear_target): Move here and rewrite.
7990 * parameters.h (class Parameters): Update declarations. Add
7991 set_parameters_target_once_ field.
7992 (Parameters::Parameters): Move to parameters.cc.
7993 (Parameters::clear_target): Likewise.
7994 * readsyms.cc (Read_symbols::do_group): Create a Start_group
7995 task.
7996 (Start_group::~Start_group): New function.
7997 (Start_group::is_runnable): New function.
7998 (Start_group::locks, Start_group::run): New functions.
7999 (Finish_group::run): Change saw_undefined to size_t.
8000 * readsyms.h (class Start_group): Define.
8001 (class Finish_group): Change saw_undefined_ field to size_t.
8002 (Finish_group::Finish_group): Remove saw_undefined and
8003 this_blocker parameters. Change all callers.
8004 (Finish_group::set_saw_undefined): New function.
8005 (Finish_group::set_blocker): New function.
8006 * symtab.h (class Symbol_table): Change saw_undefined to return
8007 size_t. Change saw_undefined_ field to size_t.
8008 * target-select.cc (Set_target_once::do_run_once): New function.
8009 (Target_selector::Target_selector): Initialize set_target_once_
8010 field. Don't initialize lock_ and initialize_lock_ fields.
8011 (Target_selector::instantiate_target): Rewrite.
8012 (Target_selector::set_target): New function.
8013 * target-select.h (class Set_target_once): Define.
8014 (class Target_selector): Update declarations. Make
8015 Set_target_once a friend. Remove lock_ and initialize_lock_
8016 fields. Add set_target_once_ field.
8017
8018 2010-02-10 Ian Lance Taylor <iant@google.com>
8019
8020 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8021 queueing any tasks.
8022 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
8023 (queue_middle_tasks): Add all blockers before queueing any tasks.
8024 (queue_final_tasks): Likewise.
8025 * token.h (Task_token::add_blockers): New function.
8026 * object.h (Input_objects::number_of_relobjs): New function.
8027
8028 2010-02-10 Ian Lance Taylor <iant@google.com>
8029
8030 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8031 shared, not if not position independent.
8032 * x86_64.cc (Relocate::relocate_tls): Likewise.
8033 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8034 (tls_pie_pic_test): New target.
8035 * testsuite/Makefile.in: Rebuild.
8036
8037 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8038 (tls_test_main_pie.o, tls_test_pie.o): New targets.
8039 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8040 * testsuite/Makefile.in: Rebuild.
8041
8042 2010-02-09 David S. Miller <davem@davemloft.net>
8043
8044 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8045 R_SPARC_RELATIVE using ->add_local_relative().
8046 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8047
8048 * output.h (Output_data_dynamic::add_section_size): New method
8049 that takes two Output_data objects.
8050 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8051 entry param. Handle it in initializers.
8052 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8053 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8054 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8055 arg.
8056 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8057 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8058 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8059 for dynrel_includes_plt.
8060 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8061 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8062 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8063 before .rela.plt
8064 (Target_sparc::do_finalize_sections): Update to pass true for
8065 dynrel_includes_plt.
8066 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8067 output before .rela.plt
8068 (Target_powerpc::do_finalize_sections): Update to pass true for
8069 dynrel_includes_plt when 32-bit.
8070
8071 2010-02-08 Doug Kwan <dougkwan@google.com>
8072
8073 * arm.cc (Arm_relobj::simple_input_section_output_address): New
8074 method.
8075 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8076 Arm_relobj::scan_section_for_cortex_a8_stubs,
8077 Arm_relobj::do_relocation_section): Instead of calling
8078 Output_section::output_address, use faster
8079 Arm_relobj::simple_input_section_output_address.
8080
8081 2010-02-08 David S. Miller <davem@davemloft.net>
8082
8083 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8084 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8085 relocation helper function.
8086
8087 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8088 just like R_SPARC_GOT{10,13,22}.
8089 (Target_sparc::Scan::local): Likewise.
8090 (Target_sparc::Relocate:relocate): Likewise.
8091
8092 2010-02-06 Ian Lance Taylor <iant@google.com>
8093
8094 * configure.ac: Rewrite targetobjs duplicate removal code to use
8095 only shell constructs.
8096 * configure: Rebuild.
8097
8098 2010-02-05 Doug Kwan <dougkwan@google.com>
8099
8100 PR 11247
8101 * arm.cc (Arm_relobj::section_is_scannable): New method.
8102 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8103 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8104
8105 2010-02-04 Doug Kwan <dougkwan@google.com>
8106
8107 PR 11247
8108 * arm-reloc-property.cc (cstdio): Include.
8109 * configure.ac (targetobjs): Remove duplicates.
8110 * configure: Regenerate.
8111 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8112 big and little endian version for a given address size.
8113
8114 2010-02-03 Doug Kwan <dougkwan@google.com>
8115
8116 * arm-reloc-property.cc
8117 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8118 definition.
8119 * arm-reloc-property.h
8120 (Arm_reloc_property_table::get_implemented_static_reloc_property):
8121 New method definition.
8122 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8123 declaration.
8124 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8125 overflow to N.
8126 (GOT_PREL): Change implemented to Y.
8127 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8128 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8129 (Arm_relocate_functions::movw_abs_nc): Remove method.
8130 (Arm_relocate_functions::movt_abs): Ditto.
8131 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8132 (Arm_relocate_functions::thm_movt_abs): Ditto.
8133 (Arm_relocate_functions::movw_rel_nc): Ditto.
8134 (Arm_relocate_functions::movw_rel): Ditto.
8135 (Arm_relocate_functions::movt_rel): Ditto.
8136 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8137 (Arm_relocate_functions:thm_movw_rel): Ditto.
8138 (Arm_relocate_functions:thm_movt_rel): Ditto.
8139 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8140 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8141 New method definitions.
8142 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8143 (Arm_relocation_functions::arm_grp_ldr): Ditto.
8144 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8145 (Arm_relocation_functions::arm_grp_ldc): Ditto.
8146 (Target_arm::Relocate::relocate): Check for non-static or
8147 unimplemented relocation code and exit early. Change calls to
8148 Target_arm::reloc_uses_thumb_bit and
8149 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8150 instead. Refactor code to handle similar relocations to increase
8151 code sharing. Remove check for unsupported relocation code in switch
8152 statement.
8153 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8154 relocation property table to find out size. Change error message to
8155 print out the name of a relocation code instead of the numeric value.
8156 (Target_arm::scan_reloc_for_stub): Use relocation property table
8157 instead of calling Target_arm::reloc_uses_thumb_bit().
8158
8159 2010-02-02 Doug Kwan <dougkwan@google.com>
8160
8161 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8162 types of relaxed input section.
8163
8164 2010-02-02 Doug Kwan <dougkwan@google.com>
8165
8166 * Makefile.am (HFILES): Add arm-reloc-property.h.
8167 (DEFFILES): New.
8168 (TARGETSOURCES): Add arm-reloc-property.cc
8169 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8170 (libgold_a_SOURCES): $(DEFFILES)
8171 * Makefile.in: Regenerate.
8172 * arm-reloc-property.cc: New file.
8173 * arm-reloc-property.h: New file.
8174 * arm-reloc.def: New file.
8175 * arm.cc: Update comments.
8176 (arm-reloc-property.h): New included header.
8177 (arm_reloc_property_table): New global variable.
8178 (Target_arm::do_select_as_default_target): New method definition.
8179 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8180 arm-reloc-property to targ_extra_obj.
8181 * parameters.cc (set_parameters_target): Call
8182 Target::select_as_default_target().
8183 * target.h (Target::select_as_default_target): New method definition.
8184 (Target::do_select_as_default_target): Same.
8185
8186 2010-02-01 Doug Kwan <dougkwan@google.com>
8187
8188 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8189 first_output_text_section_.
8190 (Arm_exidx_fixup::first_output_text_section): New method definition.
8191 (Arm_exidx_fixup::first_output_text_section_): New data member.
8192 (Arm_exidx_fixup::process_exidx_section): Record the first text
8193 output section seen.
8194 (Arm_output_section::fix_exidx_coverage): Set correct linked section
8195 and entsize in output section header.
8196
8197 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8198
8199 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8200 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8201 (Arm_relocate_functions::thm_alu11): New Method.
8202 (Arm_relocate_functions::thm_pc8): New Method.
8203 (Arm_relocate_functions::thm_pc12): New Method.
8204 (Target_arm::Scan::local): Handle the relocations.
8205 (Target_arm::Scan::global): Likewise.
8206 (Target_arm::Relocate::relocate): Likewise.
8207 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8208
8209 2010-01-29 Doug Kwan <dougkwan@google.com>
8210
8211 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8212 of relocation types as ld.
8213
8214 2010-01-29 Doug Kwan <dougkwan@google.com>
8215
8216 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8217 to public.
8218 (Arm_relocate_functions::thumb_branch_common): Ditto.
8219 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8220 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8221 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8222 Arm_relocate_functions::jump24): Remove.
8223 (Target_arm::Relocate::relocate): Adjust code to call
8224 Arm_relocation_functions::arm_branch_common and
8225 Arm_relocation_functions::thumb_branch_common instead of their removed
8226 wrappers. Merge switch-cases together to reduce source code size.
8227
8228 2010-01-29 Doug Kwan <dougkwan@google.com>
8229
8230 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8231 output_local_symbol_count_needs_update_.
8232 (Arm_relobj::output_local_symbol_count_needs_update,
8233 Arm_relobj::set_output_local_symbol_count_needs_update,
8234 Arm_relobj::update_output_local_symbol_count): New methods.
8235 (Arm_relobj::output_local_symbol_count_needs_update_): New data
8236 member.
8237 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8238 of pointed function as in a R_ARM_PREL31 relocation.
8239 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8240 for output local symbol count updating.
8241 (Target_arm::do_relax): Update output local symbol counts in objects
8242 if necessary.
8243 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8244
8245 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8246
8247 * arm.cc: Added support for the ARM relocations:
8248 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8249 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8250 (Arm_relocate_functions::movw_rel_nc): Renamed (was
8251 movw_prel_nc).
8252 (Arm_relocate_functions::movw_rel): New method.
8253 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8254 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8255 thm_movw_prel_nc).
8256 (Arm_relocate_functions::thm_movw_rel): New method.
8257 (Arm_relocate_functions::thm_movt_rel): Renamed (was
8258 thm_movt_prel).
8259 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8260 relocations.
8261 (Target_arm::Scan::global): Likewise.
8262 (Target_arm::Relocate::relocate): Likewise.
8263 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8264 Likewise.
8265
8266 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8267
8268 * arm.cc: Added support for ARM group relocations.
8269 (Target_arm::reloc_needs_sym_origin): New method.
8270 (Arm_relocate_functions::calc_grp_kn): New method.
8271 (Arm_relocate_functions::calc_grp_residual): New method.
8272 (Arm_relocate_functions::calc_grp_gn): New method.
8273 (Arm_relocate_functions::arm_grp_alu): New Method.
8274 (Arm_relocate_functions::arm_grp_ldr): New Method.
8275 (Arm_relocate_functions::arm_grp_ldrs): New Method.
8276 (Arm_relocate_functions::arm_grp_ldc): New Method.
8277 (Target_arm::Scan::local): Handle the ARM group relocations.
8278 (Target_arm::Scan::global): Likewise.
8279 (Target_arm::Relocate::relocate): Likewise.
8280 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8281 Likewise.
8282
8283 2010-01-26 Doug Kwan <dougkwan@google.com>
8284
8285 * arm.cc (set): Include.
8286 (class Arm_exidx_fixup): Change type of last_input_section_ to const
8287 pointer type.
8288 (Arm_output_section::Text_section_list): New type.
8289 (Arm_output_section::append_text_sections_to_list): New method.
8290 (Arm_output_section::fix_exidx_coverage): Ditto.
8291 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8292 (Arm_relobj::convert_input_section_to_relaxed_section): Use
8293 Relobj::set_section_offset() instead of
8294 Sized_relobj::invalidate_section_offset().
8295 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8296 parameter for section headers. Ignore relocation sections for
8297 unallocated sections and EXIDX sections.
8298 (Target_arm::fix_exidx_coverage): New method.
8299 (Target_arm::output_section_address_less_than): New type.
8300 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8301 linked text section instead of the EXIDX section.
8302 (Arm_output_section::create_stub_group): Add an assertion to check
8303 that this is not an EXIDX output section.
8304 (Arm_output_section::append_text_sections_to_list): New method.
8305 (Arm_output_section::fix_exidx_coverage): Ditto.
8306 (Arm_relobj::scan_sections_for_stubs): Adjust call to
8307 Arm_relobj::section_needs_reloc_stub_scanning.
8308 (Target_arm::do_relax): Fix EXIDX output section coverage in the
8309 first pass.
8310 (Target_arm::fix_exidx_coverage): New method.
8311 * object.h (Relobj::set_output_section): New method.
8312 (Sized_relobj::invalidate_section_offset): Remove method.
8313 (Sized_relobj::do_invalidate_section_offset): Remove method.
8314 (Sized_relobj::do_set_section_offset): Handle offset value -1.
8315
8316 2010-01-25 Doug Kwan <dougkwan@google.com>
8317
8318 * arm.cc (Arm_exidx_merged_section::do_output_offset):
8319 Fix warning due to signed and unsigned comparison on a 32-bit host.
8320
8321 2010-01-22 Doug Kwan <dougkwan@google.com>
8322
8323 * arm.cc (Target_arm::do_relax): Record an output section for section
8324 offset adjustment it contains any stub table that has changed.
8325 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8326 offsets in an output section if necessary.
8327 * output.cc (Output_section::Output_section): Initialize
8328 section_offsets_need_adjustments_.
8329 (Output_section::add_input_section_for_script): Renamed to
8330 Output_section::add_simple_input_section.
8331 (Output_section::save_states): Add a comment.
8332 (Output_section::discard_states): New method defintion.
8333 (Output_section::adjust_section_offsets): Same.
8334 * output.h (Output_section::add_input_section_for_script): Renamed to
8335 Output_section::add_simple_input_section.
8336 (Output_section::discard_states): New method declaration.
8337 (Output_section::adjust_section_offsets): Same.
8338 (Output_section::section_offsets_need_adjustment,
8339 Output_section::set_section_offsets_need_adjustment): New method
8340 definitions.
8341 (Output_section::section_offsets_need_adjustment_): New data member.
8342 * script-sections.cc
8343 (Output_section_element_input::set_section_address): Adjust code for
8344 renaming of Output_section::add_input_section_for_script.
8345 (Orphan_output_section::set_section_address): Same.
8346
8347 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8348
8349 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8350 Fix_v4bx enum values .
8351 * gold/options.h (General_options): New option definitions.
8352 (General_options::fix_v4bx): New method.
8353 (General_options::Fix_v4bx): New enum.
8354 * gold/options.cc (General_options::parse_fix_v4bx): New method.
8355 (General_options::parse_fix_v4bx_interworking): New method.
8356
8357 2010-01-22 Doug Kwan <dougkwan@google.com>
8358
8359 * arm.cc (Arm_exidx_fixup): New class.
8360
8361 2010-01-21 Doug Kwan <dougkwan@google.com>
8362
8363 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8364 classes.
8365 (Arm_exidx_section_offset_map): New type.
8366
8367 2010-01-21 Doug Kwan <dougkwan@google.com>
8368
8369 * arm.cc (Arm_exidx_input_section): New class.
8370 (Arm_relobj::exidx_input_section_by_link,
8371 Arm_relobj::exidx_input_section_by_shndx,
8372 Arm_relobj::make_exidx_input_section): New methods.
8373 (read_arm_attributes_section): Remove.
8374 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8375 information about them.
8376 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8377 to here.
8378
8379 2010-01-20 Doug Kwan <dougkwan@google.com>
8380
8381 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8382 Input_section_specifier to Section_id.
8383 (Target_arm::new_arm_input_section: Adjust code for change of key
8384 type.
8385 (Target_arm::find_arm_input_section): Ditto.
8386 * gc.h (object.h): Include for Section_id nand Section_id_hash.
8387 (Section_id): Remove.
8388 (Garbage_collection::Section_id_hash): Remove.
8389 * icf.h (object.h): Include for Section_id nand Section_id_hash.
8390 (Section_id): Remove.
8391 (Icf::Section_id_hash): Remove.
8392 * object.h (Section_id, Const_section_id, Section_id_hash,
8393 Const_section_id_hash): New type definitions.
8394 * output.cc (Output_section::add_relaxed_input_section): Change to
8395 use Const_section_id instead of Input_section_specifier as key type.
8396 (Output_section::add_merge_input_section): Ditto.
8397 (Output_section::build_relaxation_map): Change to use Section_id
8398 instead of Input_section_specifier as key type.
8399 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8400 Ditto.
8401 (Output_section::convert_input_sections_to_relaxed_sections): Change
8402 to use Const_section_id instead of Input_section_specifier as key type.
8403 (Output_section::find_merge_section): Ditto.
8404 (Output_section::find_relaxed_input_section): Ditto.
8405 * output.h (Input_section_specifier): Remove class.
8406 (Output_section::Output_section_data_by_input_section_map): Change
8407 key type to Const_section_id.
8408 (Output_section::Output_relaxed_input_section_by_input_section_map):
8409 Ditto.
8410 (Output_section::Relaxation_map): Change key type to Section_id.
8411
8412 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8413
8414 * gold/arm.cc: Added support for R_ARM_V4BX relocation
8415 (class Arm_v4bx_stub): New class.
8416 (DEF_STUBS): Updated definition to support v4_veneer_bx.
8417 (Stub_factory::make_arm_v4bx_stub): New method.
8418 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8419 (Stub_table::empty): Handle v4bx stubs.
8420 (Stub_table::add_arm_v4bx_stub): New method.
8421 (Stub_table::find_arm_v4bx_stub): New method.
8422 (Arm_relocate_functions::v4bx): New method.
8423 (Target_arm::fix_v4bx): New method.
8424 (Target_arm::Target_arm): Handle R_ARM_V4BX.
8425 (Stub_table::relocate_stubs): Likewise.
8426 (Stub_table::do_write): Likewise.
8427 (Stub_table::update_data_size_and_addralign): Likewise.
8428 (Stub_table::finalize_stubs): Likewise.
8429 (Target_arm::Scan::local): Likewise.
8430 (Target_arm::Scan::global): Likewise.
8431 (Target_arm::do_finalize_sections): Likewise.
8432 (Target_arm::Relocate::relocate): Likewise.
8433 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8434 Likewise.
8435 (Target_arm::scan_reloc_for_stub): Likewise.
8436 (Target_arm::scan_reloc_section_for_stubs): Likewise.
8437
8438 2010-01-19 Ian Lance Taylor <iant@google.com>
8439
8440 * output.cc (Output_section_headers::do_sized_write): Write large
8441 segment count to sh_info field.
8442 (Output_file_header::do_sized_write): For large segment count,
8443 write PN_XNUM to e_phnum field.
8444
8445 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8446
8447 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8448 (Arm_relocate_functions::thm_jump8): New function.
8449 (Arm_relocate_functions::thm_jump11): New function.
8450 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8451 R_ARM_THM_JUMP11.
8452 (Target_arm::Scan::global): Likewise.
8453 (Target_arm::Relocate::relocate): Likewise.
8454 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8455 Likewise.
8456
8457 2010-01-14 Doug Kwan <dougkwan@google.com>
8458
8459 * arm.cc (map, utility): Include headers.
8460 (Target_arm::apply_cortex_a8_workaround): New method.
8461 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8462 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8463 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8464 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8465 the --[no-]fix-cortex-a8 command line options.
8466 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8467 (Target_arm::relocate_stub): Use addend in instruction template.
8468 * options.h (DEFINE_bool): Set the user-set flag.
8469 (General_options): Add --[no-]-fix-cortex options.
8470 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8471 : Update fast look-up map after conversion.
8472
8473 2010-01-14 Sriraman Tallam <tmsriram@google.com>
8474
8475 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8476 in the first pass of do_layout.
8477
8478 2010-01-13 Doug Kwan <dougkwan@google.com>
8479
8480 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8481 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8482 apparent compiler problem of not folding static constant integral
8483 data members of elfcpp::Elf_sizes<32>.
8484
8485 2010-01-13 Doug Kwan <dougkwan@google.com>
8486
8487 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8488 Arm_relobj::section_needs_cortex_a8_stub_scanning,
8489 Arm_relobj::scan_section_for_cortex_a8_erratum,
8490 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8491 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8492 sections to scan for relocation stubs into a new method
8493 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
8494 relocation and Cortex-A8 stub scanning.
8495 (Target_arm::do_relax): Force stubs to be after stubbed sections
8496 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
8497 the beginning of a new relaxation pass. Update a comment.
8498 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8499
8500 2010-01-12 Ian Lance Taylor <iant@google.com>
8501
8502 * target-reloc.h (visibility_error): New inline function.
8503 (relocate_section): Call visibility_error.
8504 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8505 (MOSTLYCLEANFILES): Likewise.
8506 (protected_4_pic.o, protected_3.err): New targets.
8507 * testsuite/protected_4.cc: New file.
8508
8509 2010-01-12 Doug Kwan <dougkwan@google.com>
8510
8511 * arm.cc (Cortex_a8_reloc): New class.
8512 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8513 and cortex_a8_relocs_info_.
8514 (Target_arm::fix_cortex_a8): New method definition.
8515 (Target_arm::Cortex_a8_relocs_info): New type.
8516 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8517 New data member declarations.
8518 (Target_arm::scan_reloc_for_stub): Record information about
8519 relocations for THUMB branches that might be exempted from the
8520 Cortex-A8 workaround.
8521 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8522 at the beginning of a relaxation pass.
8523
8524 2010-01-12 Doug Kwan <dougkwan@google.com>
8525
8526 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8527 (Arm_relobj::Mapping_symbol_position,
8528 Arm_reloj::Mapping_symbol_position_less,
8529 Arm_relobj::Mapping_symbols_info): New types.
8530 (Target_arm::is_mapping_symbol_name): New method definition.
8531 (Arm_relobj::do_count_local_symbols): Save information about mapping
8532 symbols.
8533
8534 2010-01-11 Doug Kwan <dougkwan@google.com>
8535
8536 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8537 Arm_relocate_functions::thumb32_branch_upper,
8538 Arm_relocate_functions::thumb32_branch_lower,
8539 Arm_relocate_functions::thumb32_cond_branch_offset,
8540 Arm_relocate_functions::thumb32_cond_branch_upper,
8541 Arm_relocate_functions::thumb32_cond_branch_lower,
8542 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8543 branch offset encoding.
8544 (Arm_relocate_functions::thumb_branch_common): Use new branch
8545 offset encoding methods to avoid code duplication.
8546 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8547 (Stub_addend_reader::operator()): Use new branch encoding method
8548 to avoid code duplication.
8549
8550 2010-01-11 Doug Kwan <dougkwan@google.com>
8551
8552 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8553 (Target_arm::do_finalize_sections): Define special EXIDX section
8554 symbols only if referenced.
8555 * gc.h (Garbage_collection::add_reference): New method.
8556 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8557 code duplication.
8558
8559 2010-01-11 Ian Lance Taylor <iant@google.com>
8560
8561 * script.cc (Version_script_info::build_expression_list_lookup):
8562 Change complaing about duplicate wildcard match from error to
8563 warning.
8564
8565 * script.cc (class Lazy_demangler): Recreate--revert part of patch
8566 of 2009-12-30.
8567 (Version_script_info::Version_script_info): Initialize globs_,
8568 default_version_, default_is_global_, and exact_. Don't
8569 initialize globals_ or locals_.
8570 (Version_script_info::build_lookup_tables): Build local symbols
8571 first.
8572 (Version_script_info::unquote): New function.
8573 (Version_script_info::add_exact_match): New function.
8574 (Version_script_info::build_expression_list_lookup): Remove lookup
8575 parameter. Add is_global parameter. Change all callers. Handle
8576 wildcard pattern specially. Unquote pattern. Call
8577 add_exact_match.
8578 (Version_script_info::get_name_to_match): New function.
8579 (Version_script_info::get_symbol_version): New function.
8580 (Version_script_info::get_symbol_version_helper): Remove.
8581 (Version_script_info::check_unmatched_names): Call unquote.
8582 * script.h (class Version_script_info): Change get_symbol_version
8583 to be non-inline and add is_global parameter; change all callers.
8584 Rewrite symbol_is_local. Update declarations. Define struct
8585 Version_tree_match, Exact, Globs. Don't define struct Lookup.
8586 Remove globals_ and locals_ members. Add exact_, globs_,
8587 default_version_, is_global_.
8588 (Version_script_info::Glob): Remove pattern, add expression and
8589 is_global. Update constructor. Change all callers.
8590 * dynobj.cc (Versions::finalize): Mark the version symbol as the
8591 default version.
8592 (Versions::symbol_section_contents): If a symbol is undefined, or
8593 defined in a dynamic object, set the version index to
8594 VER_NDX_LOCAL.
8595 * symtab.cc (Symbol_table::add_from_relobj): Don't call
8596 symbol_is_local.
8597 (Symbol_table::add_from_pluginobj): Likewise.
8598 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8599
8600 2010-01-11 Doug Kwan <dougkwan@google.com>
8601
8602 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8603 (incremental_dump_LDADD): Add linking option for libintl.
8604 * Makefile.in: Regenerate.
8605
8606 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
8607
8608 PR gold/11144
8609 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8610 instead of -Ds.
8611 * testsuite/Makefile.in: Regenerated.
8612
8613 2010-01-10 Doug Kwan <dougkwan@google.com>
8614
8615 * options.h (DEFINE_var): Use parentheses around argument varname__
8616 in macro body to avoid any unintended subsequent substitutions.
8617
8618 2010-01-10 Ian Lance Taylor <iant@google.com>
8619
8620 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8621 candidates before doing symbol resolution.
8622
8623 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8624 ODR candidates if only one is weak.
8625
8626 2010-01-08 Ian Lance Taylor <iant@google.com>
8627
8628 * script.cc (Version_script_info::build_expression_list_lookup):
8629 Don't warn about ambiguous version, just record the ambiguity.
8630 (Version_script_info::get_symbol_version_helper): Give error if
8631 version is ambiguous.
8632
8633 2010-01-08 Doug Kwan <dougkwan@google.com>
8634
8635 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8636 prev_data_size_ and prev_addralign_. Remove initializer for
8637 deleted data member has_been_changed_.
8638 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8639 to determine if the table is empty.
8640 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8641 Remove.
8642 (Stub_table::add_reloc_stub): Define method in class definition
8643 instead of just declaring it there.
8644 (Stub_table::add_cortex_a8_stub): New method definition.
8645 (Stub_table::update_data_size_and_addralign): Ditto.
8646 (Stub_table::finalize_stubs): Ditto.
8647 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8648 (Stub_table::do_addralign_): Return address alignment in the
8649 (Stub_table::do_reset_address_and_file_offset): Define method in
8650 class definition instead of declaring it there. Set current data
8651 size to be the data size of the previous pass.
8652 (Stub_table::set_final_data_size): Use current data size as the
8653 final data size.
8654 (Stub_table::relocate_stub): Change parameter type of stub from
8655 Reloc_stub pointer to Stub pointer.
8656 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8657 (Stub_table::Cortex_a8_stub_list): New typedef.
8658 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8659 Stub_table::prev_addralign_): New data member.
8660 (Arm_relobj::Arm_relobj): Initialize data member
8661 section_has_cortex_a8_workaround_.
8662 (Arm_relobj::section_has_cortex_a8_workaround,
8663 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8664 definitions.
8665 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8666 declarations.
8667 (Target_arm::relocate_stub): Change parameter type of stub from
8668 Reloc_stub pointer to Stub pointer.
8669 (Insn_template::size, Insn_template::alignment): Handle
8670 THUMB16_SPECIAL_TYPE.
8671 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8672 Stub_table::update_data_size_and_addralign,
8673 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8674 definitions.
8675 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8676 (Stub_table::do_write): Ditto.
8677 (Target_arm::do_relax): Adjust code for changes in Stub_table.
8678
8679 2010-01-08 Ian Lance Taylor <iant@google.com>
8680
8681 PR 11108
8682 * symtab.h (class Symbol): Remove fields is_target_special_ and
8683 has_plt_offset_. Add field is_defined_in_discarded_section_.
8684 (Symbol::is_defined_in_discarded_section): New function.
8685 (Symbol::set_is_defined_in_discarded_section): New function.
8686 (Symbol::has_plt_offset): Rewrite.
8687 (Symbol::set_plt_offset): Verify that new offset is not -1U.
8688 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8689 Don't initialize is_target_special_ or has_plt_offset_.
8690 Initialize is_defined_in_discarded_section_.
8691 (Symbol_table::add_from_relobj): If appropriate, set
8692 is_defined_in_discarded_section.
8693 * resolve.cc (Symbol::override_base_with_special): Don't test
8694 is_target_special_. Change has_plt_offset_ to has_plt_offset().
8695 * target-reloc.h (relocate_section): Do special handling for
8696 symbols defined in discarded sections for global symbols as well
8697 as local symbols.
8698
8699 2010-01-08 Ian Lance Taylor <iant@google.com>
8700
8701 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8702 the SHT_SYMTAB case.
8703
8704 2010-01-08 Ian Lance Taylor <iant@google.com>
8705
8706 * object.cc (Sized_relobj::do_layout): Don't get confused if
8707 layout_eh_frame returns NULL.
8708
8709 2010-01-08 Ian Lance Taylor <iant@google.com>
8710
8711 PR 11084
8712 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8713 dynamic symbol table, use the normal symbol table.
8714 (Sized_dynobj::do_read_symbols): Remove assertion about type of
8715 symbol table.
8716
8717 2010-01-08 Ian Lance Taylor <iant@google.com>
8718
8719 PR 11072
8720 * layout.cc (Layout::include_section): Remove .gnu_debuglink
8721 sections.
8722
8723 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
8724
8725 * version.cc (print_version): Change to "Copyright 2010".
8726
8727 2010-01-08 Ian Lance Taylor <iant@google.com>
8728
8729 PR 10287
8730 PR 11063
8731 * i386.cc (class Target_i386): Change return type of plt_section
8732 to be non-const.
8733 (class Output_data_plt_i386): Add tls_desc_rel_ field.
8734 (Output_data_plt_i386::Output_data_plt_i386): Initialize
8735 tls_desc_rel_ field.
8736 (Output_data_plt_i386::rel_tls_desc): New function.
8737 (Target_i386::rel_tls_desc_section): New function.
8738 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8739 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8740 R_386_TLS_DESC reloc in rel_tls_desc_section.
8741 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8742 Define struct Tlsdesc_info.
8743 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8744 (Target_x86_64::do_reloc_symbol_index): New function.
8745 (Target_x86_64::add_tlsdesc_info): New function.
8746 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8747 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8748 tlsdesc_rel_ field.
8749 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
8750 all callers.
8751 (Output_data_plt_x86_64::rela_tlsdesc): New function.
8752 (Target_x86_64::rela_tlsdesc_section): New function.
8753 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8754 handling.
8755 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8756 (Target_x86_64::do_reloc_addend): New function.
8757 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8758 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8759 declarations. Define TARGET_CODE. Add arg field to u1_ union.
8760 (Output_reloc::type): New function.
8761 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8762 (Output_reloc::is_target_specific): New function.
8763 (Output_reloc::target_arg): New function.
8764 (class Output_reloc) [SHT_RELA]: Add four new constructors for
8765 absolute relocs and target specific relocs.
8766 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8767 add_target_specific.
8768 (class Output_data_reloc) [SHT_RELA]: Likewise.
8769 * output.cc (Output_reloc::Output_reloc): Add four new versions
8770 for absolute relocs and target specific relocs.
8771 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8772 (Output_reloc::get_symbol_index): Likewise.
8773 (Output_reloc::local_section_offset): Check that local_sym_index_
8774 is not TARGET_CODE or 0.
8775 (Output_reloc::symbol_value): Likewise.
8776 (Output_reloc::write) [SHT_RELA]: Call target for target specific
8777 reloc.
8778 * target.h (class Target): Add reloc_symbol_index and reloc_addend
8779 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
8780 functions.
8781 * layout.cc (add_target_dynamic_tags): Use output section for
8782 DT_PLTRELSZ and DT_JMPREL.
8783
8784 2010-01-07 Ian Lance Taylor <iant@google.com>
8785
8786 PR 11061
8787 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8788 function.
8789 (class Output_data_reloc_generic): Define.
8790 (class Output_data_reloc_base): Change base class to
8791 Output_data_reloc_generic. Change add() method to call
8792 bump_relative_reloc_count for a relative reloc. Remove
8793 sort_relocs_ field.
8794 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8795 to sort_relocs().
8796 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8797 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
8798 appropriate.
8799 * layout.h (class Layout): Update declaration.
8800
8801 2010-01-07 Ian Lance Taylor <iant@google.com>
8802
8803 * output.h (class Output_data): Add const version of
8804 output_section and do_output_section.
8805 (class Output_section_data): Add const version of
8806 do_output_section.
8807 (class Output_section): Likewise.
8808 * layout.cc (Layout::add_target_dynamic_tags): New function.
8809 * layout.h (class Layout): Update declarations.
8810 * arm.cc (Target_arm::do_finalize_sections): Use
8811 add_target_dynamic_tags.
8812 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8813 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8814 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8815 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8816
8817 2010-01-07 Ian Lance Taylor <iant@google.com>
8818
8819 PR 11042
8820 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8821 object as needed.
8822
8823 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
8824 Ian Lance Taylor <iant@google.com>
8825
8826 PR 11019
8827 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8828 Xindex::read_symtab_xindex.
8829
8830 2010-01-07 Doug Kwan <dougkwan@google.com>
8831
8832 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8833 (Insn_template::thumb16_bcond_insn): New method declaration.
8834 (Insn_template): Fix spelling.
8835 (Stub::thumb16_special): New method declaration.
8836 (Stub::do_write): Define virtual method which was previously pure
8837 virtual.
8838 (Stub::do_thumb16_special): New method declaration.
8839 (Stub::do_fixed_endian_write): New template member.
8840 (Reloc_stub::do_write): Remove.
8841 (Reloc_stub::do_fixed_endian_write): Remove.
8842 (Cortex_a8_stub): New class definition.
8843 (Stub_factory::make_cortex_a8_stub): New method definition.
8844 (Stub_factory::Stub_factory): Add missing static storage class
8845 qualifier for elf32_arm_stub_a8_veneer_blx.
8846
8847 2010-01-07 Ian Lance Taylor <iant@google.com>
8848
8849 PR 10980
8850 * options.h (class General_options): Add --warn-unresolved-symbols
8851 and --error-unresolved-symbols.
8852 * errors.cc (Errors::undefined_symbol): Implement
8853 --warn-unresolved-symbols.
8854
8855 * options.h (class General_options): Add -z text and -z textoff.
8856 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8857
8858 2010-01-06 Sriraman Tallam <tmsriram@google.com>
8859
8860 * gc.h (Garbage_collection::Cident_section_map): New typedef.
8861 (Garbage_collection::cident_sections): New function.
8862 (Garbage_collection::add_cident_section): New function.
8863 (Garbage_collection::cident_sections_): New member.
8864 (gc_process_relocs): Add references to sections whose names are C
8865 identifiers.
8866 * gold.h (cident_section_start_prefix): New constant.
8867 (cident_section_stop_prefix): New constant.
8868 (is_cident): New function.
8869 * layout.cc (Layout::define_section_symbols): Replace string constants
8870 with the newly defined constants.
8871 * object.cc (Sized_relobj::do_layout): Track sections whose names are
8872 C identifiers.
8873 * testsuite/Makefile.am: Add gc_orphan_section_test.
8874 * testsuite/Makefile.in: Regenerate.
8875 * testsuite/gc_orphan_section_test.cc: New file.
8876 * testsuite/gc_orphan_section_test.sh: New file.
8877
8878 2010-01-06 Ian Lance Taylor <iant@google.com>
8879
8880 PR 10980
8881 * options.h (class General_options): Add --warn-shared-textrel.
8882 * layout.cc (Layout::finish_dynamic_section): Implement
8883 --warn-shared-textrel.
8884
8885 PR 10980
8886 * options.h (class General_options): Add --warn-multiple-gp.
8887
8888 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8889
8890 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8891 $(THREADSLIB) and $(LIBDL).
8892 * Makefile.in: Rebuild.
8893
8894 2010-01-06 Ian Lance Taylor <iant@google.com>
8895
8896 PR 10980
8897 * options.cc (General_options::parse_section_start): New function.
8898 (General_options::section_start): New function.
8899 (General_options::General_options): Initialize all members.
8900 * options.h: Include <map>
8901 (class General_options): Add --section-start. Add section_starts_
8902 member.
8903 * layout.cc (Layout::attach_allocated_section_to_segment): If
8904 --section-start was used, set the address of the segment. Remove
8905 local sort_sections.
8906 (Layout::relaxation_loop_body): If the address of the load segment
8907 has been set by --section-start, don't use it.
8908 * output.h (Output_segment::update_flags_for_output_section): New
8909 function.
8910 * output.cc (Output_segment::add_output_section): Call
8911 update_flags_for_output_section.
8912
8913 2010-01-05 Ian Lance Taylor <iant@google.com>
8914
8915 PR 10980
8916 * options.h (class General_options): Add --undefined-version.
8917 * script.cc (struct Version_expression): Add was_matched_by_symbol
8918 field.
8919 (Version_script_info::matched_symbol): New function.
8920 (Version_script_info::get_symbol_version_helper): Call
8921 matched_symbol.
8922 (Version_script_info::check_unmatched_names): New function.
8923 * script.h (class Version_script_info): Update declarations.
8924 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8925
8926 * options.h (class General_options): Use DEFINE_bool_alias for
8927 allow_multiple_definition.
8928 * resolve.cc (Symbol_table::should_override): Don't test
8929 allow_multiple_definition.
8930
8931 PR 10980
8932 * options.h (class General_options): Add --cref.
8933 * main.cc (main): Print cref table if --cref. Don't close mapfile
8934 until after printing cref table.
8935 * cref.cc: Include "symtab.h".
8936 (class Cref_inputs): Define Cref_table_compare and Cref_table.
8937 (Cref_table_compare::operator()): New function.
8938 (Cref_inputs::gather_cref): New function.
8939 (filecol): New static const.
8940 (Cref_inputs::print_cref): New function.
8941 (Cref::print_cref): New function.
8942 * cref.h: Include <cstdio>.
8943 (class Cref): Update declarations.
8944 * mapfile.h (Mapfile::file): New function.
8945 * object.h (class Object): Define Symbols. Declare virtual
8946 do_get_global_symbols.
8947 (Object::get_global_symbols): New function.
8948 * object.cc (Input_objects::add_object): Pass object to cref_ if
8949 --cref.
8950 (Input_objects::archive_start): Likewise.
8951 (Input_objects::archive_stop): Likewise.
8952 (Input_objects::print_cref): New function.
8953 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8954 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8955 --cref.
8956 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8957 function.
8958 * plugin.h (class Sized_pluginobj): Update declarations.
8959
8960 2010-01-05 Ian Lance Taylor <iant@google.com>
8961
8962 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8963 to is_default_version. Rename insdef to insdefault.
8964 (Symbol_table::add_from_relobj): Rename def to is_default_version
8965 and local to is_forced_local.
8966 (Symbol_table::add_from_pluginobj): Likewise.
8967 (Symbol_table::add_from_dynobj): Likewise.
8968 (Symbol_table::define_special_symbol): Rename insdef to
8969 insdefault.
8970
8971 2010-01-04 Ian Lance Taylor <iant@google.com>
8972
8973 PR 10980
8974 * options.h (class General_options): Add
8975 --allow-multiple-definition and -z muldefs.
8976 * resolve.cc (Symbol_table::should_override): Don't warn about a
8977 multiple symbol definition if --allow-multiple-definition or -z
8978 muldefs.
8979
8980 PR 10980
8981 * options.h (class General_options): Add --add-needed and
8982 --copy-dt-needed-entries. Tweak --as-needed help entry.
8983 * object.cc (Input_objects::check_dynamic_dependencies): Give an
8984 error if --copy-dt-needed-entries aka --add-needed is used and
8985 would cause a change in behaviour.
8986
8987 PR 10980
8988 * options.h (class General_options): Add -G as a short version of
8989 --shared. Add no-op options -assert, -g, and -i.
8990
8991 2010-01-04 Sriraman Tallam <tmsriram@google.com>
8992
8993 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8994 check for .text or .gnu.linkonce.t sections.
8995 * icf.cc (Icf::find_identical_sections): Ditto.
8996 Change the detection for mangled function name within the section
8997 name.
8998 * icf.h (is_section_foldable_candidate): New function.
8999
9000 2009-12-30 Ian Lance Taylor <iant@google.com>
9001
9002 PR 10980
9003 * options.h (class General_options): Permit two dashes with
9004 --retain-symbols-file.
9005
9006 2009-12-30 Ian Lance Taylor <iant@google.com>
9007
9008 PR 10979
9009 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9010 don't put the file header and segment headers in the text
9011 segment.
9012
9013 PR 10979
9014 * common.cc (Sort_commons::operator()): Stabilize sort when both
9015 entries are NULL.
9016 (Symbol_table::do_allocate_commons_list): When allocating common
9017 symbols, skip a symbol which is no longer common.
9018 * symtab.h (Symbol::is_common): Test whether the symbol comes from
9019 an object before checking its type.
9020 * testsuite/common_test_2.c: New file.
9021 * testsuite/common_test_3.c: New file.
9022 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9023 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9024 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9025 (common_test_2_pic.o, common_test_2.so): New targets.
9026 (common_test_3_pic.o, common_test_3.so): New targets.
9027 * testsuite/Makefile.in: Rebuild.
9028
9029 PR 10979
9030 * script.cc (read_input_script): If we see a new SECTIONS clause,
9031 and we have added an input section, give an error.
9032 * layout.h (class Layout): Add have_added_input_section function.
9033 Add have_added_input_section_ field.
9034 * layout.cc (Layout::Layout): Initialize
9035 have_added_input_section_.
9036 (Layout::layout): Set have_added_input_section_.
9037 (Layout::layout_eh_frame): Likewise.
9038
9039 2009-12-30 Ian Lance Taylor <iant@google.com>
9040
9041 PR 10931
9042 * options.h (class General_options): Add --sort-common option.
9043 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9044 * common.cc (Sort_common): Add sort_order parameter to
9045 constructor. Add sort_order_ field.
9046 (Sort_commons::operator): Check sort_order_.
9047 (Symbol_table::allocate_commons): Determine the sort order.
9048 (Symbol_table::do_allocate_commons): Add sort_order parameter.
9049 Change all callers.
9050 (Symbol_table::do_allocate_commons_list): Likewise.
9051
9052 2009-12-30 Ian Lance Taylor <iant@google.com>
9053
9054 PR 10916
9055 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9056 symbols from this object, don't change the visibility of an
9057 undefined symbol.
9058 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9059
9060 2009-12-30 Ian Lance Taylor <iant@google.com>
9061
9062 PR 10861
9063 * script.h (class Version_script_info): Define Language enum.
9064 Update declarations. Define Glob, Exact, and Lookup types. Add
9065 new fields globals_, locals_, and is_finalized_.
9066 * script.cc: Various formatting fixes.
9067 (class Parser_closure): Change language_stack_ from a vector of
9068 std::string to one of Version_script_info::Language. Adjust all
9069 uses accordingly.
9070 (class Lazy_demangler): Remove.
9071 (struct Version_expression): Change language from std::string to
9072 Version_script_info::Language.
9073 (Version_script_info::Version_script_info): New function.
9074 (Version_script_info::~Version_script_info): Don't call clear.
9075 (Version_script_info::finalize): New function.
9076 (Version_script_info::build_lookup_tables): New function.
9077 (Version_script_info::build_expression_list_lookup): New
9078 function.
9079 (Version_script_info::get_symbol_version_helper): Rewrite to use
9080 lookup tables.
9081 (Version_script_info::print_expression_list): Adjust to use
9082 Version_script_info::Language.
9083 (script_push_lex_into_version_mode): Check that the version script
9084 has not been finalized.
9085 (version_script_push_lang): Change language string to
9086 Version_script_info::Language.
9087 * options.cc (Command_line::version_script): New function.
9088 * options.h (class General_options): Add finalize_dynamic_list
9089 function. Change version_script from declaration to definition.
9090 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9091 * testsuite/version_script.map: Remove duplicate def of foo.
9092 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9093 version_script.map.
9094 * testsuite/Makefile.in: Rebuild.
9095
9096 2009-12-30 Ian Lance Taylor <iant@google.com>
9097
9098 PR 10843
9099 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9100 if the input symbol index is 0, make the output symbol index 0.
9101
9102 2009-12-30 Ian Lance Taylor <iant@google.com>
9103
9104 PR 10670
9105 * options.h (class General_options): Add -x/--discard-all.
9106 * object.cc (Sized_relobj::do_count_local_symbols): Handle
9107 --discard-all. If the local symbol needs a dynamic entry, check
9108 that before handling --discard-locals.
9109
9110 2009-12-30 Ian Lance Taylor <iant@google.com>
9111
9112 PR 10450
9113 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9114 flags to PF_R.
9115 (Output_segment::add_output_section): Don't change the flags if
9116 the type is PT_TLS.
9117
9118 PR 10450
9119 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9120 GNU hash table if they need a dynamic value. Otherwise, don't add
9121 them if they are defined in a dynamic object or are forced local.
9122
9123 2009-12-29 Ian Lance Taylor <iant@google.com>
9124
9125 PR 10450
9126 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9127 .gnu.hash table for a 32-bit target.
9128
9129 PR 10450
9130 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9131 regular and a dynamic object only needs a dynamic symbol table
9132 entry if it is externally visible.
9133
9134 PR 10450
9135 * i386.cc (class Target_i386): Initialize global_offset_table_ in
9136 constructor. Add global_offset_table_ field.
9137 (Target_i386::got_section): Set global_offset_table_.
9138 (Target_i386::do_finalize_sections): Set global_offset_table_
9139 size.
9140 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9141 in constructor. Add global_offset_table_ field.
9142 (Target_x86_64::got_section): Set global_offset_table_.
9143 (Target_x86_64::do_finalize_sections): Set global_offset_table_
9144 size.
9145
9146 * layout.cc (Layout::Layout): Initialize increase_relro_.
9147 (Layout::get_output_section): Add is_relro, is_last_relro, and
9148 is_first_non_relro parameters. Change all callers.
9149 (Layout::choose_output_section): Likewise.
9150 (Layout::add_output_section_data): Likewise.
9151 (Layout::make_output_section): Likewise.
9152 (Layout::set_segment_offsets): Clear increase_relro when using a
9153 linker script.
9154 * layout.h (class Layout): Add increase_relro method. Add
9155 increase_relro_ field. Update declarations.
9156 * output.cc (Output_section::Output_section): Initialize
9157 is_last_relro_ and is_first_non_relro_.
9158 (Output_segment::add_output_section): Group relro sections is
9159 do_sort is true. Handle is_last_relro and is_first_non_relro.
9160 (Output_segment::maximum_alignment): Remove relro handling.
9161 (Output_segment::set_section_addresses): Add increase_relro
9162 parameter. Change all callers. Add initial alignment to align
9163 relro sections on separate page. Remove old relro handling.
9164 (Output_segment::set_section_list_addresses): Remove in_relro
9165 parameter. Change all callers.
9166 (Output_segment::set_offset): Add increase parameter. Change all
9167 callers. Remove old relro handling.
9168 * output.h (class Output_section): Add new methods: is_last_relro,
9169 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9170 Add is_last_relro_ and is_first_non_relro_ fields.
9171 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9172 Create separate .got.plt section. Call increase_relro.
9173 * x86_64.cc (Target_x86_64::got_section): Likewise.
9174 * testsuite/relro_script_test.t: Add .got.plt.
9175
9176 PR 10450
9177 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9178 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9179 (Layout::finalize): Call set_dynamic_symbol_size.
9180 (Layout::set_dynamic_symbol_size): New function.
9181 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
9182 set_dynamic_symbol_size.
9183
9184 PR 10450
9185 * output.h (class Output_section): Add is_entsize_zero_ field.
9186 * output.cc (Output_section::Output_section): Initialize
9187 is_entsize_zero_.
9188 (Output_section::set_entsize): If two different entsizes are
9189 requested, force it to zero.
9190 (Output_section::add_input_section): Set flags for .debug_str
9191 before updating section flags. Set entsize.
9192 (Output_section::update_flags_for_input_section): Set SHF_MERGE
9193 and SHF_STRING if all input sections have those flags.
9194
9195 2009-12-29 Rafael Espindola <espindola@google.com>
9196
9197 * main.cc (main): Fix the sys time reporting.
9198 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9199 reporting.
9200
9201 2009-12-29 Sriraman Tallam <tmsriram@google.com>
9202
9203 * options.cc (General_options::parse_version): Allow -v to exit
9204 without an error if there is nothing to link.
9205
9206 2009-12-29 Ian Lance Taylor <iant@google.com>
9207
9208 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9209 using a version of gcc before 4.1.
9210 * configure: Rebuild.
9211
9212 2009-12-28 Chris Demetriou <cgd@google.com>
9213
9214 * attributes.cc (Output_attributes_section_data::do_write): Use
9215 std::vector::front rather than std::vector::data.
9216
9217 2009-12-28 Ian Lance Taylor <iant@google.com>
9218
9219 * symtab.h (class Symbol_table): Add enum Defined.
9220 * resolve.cc (Symbol_table::should_override): Add defined
9221 parameter. Change all callers. Test whether object is NULL
9222 before calling a method on it.
9223 (Symbol_table::report_resolve_problem): Add defined parameter.
9224 Change all callers.
9225 (Symbol_table::should_override_with_special): Likewise.
9226 * symtab.cc (Symbol_table::define_in_output_data): Add defined
9227 parameter. Change all callers.
9228 (Symbol_table::do_define_in_output_data): Likewise.
9229 (Symbol_table::define_in_output_segment): Likewise.
9230 (Symbol_table::do_define_in_output_segment): Likewise.
9231 (Symbol_table::define_as_constant): Likewise.
9232 (Symbol_table::do_define_as_constant): Likewise.
9233 * script.h (class Symbol_assignment): Add is_defsym parameter to
9234 constructor; change all callers.
9235 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9236 parameter. Change all callers. Add is_defsym_ field.
9237 (class Parser_closure): Add parsing_defsym parameter to
9238 constructor; change all callers. Add parsing_defsym accessor
9239 function. Add parsing_defsym_ field.
9240
9241 2009-12-28 Ian Lance Taylor <iant@google.com>
9242
9243 * gold.cc (queue_middle_tasks): Fix formatting.
9244 * object.cc (Relobj::is_section_name_included): Likewise.
9245
9246 2009-12-23 Ian Lance Taylor <iant@google.com>
9247
9248 * i386.cc (Target_i386::do_calls_non_split): Recognize
9249 -fsplit-stack prologue for a function with a static chain.
9250 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9251 -fsplit-stack prologue when using %r11.
9252
9253 2009-12-21 Sriraman Tallam <tmsriram@google.com>
9254
9255 * options.cc (General_options::parse_version): Make -v continue and do
9256 the link like GNU ld does.
9257
9258 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
9259
9260 * Makefile.am (CCFILES): Add timer.cc.
9261 (HFILES): Add timer.h.
9262 * configure.ac: Check for sysconf and times.
9263 * main.cc: include timer.h.
9264 (main): Use Timer instead of get_run_time.
9265 * timer.cc: New.
9266 * timer.h: New.
9267 * workqueue.cc: include timer.h.
9268 (Workqueue::find_and_run_task):
9269 Report user, sys and wall time.
9270 * Makefile.in: Regenerate.
9271 * config.in: Regenerate.
9272 * configure: Regenerate.
9273
9274 2009-12-16 Doug Kwan <dougkwan@google.com>
9275
9276 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9277 sections.
9278 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9279 relaxed input sections.
9280 * output.cc (Output_section::find_relaxed_input_section): Change
9281 return type to Output_relaxed_input_section pointer. Adjust code
9282 for new type of relaxed_input_section_map_.
9283 * output.h (Output_section::find_relaxed_input_section): Change
9284 return type to Output_relaxed_input_section pointer.
9285 (Output_section::Output_relaxed_input_section_by_input_section_map):
9286 New type.
9287 (Output_section::relaxed_input_section_map_): Change type to
9288 Output_section::Output_relaxed_input_section_by_input_section_map.
9289 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9290 input section.
9291
9292 2009-12-15 Ian Lance Taylor <iant@google.com>
9293
9294 * layout.cc (Layout::create_shstrtab): Only write out after input
9295 sections if we are compressing debug sections.
9296
9297 2009-12-15 Ian Lance Taylor <iant@google.com>
9298
9299 * archive.cc (Archive::add_symbols): Only look up a symbol without
9300 a version if there is, in fact, a version.
9301
9302 2009-12-14 Ian Lance Taylor <iant@google.com>
9303
9304 Revert -Wshadow changes, all changes from:
9305 2009-12-11 Doug Kwan <dougkwan@google.com>
9306 2009-12-11 Nick Clifton <nickc@redhat.com>
9307 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9308
9309 2009-12-11 Doug Kwan <dougkwan@google.com>
9310
9311 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9312 due to -Wshadow.
9313 * attributes.cc (Object_attribute::size): Ditto.
9314 (Attributes_section_data::size): Ditto.
9315 (Attributes_section_data::Attributes_section_data): Ditto.
9316 (Output_attributes_section_data::do_write): Ditto.
9317 * attributes.h (Object_attribute::set_type): Ditto.
9318 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9319
9320 2009-12-11 Nick Clifton <nickc@redhat.com>
9321
9322 * archive.cc: Fix shadowed variable warnings.
9323 * arm.cc: Likewise.
9324 * compressed_output.cc: Likewise.
9325 * compressed_output.h: Likewise.
9326 * configure: Likewise.
9327 * dwarf_reader.cc: Likewise.
9328 * dynobj.cc: Likewise.
9329 * dynobj.h: Likewise.
9330 * ehframe.cc: Likewise.
9331 * ehframe.h: Likewise.
9332 * errors.cc: Likewise.
9333 * expression.cc: Likewise.
9334 * fileread.cc: Likewise.
9335 * fileread.h: Likewise.
9336 * freebsd.h: Likewise.
9337 * i386.cc: Likewise.
9338 * icf.cc: Likewise.
9339 * incremental.h: Likewise.
9340 * layout.cc: Likewise.
9341 * layout.h: Likewise.
9342 * mapfile.cc: Likewise.
9343 * merge.cc: Likewise.
9344 * merge.h: Likewise.
9345 * object.cc: Likewise.
9346 * object.h: Likewise.
9347 * options.h: Likewise.
9348 * output.cc: Likewise.
9349 * output.h: Likewise.
9350 * parameters.cc: Likewise.
9351 * plugin.cc: Likewise.
9352 * powerpc.cc: Likewise.
9353 * reduced_debug_output.cc: Likewise.
9354 * reduced_debug_output.h: Likewise.
9355 * reloc.cc: Likewise.
9356 * reloc.h: Likewise.
9357 * resolve.cc: Likewise.
9358 * script-sections.cc: Likewise.
9359 * script.cc: Likewise.
9360 * script.h: Likewise.
9361 * sparc.cc: Likewise.
9362 * symtab.cc: Likewise.
9363 * symtab.h: Likewise.
9364 * target-select.cc: Likewise.
9365 * target-select.h: Likewise.
9366 * token.h: Likewise.
9367 * workqueue.cc: Likewise.
9368 * workqueue.h: Likewise.
9369 * x86_64.cc: Likewise.
9370
9371 2009-12-10 Doug Kwan <dougkwan@google.com>
9372
9373 * arm.cc (attributes.h): New include.
9374 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9375 (Arm_relobj::~Arm_relobj): Delete object pointed by
9376 attributes_section_data_.
9377 (Arm_relobj::attributes_section_data): New method definition.
9378 (Arm_relobj::attributes_section_data_): New data member declaration.
9379 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9380 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9381 attributes_section_data_.
9382 (Arm_dynobj::attributes_section_data): New method definition.
9383 (Arm_dynobj::attributes_section_data_): New data member declaration.
9384 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
9385 initialization value of may_use_blx_ to false.
9386 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9387 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9388 object attributes to compute results instead of hard-coding.
9389 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9390 Target_arm::get_secondary_compatible_arch,
9391 Target_arm::set_secondary_compatible_arch
9392 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9393 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9394 New method declarations.
9395 (Target_arm::get_aeabi_object_attribute): New method definition.
9396 (Target_arm::attributes_section_data_): New data member declaration.
9397 (read_arm_attributes_section): New template definition.
9398 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9399 (Arm_dynobj::do_read_symbols): Ditto.
9400 (Target_arm::do_finalize_sections): Merge attributes sections from
9401 input. Check for BLX use after attributes section merging.
9402 Fix __exidx_start and __exidx_end visibility. Create an
9403 .ARM.attributes section if necessary.
9404 (Target_arm::get_secondary_compatible_arch,
9405 Target_arm::set_secondary_compatible_arch,
9406 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9407 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9408 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9409 New method definitions.
9410
9411 2009-12-09 Ian Lance Taylor <iant@google.com>
9412
9413 * plugin.cc (Plugin::load): Don't cast from void* to a function
9414 pointer.
9415
9416 2009-12-09 Ian Lance Taylor <iant@google.com>
9417
9418 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9419 information fields.
9420
9421 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
9422
9423 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9424 Replace two_file_shared_1.so with two_file_shared_2.so.
9425 * testsuite/Makefile.in: Regenerated.
9426
9427 2009-12-08 Doug Kwan <dougkwan@google.com>
9428
9429 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9430 (HFILES): Add attributes.h and int_encoding.h.
9431 * Makefile.in: Regenerate.
9432 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9433 function definitions to int_encoding.cc
9434 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9435 prototypes to int_encoding.h
9436 * reduced_debug_output.cc (int_encoding.h): New include.
9437 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9438 function definitions to int_encoding.cc
9439 (insert_into_vector, read_from_pointer): Move template definitions to
9440 int_encoding.h
9441 * attributes.cc: New file.
9442 * attributes.h: New file.
9443 * int_encoding.cc: New file.
9444 * int_encoding.h: New file.
9445
9446 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
9447
9448 PR gold/11055
9449 * incremental-dump.cc (dump_incremental_inputs): New.
9450 (main): Use dump_incremental_inputs.
9451
9452 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
9453
9454 PR gold/10893
9455 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9456 checking elfcpp::STT_FUNC.
9457 (Target_i386::Relocate::relocate): Likewise.
9458 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9459
9460 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9461 symbols from shared libraries into normal FUNC symbols.
9462
9463 * symtab.h (Symbol): Add is_func and use it.
9464
9465 2009-12-05 Doug Kwan <dougkwan@google.com>
9466
9467 * arm.cc (Target_arm::arm_info): Initialize new fields
9468 attributes_section and attributes_vendor.
9469 * i386.cc (Target_i386::i386_info): Same.
9470 * object.cc (Sized_relobj::do_layout): Skip attribute section.
9471 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9472 fields attributes_section and attributes_vendor.
9473 * sparc.cc (Target_sparc::sparc_info): Same.
9474 * target.h (Target::attributes_section, Target::attributes_vendor,
9475 Target::is_attributes_section, Target::attribute_arg_type,
9476 Target::attributes_order): New method definitions.
9477 (Target::Target_info::attributes_section,
9478 Target::Target_info::attributes_vendor): New fields.
9479 (Target::do_attribute_arg_type, Target::do_attributes_order): New
9480 virtual method definitions.
9481 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9482 attributes_section and attributes_vendor.
9483 * testsuite/testfile.cc (Target_test::test_target_info): Same.
9484
9485 2009-12-05 Doug Kwan <dougkwan@google.com>
9486
9487 * arm.cc: Update comments about interworking and stub generation.
9488 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9489 considered as non-PIC.
9490 (Arm_relocate_functions::base_abs): Fix formatting.
9491 (Arm_relocate_functions::got_prel): Fix comment. Change interface
9492 of function to use GOT entry address instead of offset.
9493 (Target_arm::Scan::global): Issue an error if a symbol would need a
9494 PLT does not get one because it is untyped. Remove code to create
9495 dynamic symbols for relative branches.
9496 (Target_arm::Relocate::relocate: Use 0 instead of false since function
9497 takes unsigned integer instead of boolean.
9498
9499 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
9500
9501 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9502 (two_file_test_LDADD): Likewise.
9503 (common_test_1_LDADD): Likewise.
9504 (exception_test_LDADD) Likewise.
9505 (weak_test_LDADD): Likewise.
9506 (many_sections_test_LDADD): Likewise.
9507 (initpri1_LDADD): Likewise.
9508 (script_test_1_LDADD): Likewise.
9509 (script_test_2_LDADD): Likewise.
9510 (justsyms_LDADD): Likewise.
9511 (binary_test_LDADD): Likewise.
9512 (large_LDADD): Likewise.
9513 * testsuite/Makefile.in: Regenerated.
9514
9515 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
9516
9517 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9518 (Symbol_table::override_with_special): Likewise.
9519 (Symbol_table::add_from_object): Likewise.
9520
9521 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9522
9523 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9524 Don't set the data_offset twice.
9525
9526 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9527
9528 * testsuite/Makefile.in: Regenerate.
9529
9530 2009-12-03 Doug Kwan <dougkwan@google.com>
9531
9532 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9533 (Target_arm::do_finalize_sections): Add parameter for symbol table
9534 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
9535 * i386.cc (Target_i386::do_finalize_sections): Add an additional
9536 parameter for symbol table pointer.
9537 * layout.cc (Layout::finalize): Call Target::finalize_sections with
9538 an additional parameter for a pointer to symbol table.
9539 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9540 parameter for a symbol table pointer.
9541 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9542 * target.h (Target::finalize_sections, Target::do_finalize_sections):
9543 Ditto.
9544 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9545 parameter for a symbol table pointer.
9546
9547 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
9548
9549 * incremental.cc (Incremental_inputs_header)
9550 (Incremental_inputs_header_write, Incremental_inputs_entry)
9551 (Incremental_inputs_entry_write): Move ...
9552 * incremental.h (Incremental_inputs_header)
9553 (Incremental_inputs_header_write, Incremental_inputs_entry)
9554 (Incremental_inputs_entry_write): here.
9555
9556 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9557
9558 * incremental.cc (make_sized_incremental_binary): Set the target.
9559 Error if it is incompatible.
9560 * output.h (Output_file): Add filename method.
9561
9562 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9563
9564 * incremental.cc (Incremental_inputs_entry): Remove unused argument
9565 from the get_* methods.
9566
9567 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9568
9569 * incremental-dump.cc (main): Check that the offeset of a script is 0.
9570 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9571 Write 0 for the data_offset of scripts.
9572
9573 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9574
9575 * testsuite/Makefile.am: Add the incremental_test.sh test.
9576 * testsuite/incremental_test.sh: New.
9577 * testsuite/incremental_test_1.c: New.
9578 * testsuite/incremental_test_2.c: New.
9579
9580 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
9581
9582 * incremental-dump.cc (main): Fix typos.
9583
9584 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
9585
9586 PR gold/11025
9587 * incremental-dump.cc (main): Use llu to print 64 bit values.
9588
9589 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
9590 H.J. Lu <hongjiu.lu@intel.com>
9591
9592 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9593 $(LIBDL).
9594 (incremental_dump_LDADD): Likewise.
9595 * Makefile.in: Regenerated.
9596
9597 2009-11-25 Doug Kwan <dougkwan@google.com>
9598
9599 Revert:
9600
9601 2009-11-25 Doug Kwan <dougkwan@google.com>
9602
9603 * arm.cc (Target_arm::Target_arm): Move method definition
9604 outside of class definition. Add code to handle
9605 --target1-rel, --target1-abs and --target2= options.
9606 (Target_arm::get_reloc_reloc_type): Change method to be
9607 non-static and const.
9608 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9609 New data member declaration.
9610 (Target_arm::Scan::local, Target_arm::Scan::global,
9611 Target_arm::Relocate::relocate,
9612 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9613 Adjust call to Target_arm::get_real_reloc_type.
9614 (Target_arm::get_real_reloc_type): Use command line options
9615 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9616 * options.h (--target1-rel, --target1-abs, --target2): New
9617 ARM-only options.
9618
9619 2009-11-25 Doug Kwan <dougkwan@google.com>
9620
9621 * arm.cc (Target_arm::Target_arm): Move method definition outside of
9622 class definition. Add code to handle --target1-rel, --target1-abs
9623 and --target2= options.
9624 (Target_arm::get_reloc_reloc_type): Change method to be non-static
9625 and const.
9626 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9627 member declaration.
9628 (Target_arm::Scan::local, Target_arm::Scan::global,
9629 Target_arm::Relocate::relocate,
9630 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9631 call to Target_arm::get_real_reloc_type.
9632 (Target_arm::get_real_reloc_type): Use command line options to
9633 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9634 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9635 options.
9636
9637 2009-11-25 Doug Kwan <dougkwan@google.com>
9638
9639 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9640 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9641 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9642 formatting.
9643 (Arm_relocate_functions::thm_call): Replace body with a call to
9644 Arm_relocate_functions::thumb_branch_common.
9645 (Arm_relocate_functions::thm_jump24,
9646 Arm_relocate_functions::thm_xpc22): New method definitions.
9647 (Arm_relocate_functions::thumb_branch_common): New method definition.
9648 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9649 operator.
9650 (Target_arm::Relocate::relocate): Adjust call to thm_call.
9651 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9652
9653 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9654
9655 * Makefile.am: Build incremental-dump
9656 * Makefile.in: Regenerate.
9657 * incremental-dump.cc: New.
9658 * incremental.cc (Incremental_inputs_header_data,
9659 Incremental_inputs_entry_data): Move to incremental.h
9660 * incremental.h: (Incremental_inputs_header_data,
9661 Incremental_inputs_entry_data): Move from incremental.cc
9662
9663 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9664
9665 * incremental.cc (Incremental_inputs_header,
9666 Incremental_inputs_header_write, Incremental_inputs_entry,
9667 Incremental_inputs_entry_write): Add a typedef with the data type.
9668
9669 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9670
9671 * incremental.cc (Incremental_inputs_header,
9672 Incremental_inputs_header_write, Incremental_inputs_entry,
9673 Incremental_inputs_entry_write): Update comment about which
9674 type has the filed descriptions.
9675
9676 2009-11-15 Doug Kwan <dougkwan@google.com>
9677
9678 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9679 (Arm_relocate_functions::arm_branch_common): Change method defintion
9680 in class definition to a method declaration and update list of formal
9681 parameters.
9682 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9683 Arm_relocation_functions::jump24): Adjust call to
9684 Arm_relocate_functions::arm_branch_common. Update list of formal
9685 parameters.
9686 (Arm_relocate_functions::xpc25): New method definition.
9687 (Arm_relocate_functions::arm_branch_common): Move method defintion
9688 out from class definition. Use stubs for mode-switching and extending
9689 branch ranges.
9690 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9691 specially. Change code to enable use of stubs in ARM branches.
9692
9693 2009-11-10 Doug Kwan <dougkwan@google.com>
9694
9695 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9696 in method declaration.
9697 (Target_arm::relocate_stub): New method declaration.
9698 (Target_arm::default_target): Change to return a pointer instead of
9699 a const reference.
9700 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9701 Target_arm::default_target.
9702 (Arm_Relobj::do_relocate_sections): Remove options paramater in
9703 method definition.
9704 (Target_arm::relocate_section): Adjust view.
9705 (Target_arm::relocate_stub): New method definition.
9706
9707 2009-11-10 Doug Kwan <dougkwan@google.com>
9708
9709 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9710 a format warning.
9711 * incremental.cc (open_incremental_binary): Initialized local
9712 variables to avoid warnings.
9713 * object.cc (make_elf_object): Ditto.
9714 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9715 a format warning.
9716
9717 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
9718
9719 PR gold/10930
9720 * testsuite/plugin_test.c: Include "config.h".
9721
9722 2009-11-09 Doug Kwan <dougkwan@google.com>
9723
9724 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9725 (arm_symbol_value): Remove.
9726 (Arm_relocate_functions::arm_branch_common,
9727 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9728 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9729 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9730 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9731 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9732 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9733 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9734 Arm_relocate_functions::thm_mobw_abs_nc,
9735 Arm_relocate_functions::thm_mov_abs,
9736 Arm_relocate_functions::movw_prel_nc,
9737 Arm_relocate_functions::thm_movt_abs,
9738 Arm_relocate_functions::movt_prel,
9739 Arm_relocate_functions::thm_movw_prel_nc,
9740 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9741 (Target_arm::Relocate::relocate): Only decompose address into two
9742 parts if relocation type uses the thumb-bit and pass the actual
9743 bit instead of a flag indicating that the thumb-bit is used. Adjust
9744 calls to methods in Arm_relocate_functions for this change.
9745
9746 2009-11-08 Ian Lance Taylor <iant@google.com>
9747
9748 PR 10925
9749 * reloc.cc: Instantiate
9750 Sized_relobj::initialize_input_to_output_maps and
9751 Sized_relobj:free_input_to_output_maps.
9752
9753 2009-11-06 Ian Lance Taylor <iant@google.com>
9754
9755 PR 10876
9756 * defstd.cc (in_segment): Set only_if_ref true for "end".
9757
9758 2009-11-06 Doug Kwan <dougkwan@google.com>
9759
9760 * arm.cc (class Reloc_stub): Correct a comment.
9761 (Target_arm::Target_arm): Initialize arm_input_section_map_.
9762 (Target_arm::scan_section_for_stubs): New method declaration.
9763 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9764 Change methods from private to protected.
9765 (Target_arm::do_may_relax): New method definition.
9766 (Target_arm::do_relax, Target_arm::group_sections,
9767 Target_arm::scan_reloc_for_stub,
9768 Target_arm::scan_reloc_section_for_stubs): New method declarations.
9769 (Target_arm::arm_input_section_map_): New data member declaration.
9770 (Target_arm::scan_reloc_for_stub,
9771 Target_arm::scan_reloc_section_for_stubs,
9772 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9773 Target_arm::do_relax): New method definitions.
9774
9775 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
9776
9777 * configure.ac: Check for (struct stat)::st_mtim
9778 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9779 * config.in: Regenerate.
9780 * configure: Regenerate.
9781
9782 2009-11-05 Ian Lance Taylor <iant@google.com>
9783
9784 PR 10910
9785 * output.cc (Output_segment::add_output_section): Add missing
9786 return statement.
9787
9788 2009-11-04 Ian Lance Taylor <iant@google.com>
9789
9790 PR 10880
9791 * object.h (class Object): Add is_needed and set_is_needed
9792 methods. Add is_needed_ field. Make bool fields into bitfields.
9793 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9794 defined in a dynamic object and referenced by a regular object,
9795 set is_needed for the dynamic object.
9796 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9797 if the file is marked with as_needed and it is not needed.
9798
9799 2009-11-04 Ian Lance Taylor <iant@google.com>
9800
9801 PR 10887
9802 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9803 tags if data is discarded by linker script.
9804 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9805 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9806 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9807 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9808
9809 2009-11-04 Ian Lance Taylor <iant@google.com>
9810
9811 * layout.cc (Layout::get_output_section): Add is_interp and
9812 is_dynamic_linker_section parameters. Change all callers.
9813 (Layout::choose_output_section): Likewise.
9814 (Layout::make_output_section): Likewise.
9815 (Layout::add_output_section_data): Add is_dynamic_linker_section
9816 parameter. Change all callers.
9817 * layout.h (class Layout): Update declarations.
9818 * output.h (class Output_section): Add is_interp, set_is_interp,
9819 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9820 Add is_interp_, is_dynamic_linker_section_ fields. Change
9821 generate_code_fills_at_write_ to a bitfield.
9822 * output.cc (Output_section::Output_sections): Initialize new
9823 fields.
9824 (Output_segment::add_output_section): Add do_sort parameter.
9825 Change all callers.
9826
9827 2009-11-03 Ian Lance Taylor <iant@google.com>
9828
9829 PR 10860
9830 * options.h (class General_options): Add --warn-common.
9831 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9832 merging two common symbols.
9833 (Symbol_table::should_override): Handle --warn-common when merging
9834 a common symbol with a defined symbol. Use report_resolve_problem
9835 for multiple definitions.
9836 (Symbol_table::report_resolve_problem): New function.
9837 * symtab.h (class Symbol_table): Declare report_resolve_problem.
9838
9839 2009-11-03 Doug Kwan <dougkwan@google.com>
9840
9841 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9842 stub_factory_.
9843 (Target_arm::stub_factory): New method definition.
9844 (Target_arm::new_arm_input_section,
9845 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9846 Target_arm::reloc_uses_thumb_bit): New method declarations.
9847 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9848 New type definitions.
9849 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9850 member declarations.
9851 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9852 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9853 New method definitions.
9854
9855 2009-11-03 Ian Lance Taylor <iant@google.com>
9856
9857 * options.h (class General_options): Add --warn_constructors.
9858
9859 2009-11-03 Ian Lance Taylor <iant@google.com>
9860
9861 PR 10893
9862 * defstd.cc (in_section): Add entries for __rel_iplt_start,
9863 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9864
9865 2009-11-03 Ian Lance Taylor <iant@google.com>
9866
9867 PR 10895
9868 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9869 --msgid-bugs-address.
9870 (install-pdf): New target.
9871 (install-data_yes): Look up one directory to find mkinstalldirs.
9872
9873 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
9874
9875 * po/Make-in (.po.gmo): Don't generate .gmo files in source
9876 tree.
9877
9878 2009-10-30 Doug Kwan <dougkwan@google.com>
9879
9880 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9881
9882 2009-10-30 Doug Kwan <dougkwan@google.com>
9883
9884 * arm.cc (Stub_addend_reader): New struct template definition
9885 and partial specializations.
9886 (Stub_addend_reader::operator()): New method definition for a
9887 partially specialized template.
9888
9889 2009-10-30 Doug Kwan <dougkwan@google.com>
9890
9891 * arm.cc (Arm_relobj::processor_specific_flags): New method
9892 definition.
9893 (Arm_relobj::do_read_symbols): New method declaration.
9894 (Arm_relobj::processor_specific_flags_): New data member declaration.
9895 (Arm_dynobj): New class definition.
9896 (Target_arm::do_finalize_sections): Add input_objects parameter.
9897 (Target_arm::do_adjust_elf_header): New method declaration.
9898 (Target_arm::are_eabi_versions_compatible,
9899 (Target_arm::merge_processor_specific_flags): New method declaration.
9900 (Target_arm::do_make_elf_object): New overloaded method definitions
9901 and declaration.
9902 (Arm_relobj::do_read_symbols): New method definition.
9903 (Arm_dynobj::do_read_symbols): Ditto.
9904 (Target_arm::do_finalize_sections): Add input_objects parameters.
9905 Merge processor-specific flags from all input objects.
9906 (Target_arm::are_eabi_versions_compatible,
9907 Target_arm::merge_processor_specific_flags,
9908 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9909 New method definitions.
9910 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9911 Input_objects pointer type parameter.
9912 * layout.cc (Layout::finalize): Pass input objects to target's.
9913 finalize_sections function.
9914 * output.cc (Output_file_header::do_sized_write): Set ELF file
9915 header's processor-specific flags.
9916 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9917 Input_objects pointer type parameter.
9918 * sparc.cc (Target_sparc::do_finalize_sections): Same.
9919 * target.h (Input_objects): New forward class declaration.
9920 (Target::processor_specific_flags,
9921 Target::are_processor_specific_flags_sect): New method definitions.
9922 (Target::finalize_sections): Add input_objects parameter.
9923 (Target::Target): Initialize processor_specific_flags_ and
9924 are_processor_specific_flags_set_.
9925 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9926 parameter.
9927 (Target::set_processor_specific_flags): New method definition.
9928 (Target::processor_specific_flags_,
9929 Target::are_processor_specific_flags_set_): New data member
9930 declarations.
9931 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9932 Input_objects pointer type parameter.
9933
9934 2009-10-30 Doug Kwan <dougkwan@google.com>
9935
9936 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9937
9938 2009-10-28 Ian Lance Taylor <iant@google.com>
9939
9940 * object.h (class Relobj): Drop options parameter from
9941 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9942 do_scan_relocs, do_relocate. Change all callers.
9943 (class Sized_relobj): Drop options parameters from
9944 do_gc_process_relocs, do_scan_relocs, do_relocate,
9945 do_relocate_sections, relocate_sections, emit_relocs_scan,
9946 emit_relocs_scan_reltype. Change all callers.
9947 (struct Relocate_info): Remove options field and all references to
9948 it.
9949 * reloc.h (class Read_relocs): Remove options constructor
9950 parameter and options_ field. Change all callers.
9951 (class Gc_process_relocs, class Scan_relocs): Likewise.
9952 (class Relocate_task): Likewise.
9953 * target-reloc.h (scan_relocs): Remove options parameter. Change
9954 all callers.
9955 (scan_relocatable_relocs): Likewise.
9956 * target.h (class Sized_target): Remove options parameter from
9957 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
9958 all callers.
9959 * gc.h (gc_process_relocs): Remove options parameter. Change all
9960 callers.
9961 * arm.cc: Update functions to remove options parameters.
9962 * i386.cc: Likewise.
9963 * powerpc.cc: Likewise.
9964 * sparc.cc: Likewise.
9965 * x86_64.cc: Likewise.
9966 * testsuite/testfile.cc: Likewise.
9967
9968 2009-10-28 Doug Kwan <dougkwan@google.com>
9969
9970 * arm.cc (Arm_relobj): New class definition.
9971 (Arm_relobj::scan_sections_for_stubs,
9972 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9973 New method definitions.
9974
9975 2009-10-28 Cary Coutant <ccoutant@google.com>
9976
9977 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9978 (Plugin::cleanup_done_): New member.
9979 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9980 (Plugin_manager::cleanup_done_): Remove.
9981 (Plugin_manager::add_input_file): Edit error message.
9982 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9983 (Plugin_manager::cleanup): Remove use of cleanup_done_.
9984
9985 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
9986
9987 * fileread.cc: (File_read::View::~View): Use the new
9988 data_ownership_ filed.
9989 (File_read::~File_read): Dispose the new whole_file_view_.
9990 (File_read::open): Mmap the whole file if needed.
9991 (File_read::open): Use whole_file_view_ instead of contents_.
9992 (File_read::find_view): Use whole_file_view_ if applicable.
9993 (File_read::do_read): Use whole_file_view_ instead of contents_.
9994 (File_read::make_view): Use whole_file_view_ instead of contents_,
9995 update File_read::View::View call.
9996 (File_read::find_or_make_view): Update File_read::View::View
9997 call.
9998 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9999 remove contents_
10000 (File_read::View::Data_ownership): New enum.
10001 (File_read::View::View): Replace bool mapped_ with Data_ownership
10002 argument.
10003 (File_read::View::mapped_): Remove (replaced by data_ownership_).
10004 (File_read::View::data_ownership_): New field.
10005 (File_read::contents_): Remove (replaced by whole_file_view_).
10006 (File_read::whole_file_view_): New field.
10007 * options.h (class General_options): Add --keep-files-mapped.
10008
10009 2009-10-27 Cary Coutant <ccoutant@google.com>
10010
10011 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10012 * testsuite/Makefile.am (plugin_test_5): New test case.
10013 * testsuite/Makefile.in: Regenerate.
10014
10015 2009-10-25 Doug Kwan <dougkwan@google.com>
10016
10017 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10018 from private to protected to allow access by child class.
10019 (Sized_relobj::do_relocate_sections): New method declaration.
10020 (Sized_relobj::relocate_sections): Virtualize.
10021 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10022 Sized_relobj::relocate_sections. Instantiate template explicitly
10023 for different target sizes and endianity.
10024
10025 2009-10-24 Doug Kwan <dougkwan@google.com>
10026
10027 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10028 (Arm_input_section::as_arm_input_section): New method.
10029 (Arm_output_section): New class definition.
10030 (Arm_output_section::create_stub_group,
10031 Arm_output_section::group_sections): New method definitions.
10032
10033 2009-10-22 Doug Kwan <dougkwan@google.com>
10034
10035 * arm.cc (Arm_input_section): New class definition.
10036 (Arm_input_section::init, Arm_input_section:do_write,
10037 Arm_input_section::set_final_data_size,
10038 Arm_input_section::do_reset_address_and_file_offset): New method
10039 definitions.
10040
10041 2009-10-21 Doug Kwan <dougkwan@google.com>
10042
10043 * arm.cc (Stub_table, Arm_input_section): New forward class
10044 declarations.
10045 (Stub_table): New class defintion.
10046 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10047 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10048 New method definition.
10049
10050 2009-10-21 Doug Kwan <dougkwan@google.com>
10051
10052 * arm.cc: Update copyright comments.
10053 (Target_arm): New forward class template declaration.
10054 (Arm_address): New type.
10055 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10056 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10057 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10058 constants.
10059 (Insn_template): Same.
10060 (DEF_STUBS): New macro.
10061 (Stub_type): New enum type.
10062 (Stub_template): New class definition.
10063 (Stub): Same.
10064 (Reloc_stub): Same.
10065 (Stub_factory): Same.
10066 (Target_arm::Target_arm): Initialize may_use_blx_ and
10067 should_force_pic_veneer_.
10068 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10069 Target_arm::should_force_pic_veneer,
10070 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10071 Target_arm::using_thumb_only, Target_arm:;default_target): New
10072 method defintions.
10073 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10074 New data member declarations.
10075 (Insn_template::size, Insn_template::alignment): New method defintions.
10076 (Stub_template::Stub_template): New method definition.
10077 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10078 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10079 (Stub_factory::Stub_factory): New method definition.
10080 * gold.h (string_hash): New template.
10081 * output.h (Input_section_specifier::hash_value): Use
10082 gold::string_hash.
10083 (Input_section_specifier::string_hash): Remove.
10084 * stringpool.cc (Stringpool_template::string_hash): Use
10085 gold::string_hash.
10086
10087 2009-10-20 Doug Kwan <dougkwan@google.com>
10088
10089 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10090 symbols of relaxed input sections.
10091 * output.h (Output_section::find_relaxed_input_section): Make
10092 method public.
10093
10094 2009-10-16 Doug Kwan <dougkwan@google.com>
10095
10096 * dynobj.cc (Versions::Versions): Initialize version_script_.
10097 Only insert base version symbol definition for a shared object
10098 if version script defines any version versions.
10099 (Versions::define_base_version): New method definition.
10100 (Versions::add_def): Check that base version is not needed.
10101 (Versions::add_need): Define base version lazily.
10102 * dynobj.h (Versions::define_base_version): New method declaration.
10103 (Versions::needs_base_version_): New data member declaration.
10104 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10105 (check_DATA): Add no_version_test.stdout.
10106 (libno_version_test.so, no_version_test.o no_version_test.stdout):
10107 New make rules.
10108 * testsuite/Makefile.in: Regenerate.
10109 * testsuite/no_version_test.c: New file.
10110 * testsuite/no_version_test.sh: Ditto.
10111
10112 2009-10-16 Doug Kwan <dougkwan@google.com>
10113
10114 * expression.cc (class Segment_start_expression): New class definition.
10115 (Segment_start_expression::value): New method definition.
10116 (script_exp_function_segment_start): Return a new
10117 Segment_start_expression.
10118 * gold/script-c.h (script_saw_segment_start_expression): New function
10119 prototype.
10120 * script-sections.cc (Script_sections::Script_sections): Initialize
10121 SAW_SEGMENT_START_EXPRESSION_ to false.
10122 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10123 and -Tbbs options to specify section addresses if given in
10124 command line and no SEGMENT_START expression is seen in a script.
10125 * script-sections.h (Script_sections::saw_segment_start_expression,
10126 Script_sections::set_saw_segment_start_expression): New method
10127 definition.
10128 (Script_sections::saw_segment_start_expression_): New data member
10129 declaration.
10130 * script.cc (script_saw_segment_start_expression): New function.
10131 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10132 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10133 script_test_7.sh and script_test_8.sh.
10134 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10135 script_test_8.stdout.
10136 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10137 (script_test_6, script_test_6.stdout, script_test_7,
10138 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10139 * Makefile.in: Regenerate.
10140 * testsuite/script_test_6.sh: New file.
10141 * testsuite/script_test_6.t: Same.
10142 * testsuite/script_test_7.sh: Same.
10143 * testsuite/script_test_7.t: Same.
10144 * testsuite/script_test_8.sh: Same.
10145
10146 2009-10-16 Doug Kwan <dougkwan@google.com>
10147
10148 * output.cc (Output_segment::set_section_list_address): Cast
10149 expressions to unsigned long long type to avoid format warnings.
10150
10151 2009-10-15 Ian Lance Taylor <iant@google.com>
10152
10153 * script.cc (Script_options::add_symbol_assignment): Always add a
10154 dot assignment to script_sections_.
10155 * script-sections.cc (Script_sections::add_dot_assignment):
10156 Initialize if necessary.
10157
10158 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10159 program headers with no load segment if there is a linker script.
10160
10161 * layout.cc (Layout::set_segment_offsets): Align the file offset
10162 to the segment aligment for -N or -n with no load segment.
10163 * output.cc (Output_segment::add_output_section): Don't crash if
10164 the first section is a TLS section.
10165 (Output_segment::set_section_list_addresses): Print an error
10166 message if the address moves backward in a linker script.
10167 * script-sections.cc
10168 (Output_section_element_input::set_section_addresses): Don't
10169 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10170 (Orphan_output_section::set_section_addresses): Likewise.
10171
10172 2009-10-15 Doug Kwan <dougkwan@google.com>
10173
10174 * layout.cc (Layout::finish_dynamic_section): Generate tags
10175 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10176 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10177 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10178
10179 2009-10-14 Ian Lance Taylor <iant@google.com>
10180
10181 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10182 fields.
10183 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10184 data_shdr fields of relinfo.
10185 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10186 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
10187 R_386_TLS_LDO_32, adjust based on section flags.
10188 (Target_i386::Relocate::fix_up_ldo): Remove.
10189
10190 2009-10-13 Ian Lance Taylor <iant@google.com>
10191
10192 Add support for -pie.
10193 * options.h (class General_options): Add -pie and
10194 --pic-executable.
10195 (General_options::output_is_position_independent): Test -pie.
10196 (General_options::output_is_executable): Return true if not shared
10197 and not relocatable.
10198 (General_options::output_is_pie): Remove.
10199 * options.cc (General_options::finalize): Reject incompatible uses
10200 of -pie.
10201 * gold.cc (queue_middle_tasks): A -pie link is not static.
10202 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10203 * symtab.cc (Symbol::final_value_is_known): Return false if
10204 output_is_position_independent.
10205 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10206 output_is_position_independent.
10207 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10208 output_is_position_independent.
10209 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10210 output_is_position_independent.
10211 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10212 two_file_pie_test.
10213 (basic_pie_test.o, basic_pie_test): New targets.
10214 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10215 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10216 (two_file_pie_test): New target.
10217 * testsuite/Makefile.in: Rebuild.
10218 * README: Remove note saying that -pie is not supported.
10219
10220 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
10221
10222 * options.h (class General_options): Add -init and -fini.
10223 * layout.cc (Layout::finish_dynamic_section): Emit
10224 given init and fini functions.
10225
10226 2009-10-13 Sriraman Tallam <tmsriram@google.com>
10227
10228 * gc.h (gc_process_relocs): Check if icf is enabled using new
10229 function.
10230 * gold.cc (queue_initial_tasks): Likewise.
10231 (queue_middle_tasks): Likewise.
10232 * object.cc (do_layout): Likewise.
10233 * symtab.cc (is_section_folded): Likewise.
10234 * main.cc (main): Likewise.
10235 * reloc.cc (Read_relocs::run): Likewise.
10236 (Sized_relobj::do_scan_relocs): Likewise.
10237 * icf.cc (is_function_ctor_or_dtor): New function.
10238 (Icf::find_identical_sections): Check if function is ctor or dtor when
10239 safe icf is chosen.
10240 * options.h (General_options::icf): Change option to be an enum.
10241 (Icf_status): New enum.
10242 (icf_enabled): New method.
10243 (icf_safe_folding): New method.
10244 (set_icf_status): New method.
10245 (icf_status_): New variable.
10246 * (options.cc) (General_options::finalize): Set icf_status_.
10247 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10248 icf_test and icf_keep_unique_test to use the --icf enum flag.
10249 * testsuite/icf_safe_test.sh: New file.
10250 * testsuite/icf_safe_test.cc: New file.
10251
10252 2009-10-12 Sriraman Tallam <tmsriram@google.com>
10253
10254 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10255 includes to gc.h and icf.h.
10256 * arm.cc: Include gc.h.
10257 * gold.cc: Likewise.
10258 * i386.cc: Likewise.
10259 * powerpc.cc: Likewise.
10260 * sparc.cc: Likewise.
10261 * x86_64.cc: Likewise.
10262 * gc.h: Include icf.h.
10263
10264 2009-10-11 Ian Lance Taylor <iant@google.com>
10265
10266 * plugin.cc: Include "gold.h" before other header files.
10267
10268 2009-10-10 Chris Demetriou <cgd@google.com>
10269
10270 * options.h (Input_file_argument::Input_file_type): New enum.
10271 (Input_file_argument::is_lib_): Replace with...
10272 (Input_file_argument::type_): New member.
10273 (Input_file_argument::Input_file_argument): Take Input_file_type
10274 'type' rather than boolean 'is_lib' as second argument.
10275 (Input_file_argument::is_lib): Use type_.
10276 (Input_file_argument::is_searched_file): New function.
10277 (Input_file_argument::may_need_search): Handle is_searched_file.
10278 * options.cc (General_options::parse_library): Support -l:filename.
10279 (General_options::parse_just_symbols): Update for Input_file_argument
10280 changes.
10281 (Command_line::process): Likewise.
10282 * archive.cc (Archive::get_file_and_offset): Likewise.
10283 * plugin.cc (Plugin_manager::release_input_file): Likewise.
10284 * script.cc (read_script_file, script_add_file): Likewise.
10285 * fileread.cc (Input_file::Input_file): Likewise.
10286 (Input_file::will_search_for): Handle is_searched_file.
10287 (Input_file::open): Likewise.
10288 * readsyms.cc (Read_symbols::get_name): Likewise.
10289 * testsuite/Makefile.am (searched_file_test): New test.
10290 * testsuite/Makefile.in: Regenerate.
10291 * testsuite/searched_file_test.cc: New file.
10292 * testsuite/searched_file_test_lib.cc: New file.
10293
10294 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10295 Ian Lance Taylor <iant@google.com>
10296
10297 * descriptor.cc: Include <cstdio> and "binary-io.h".
10298 (Descriptors::open): Open the files in binary mode always.
10299 * script.cc (Lex::get_token): Treat \r as whitespace.
10300
10301 2009-10-09 Ian Lance Taylor <iant@google.com>
10302
10303 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10304
10305 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10306 Ian Lance Taylor <iant@google.com>
10307
10308 * configure.ac: Check for readv function also.
10309 * fileread.cc (readv): Define if not HAVE_READV.
10310 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10311 does not exist.
10312 * config.in: Regenerate.
10313 * configure: Regenerate.
10314
10315 2009-10-09 Doug Kwan <dougkwan@google.com>
10316
10317 * layout.cc (Layout::make_output_section): Call target hook to make
10318 ordinary output section.
10319 (Layout::finalize): Adjust parameter list of call the
10320 Target::may_relax().
10321 * layout.h (class Layout::section_list): New method.
10322 * merge.h (Output_merge_base::entsize): Change visibility to public.
10323 (Output_merge_base::is_string, Output_merge_base::do_is_string):
10324 New methods.
10325 (Output_merge_string::do_is_string): New method.
10326 * object.cc (Sized_relobj::do_setup): renamed from
10327 Sized_relobj::set_up.
10328 * object.h (Sized_relobj::adjust_shndx,
10329 Sized_relobj::initializ_input_to_output_maps,
10330 Sized_relobj::free_input_to_output_maps): Change visibilities to
10331 protected.
10332 (Sized_relobj::setup): Virtualize.
10333 (Sized_relobj::do_setup): New method declaration.
10334 (Sized_relobj::invalidate_section_offset,
10335 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10336 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10337 * options.cc (parse_int): New function.
10338 * options.h (parse_int): New declaration.
10339 (DEFINE_int): New macro.
10340 (stub_group_size): New option.
10341 * output.cc (Output_section::Output_section): Initialize memebers
10342 merge_section_map_, merge_section_by_properties_map_,
10343 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10344 (Output_section::add_input_section): Handled deferred code-fill
10345 generation and remove an old comment.
10346 (Output_section::add_relaxed_input_section): New method definition.
10347 (Output_section::add_merge_input_section): Use merge section by
10348 properties map to speed to search. Update merge section maps
10349 as appropriate.
10350 (Output_section::build_relaxation_map): New method definition.
10351 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10352 Same.
10353 (Output_section::relax_input_section): Renamed to
10354 Output_section::convert_input_sections_to_relaxed_sections and change
10355 interface to take a vector of pointers to relaxed sections.
10356 (Output_section::find_merge_section,
10357 Output_section::find_relaxed_input_section): New method definitions.
10358 (Output_section::is_input_address_mapped,
10359 Output_section::output_offset, Output_section::output_address):
10360 Use output section data maps to speed up searching.
10361 (Output_section::find_starting_output_address): Add comments.
10362 (Output_section::do_write,
10363 Output_section::write_to_postprocessing_buffer): Do code-fill
10364 generation as appropriate.
10365 (Output_section::get_input_sections): Invalidate relaxed input section
10366 map.
10367 (Output_section::restore_states): Adjust type of checkpoint .
10368 Invalidate relaxed input section map.
10369 * output.h (Output_merge_base): New class declaration.
10370 (Input_section_specifier): New class defintion.
10371 (class Output_relaxed_input_section) Change base class to
10372 Output_section_data_build.
10373 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10374 base class initializer.
10375 (Output_section::add_relaxed_input_section): New method declaration.
10376 (Output_section::Input_section): Change visibility to protected.
10377 (Output_section::Input_section::relobj,
10378 Output_section::Input_section::shndx): Handle relaxed input sections.
10379 Output_section::input_sections) Change visibility to protected. Also
10380 define overload to return a non-const pointer.
10381 (Output_section::Merge_section_properties): New class defintion.
10382 (Output_section::Merge_section_by_properties_map,
10383 Output_section::Output_section_data_by_input_section_map,
10384 Output_section::Relaxation_map): New types.
10385 (Output_section::relax_input_section): Rename method to
10386 Output_section::convert_input_sections_to_relaxed_sections and change
10387 interface to take a vector of relaxed section pointers.
10388 (Output_section::find_merge_section,
10389 Output_section::find_relaxed_input_section,
10390 Output_section::build_relaxation_map,
10391 Output_section::convert_input_sections_in_list_to_relaxed_sections):
10392 New method declarations.
10393 (Output_section::merge_section_map_
10394 Output_section::merge_section_by_properties_map_,
10395 Output_section::relaxed_input_section_map_,
10396 Output_section::is_relaxed_input_section_map_valid_,
10397 Output_section::generate_code_fills_at_write_): New data members.
10398 * script-sections.cc
10399 (Output_section_element_input::set_section_addresses): Call
10400 current_data_size and addralign methods of relaxed input sections.
10401 (Orphan_output_section::set_section_addresses): Call current_data_size
10402 and addralign methods of relaxed input sections.
10403 * symtab.cc (Symbol_table::compute_final_value): Extract template
10404 from the body of Symbol_table::sized_finalize_symbol.
10405 (Symbol_table::sized_finalized_symbol): Call
10406 Symbol_table::compute_final_value.
10407 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10408 (Symbol_table::compute_final_value): New templated method declaration.
10409 * target.cc (Target::do_make_output_section): New method defintion.
10410 * target.h (Target::make_output_section): New method declaration.
10411 (Target::relax): Add more parameters for input objects, symbol table
10412 and layout. Adjust call to do_relax.
10413 (Target::do_make_output_section): New method declaration.
10414 (Target::do_relax): Add parameters for input objects, symbol table
10415 and layout.
10416
10417 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10418
10419 * pread.c: Include stdio.h.
10420
10421 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10422
10423 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10424 defined.
10425
10426 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10427
10428 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10429 Change read_shndx type to unsigned int.
10430 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10431 int.
10432 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10433 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10434 Change read_shndx type to unsigned int.
10435 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10436 int.
10437 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10438 * layout.cc (Layout::create_symtab_sections): Cast the result of
10439 local_symcount * symsize to off_t in the gold_assert.
10440
10441 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10442
10443 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10444 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10445 R_ARM_BASE_ABS.
10446 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10447 (Arm_relocate_functions::thm_abs5): New function.
10448 (Arm_relocate_functions::abs12): New function.
10449 (Arm_relocate_functions::abs16): New function.
10450 (Arm_relocate_functions::base_abs): New function.
10451 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10452 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
10453 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10454 R_ARM_BASE_ABS.
10455 (Scan::global): Likewise.
10456 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10457 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10458 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10459 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10460 R_ARM_BASE_ABS.
10461
10462 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10463
10464 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10465 (Arm_relocate_functions::movt_prel): New function.
10466 (Arm_relocate_functions::thm_movw_prel_nc): New function.
10467 (Arm_relocate_functions::thm_movt_prel): New function.
10468 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10469 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10470 (Scan::global, Relocate::relocate): Likewise.
10471 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10472
10473 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10474
10475 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10476 Incremental_checker.
10477 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10478 unsigned int.
10479 (class Incremental_inputs_header): New class.
10480 (Incremental_inputs_header_writer): Edit comment.
10481 (Incremental_inputs_entry): New class.
10482 (Incremental_inputs_entry_writer): Edit comment.
10483 (Sized_incremental_binary::do_find_incremental_inputs_section):
10484 Add *strtab_shndx parameter, fill it.
10485 (Sized_incremental_binary::do_check_inputs): New method.
10486 (Incremental_checker::can_incrementally_link_output_file): Use
10487 Sized_incremental_binary::check_inputs.
10488 (Incremental_inputs::report_command_line): Save command line in
10489 command_line_.
10490 * incremental.h:
10491 (Incremental_binary::find_incremental_inputs_section): New
10492 method.
10493 (Incremental_binary::do_find_incremental_inputs_section): Add
10494 strtab_shndx parameter.
10495 (Incremental_binary::do_check_inputs): New pure virtual method.
10496 (Sized_incremental_binary::do_check_inputs): Declare.
10497 (Incremental_checker::Incremental_checker): Add incremental_inputs
10498 parameter, use it to initialize incremental_inputs_.
10499 (Incremental_checker::incremental_inputs_): New field.
10500 (Incremental_checker::command_line): New method.
10501 (Incremental_checker::inputs): New method.
10502 (Incremental_checker::command_line_): New field.
10503
10504 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10505
10506 * incremental.cc: Include <cstdarg> and "target-select.h".
10507 (vexplain_no_incremental): New function.
10508 (explain_no_incremental): New function.
10509 (Incremental_binary::error): New method.
10510 (Sized_incremental_binary::do_find_incremental_inputs_section): New
10511 method.
10512 (make_sized_incremental_binary): New function.
10513 (open_incremental_binary): New function.
10514 (can_incrementally_link_file): Add checks if output is ELF and has
10515 inputs section.
10516 * incremental.h: Include "elfcpp_file.h" and "output.h".
10517 (Incremental_binary): New class.
10518 (Sized_incremental_binary): New class.
10519 (open_incremental_binary): Declare.
10520 * object.cc (is_elf_object): Use
10521 elfcpp::Elf_recognizer::is_elf_file.
10522 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10523 * output.h (Output_file::filesize): New method.
10524
10525 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10526
10527 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10528 New function.
10529 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10530 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10531 function.
10532 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10533 function.
10534 (Arm_relocate_functions::movw_abs_nc): New function.
10535 (Arm_relocate_functions::movt_abs): New function.
10536 (Arm_relocate_functions::thm_movw_abs_nc): New function.
10537 (Arm_relocate_functions::thm_movt_abs): New function.
10538 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10539 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10540 (Scan::global): Likewise.
10541 (Relocate::relocate): Likewise.
10542 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10543
10544 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10545
10546 * arm.cc (Arm_relocate_functions::got_prel) New function.
10547 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10548 (Relocate::relocate): Likewise.
10549 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10550
10551 2009-10-06 Ian Lance Taylor <iant@google.com>
10552
10553 * options.h (class General_options): Define
10554 split_stack_adjust_size parameter.
10555 * object.h (class Object): Add uses_split_stack_ and
10556 has_no_split_stack_ fields. Add uses_split_stack and
10557 has_no_split_stack accessor functions. Declare
10558 handle_split_stack_section.
10559 (class Reloc_symbol_changes): Define.
10560 (class Sized_relobj): Define Function_offsets. Declare
10561 split_stack_adjust, split_stack_adjust_reltype, and
10562 find_functions.
10563 * object.cc (Object::handle_split_stack_section): New function.
10564 (Sized_relobj::do_layout): Call handle_split_stack_section.
10565 * dynobj.cc (Sized_dynobj::do_layout): Call
10566 handle_split_stack_section.
10567 * reloc.cc (Sized_relobj::relocate_sections): Call
10568 split_stack_adjust for executable sections in split_stack
10569 objects. Pass reloc_map to relocate_section.
10570 (Sized_relobj::split_stack_adjust): New function.
10571 (Sized_relobj::split_stack_adjust_reltype): New function.
10572 (Sized_relobj::find_functions): New function.
10573 * target-reloc.h: Include "object.h".
10574 (relocate_section): Add reloc_symbol_changes parameter. Change
10575 all callers.
10576 * target.h (class Target): Add calls_non_split method. Declare
10577 do_calls_non_split virtual method. Declare match_view and
10578 set_view_to_nop.
10579 * target.cc: Include "elfcpp.h".
10580 (Target::do_calls_non_split): New function.
10581 (Target::match_view): New function.
10582 (Target::set_view_to_nop): New function.
10583 * gold.cc (queue_middle_tasks): Give an error if mixing
10584 split-stack and non-split-stack objects with -r.
10585 * i386.cc (Target_i386::relocate_section): Add
10586 reloc_symbol_changes parameter.
10587 (Target_i386::do_calls_non_split): New function.
10588 * x86_64.cc (Target_x86_64::relocate_section): Add
10589 reloc_symbol_changes parameter.
10590 (Target_x86_64::do_calls_non_split): New function.
10591 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10592 parameter.
10593 * powerpc.cc (Target_powerpc::relocate_section): Add
10594 reloc_symbol_changes parameter.
10595 * sparc.cc (Target_sparc::relocate_section): Add
10596 reloc_symbol_changes parameter.
10597 * configure.ac: Call AM_CONDITIONAL for the default target.
10598 * configure: Rebuild.
10599 * testsuite/Makefile.am (TEST_AS): New variable.
10600 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10601 (check_DATA): Add split_i386 and split_x86_64 files.
10602 (SPLIT_DEFSYMS): Define.
10603 (split_i386_[1234n].o): New targets.
10604 (split_i386_[124]): New targets.
10605 (split_i386_[1234r].stdout): New targets.
10606 (split_x86_64_[1234n].o): New targets.
10607 (split_x86_64_[124]): New targets.
10608 (split_x86_64_[1234r].stdout): New targets.
10609 (MOSTLYCLEANFILES): Add new executables.
10610 * testsuite/split_i386.sh: New file.
10611 * testsuite/split_x86_64.sh: New file.
10612 * testsuite/split_i386_1.s: New file.
10613 * testsuite/split_i386_2.s: New file.
10614 * testsuite/split_i386_3.s: New file.
10615 * testsuite/split_i386_4.s: New file.
10616 * testsuite/split_i386_n.s: New file.
10617 * testsuite/split_x86_64_1.s: New file.
10618 * testsuite/split_x86_64_2.s: New file.
10619 * testsuite/split_x86_64_3.s: New file.
10620 * testsuite/split_x86_64_4.s: New file.
10621 * testsuite/split_x86_64_n.s: New file.
10622 * testsuite/testfile.cc (Target_test): Update relocation_section
10623 function.
10624 * testsuite/Makefile.in: Rebuild.
10625
10626 2009-10-06 Ian Lance Taylor <iant@google.com>
10627
10628 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10629 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10630 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
10631 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10632 the address on ldo_addrs_.
10633 (Target_i386::Relocate::fix_up_ldo): New function.
10634
10635 2009-10-06 Rafael Espindola <espindola@google.com>
10636
10637 * plugin.cc (add_input_library): New.
10638 (Plugin::load): Add add_input_library to tv.
10639 (Plugin_manager::add_input_file): Add the is_lib argument.
10640 (add_input_file): Update call to Plugin_manager::add_input_file.
10641 (add_input_library): New.
10642 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10643
10644 2009-09-30 Doug Kwan <dougkwan@google.com>
10645
10646 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10647 symbol and call Symbol::may_need_copy_reloc to determine if
10648 a copy reloc is needed.
10649 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10650 nocopyreloc is given in command line.
10651 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10652 given in command line.
10653 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10654 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10655 of the removed Target_i386::may_need_copy_reloc.
10656 * options.h (copyreloc): New option with default value false.
10657 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10658 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10659 instead of the removed Target_powerpc::may_need_copy_reloc.
10660 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10661 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10662 instead of the removed Target_sparc::may_need_copy_reloc.
10663 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10664 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10665 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10666 instead of the removed Target_x86_64::may_need_copy_reloc.
10667
10668 2009-09-30 Ian Lance Taylor <iant@google.com>
10669
10670 * object.h (class Object): Remove target_ field, and target,
10671 sized_target, and set_target methods.
10672 (Object::sized_target): Remove.
10673 (class Sized_relobj): Update declarations. Remove sized_target.
10674 * object.cc (Sized_relobj::setup): Remove target parameter.
10675 Change all callers.
10676 (Input_objects::add_object): Don't do anything with the target.
10677 (make_elf_sized_object): Add punconfigured parameter. Change all
10678 callers. Set or test parameter target.
10679 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10680 Change all callers.
10681 * parameters.cc (Parameters::set_target): Change parameter type to
10682 be non-const.
10683 (Parameters::default_target): Remove.
10684 (set_parameters_target): Change parameter type to be non-const.
10685 (parameters_force_valid_target): New function.
10686 (parameters_clear_target): New function.
10687 * parameters.h (class Parameters): Update declarations. Remove
10688 default_target method. Add sized_target and clear_target
10689 methods. Change target_ to be non-const.
10690 (set_parameters_target): Update declaration.
10691 (parameters_force_valid_target): Declare.
10692 (parameters_clear_target): Declare.
10693 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10694 as NULL if we aren't searching.
10695 (Add_symbols::run): Don't check for compatible target.
10696 * fileread.cc (Input_file::open_binary): Call
10697 parameters_force_valid_target.
10698 * gold.cc (queue_middle_tasks): Likewise.
10699 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
10700 set_target on object.
10701 * dynobj.h (class Sized_dynobj): Update declarations.
10702 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10703 make_elf_object returns NULL.
10704 (Archive::include_member): Don't check whether object target is
10705 compatible.
10706 * output.cc (Output_section::add_input_section): Get target from
10707 parameters.
10708 (Output_section::relax_input_section): Likewise.
10709 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10710 parameters.
10711 (Sized_relobj::do_scan_relocs): Likewise.
10712 (Sized_relobj::relocate_sections): Likewise.
10713 * resolve.cc (Symbol_table::resolve): Likewise.
10714 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
10715 parameter. Change all callers.
10716 (Symbol_table::add_from_object): Get target from parameters.
10717 (Symbol_table::add_from_relobj): Don't check object target.
10718 (Symbol_table::add_from_dynobj): Likewise.
10719 (Symbol_table::define_special_symbol): Get target from
10720 parameters.
10721 * symtab.h (class Symbol_table): Update declaration.
10722 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10723 parameter. Change all callers. Clear parameter target.
10724 (Binary_test): Test target here.
10725 * testsuite/object_unittest.cc (gold_testsuite): Remove
10726 target_test_pointer parameter. Change all callers.
10727 (Object_test): Test target here.
10728
10729 2009-09-26 Ian Lance Taylor <iant@google.com>
10730
10731 * testsuite/initpri1.c: Don't try to use constructor priorities if
10732 compiling with gcc before 4.3.
10733
10734 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
10735
10736 * testsuite/retain_symbols_file_test.sh (check_present): Change
10737 output file name to retain_symbols_file_test.stdout.
10738 (check_absent): Likewise.
10739
10740 2009-09-18 Craig Silverstein <csilvers@google.com>
10741
10742 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10743 * options.cc: Include <cerrno> and <fstream>.
10744 (General_options::finalize): Parse -retain-symbols-file tag.
10745 * options.h: New flag.
10746 (General_options): New method should_retain_symbol, new
10747 variable symbols_to_retain.
10748 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10749 should_retain_symbol map.
10750 * testsuite/Makefile.am (retain_symbols_file_test): New test.
10751 * testsuite/Makefile.in: Regenerate.
10752 * testsuite/retain_symbols_file_test.sh: New file.
10753
10754 2009-09-18 Nick Clifton <nickc@redhat.com>
10755
10756 * po/es.po: Updated Spanish translation.
10757
10758 2009-09-17 Doug Kwan <dougkwan@google.com>
10759
10760 * debug.h (DEBUG_RELAXATION): New constant.
10761 (DEBUG_ALL): Add DEBUG_RELAXATION.
10762 (debug_string_to_enum): Add relaxation debug option.
10763 * layout.cc
10764 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10765 Layout::Relaxation_debug_check::read_sections,
10766 Layout::Relaxation_debug_check::read_sections): New method definitions.
10767 (Layout::Layout): Initialize data members
10768 record_output_section_data_from_scrips_,
10769 script_output_section_data_list_ and relaxation_debug_check_.
10770 (Layout::save_segments, Layout::restore_segments,
10771 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10772 Layout::relaxation_loop_body): New method definitions.
10773 (Layout::finalize): Support relaxation. Move section layout code to
10774 Layout::relaxation_loop_body.
10775 (Layout::set_asection_address_from_script): Move code for orphan
10776 section placement out.
10777 (Layout::place_orphan_sections_in_script): New method definition.
10778 * layout.h (Output_segment_headers, Output_file_header):
10779 New forward class declarations.
10780 (Layout::~Layout): Define.
10781 (Layout::new_output_section_data_from_script): New method definition.
10782 (Layout::place_orphan_sections_in_script): New method declaration.
10783 (Layout::Segment_states): New type declaration.
10784 (Layout::save_segments, Layout::restore_segments,
10785 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10786 Layout::relaxation_loop_body): New method declarations.
10787 (Layout::Output_section_data_list): New type declaration.
10788 (Layout::Relaxation_debug_check): New class definition.
10789 (Layout::record_output_section_data_from_script_,
10790 Layout::script_output_section_data_list_, Layout::segment_states_,
10791 Layout::relaxation_debug_check_): New data members.
10792 * output.cc: (Output_section_headers::do_size): New method definition.
10793 (Output_section_headers::Output_section_headers): Move size
10794 computation to Output_section_headers::do_size.
10795 (Output_segment_headers::do_size): New method definition.
10796 (Output_file_header::Output_file_header): Move size computation to
10797 Output_file_header::do_size and call it.
10798 (Output_file_header::do_size): New method definition.
10799 (Output_data_group::Output_data_group): Adjust call to
10800 Output_section_data.
10801 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10802 (Output_symtab_xindex::do_write): Add array bound check.
10803 (Output_section::Input_section::print_to_mapfile): Handle
10804 RELAXED_INPUT_SECTION_CODE.
10805 (Output_section::Output_section): Initialize data member checkpoint_.
10806 (Output_section::~Output_section): Delete checkpoint object pointed
10807 by checkpoint_.
10808 (Output_section::add_input_section): Always add an Input_section if
10809 relaxing.
10810 (Output_section::add_merge_input_section): Add assert.
10811 (Output_section::relax_input_section): New method definition.
10812 (Output_section::set_final_data_size): Set load address to zero for
10813 an unallocated section.
10814 (Output_section::do_address_and_file_offset_have_reset_values):
10815 New method definition.
10816 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10817 Handle relaxed input section.
10818 (Output_section::sort_attached_input_sections): Checkpoint input
10819 section list lazily.
10820 (Output_section::get_input_sections): Change type of input_sections to
10821 list of Simple_input_section pointers. Checkpoint input section list
10822 lazily. Also handle relaxed input sections.
10823 (Output_section::add_input_section_for_script): Take a reference to
10824 a Simple_input_section object instead of Relobj pointer and section
10825 index as parameter. Handle relaxed input sections.
10826 (Output_section::save_states, Output_section::restore_states): New
10827 method definitions.
10828 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10829 (Output_data::is_data_size_fixed): New method definition.
10830 (Output_data::reset_addresss_and_file_offset): Do not reset data size
10831 if it is fixed.
10832 (Output_data::address_and_file_offset_have_reset_values): New method
10833 definition.
10834 (Output_data::do_address_and_file_offset_have_reset_values): New method
10835 definition.
10836 (Output_data::set_data_size): Check that data size is not fixed.
10837 (Output_data::fix_data_size): New method definition.
10838 (Output_data::is_data_size_fixed_): New data member.
10839 (Output_section_headers::set_final_data_size): New method definition.
10840 (Output_section_headers::do_size): New method declaration.
10841 (Output_segment_headers::set_final_data_size): New method definition.
10842 (Output_segment_headers::do_size): New method declaration.
10843 (Output_file_header::set_final_data_size)::New method definition.
10844 (Output_file_header::do_size)::New method declaration.
10845 (Output_section_data::Output_section_data): Add new parameter
10846 is_data_size_fixed and use it to fix data size.
10847 (Output_data_const::Output_data_const): Adjust call to base class
10848 constructor and fix data size.
10849 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10850 base class constructor and fix data size.
10851 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10852 base class constructor and fix data size.
10853 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10854 class constructor and fix data size.
10855 (Output_data_group::set_final_data_size): New method definition.
10856 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10857 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10858 class constructor and fix data size.
10859 (Output_relaxed_input_section): New class definition.
10860 (Output_section::Simple_input_section): New class definition.
10861 (Output_section::get_input_sections): Adjust parameter list.
10862 (Output_section::add_input_section_for_script): Same.
10863 (Output_section::save_states, Output_section::restore_states,
10864 Output_section::do_address_and_file_offset_have_reset_values,
10865 (Output_section::Input_section::Input_section): Handle
10866 RELAXED_INPUT_SECTION_CODE. Add new overload for
10867 Output_relaxed_input_section.
10868 (Output_section::Input_section::is_input_section,
10869 Output_section::Input_section::set_output_section): Handle relaxed
10870 input section.
10871 (Output_section::Input_section::is_relaxed_input_section,
10872 Output_section::Input_section::output_section_data,
10873 Output_section::Input_section::relaxed_input_section): New method
10874 definitions.
10875 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10876 value.
10877 (Output_section::Input_section::u1_): Update comments.
10878 (Output_section::Input_section::u2_): Add new union member poris.
10879 (Output_section::Checkpoint_output_section): New classs definition.
10880 (Output_section::relax_input_section): New method declaration.
10881 (Output_section::checkpoint_): New data member.
10882 (Output_segment): Update comments.
10883 (Output_segment::Output_segment): Un-privatize copy constructor.
10884 (Output_segment::operator=): Un-privatize.
10885 * script-sections.cc (Output_section_element::Input_section_list):
10886 Change element type to Output_section::Simple_input_section.
10887 (Output_section_element_dot_assignment::set_section_addresses):
10888 Register output section data for relaxation clean up.
10889 (Output_data_exression::Output_data_expression): Adjust call to base
10890 constructor to fix data size.
10891 (Output_section_element_data::set_section_addresses): Register
10892 Output_data_expression object for relaxation clean up.
10893 (struct Input_section_info): Replace Relobj pointer and section index
10894 pair with Output_section::Simple_input_section and Convert struct to a
10895 class.
10896 (Input_section_sorter::operator()): Adjust access to
10897 Input_section_info data member to use accessors.
10898 (Output_section_element_input::set_section_addresses): Use layout
10899 parameter. Adjust code to use Output_section::Simple_input_section
10900 and Input_secction_info classes. Register filler for relaxation
10901 clean up.
10902 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10903 and section index pair with Output_section::Simple_input_section
10904 class. Adjust code accordingly.
10905 (Phdrs_element::release_segment): New method definition.
10906 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10907 segment list.
10908 (Script_sections::release_segments): New method definition.
10909 * gold/script-sections.h (Script_sections::release_segments): New
10910 method declaration.
10911 * gold/target.h (Target::may_relax, Target::relax,
10912 Target::do_may_relax, Target::do_relax): New method definitions.
10913
10914 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10915
10916 * arm.cc (has_signed_unsigned_overflow): New function.
10917 (Arm_relocate_functions::abs8): New function.
10918 (Target_arm::Scan::local): Handle R_ARM_ABS8.
10919 (Target_arm::Scan::global): Likewise.
10920 (Target_arm::relocate::relocate): Likewise.
10921 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10922 Likewise.
10923
10924 2009-09-16 Cary Coutant <ccoutant@google.com>
10925
10926 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10927 * testsuite/Makefile.in: Regenerate.
10928
10929 2009-09-11 Nick Clifton <nickc@redhat.com>
10930
10931 * po/gold.pot: Updated by the Translation project.
10932
10933 2009-09-08 Cary Coutant <ccoutant@google.com>
10934
10935 * output.cc (Output_file::open): Add execute permission to empty file.
10936 * testsuite/Makefile.am (permission_test): New test.
10937 * testsuite/Makefile.in: Regenerate.
10938
10939 2009-09-02 Ian Lance Taylor <iant@google.com>
10940
10941 * output.cc (Output_file::resize): Call map_no_anonymous rather
10942 than map.
10943
10944 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
10945
10946 * gold.cc: Include "incremental.h".
10947 (queue_initial_tasks): Call Incremental_checker methods.
10948 * incremental.cc: Include "output.h".
10949 (Incremental_checker::can_incrementally_link_output_file): New
10950 method.
10951 * incremental.h (Incremental_checker): New class.
10952
10953 * output.cc (Output_file::open_for_modification): New method.
10954 (Output_file::map_anonymous): Changed return type to bool. Record
10955 map in base_ field.
10956 (Output_file::map_no_anonymous): New method, broken out of map.
10957 (Output_file::map): Use map_no_anonymous and map_anonymous.
10958 * output.h (class Output_file): Update declarations.
10959
10960 2009-08-24 Cary Coutant <ccoutant@google.com>
10961
10962 * options.h (Command_line::Pre_options): New class.
10963 (Command_line::pre_options): New member.
10964 * options.cc (gold::options::ready_to_register): New variable.
10965 (One_option::register_option): Do nothing if not registering options.
10966 Assert if same short option registered twice.
10967 (General_options::General_options): Turn off option registration when
10968 done constructing.
10969 (Command_line::Pre_options::Pre_options): New constructor.
10970
10971 2009-08-24 Cary Coutant <ccoutant@google.com>
10972
10973 * options.h (General_options::no_keep_memory): Remove incorrect
10974 short option.
10975
10976 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10977
10978 * Makefile.am (am__skiplex, am__skipyacc): New.
10979 * Makefile.in: Regenerate.
10980
10981 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10982
10983 * Makefile.am (AM_CPPFLAGS): Renamed from ...
10984 (INCLUDES): ... this.
10985 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10986 (AM_CPPFLAGS): Renamed from ...
10987 (INCLUDE): ... this.
10988 * Makefile.in, testsuite/Makefile.in: Regenerate.
10989
10990 * Makefile.in: Regenerate.
10991 * aclocal.m4: Likewise.
10992 * config.in: Likewise.
10993 * configure: Likewise.
10994 * testsuite/Makefile.in: Likewise.
10995
10996 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10997 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10998 * Makefile.in: Regenerate.
10999 * testsuite/Makefile.in: Regenerate.
11000
11001 2009-08-19 Cary Coutant <ccoutant@google.com>
11002
11003 * resolve.cc (Symbol_table::resolve): Don't complain about defined
11004 symbols in shared libraries overridden by hidden or internal symbols
11005 in the main program.
11006
11007 2009-08-19 Chris Demetriou <cgd@google.com>
11008
11009 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11010 checking source file names in error messages.
11011
11012 2009-08-18 Doug Kwan <dougkwan@google.com>
11013
11014 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11015 an elcpp::Ehdr as parameter. Adjust call to set_target.
11016 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11017 an elfcpp::Ehdr as parameter.
11018 * object.cc (Object::set_target): Remove the version that looks up
11019 a target and sets it.
11020 (Sized_relobj::setup): Take a Target object instead of
11021 an elfcpp::Ehdr as parameter. Adjust call to set_target.
11022 (make_elf_sized_object): Find target and ask target to
11023 make an ELF object.
11024 * object.h: (Object::set_target): Remove the version that looks up
11025 a target and sets it.
11026 (Sized_relobj::setup): Take a Target object instead of
11027 an elfcpp:Ehdr as parameter.
11028 * target.cc: Include dynobj.h.
11029 (Target::do_make_elf_object_implementation): New.
11030 (Target::do_make_elf_object): New.
11031 * target.h (Target::make_elf_object): New template declaration.
11032 (Target::do_make_elf_object): New method declarations.
11033 (Target::do_make_elf_object_implementation): New template declaration.
11034
11035 2009-08-14 Ian Lance Taylor <iant@google.com>
11036
11037 * gold.h (FUNCTION_NAME): Define.
11038 (gold_unreachable): Use FUNCTION_NAME.
11039
11040 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11041
11042 * icf.cc (Icf::find_identical_sections): Issue a warning when a
11043 symbol in the --keep-unique list is not found.
11044
11045 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11046
11047 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11048 been maked as --keep-unique.
11049 (Icf::unfold_section): New function.
11050 * icf.h (Icf::unfold_section): New function.
11051 * options.h (General_options::keep_unique): New option.
11052 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11053 * testsuite/Makefile.in: Regenerate.
11054 * testsuite/icf_keep_unique_test.sh: New file.
11055 * testsuite/icf_keep_unique_test.cc: New file.
11056
11057 2009-08-12 Cary Coutant <ccoutant@google.com>
11058
11059 PR 10471
11060 * resolve.cc (Symbol_table::resolve): Check for references from
11061 dynamic objects to hidden and internal symbols.
11062 * testsuite/Makefile.am (hidden_test.sh): New test.
11063 * testsuite/Makefile.in: Regenerate.
11064 * testsuite/hidden_test.sh: New script.
11065 * testsuite/hidden_test_1.c: New test source.
11066 * testsuite/hidden_test_main.c: New test source.
11067
11068 2009-08-11 Doug Kwan <dougkwan@google.com>
11069
11070 * arm.cc: Update comments.
11071 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11072 segment to locate the .ARM.exidx section if present.
11073
11074 2009-08-09 Doug Kwan <dougkwan@google.com>
11075
11076 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11077 patch.
11078
11079 2009-08-07 Sriraman Tallam <tmsriram@google.com>
11080 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11081 compiler warnings.
11082
11083 2009-08-06 Sriraman Tallam <tmsriram@google.com>
11084
11085 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11086 valid tls_segment only for non-debug-section relocations.
11087 * testsuite/Makefile.am: Add gc_tls_test.
11088 * testsuite/Makefile.in: Regenerate.
11089 * testsuite/gc_tls_test.cc: New file.
11090 * testsuite/gc_tls_test.sh: New file.
11091
11092 2009-08-05 Sriraman Tallam <tmsriram@google.com>
11093
11094 * icf.cc: New file.
11095 * icf.h: New file.
11096 * Makefile.am (CCFILES): Add icf.cc.
11097 (HFILES): Add icf.h
11098 * Makefile.in: Regenerate.
11099 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11100 * gc.h (gc_process_relocs): Populate lists used by icf to contain
11101 section, symbol and addend information for the relocs.
11102 * gold.cc (queue_middle_tasks): Call identical code folding.
11103 * gold.h: Add defines for multimap.
11104 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11105 to the call of finalize_local_symbols.
11106 * main.cc (main): Create object of class Icf.
11107 * object.cc (Sized_relobj::do_layout): Allow this function to be
11108 called twice during icf.
11109 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11110 to sections marked as identical by icf.
11111 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11112 when available.
11113 (Sized_relobj::do_section_entsize): New function.
11114 * object.h (Object::section_entsize): New function.
11115 (Object::do_section_entsize): New pure virtual function.
11116 (Relobj::finalize_local_symbols): Add new parameter.
11117 (Relobj::do_section_entsize): New function.
11118 * options.h (General_options::icf): New option.
11119 (General_options::icf_iterations): New option.
11120 (General_options::print_icf_sections): New option.
11121 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11122 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11123 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11124 icf.
11125 * symtab.cc (Symbol_table::is_section_folded): New function.
11126 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
11127 to sections marked as identical by icf.
11128 * symtab.h (Symbol_table::set_icf): New function.
11129 (Symbol_table::icf): New function.
11130 (Symbol_table::is_section_folded): New function.
11131 (Symbol_table::icf_): New data member.
11132 * target-reloc.h (relocate_section): Ignore sections folded by icf.
11133 * testsuite/Makefile.am: Add commands to build icf_test.
11134 * testsuite/Makefile.in: Regenerate.
11135 * testsuite/icf_test.sh: New file.
11136 * testsuite/icf_test.cc: New file.
11137
11138 2009-07-24 Chris Demetriou <cgd@google.com>
11139
11140 * layout.cc (is_compressible_debug_section): Fix incorrect
11141 comment about compressed section names.
11142
11143 2009-07-20 Ian Lance Taylor <ian@airs.com>
11144
11145 PR 10419
11146 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11147
11148 2009-07-16 Ian Lance Taylor <iant@google.com>
11149
11150 PR 10400
11151 * layout.h: #include <map>.
11152 (class Kept_section): Change from struct to class. Add accessors
11153 and setters. Add section size to Comdat_group mapping. Change
11154 Comdat_group to std::map. Add is_comdat_ field. Add
11155 linkonce_size field in union.
11156 (class Layout): Update declaration of find_or_add_kept_section.
11157 Don't declare find_kept_object.
11158 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11159 parameter. Add object, shndx, is_comdat, and is_group_name
11160 parameters. Change all callers. Adjust for new Kept_section.
11161 (Layout::find_kept_object): Remove.
11162 * object.cc (Sized_relobj::include_section_group): Update use of
11163 Kept_section. Rename secnum to shndx. Only record
11164 Kept_comdat_section if sections are the same size.
11165 (Sized_relobj::include_linkonce_section): Update use of
11166 Kept_section. Only record Kept_comdat_section if sections are the
11167 same size. Set size of linkonce section.
11168 (Sized_relobj::map_to_kept_section): Update call to
11169 get_kept_comdat_section.
11170 * object.h (class Sized_relobj): Rename fields in
11171 Kept_comdat_section to drop trailing underscores; change object
11172 field to Relobj*. Change Kept_comdat_section_table to store
11173 struct rather than pointer.
11174 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11175 Add kept_object and kept_shndx parameters. Change all callers.
11176 (Sized_relobj::get_kept_comdat_section): Change return type to
11177 bool. Add kept_object and kept_shndx parameters. Change all
11178 callers.
11179 * plugin.cc (Pluginobj::include_comdat_group): Update call to
11180 Layout::find_or_add_kept_section.
11181
11182 2009-07-09 Ian Lance Taylor <iant@google.com>
11183
11184 * merge.cc (Object_merge_map::initialize_input_to_output_map):
11185 Reserve space in the hash table.
11186
11187 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
11188
11189 * fileread.cc (File_read::get_mtime): New method.
11190 * fileread.h (Timespec): New structure.
11191 (File_read::get_mtime): New method.
11192 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11193 Renamed from timestamp_nsec.
11194 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11195 Elf_Xword.
11196 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11197 timestamp_nsec.
11198 (Incremental_inputs::report_archive): Save mtime; style fix.
11199 (Incremental_inputs::report_obejct): Save mtime; style fix.
11200 (Incremental_inputs::report_script): Save mtime; style fix.
11201 (Incremental_inputs::finalize_inputs): Style fix.
11202 (Incremental_inputs::finalize): Style fix.
11203 (Incremental_inputs::create_input_section_data): Store inputs
11204 mtime.
11205 * incremental.h (Incremental_inputs::report_script): Add mtime
11206 argument.
11207 (Incremental_inputs::Input_info::Input_info): Intialize only one
11208 union member.
11209 (Incremental_inputs::Input_info::archive): Move to nameless
11210 union.
11211 (Incremental_inputs::Input_info::obejct): Move to nameless union.
11212 (Incremental_inputs::Input_info::script): Move to nameless union.
11213 (Incremental_inputs::mtime): New field.
11214 * script.cc (read_input_script): Pass file mtime to
11215 Incremental_input.
11216 * script.h (Script_info::inputs): Style fix.
11217
11218 2009-07-01 Ian Lance Taylor <ian@airs.com>
11219
11220 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11221 instead of 32.
11222
11223 2009-06-24 Ian Lance Taylor <iant@google.com>
11224
11225 PR 10156
11226 * layout.cc (Layout::choose_output_section): If we find an
11227 existing section, update the flags.
11228 (Layout::create_notes): New function, broken out of
11229 Layout::finalize.
11230 (Layout::finalize): Don't create note sections.
11231 (Layout::create_note): Don't crash if linker script discards
11232 section.
11233 (Layout::create_gold_note): Likewise.
11234 (Layout::create_build_id): Likewise. Don't set
11235 after_input_sections on the section.
11236 (Layout::create_executable_stack_info): Remove target parameter.
11237 Change caller.
11238 * layout.h (class Layout): Declare create_notes. Update
11239 declaration of create_executable_stack_info.
11240 * gold.cc (queue_middle_tasks): Call create_notes.
11241 * output.cc (Output_section::update_flags_for_input_section): Move
11242 here from output.h. If SHF_ALLOC flag is newly set, mark address
11243 invalid.
11244 * output.h (Output_data::mark_address_invalid): New function.
11245 (class Output_section): Only declare, not define,
11246 update_flags_for_input_section. Remove set_flags.
11247
11248 2009-06-24 Ian Lance Taylor <iant@google.com>
11249
11250 * script-sections.cc (Output_section_definition::
11251 set_section_addresses): Rename shadowing local load_address to
11252 laddr.
11253
11254 2009-06-24 Ian Lance Taylor <iant@google.com>
11255
11256 PR 10244
11257 * reloc.cc (relocate_sections): Skip empty relocation sections.
11258
11259 2009-06-23 Ian Lance Taylor <iant@google.com>
11260
11261 PR 10156
11262 * layout.cc (Layout::create_note): Use choose_output_section
11263 rather than make_output_section.
11264
11265 2009-06-23 Ian Lance Taylor <iant@google.com>
11266
11267 PR 10237
11268 * options.cc (General_options::parse_V): Set printed_version_.
11269 (General_options::General_options): Initialize printed_version_.
11270 * options.h (class General_options): Add printed_version_ field.
11271 * gold.cc (queue_initial_tasks): If there are no input files,
11272 don't give a fatal error if we printed the version information.
11273 (queue_middle_tasks): If using -r with a shared object, give a
11274 fatal error rather than an ordinary error.
11275
11276 2009-06-23 Ian Lance Taylor <iant@google.com>
11277
11278 PR 10219
11279 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11280 (Layout::make_output_section): Set have_stabstr_section_ if we see
11281 a .stab*str section.
11282 (Layout::finalize): Call link_stabs_sections.
11283 (Layout::link_stabs_sections): New file.
11284 * layout.h (class Layout): Add have_stabstr_section_ field.
11285 Declare link_stabs_sections.
11286
11287 2009-06-23 Doug Kwan <dougkwan@google.com>
11288
11289 * Makefile.am (libgold_a_LIBADD): New.
11290 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11291 * Makefile.in: Regenerate.
11292 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11293 * configure: Regenerate.
11294 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11295 * fileread.cc: Include sys/state.h
11296 * gold.h: Declare memmem and strndup if found missing.
11297 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11298
11299 2009-06-23 Ian Lance Taylor <iant@google.com>
11300
11301 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11302 * configure: Rebuild.
11303
11304 2009-06-23 Ian Lance Taylor <iant@google.com>
11305
11306 PR 10147
11307 * object.cc (Object::section_contents): Don't try to get a view if
11308 the section has length zero.
11309 (Object::handle_gnu_warning_section): If the section is empty, use
11310 the name of the section as the warning.
11311
11312 2009-06-23 Ian Lance Taylor <iant@google.com>
11313
11314 PR 10133
11315 * stringpool.h (class Stringpool_template): Add optimize_ field.
11316 (Stringpool_template::set_optimize): New function.
11317 * stringpool.cc (Stringpool_template::Stringpool_template):
11318 Initialize optimize_ field.
11319 (Stringpool_template::set_string_offsets): Test local optimize
11320 fild rather than parameter.
11321 * layout.cc (Layout::Layout): Call set_optimize on the section
11322 name stringpool.
11323
11324 2009-06-22 Ian Lance Taylor <iant@google.com>
11325
11326 PR 10030
11327 * yyscript.y: Parse TARGET.
11328 * script.cc (script_set_target): New function.
11329 * script-c.h (script_set_target): Declare.
11330 * options.cc (General_options::string_to_object_format): Rename
11331 from string_to_object_format in anonymous namespace. Change
11332 callers.
11333 * options.h (class General_options): Declare
11334 string_to_object_format.
11335
11336 2009-06-22 Ian Lance Taylor <iant@google.com>
11337
11338 * script-sections.cc (Script_sections::create_segments): Don't put
11339 program headers in a PT_LOAD segment if -n or -N.
11340
11341 2009-06-22 Ian Lance Taylor <iant@google.com>
11342
11343 PR 10141
11344 * options.h (class General_options): Add -z lazy and -z now. Sort
11345 -z options into alphabetical order.
11346 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11347
11348 2009-06-21 Ian Lance Taylor <iant@google.com>
11349
11350 * layout.cc (Layout::make_output_section): Call
11351 Target::new_output_section.
11352 (Layout::attach_allocated_section_to_segment): Put large section
11353 sections in a separate load segment with the large segment flag
11354 set.
11355 (Layout::segment_precedes): Sort large data segments after other
11356 load segments.
11357 (align_file_offset): New static function.
11358 (Layout::set_segment_offsets): Use align_file_offset.
11359 * output.h (class Output_section): Add is_small_section_ and
11360 is_large_section_ fields.
11361 (Output_section::is_small_section): New function.
11362 (Output_section::set_is_small_section): New function.
11363 (Output_section::is_large_section): New function.
11364 (Output_section::set_is_large_section): New function.
11365 (Output_section::is_large_data_section): New function.
11366 (class Output_segment): Add is_large_data_segment_ field.
11367 (Output_segment::is_large_data_segment): New function.
11368 (Output_segment::set_is_large_data_segment): New function.
11369 * output.cc (Output_section::Output_section): Initialize new
11370 fields.
11371 (Output_segment::Output_segment): Likewise.
11372 (Output_segment::add_output_section): Add assertion that large
11373 data sections always go in large data segments. Force small data
11374 sections to the end of the list of data sections. Force small BSS
11375 sections to the start of the list of BSS sections. For large BSS
11376 sections to the end of the list of BSS sections.
11377 * symtab.h (class Symbol): Declare is_common_shndx.
11378 (Symbol::is_defined): Check Symbol::is_common_shndx.
11379 (Symbol::is_common): Likewise.
11380 (class Symbol_table): Define enum Commons_section_type. Update
11381 declarations. Add small_commons_ and large_commons_ fields.
11382 * symtab.cc (Symbol::is_common_shndx): New function.
11383 (Symbol_table::Symbol_table): Initialize new fields.
11384 (Symbol_table::add_from_object): Put small and large common
11385 symbols in the right list.
11386 (Symbol_table::sized_finalized_symbol): Check
11387 Symbol::is_common_shndx.
11388 (Symbol_table::sized_write_globals): Likewise.
11389 * common.cc (Symbol_table::do_allocate_commons): Allocate new
11390 common symbol lists. Don't call do_allocate_commons_list if the
11391 list is empty.
11392 (Symbol_table::do_allocate_commons_list): Remove is_tls
11393 parameter. Add comons_section_type parameter. Change all
11394 callers. Handle small and large common symbols.
11395 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11396 Symbol::is_common_shndx.
11397 * resolve.cc (symbol_to_bits): Likewise.
11398 * target.h (Target::small_common_shndx): New function.
11399 (Target::small_common_section_flags): New function.
11400 (Target::large_common_shndx): New function.
11401 (Target::large_common_section_flags): New function.
11402 (Target::new_output_section): New function.
11403 (Target::Target_info): Add small_common_shndx, large_common_shndx,
11404 small_common_section_flags, and large_common_section_flags
11405 fields.
11406 (Target::do_new_output_section): New virtual function.
11407 * arm.cc (Target_arm::arm_info): Initialize new fields.
11408 * i386.cc (Target_i386::i386_info): Likewise.
11409 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11410 Likewise.
11411 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11412 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11413 (Target_x86_64::do_new_output_section): New function.
11414 * configure.ac: Define conditional MCMODEL_MEDIUM.
11415 * testsuite/Makefile.am (check_PROGRAMS): Add large.
11416 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11417 (large_LDFLAGS): Define.
11418 * testsuite/large.c: New file.
11419 * testsuite/testfile.cc (Target_test::test_target_info):
11420 Initialize new fields.
11421 * configure, testsuite/Makefile.in: Rebuild.
11422
11423 2009-06-05 Doug Kwan <dougkwan@google.com>
11424
11425 * Makefile.am (CCFILES): Add target.cc.
11426 * Makefile.in: Regenerate.
11427 * i386.cc (class Target_i386): Define new virtual method to
11428 override do_is_local_label_name in parent.
11429 * object.cc (Sized_relobj::do_count_local_symbols): Discard
11430 local symbols if --discard-locals or -X is given.
11431 * options.h (class General_options): Declare new options
11432 '--discard-locals' and '-X' for discarding locals.
11433 * target.h (class Target): Define new methods is_local_label_name.
11434 Declare new virtual method do_is_local_label_name.
11435 * target.cc: New file.
11436 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11437 (check_SCRIPTS): Add discard_locals_test.sh.
11438 (check_DATA): Add discard_local_tests.syms.
11439 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11440 (discard_local_tests.syms, discard_locals_test.o): New make rules.
11441 * testsuite/Makefile.in: Regenerate.
11442 * testsuite/discard_locals_test.c: New file.
11443 * testsuite/discard_locals_test.sh: Same.
11444
11445 2009-06-05 Doug Kwan <dougkwan@google.com>
11446
11447 * object.cc (Sized_relobj::Sized_relobj): Initialize
11448 discarded_eh_frame_shndx_ to -1U.
11449 (Sized_relobj::do_layout): Record index of a discard .eh_frame
11450 section.
11451 (Sized_relobj::do_count_local_symbols): Skip local symbols in
11452 a discarded .eh_frame section.
11453 (Sized_relobj::do_finalize_local_symbols): Ditto.
11454 * object.h (class Sized_relobj): Declare new member
11455 discarded_eh_frame_shndx_.
11456 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11457 (local_labels_test.o, local_labels_test): New rules.
11458 * testsuite/Makefile.in: Regenerate.
11459
11460 2009-06-04 Doug Kwan <dougkwan@google.com>
11461
11462 * layout.cc (Layout::section_name_mapping): Add mapping for
11463 special ARM sections.
11464
11465 2009-06-03 Doug Kwan <dougkwan@google.com>
11466
11467 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11468 (utils::has_overflow): Same.
11469
11470 2009-06-03 Ian Lance Taylor <iant@google.com>
11471
11472 * layout.cc (Layout::section_name_mapping): New array, replacing
11473 Layout::linkonce_mapping.
11474 (Layout::section_name_mapping_count): New variable, replacing
11475 Layout::linkonce_mapping_count.
11476 (Layout::linkonce_output_name): Remove.
11477 (Layout::output_section_name): Rewrite.
11478 * layout.h (class Layout): Rename Linkonce_mapping to
11479 Section_name_mapping, linkonce_mapping to section_name_mapping,
11480 linkonce_mapping_count to section_name_mapping_count. Don't
11481 declare linkonce_output_name.
11482
11483 2009-06-03 Doug Kwan <dougkwan@google.com>
11484
11485 * gold/arm.cc (namespace utils): New.
11486 (Target_arm::reloc_is_non_pic): Define new method.
11487 (class Arm_relocate_functions): New.
11488 (Target_arm::Relocate::relocate): Handle relocation types used by
11489 Android.
11490
11491 2009-06-03 Ian Lance Taylor <iant@google.com>
11492
11493 * arm.cc (Target_arm::scan::global): Use || instead of |.
11494
11495 2009-06-02 Doug Kwan <dougkwan@google.com>
11496
11497 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
11498 issued_non_pic_error_.
11499 (class Target_arm::Scan): Declare new method check_non_pic.
11500 Define new method symbol_needs_plt_entry.
11501 Declare new data member issued_non_pic_error_.
11502 (class Target_arm::Relocate): Declare new method
11503 should_apply_static_reloc.
11504 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11505 (Target_arm::Scan::check_non_pic): Define new method.
11506 (Target_arm::Scan::local): Handle a small subset of reloc types used
11507 by Android.
11508 (Target_arm::Scan::local): Same.
11509 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11510
11511 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
11512
11513 * incremental.cc (Incremental_inputs::report_command_line): Filter
11514 out --incremental-* options.
11515
11516 2009-05-29 Doug Kwan <dougkwan@google.com>
11517
11518 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11519 template class.
11520 (class Target_arm): Update comment.
11521 (Target_arm::Target_arm): Initialize new data members GOT_,
11522 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11523 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11524 and Target_arm::rel_dyn_section.
11525 Declare new_enum Target_arm::Got_type.
11526 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11527 and DYNBSS_.
11528 Update commments for member do_dynsym_value.
11529 (Target_arm::got_size, Target_arm::plt_section,
11530 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11531 new methods inside class defintion.
11532 (Target_arm::got_section): Define new method.
11533 (Target_arm::rel_dyn_section): Same.
11534 (Output_data_plt_arm): New template class.
11535 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11536 (Output_data_plt_arm:do_adjust_output_section): Define new method.
11537 (Output_data_plt_arm::add_entry): Same.
11538 (Output_data_plt_arm::first_plt_entry): Define new
11539 static data member for PLT instruction template.
11540 (Output_data_plt_arm::plt_entry): Same.
11541 (Output_data_plt_arm::do_write): Define new method.
11542 (Target_arm::make_plt_entry): Same.
11543 (Target_arm::do_finalize_sections): Same.
11544 (Target_arm::do_dynsym_value): Same.
11545
11546 2009-05-28 Doug Kwan <dougkwan@google.com>
11547
11548 * Makefile.am (TARGETSOURCES): Add arm.cc.
11549 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11550 * Makefile.in: Regenerate.
11551 * arm.cc: New file.
11552 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11553
11554 2009-05-26 Doug Kwan <dougkwan@google.com>
11555
11556 * options.cc (General_options::parse_exclude_libs). Fix a comment.
11557 (General_options::check_excluded_libs): Strip off directories in
11558 archive name before matching like GNU ld does.
11559 * testsuite/Makefile.am (MOSTLYCLEANFILES,
11560 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11561 (exclude_libs_test_LDFLAGS): Add linker option
11562 -Wl,--exclude-libs,libexclude_libs_test_3
11563 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11564 an explicit archive without using -l.
11565 (alt/libexclude_libs_test_3.a): New make rule.
11566 * testsuite/Makefile.in: Regenerate.
11567 * testsuite/exclude_libs_test.c : Declare lib3_default().
11568 (main): Call it.
11569 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11570 * exclude_libs_test_3.c: New file.
11571
11572 2009-05-26 Nick Clifton <nickc@redhat.com>
11573
11574 * po/id.po: New Indonesian translation.
11575 * po/gold.pot: Updated template file.
11576
11577 2009-05-22 Sriraman Tallam <tmsriram@google.com>
11578
11579 * testsuite/Makefile.am: Add -ffunction-sections to compile
11580 gc_comdat_test files. Add -Wl,--gc-sections to build
11581 gc_comdat_test.
11582 * testsuite/Makefile.in: Regenerate.
11583 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11584
11585 2009-05-21 Sriraman Tallam <tmsriram@google.com>
11586
11587 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11588 kept comdat section was garbage collected.
11589 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11590 * testsuite/Makefile.in: Regenerate.
11591 * testsuite/gc_comdat_test.sh: New file.
11592 * testsuite/gc_comdat_test_1.cc: New file.
11593 * testsuite/gc_comdat_test_2.cc: New file.
11594
11595 2009-05-19 Doug Kwan <dougkwan@google.com>
11596
11597 * archive.cc (Archive::Archive): Move constructor from archive.h
11598 to here. Initialize no_export_.
11599 (Archive::get_elf_object_for_member): Set no_export flag of object.
11600 * archive.h (Archive::Archive): Move constructor body to
11601 archive.cc.
11602 (Archive::no_export): New method.
11603 (Archive::no_export_): New field.
11604 * object.h (Object::Object): Initialize no_export_ to false.
11605 (Object::no_export, Object::set_no_export): New methods.
11606 (Object::no_export_): New field.
11607 * options.cc (General_options::parse_exclude_libs): New method.
11608 (General_options::check_excluded_libs) Same.
11609 * options.h (exclude_libs): New option.
11610 (General_options::check_excluded_libs): New method declaration.
11611 (General_options::excluded_libs_): New field.
11612 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11613 default or protected visibility if an object has no-export flag set.
11614 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11615 (check_SCRIPTS): Add exclude_libs_test.sh.
11616 (check_DATA): Add exclude_libs_test.syms.
11617 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11618 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11619 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11620 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11621 (exclude_libs_test.syms, libexclude_libs_test_1.a,
11622 libexclude_libs_test_2.a): New rules.
11623 * testsuite/Makefile.in: Regenerate.
11624 * testsuite/exclude_libs_test.c: New file.
11625 * testsuite/exclude_libs_test.sh: Ditto.
11626 * testsuite/exclude_libs_test_1.c: Ditto.
11627 * testsuite/exclude_libs_test_2.c: Ditto.
11628
11629 2009-05-15 Ian Lance Taylor <iant@google.com>
11630
11631 * configure.ac: Check for declarations for cases where libiberty.h
11632 checks HAVE_DECL_xxx.
11633 * configure, config.in: Rebuild.
11634
11635 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
11636
11637 * gold.h (Incremental_argument_list): Remove (invalid) forward
11638 declaration.
11639 * incremental.cc (Incremental_inputs::report_achive): New method.
11640 (Incremental_inputs::report_object): New method.
11641 (Incremental_inputs::report_script): New method.
11642 (Incremental_inputs::finalize_inputs): New method.
11643 (Incremental_inputs::finalize): Call finalize_inputs().
11644 (Incremental_inputs::sized_create_incremental_inputs_section_data):
11645 Create inputs entries.
11646 * incremental.h (Incremental_input_type): New enum.
11647 (Incremental_inputs::Incremental_input): Initialize new fields.
11648 (Incremental_inputs::report_inputs): New method.
11649 (Incremental_inputs::report_achive): New method.
11650 (Incremental_inputs::report_object): New method.
11651 (Incremental_inputs::report_script): New method.
11652 (Incremental_inputs::finalize_inputs): New method.
11653 (Incremental_inputs::Input_info): New struct.
11654 (Incremental_inputs::Input_info_map): New typedef.
11655 (Incremental_inputs::lock_): New field.
11656 (Incremental_inputs::Inputs_): New field.
11657 (Incremental_inputs::Inputs_map): New field.
11658 * main.cc (main): Call Incremental_input::report_inputs.
11659 * options.h (Input_argument_list): Typedef moved from
11660 Input_arguments.
11661 (Input_file_group::Files): Remove, use ::Input_argument_list.
11662 (Input_file_group::Input_argument_list): Remove, use
11663 ::Input_argument_list.
11664 * plugin.cc (Plugin_manager::add_input_file): Add error in
11665 incremental build.
11666 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11667 functions.
11668 * script.cc (read_input_script): Call
11669 Incremental_input::report_script.
11670 * script.h (Script_info): New class.
11671
11672 2009-04-27 Ian Lance Taylor <iant@google.com>
11673
11674 * x86_64.cc (do_adjust_output_section): Set entsize to
11675 plt_entry_size.
11676
11677 2009-04-23 Elliott Hughes <enh@google.com>
11678
11679 * output.cc (Output_file::close): After short writes, continue
11680 writing from the correct offset in the buffer being written.
11681
11682 2009-04-23 Chris Demetriou <cgd@google.com>
11683
11684 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11685 * configure: Regenerate.
11686 * config.in: Regenerate.
11687 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11688 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11689
11690 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
11691
11692 * incremental.cc (Incremental_inputs_header_data): Renamed from
11693 Incremental_input_header_data.
11694 (Incremental_inputs_header_data::data_size): New field.
11695 (Incremental_inputs_header_data::put_input_file_count): Renamed
11696 from input_file_count.
11697 (Incremental_inputs_header_data::put_command_line_offset): Renamed
11698 from command_line_offset.
11699 (Incremental_inputs_header_data::put_reserved): Renamed from
11700 put_reserved.
11701 (Incremental_inputs_entry_data): Renamed from
11702 Incremental_input_entry_data.
11703 (Incremental_inputs_entry_data::data_size): New field.
11704 (Incremental_inputs::report_command_line): New method.
11705 (Incremental_inputs::finalize): New method.
11706 (Incremental_inputs::create_incremental_inputs_data): New method.
11707 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11708 * incremental.h: New file.
11709 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11710 (Layout::finalize): Create incremental inputs section in
11711 incremental builds.
11712 (Layout::create_incremental_info_sections): New method.
11713 * layout.h (Layout::incremental_inputs): New method.
11714 (Layout::create_incremental_info_sections): New method.
11715 (Layout::incremental_inputs_): New field.
11716 * main.cc (main): Notify Incremental_input of the command line.
11717
11718 2009-04-01 Ian Lance Taylor <iant@google.com>
11719 Mikolaj Zalewski <mikolajz@google.com>
11720
11721 * gold.h (reserve_unordered_map): Define, three versions, one for
11722 each version of Unordered_map.
11723 * layout.cc (Layout::Layout): Remove options parameter. Add
11724 number_of_input_files parameter. Don't initialize options_.
11725 Initialize number_of_input_files_ and resized_signatures_. Move
11726 sections_are_attached_.
11727 (Layout::layout_group): Reserve space for group_signatures_.
11728 (Layout::find_or_add_kept_section): Change name parameter to be a
11729 reference. Resize signatures_ map when it gets large enough.
11730 (Layout::layout_eh_frame): Use parameters->options() instead of
11731 this->options_.
11732 (Layout::make_output_section): Likewise.
11733 (Layout::attach_allocated_section_to_segment): Likewise.
11734 (Layout::finalize, Layout::create_executable_stack): Likewise.
11735 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11736 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11737 * layout.h (class Layout): Update declarations. Remove options_
11738 field. Add number_of_input_files_ and resized_signatures_
11739 fields. Move sections_are_attached_ field.
11740 * main.cc (main): Pass number of input files to Layout
11741 constructor. Don't pass options.
11742
11743 2009-03-30 Ian Lance Taylor <iant@google.com>
11744
11745 * ffsll.c (ffsll): Correct implementation.
11746
11747 2009-03-27 Ian Lance Taylor <iant@google.com>
11748
11749 * ffsll.c: New file.
11750 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11751 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11752 * ftruncate.c (ftruncate): Declare before definition.
11753 * mremap.c (mremap): Likewise.
11754 * pread.c (pread): Likewise.
11755 * configure, Makefile.in, config.in: Rebuild.
11756
11757 * mremap.c: New file.
11758 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11759 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11760 (mremap): Declare if HAVE_MREMAP is not defined.
11761 * configure, Makefile.in, config.in: Rebuild.
11762
11763 2009-03-27 Cary Coutant <ccoutant@google.com>
11764
11765 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11766 position independent.
11767 * sparc.cc (Target_sparc::check_non_pic): Likewise.
11768 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11769
11770 2009-03-24 Cary Coutant <ccoutant@google.com>
11771
11772 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11773 an executable.
11774 (needs_dynamic_reloc): Likewise.
11775
11776 2009-03-24 Ian Lance Taylor <iant@google.com>
11777
11778 * yyscript.y (file_cmd): Recognize EXTERN.
11779 (extern_name_list, extern_name_list_body): New nonterminals.
11780 * script.cc (script_add_extern): Define.
11781 * script-c.h (script_add_extern): Declare.
11782
11783 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
11784
11785 * object.cc (is_elf_object): Define.
11786 * object.h (is_elf_object): Declare.
11787 * archive.cc (Archive::get_elf_object_for_member): Call
11788 is_elf_object.
11789 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11790
11791 2009-03-24 Elliott Hughes <enh@google.com>
11792
11793 * output.cc (Output_file::map_anonymous): Define.
11794 (Output_file::map): Use map_anonymous. If the regular mmap fails,
11795 try an anonymous one. Report the size if the mmap fails.
11796 * output.h (class Output_file): Declare map_anonymous.
11797
11798 2009-03-24 Ian Lance Taylor <iant@google.com>
11799
11800 * target-select.cc (instantiate_target): Don't acquire the lock if
11801 the instantiated_target_ field has already been set.
11802
11803 2009-03-23 Ian Lance Taylor <iant@google.com>
11804
11805 * gold-threads.h (class Initialize_lock): Define.
11806 * gold-threads.cc (class Initialize_lock_once): Define.
11807 (initialize_lock_control): New static variable.
11808 (initialize_lock_pointer): New static variable.
11809 (initialize_lock_once): New static function.
11810 (Initialize_lock::Initialize_lock): Define.
11811 (Initialize_lock::initialize): Define.
11812 * target-select.h: Include "gold-threads.h".
11813 (class Target_selector): Add lock_ and initialize_lock_ fields.
11814 Don't define instantiate_target, just declare it.
11815 * target-select.cc (Target_selector::Target_selector): Initialize
11816 new fields.
11817 (Target_selector::instantiate_target): Define.
11818 * descriptors.h: Include "gold-threads.h".
11819 (class Descriptors): Add initialize_lock_ field.
11820 * descriptors.cc (Descriptors::Descriptors): Initialize new
11821 field.
11822 (Descriptors::open): Use initialize_lock_ field
11823 * errors.h (class Errors): Add initialize_lock_ field.
11824 * errors.cc (Errors::Errors): Initialize new field.
11825 (Errors::initialize_lock): Use initialize_lock_ field.
11826 * powerpc.cc (class Target_selector_powerpc): Remove
11827 instantiated_target_ field. In do_recognize call
11828 instantiate_target rather than do_instantiate_target. In
11829 do_instantiate_target just allocate a new target.
11830 * sparc.cc (class Target_selector_sparc): Likewise.
11831
11832 * freebsd.h: New file.
11833 * i386.cc: Include "freebsd.h".
11834 (Target_i386): Derive from Target_freebsd rather than
11835 Sized_target.
11836 (Target_selector_i386): Derive from Target_selector_freebsd rather
11837 than Target_selector.
11838 * x86_64.cc: Include "freebsd.h".
11839 (Target_x86_64): Derive from Target_freebsd rather than
11840 Sized_target.
11841 (Target_selector_x86_64): Derive from Target_selector_freebsd
11842 rather than Target_selector.
11843 * target.h (class Target): Add adjust_elf_header and
11844 do_adjust_elf_header.
11845 * output.cc (Output_file_header:: do_sized_write): Call target
11846 adjust_elf_header routine.
11847 * configure.tgt: Set targ_osabi.
11848 * configure.ac: Define GOLD_DEFAULT_OSABI.
11849 * parameters.cc (Parameters::default_target): Pass
11850 GOLD_DEFAULT_OSABI to select_target.
11851 * target-select.h (class Target_selector): Make instantiate_target
11852 protected rather than private.
11853 * Makefile.am (HFILES): Add freebsd.h.
11854 * configure, Makefile.in, config.in: Rebuild.
11855
11856 * merge.cc (do_add_input_section): Correct pend value. Change
11857 message about last entry not being null terminated from error to
11858 warning.
11859
11860 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
11861
11862 * incremental.cc: New file.
11863 * Makefile.am (CCFILES): Add incremental.cc.
11864 * Makefile.in: Rebuild.
11865
11866 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
11867
11868 * layout.cc (Layout::output_section_name): Preserve names
11869 of '.note.' sections.
11870
11871 2009-03-19 Ian Lance Taylor <iant@google.com>
11872
11873 * descriptors.cc (Descriptors::open): Check that the options are
11874 valid before using them.
11875
11876 2009-03-18 Ian Lance Taylor <iant@google.com>
11877
11878 * script-sections.h: Include <list>.
11879 (class Script_sections): Change Sections_elements from std::vector
11880 to std::list. Typedef public Elements_iterator. Add
11881 orphan_section_placement_, data_segment_align_start_, and
11882 saw_data_segment_align_ fields. Remove data_segment_align_index_
11883 field.
11884 * script-sections.cc (class Orphan_section_placement): New class.
11885 (class Sections_element): Add virtual functions is_relro and
11886 orphan_section_init. Remove virtual function place_orphan_here.
11887 (class Output_section_definition): Add is_relro and
11888 orphan_section_init. Remove place_orphan_here.
11889 (class Orphan_output_section): Likewise.
11890 (Script_sections::Script_sections): Update for field changes.
11891 (Script_sections::data_segment_align): Set saw_data_segment_align_
11892 and data_segment_align_start_, not data_segment_align_index.
11893 (Script_sections::data_segment_relro_end): Check
11894 saw_data_segment_align_. Use data_segment_align_start_ rather
11895 than data_segment_align_index_.
11896 (Script_sections::place_orphan): Rewrite to use
11897 Orphan_section_placement.
11898
11899 2009-03-17 Ian Lance Taylor <iant@google.com>
11900
11901 * archive.cc (Archive::add_symbols): Check for a version attached
11902 to the symbol name in the archive map.
11903 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11904 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11905 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11906 (ver_test_11.a): New target.
11907 * testsuite/Makefile.in: Rebuild.
11908
11909 * configure.ac: Check for chsize and posix_fallocate. Replace
11910 ftruncate.
11911 * ftruncate.c: New file, from gnulib.
11912 * output.cc (posix_fallocate): Define dummy version if not
11913 HAVE_POSIX_FALLOCATE.
11914 (Output_file::map): Call posix_fallocate rather than lseek and
11915 write.
11916 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11917 * configure, Makefile.in, config.in: Rebuild.
11918
11919 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
11920
11921 * layout.h (Layout::create_note): Add section_name parameter.
11922 * layout.cc (Layout::create_note): Likewise.
11923 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11924
11925 2009-03-17 Ian Lance Taylor <iant@google.com>
11926
11927 * descriptors.cc: Include "options.h".
11928 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11929 (Descriptors::open): Always use O_CLOEXEC when opening a new
11930 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
11931 then set FD_CLOEXEC.
11932
11933 * sparc.cc (class Target_sparc): Add has_got_section.
11934 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11935 make sure we have a GOT section.
11936
11937 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11938 (Target_sparc::Scan::local): Likewise.
11939 (Target_sparc::Scan::global): Likewise.
11940 (Target_sparc::Relocate::relocate): Likewise.
11941 (Target_sparc::Relocate::relocate_tls): Likewise.
11942
11943 * symtab.cc (Symbol_table::define_default_version): New function,
11944 broken out of add_from_object.
11945 (Symbol_table::add_from_object): Call define_default_version.
11946 (Symbol_table::define_special_symbol): Add resolve_oldsym
11947 parameter. Change all callers. If the version for a symbol comes
11948 from a version script, resolve it with the symbol with the same
11949 name with no version. Also add the symbol without a version if
11950 appropriate.
11951 (do_define_in_output_data): If resolving with oldsym, don't delete
11952 sym.
11953 (do_define_in_output_segment): Likewise.
11954 (do_define_as_constant): Likewise.
11955 * symtab.h (class Symbol_table): Update declarations.
11956
11957 2009-03-13 Ian Lance Taylor <iant@google.com>
11958
11959 * readsyms.cc (Read_symbols::incompatible_warning): New function.
11960 (Read_symbols::requeue): New function.
11961 (Read_symbols::do_read_symbols): If make_elf_object fails because
11962 the target type is not configured, and the file was searched for,
11963 issue a warning and retry with the next directory.
11964 (Add_symbols::run): If the file has an incompatible format, and
11965 it was searched for, requeue the Read_symbols task. On error,
11966 release the object.
11967 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
11968 dirindex parameter to constructor. Change all callers. Declare
11969 incompatible_warning and requeue.
11970 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11971 input_argument_ and input_group_ fields. Add them to
11972 constructor. Change all callers.
11973 (class Read_script): Add dirindex_ field. Add it to constructor.
11974 Change all callers.
11975 * archive.cc (Archive::setup): Remove input_objects parameter.
11976 Change all callers.
11977 (Archive::get_file_and_offset): Likewise.
11978 (Archive::read_all_symbols): Likewise.
11979 (Archive::read_symbols): Likewise.
11980 (Archive::get_elf_object_for_member): Remove input_objects
11981 parameter. Add punconfigured parameter. Change all callers.
11982 (Archive::add_symbols): Change return type to bool. Check return
11983 value of include_member.
11984 (Archive::include_all_members): Likewise.
11985 (Archive::include_member): Change return type to bool. Return
11986 false if first included object has incompatible target. Set
11987 included_member_ field.
11988 (Add_archive_symbols::run): If add_symbols returns false, requeue
11989 Read_symbols task.
11990 * archive.h (class Archive): Add included_member_ field.
11991 Initialize it in constructor. Add input_file and searched_for
11992 methods. Update declarations.
11993 (class Add_archive_symbols): Add dirpath_, dirindex_, and
11994 input_argument_ fields. Add them to constructor. Change all
11995 callers.
11996 * script.cc: Include "target-select.h".
11997 (class Parser_closure): Add skip_on_incompatible_target_ and
11998 found_incompatible_target_ fields. Add
11999 skip_on_incompatible_target parameter to constructor. Change all
12000 callers. Add methods skip_on_incompatible_target,
12001 clear_skip_on_incompatible_target, found_incompatible_target, and
12002 set_found_incompatible_target.
12003 (read_input_script): Add dirindex parameter. Change all callers.
12004 If parser finds an incompatible target, requeue Read_symbols
12005 task.
12006 (script_set_symbol): Clear skip_on_incompatible_target in
12007 closure.
12008 (script_add_assertion, script_parse_option): Likewise.
12009 (script_start_sections, script_add_phdr): Likewise.
12010 (script_check_output_format): New function.
12011 * script.h (read_input_script): Update declaration.
12012 * script-c.h (script_check_output_format): Declare.
12013 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12014 (ignore_cmd): Remove OUTPUT_FORMAT.
12015 * fileread.cc (Input_file::Input_file): Add explicit this.
12016 (Input_file::will_search_for): New function.
12017 (Input_file::open): Add pindex parameter. Change all callers.
12018 * fileread.h (class Input_file): Add input_file_argument method.
12019 Declare will_search_for. Update declarations.
12020 * object.cc (make_elf_object): Add punconfigured parameter.
12021 Change all callers.
12022 * object.h (class Object): Make input_file public. Add
12023 searched_for method.
12024 (make_elf_object): Update declaration.
12025 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
12026 restart search.
12027 * dirsearch.h (class Dirsearch): Update declaration.
12028 * options.h (class General_options): Add --warn-search-mismatch.
12029 * parameters.cc (Parameters::is_compatible_target): New function.
12030 * parameters.h (class Parameters): Declare is_compatible_target.
12031 * workqueue.cc (Workqueue::add_blocker): New function.
12032 * workqueue.h (class Workqueue): Declare add_blocker.
12033
12034 * fileread.cc (Input_file::open): Remove options parameter.
12035 Change all callers.
12036 (Input_file::open_binary): Likewise.
12037 * script.cc (read_input_script): Likewise.
12038 * readsyms.h (class Read_symbols): Remove options_ field. Remove
12039 options parameter from constructor. Change all callers.
12040 (class Read_script): Likewise.
12041 * fileread.h (class Input_file): Update declarations.
12042 * script.h (read_input_script): Update declaration.
12043
12044 2009-03-10 Nick Clifton <nickc@redhat.com>
12045
12046 * po/es.po: New Spanish translation.
12047
12048 2009-03-06 Cary Coutant <ccoutant@google.com>
12049
12050 * options.cc (parse_short_option): Keep dash_z from registering itself.
12051
12052 2009-03-03 Ian Lance Taylor <iant@google.com>
12053
12054 PR 9918
12055 * target-reloc.h (relocate_section): Pass output_section to
12056 relocate.
12057 * i386.cc (Target_i386::should_apply_static_reloc): Add
12058 output_section parameter. Change all callers.
12059 (Target_i386::Relocate::relocate): Add output_section parameter.
12060 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12061 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12062 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12063 * testsuite/two_file_shared.sh: New script.
12064 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12065 (check_DATA): Add two_file_shared.dbg.
12066 (two_file_shared.dbg): New target.
12067 * testsuite/Makefile.in: Rebuild.
12068
12069 2009-03-01 Ian Lance Taylor <iant@google.com>
12070
12071 * configure.ac: Check for byteswap.h.
12072 * configure: Rebuild.
12073 * config.in: Rebuild.
12074
12075 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
12076
12077 * layout.cc (Layout::find_or_add_kept_section): New function.
12078 (Layout::add_comdat): Removed.
12079 * layout.h (struct Kept_section): Move out of class Layout.
12080 Remove trailing underscores from field names. Add group_sections
12081 field. Rename group_ field to is_group. Change all uses.
12082 (class Layout): Declare find_or_add_kept_section, not add_comdat.
12083 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12084 comdat_groups_ field.
12085 (Sized_relobj::include_section_group): Use
12086 find_or_add_kept_section and Kept_section::group_sections.
12087 (Sized_relobj::include_linkonce_section): Likewise.
12088 * object.cc (class Sized_relobj): Don't define Comdat_group or
12089 Comdat_group_table. Remove find_comdat_group and
12090 add_comdat_group. Remove comdat_groups_ field.
12091 * plugin.cc (include_comdat_group): Use
12092 Layout::find_or_add_kept_section.
12093
12094 2009-02-28 Ian Lance Taylor <iant@google.com>
12095
12096 * README: --gc-sections and map files are now supported. Document
12097 some build requirements.
12098
12099 PR 6992
12100 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12101 relocatable link set the value of the section symbol to zero.
12102 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12103 relocatable link don't include the section address in the local
12104 symbol value.
12105
12106 2009-02-27 Ian Lance Taylor <iant@google.com>
12107
12108 PR 6811
12109 * options.h (class Search_directory): Add is_system_directory.
12110 (class General_options): Declare is_in_system_directory.
12111 * options.cc (get_relative_sysroot): Make static.
12112 (get_default_sysroot): Make static.
12113 (General_optoins::is_in_system_directory): New function.
12114 * fileread.cc (Input_file::is_in_system_directory): New function.
12115 * fileread.h (class Input_file): Declare is_in_system_directory.
12116 * object.h (class Object): Add is_in_system_directory.
12117 (class Input_objects): Remove system_library_directory_ field.
12118 * object.cc (Input_objects::add_object): Don't set
12119 system_library_directory_.
12120 (input_objects::found_in_system_library_directory): Remove.
12121 * symtab.cc (Symbol_table::write_globals): Remove input_objects
12122 parameter. Change all callers.
12123 (Symbol_table::sized_write_globals): Likewise.
12124 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12125 Call Object::is_in_system_directory.
12126 * symtab.h (class Symbol_table): Update declarations.
12127
12128 PR 5990
12129 * descriptors.h (Open_descriptor): Add is_on_stack field.
12130 * descriptors.cc (Descriptors::open): If the descriptor is on the
12131 top of the stack, remove it. Initialize is_on_stack field.
12132 (Descriptors::release): Only add pod to stack if it is not on the
12133 stack already.
12134 (Descriptors::close_some_descriptor): Clear stack_next and
12135 is_on_stack fields.
12136
12137 PR 7091
12138 * output.cc (Output_section::find_starting_output_address): Rename
12139 from starting_output_address; add PADDR parameter; change return
12140 type.
12141 * output.h (class Output_section): Declare
12142 find_starting_output_address instead of starting_output_address.
12143 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12144 section symbol for which we can't find a merge section.
12145
12146 PR 9836
12147 * symtab.cc (Symbol_table::add_from_object): If the visibility is
12148 hidden or internal, force the symbol to be local.
12149 * resolve.cc (Symbol::override_visibility): Define.
12150 (Symbol::override_base): Use override_visibility.
12151 (Symbol_table::resolve): Likewise.
12152 (Symbol::override_base_with_special): Likewise.
12153 (Symbol_table::override_with_special): If the visibility is hidden
12154 or internal, force the symbol to be local.
12155 * symtab.h (class Symbol): Add set_visibility and
12156 override_visibility.
12157 * testsuite/ver_test_1.sh: New file.
12158 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12159 (check_DATA): Add ver_test_1.syms.
12160 (ver_test_1.syms): New target.
12161 * testsuite/Makefile.in: Rebuild.
12162
12163 2009-02-25 Cary Coutant <ccoutant@google.com>
12164
12165 * layout.cc (Layout::choose_output_section): Don't rename sections
12166 when using a linker script that has a SECTIONS clause.
12167 * Makefile.in: Regenerate.
12168
12169 * testsuite/Makefile.am (script_test_5.sh): New test case.
12170 * testsuite/Makefile.in: Regenerate.
12171 * testsuite/script_test_5.cc: New file.
12172 * testsuite/script_test_5.sh: New file.
12173 * testsuite/script_test_5.t: New file.
12174
12175 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
12176
12177 * archive.cc (Archive::include_member): Update calls to add_symbols.
12178 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12179 the Layout argument.
12180 * dynobj.h (do_add_symbols): Add the Layout argument.
12181 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12182 Layout argument.
12183 * object.h (Object::add_symbols): Add the Layout argument.
12184 (Object::do_add_symbols): Add the Layout argument.
12185 (Sized_relobj::do_add_symbols): Add the Layout argument.
12186 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12187 Unify the two versions.
12188 (Add_plugin_symbols): Remove.
12189 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12190 (Sized_pluginobj::do_add_symbols): Unify the two versions.
12191 (Add_plugin_symbols): Remove.
12192 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12193 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12194 (Add_symbols::run): Make it work with Pulginobj.
12195
12196 2009-02-06 Ian Lance Taylor <iant@google.com>
12197
12198 * object.cc (Sized_relobj::do_layout): Make info message start
12199 with lower case letter.
12200
12201 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
12202
12203 * binary.cc: Fix file comment.
12204
12205 * options.h (enum Incremental_disposition): Define.
12206 (class General_options): Add new options: --incremental,
12207 --incremental_changed, --incremental_unchanged,
12208 --incremental_unknown. Add incremental_disposition_ and
12209 implicit_incremental_ fields.
12210 (General_options::incremental_disposition): New function.
12211 (class Position_dependent_options): Add incremental_disposition
12212 option.
12213 (Position_dependent_options::copy_from_options): Set incremental
12214 dispositions.
12215 * options.cc (General_options::parse_incremental_changed): New
12216 function.
12217 (General_options::parse_incremental_unchanged): New function.
12218 (General_options::parse_incremental_unknown): New function.
12219 (General_options::General_options): Initialize new fields
12220 incremental_disposition_ and implicit_incremental_.
12221 (General_options::finalize): Check for uasge of --incremental-*
12222 without --incremental.
12223
12224 2009-02-06 Chris Demetriou <cgd@google.com>
12225
12226 * gold.h (gold_undefined_symbol): Change to take only a Symbol
12227 pointer and to report location as the file name associated with
12228 the symbol.
12229 (gold_undefined_symbol_at_location): New function to replace the
12230 old gold_undefined_symbol functionality.
12231 * target-reloc.h (relocate_section): Update to use
12232 gold_undefined_symbol_at_location.
12233 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12234 Call gold_undefined_symbol function rather than gold_error.
12235 * errors.h (Errors::undefined_symbol): Take location as a
12236 string, rather than calculating it from a relocation.
12237 * errors.cc (Errors::fatal): Print "fatal error:" before the
12238 formatted message.
12239 (Errors::error, Errors::error_at_location): Print "error: "
12240 before the formatted message.
12241 (Errors::undefined_symbol): Take location as a string, rather
12242 than calculating it from a relocation.
12243 (gold_undefined_symbol_at_location): New function akin to
12244 old gold_undefined_symbol, calculates location from relocation.
12245 (gold_undefined_symbol): Change to take only a Symbol pointer
12246 and to report location as the file name associated with the symbol.
12247 * testsuite/debug_msg.sh: Update for changed error messages.
12248 * testsuite/undef_symbol.sh: Likewise.
12249
12250 2009-02-04 Duncan Sands <baldrick@free.fr>
12251
12252 PR 9812
12253 * reduced_debug_output.h
12254 (Output_reduced_debug_abbrev_section::failed): Use format for
12255 gold_warning.
12256 (Output_reduced_debug_info_section::faild): Likewise.
12257
12258 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
12259
12260 * script.cc (Lazy_demangler): New class.
12261 (Version_script_info::get_symbol_version_helper): Demangle a
12262 symbol only once.
12263
12264 2009-01-29 Cary Coutant <ccoutant@google.com>
12265
12266 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12267 to __tls_get_addr.
12268 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12269
12270 2009-01-28 Ian Lance Taylor <iant@google.com>
12271
12272 * version.cc (version_string): Bump to 1.9.
12273
12274 * gold.h: Include <cstring> and <stdint.h>.
12275 * version.cc: Include <cstdio>.
12276 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12277 warning.
12278 * reduced_debug_output.cc (insert_into_vector): Rename from
12279 Insert_into_vector; change all callers. Use Swap_unaligned to
12280 avoid aliasing issue; remove union since it is unnecessary.
12281
12282 2009-01-27 Sriraman Tallam <tmsriram@google.com>
12283
12284 * Makefile.am (CCFILES): Add gc.cc.
12285 (HFILES): Add gc.h.
12286 * Makefile.in: Regenerate.
12287 * gold.cc (Gc_runner): New class.
12288 (queue_initial_tasks): Call garbage collection related tasks
12289 when corresponding options are invoked.
12290 (queue_middle_gc_tasks): New function.
12291 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12292 processed early before laying out sections during garbage collection.
12293 * gold.h (queue_middle_gc_tasks): New function.
12294 (is_prefix_of): Move from "layout.cc".
12295 * i386.cc (Target_i386::gc_process_relocs): New function.
12296 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12297 * main.cc (main): Create object of class "Garbage_collection".
12298 * object.cc (Relobj::copy_symbols_data): New function.
12299 (Relobj::is_section_name_included): New function.
12300 (Sized_relobj::do_layout): Allow this function to be called twice
12301 during garbage collection and defer layout of section during the
12302 first call.
12303 * object.h (Relobj::get_symbols_data): New function.
12304 (Relobj::is_section_name_included): New function.
12305 (Relobj::copy_symbols_data): New function.
12306 (Relobj::set_symbols_data): New function.
12307 (Relobj::get_relocs_data): New function.
12308 (Relobj::set_relocs_data): New function.
12309 (Relobj::is_output_section_offset_invalid): New pure virtual function.
12310 (Relobj::gc_process_relocs): New function.
12311 (Relobj::do_gc_process_relocs): New pure virtual function.
12312 (Relobj::sd_): New data member.
12313 (Sized_relobj::is_output_section_offset_invalid): New function.
12314 (Sized_relobj::do_gc_process_relocs): New function.
12315 * options.h (General_options::gc_sections): Modify to not be a no-op.
12316 (General_options::print_gc_sections): New option.
12317 * plugin.cc (Plugin_finish::run): Remove function call to
12318 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
12319 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12320 * reloc.cc (Read_relocs::run): Add task to process relocs and
12321 determine unreferenced sections when doing garbage collection.
12322 (Gc_process_relocs): New class.
12323 (Sized_relobj::do_gc_process_relocs): New function.
12324 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12325 sections that are garbage collected.
12326 * reloc.h (Gc_process_relocs): New class.
12327 * sparc.cc (Target_sparc::gc_process_relocs): New function.
12328 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12329 symbols whose corresponding sections are garbage collected.
12330 (Symbol_table::Symbol_table): Add new parameter for the garbage
12331 collection object.
12332 (Symbol_table::gc_mark_undef_symbols): New function.
12333 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12334 (Symbol_table::gc_mark_dyn_syms): New function.
12335 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12336 as garbage.
12337 (Symbol_table::add_from_object): Likewise.
12338 (Symbol_table::add_from_relobj): When building shared objects, do not
12339 treat externally visible symbols as garbage.
12340 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12341 table information for static and relocatable links.
12342 * symtab.h (Symbol_table::set_gc): New function.
12343 (Symbol_table::gc): New function.
12344 (Symbol_table::gc_mark_undef_symbols): New function.
12345 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12346 (Symbol_table::gc_mark_dyn_syms): New function.
12347 (Symbol_table::gc_): New data member.
12348 * target.h (Sized_target::gc_process_relocs): New pure virtual
12349 function.
12350 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12351 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12352
12353 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
12354
12355 * options.h (General_options::gc_sections): Define as a no-op for now.
12356 (General_options::no_keep_memory): Ditto.
12357 (General_options::Bshareable): Define.
12358 * options.cc (General_options::finalize): Honor -Bshareable.
12359
12360 2009-01-20 Andreas Schwab <schwab@suse.de>
12361
12362 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12363 read the value in the contents, since we don't use it. Use the
12364 template endianness when writing.
12365 (Relocate::relocate): Use it for R_PPC_REL16_HA.
12366
12367 2009-01-19 Andreas Schwab <schwab@suse.de>
12368
12369 * configure.tgt (powerpc64-*): Fix targ_obj.
12370
12371 2009-01-15 Ian Lance Taylor <iant@google.com>
12372
12373 * object.cc (Sized_relobj::write_local_symbols): Don't write out
12374 local symbols when stripping all symbols.
12375
12376 2009-01-14 Cary Coutant <ccoutant@google.com>
12377
12378 * output.cc (Output_reloc): Add explicit instantiations.
12379
12380 2009-01-14 Cary Coutant <ccoutant@google.com>
12381
12382 * archive.cc (Archive::get_elf_object_for_member): Remove call
12383 to File_read::claim_for_plugin.
12384 * descriptors.cc (Descriptors::open): Remove reference to
12385 is_claimed.
12386 (Descriptors::claim_for_plugin): Remove.
12387 * descriptors.h (Descriptors::claim_for_plugin): Remove.
12388 (Descriptors::is_claimed): Remove.
12389 (claim_descriptor_for_plugin): Remove.
12390 * fileread.cc (File_read::claim_for_plugin): Remove.
12391 * fileread.h (File_read::claim_for_plugin): Remove.
12392 (File_read::descriptor): Reopen descriptor if necessary.
12393 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
12394 (Plugin_manager::all_symbols_read): Add task parameter. Change
12395 all callers.
12396 (Plugin_manager::get_input_file): New function.
12397 (Plugin_manager::release_input_file): New function.
12398 (Pluginobj::Pluginobj): Add filesize parameter and initialize
12399 corresponding data member.
12400 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12401 and pass to base constructor. Change all callers.
12402 (get_input_file, release_input_file): New functions.
12403 (make_sized_plugin_object): Add filesize parameter. Change all callers.
12404 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12405 (Plugin_manager::all_symbols_read): Add task parameter.
12406 (Plugin_manager::get_input_file): New function.
12407 (Plugin_manager::release_input_file): New function.
12408 (Plugin_manager::task_): New data member.
12409 (Pluginobj::Pluginobj): Add filesize parameter.
12410 (Pluginobj::filename): New function.
12411 (Pluginobj::descriptor): New function.
12412 (Pluginobj::filesize): New function.
12413 (Pluginobj::filesize_): New data member.
12414 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12415 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12416 File_read::claim_for_plugin; use Object::unlock to unlock the file.
12417
12418 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12419 with archive libraries.
12420 * testsuite/Makefile.in: Regenerate.
12421 * testsuite/plugin_test.c (struct sym_info): New type.
12422 (get_input_file, release_input_file): New static variables.
12423 (onload): Capture new transfer vector entries.
12424 (claim_file_hook): Stop reading at end of file according to filesize.
12425 Factor out parsing of readelf output into separate function.
12426 (all_symbols_read_hook): Exercise get_input_file and release_input_file
12427 APIs and get the source file name from the symbol table. Convert
12428 source file name to corresponding object file name. Print info
12429 message when adding new input files.
12430 (parse_readelf_line): New function.
12431 * testsuite/plugin_test_1.sh: Add checks for new info messages.
12432 * testsuite/plugin_test_2.sh: Likewise.
12433 * testsuite/plugin_test_3.sh: Likewise.
12434 * testsuite/plugin_test_4.sh: New test case.
12435
12436 2009-01-07 Ian Lance Taylor <iant@google.com>
12437
12438 * version.cc (version_string): Bump to 1.8.
12439
12440 2008-12-23 Cary Coutant <ccoutant@google.com>
12441
12442 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12443 * plugin.cc (Plugin_manager::finish): Rename as
12444 layout_deferred_objects. Move cleanup to separate function.
12445 (Plugin_manager::cleanup): New function.
12446 (Plugin_finish::run): Call layout_deferred_objects and cleanup
12447 separately.
12448 * plugin.h (Plugin_manager::finish): Rename as
12449 layout_deferred_objects.
12450 (Plugin_manager::cleanup): New function.
12451 (Plugin_manager::cleanup_done): New field.
12452
12453 2008-12-23 Cary Coutant <ccoutant@google.com>
12454
12455 * plugin.cc (is_visible_from_outside): New function.
12456 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12457 so we don't return "IR only" status for exported symbols or -r links.
12458
12459 * testsuite/Makefile.am (plugin_test_3): New test case.
12460 * testsuite/Makefile.in: Regenerate.
12461 * testsuite/plugin_test_3.sh: New file.
12462
12463 2008-12-22 Cary Coutant <ccoutant@google.com>
12464
12465 * object.cc (Sized_relobj::layout_section): New function.
12466 (Sized_relobj::do_layout): Defer layout of input sections until after
12467 plugin has provided replacement files.
12468 (Sized_relobj::do_layout_deferred_sections): New function.
12469 * object.h (Relobj::set_section_offset): Remove virtual keyword.
12470 (Relobj::layout_deferred_sections): New function.
12471 (Relobj::do_layout_deferred_sections): New function.
12472 (Sized_relobj::do_layout_deferred_sections): New function.
12473 (Sized_relobj::layout_section): New function.
12474 (Sized_relobj::Deferred_layout): New structure.
12475 (Sized_relobj::deferred_layout_): New field.
12476 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12477 Change all callers. Layout deferred sections.
12478 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
12479 references.
12480 (Plugin_hook::run): Move code from do_plugin_hook inline.
12481 (Plugin_hook::do_plugin_hook): Remove.
12482 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12483 (Plugin_manager::finish): Renamed, was cleanup.
12484 (Plugin_manager::should_defer_layout): New function.
12485 (Plugin_manager::add_deferred_layout_object): New function.
12486 (Plugin_manager::Deferred_layout_list): New type.
12487 (Plugin_manager::deferred_layout_objects_): New field.
12488 (Plugin_hook::do_plugin_hook): Remove.
12489
12490 2008-12-17 Ian Lance Taylor <iant@google.com>
12491
12492 * options.h (class General_options): Add --no case for
12493 --export-dynamic.
12494
12495 2008-12-16 Cary Coutant <ccoutant@google.com>
12496
12497 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12498 vector.
12499 (Plugin_manager::claim_file): Create plugin object even if
12500 plugin did not call the add_symbols callback.
12501 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12502 asking for more symbols than were added.
12503 * testsuite/Makefile.am (plugin_test_1): Add test case with
12504 no global symbols.
12505 (empty.syms): New target.
12506 * testsuite/Makefile.in: Regenerate.
12507 * testsuite/plugin_test.c (claim_file_hook): Add new debug
12508 message. Don't call add_symbols if no globals.
12509 (all_symbols_read_hook): Don't provide replacement for empty
12510 claimed file.
12511
12512 2008-12-12 Ian Lance Taylor <iant@google.com>
12513
12514 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12515 r_type == 0 for a local symbol with r_sym == 0.
12516 (scan_relocatable_relocs): Pass r_sym to
12517 local_non_section_strategy.
12518 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12519 r_sym parameter.
12520
12521 * configure.ac: Update test for TLS descriptors: they are
12522 supported as of glibc 2.9.
12523 * configure: Rebuild.
12524
12525 2008-12-11 Ian Lance Taylor <iant@google.com>
12526
12527 PR 7091
12528 * target-reloc.h (Default_scan_relocatable_relocs): For each
12529 function, map r_type == 0 to RELOC_DISCARD.
12530
12531 2008-12-10 Cary Coutant <ccoutant@google.com>
12532
12533 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12534 object to override a kept COMDAT group from a plugin object.
12535
12536 2008-12-09 Ian Lance Taylor <iant@google.com>
12537
12538 PR 7088
12539 * yyscript.y (file_cmd): Handle INPUT.
12540
12541 * testsuite/initpri1.c: Change all declarations to be full
12542 prototypes by adding void, to avoid compiler warnings.
12543
12544 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
12545
12546 * options.cc (General_options::parse_plugin_opt): New.
12547 (General_options::add_plugin): The argument now is just the filename.
12548 (General_options::add_plugin_option): New.
12549 * options.h (plugin_opt): New.
12550 (add_plugin): Change argument name.
12551 (add_plugin_option): New.
12552 * plugin.cc (Plugin::load): Don't parse the plugin option.
12553 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12554 (Plugin::add_option): New.
12555 (Plugin::args_): Change type.
12556 (Plugin::filename_): New.
12557 (Plugin_manager::add_plugin_option): New.
12558 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12559 * testsuite/Makefile.in: Regenerate.
12560
12561 2008-12-05 Cary Coutant <ccoutant@google.com>
12562
12563 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12564 Handle --strip-lto-sections option.
12565 * options.h (strip_lto_sections): New option.
12566
12567 2008-12-01 Cary Coutant <ccoutant@google.com>
12568
12569 * plugin.cc (ld_plugin_message): Change format parameter to const.
12570 Fix mismatch between new[] and delete.
12571
12572 2008-11-14 Cary Coutant <ccoutant@google.com>
12573
12574 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12575 instead of -1U.
12576
12577 2008-11-05 Craig Silverstein <csilvers@google.com>
12578
12579 * options.cc (General_options::parse_dynamic_list): New function.
12580 * options.h (General_options): New flags dynamic_list,
12581 dynamic_list_data, dynamic_list_cpp_new, and
12582 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
12583 (General_options::in_dynamic_list): New function.
12584 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12585 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12586 (Lex::can_continue_name): Likewise.
12587 (yylex): Likewise.
12588 (read_script_file): New parameter script_options.
12589 (read_dynamic_list): New function.
12590 (Script_options::define_dynamic_list): New function.
12591 (dynamic_list_keyword_parsecodes): New variable.
12592 (dynamic_list_keywords): New variable.
12593 * script.h (Script_options::define_dynamic_list): New function
12594 prototype.
12595 (read_dynamic_list): New function prototype.
12596 * symtab.cc (strprefix): New macro.
12597 (Symbol::should_add_dynsym_entry): Support dynamic_list,
12598 dynamic_list_data, dynamic_list_cpp_new, and
12599 dynamic_list_cpp_typeinfo.
12600 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12601 (dynamic_list_expr): New rule.
12602 (dynamic_list_nodes): Likewise.
12603 (dynamic_list_node): Likewise.
12604 * testsuite/Makefile.am (dynamic_list): New test.
12605 * testsuite/Makefile.in: Regenerated.
12606 * testsuite/dynamic_list.t: New file.
12607 * testsuite/dynamic_list.sh: New file.
12608
12609 2008-11-05 Craig Silverstein <csilvers@google.com>
12610
12611 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12612 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12613 (t11_last): Likewise.
12614 * testsuite/ver_test_6.c (main): Likewise.
12615
12616 2008-10-07 Cary Coutant <ccoutant@google.com>
12617
12618 * options.c (General_options::finalize): Add check for -static and
12619 -shared.
12620 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12621 is not empty.
12622
12623 2008-10-02 Cary Coutant <ccoutant@google.com>
12624
12625 * plugin.cc (make_sized_plugin_object): Fix conditional
12626 compilation to work when not all targets are enabled.
12627
12628 2008-09-29 Cary Coutant <ccoutant@google.com>
12629
12630 * archive.cc (Archive::get_file_and_offset): Use filename instead
12631 of name to get library path.
12632 (Archive::include_member): Unlock external member of a thin archive.
12633
12634 * testsuite/Makefile.am (TEST_AR): New variable.
12635 (thin_archive_test_1): New test.
12636 (thin_archive_test_2): New test.
12637 * testsuite/Makefile.in: Regenerate.
12638 * testsuite/thin_archive_main.cc: New file.
12639 * testsuite/thin_archive_test_1.cc: New file.
12640 * testsuite/thin_archive_test_2.cc: New file.
12641 * testsuite/thin_archive_test_3.cc: New file.
12642 * testsuite/thin_archive_test_4.cc: New file.
12643
12644 2008-09-29 Cary Coutant <ccoutant@google.com>
12645
12646 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12647 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12648 instead of -1U.
12649 (Sized_relobj::do_finalize_local_symbols): Likewise.
12650 (Sized_relobj::map_to_kept_section): Likewise.
12651 * object.h (Sized_relobj::invalid_address): New constant.
12652 (Sized_relobj::do_output_section_offset): Check for invalid_address
12653 and return -1ULL.
12654 * output.cc (Output_reloc::local_section_offset): Use constant
12655 invalid_address instead of -1U.
12656 (Output_reloc::get_address): Likewise.
12657 (Output_section::output_address): Change -1U to -1ULL.
12658 * output.h (Output_reloc::invalid_address): New constant.
12659 * reloc.cc (Sized_relobj::write_sections): Use constant
12660 invalid_address instead of -1U.
12661 (Sized_relobj::relocate_sections): Likewise.
12662 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12663 values for merge sections.
12664 * target-reloc.h (relocate_for_relocatable): Use constant
12665 invalid_address instead of -1U.
12666
12667 2008-09-19 Cary Coutant <ccoutant@google.com>
12668
12669 Add plugin functionality for link-time optimization (LTO).
12670 * configure.ac (plugins): Add --enable-plugins option.
12671 * configure: Regenerate.
12672 * config.in: Regenerate.
12673 * Makefile.am (LIBDL): New variable.
12674 (CCFILES): Add plugin.cc.
12675 (HFILES): Add plugin.h.
12676 (ldadd_var): Add LIBDL.
12677 * Makefile.in: Regenerate.
12678
12679 * archive.cc: Include "plugin.h".
12680 (Archive::setup): Don't preread archive symbols when using a plugin.
12681 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
12682 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12683 files.
12684 (Archive::include_member): Add symbols from plugin objects.
12685 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12686 * descriptors.cc (Descriptors::open): Check for file descriptors
12687 abandoned by plugins.
12688 (Descriptors::claim_for_plugin): New function.
12689 * descriptors.h (Descriptors::claim_for_plugin): New function.
12690 (Open_descriptor::is_claimed): New field.
12691 (claim_descriptor_for_plugin): New function.
12692 * fileread.cc (File_read::claim_for_plugin): New function.
12693 * fileread.h (File_read::claim_for_plugin): New function.
12694 (File_read::descriptor): New function.
12695 * gold.cc: Include "plugin.h".
12696 (queue_initial_tasks): Add task to call plugin hooks for generating
12697 new object files.
12698 * main.cc: Include "plugin.h".
12699 (main): Load plugin libraries.
12700 * object.h (Pluginobj): Declare.
12701 (Object::pluginobj): New function.
12702 (Object::do_pluginobj): New function.
12703 (Object::set_target): New function.
12704 * options.cc: Include "plugin.h".
12705 (General_options::parse_plugin): New function.
12706 (General_options::General_options): Initialize plugins_ field.
12707 (General_options::add_plugin): New function.
12708 * options.h (Plugin_manager): Declare.
12709 (General_options): Add --plugin option.
12710 (General_options::has_plugins): New function.
12711 (General_options::plugins): New function.
12712 (General_options::add_plugin): New function.
12713 (General_options::plugins_): New field.
12714 * plugin.cc: New file.
12715 * plugin.h: New file.
12716 * readsyms.cc: Include "plugin.h".
12717 (Read_symbols::do_read_symbols): Check for archive before checking
12718 for ELF file. Call plugin hooks to claim files.
12719 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12720 from a real object file; force override when processing replacement
12721 files.
12722 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12723 (Symbol::init_base_object): Likewise.
12724 (Symbol::init_base_output_data): Likewise.
12725 (Symbol::init_base_output_segment): Likewise.
12726 (Symbol::init_base_constant): Likewise.
12727 (Symbol::init_base_undefined): Likewise.
12728 (Symbol::output_section): Assert that object is not a plugin.
12729 (Symbol_table::add_from_pluginobj): New function.
12730 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12731 undefined.
12732 (Symbol_table::sized_write_globals): Likewise.
12733 (Symbol_table::add_from_pluginobj): Instantiate template.
12734 * symtab.h (Sized_pluginobj): Declare.
12735 (Symbol::in_real_elf): New function.
12736 (Symbol::set_in_real_elf): New function.
12737 (Symbol::in_real_elf_): New field.
12738 (Symbol_table::add_from_pluginobj): New function.
12739
12740 * testsuite/Makefile.am (AM_CFLAGS): New variable.
12741 (LIBDL): New variable.
12742 (LDADD): Add LIBDL.
12743 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12744 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12745 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12746 (MOSTLYCLEANFILES): Likewise.
12747 * testsuite/Makefile.in: Regenerate.
12748 * testsuite/plugin_test.c: New file.
12749 * testsuite/plugin_test_1.sh: New file.
12750 * testsuite/plugin_test_2.sh: New file.
12751
12752 2008-09-16 Ian Lance Taylor <iant@google.com>
12753
12754 * target-reloc.h (relocate_section): Check whether a symbol is
12755 defined by the ABI before reporting an undefined symbol error.
12756 * target.h (Target::is_defined_by_abi): Make parameter const.
12757 (Target::do_is_defined_by_abi): Likewise.
12758 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12759 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12760 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12761 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12762 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12763 * testsuite/Makefile.in: Rebuild.
12764
12765 * fileread.cc (make_view): Add casts to avoid warning.
12766
12767 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12768
12769 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12770 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12771
12772 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12773
12774 * options.h (General_options::output_is_executable): New.
12775 (General_options::output_is_pie): New.
12776 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12777 for shared libraries.
12778 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12779
12780 2008-09-11 Chris Demetriou <cgd@google.com>
12781
12782 * options.h (origin): New -z option.
12783 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12784 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12785 in DT_FLAGS_1.
12786
12787 2008-09-05 Cary Coutant <ccoutant@google.com>
12788
12789 * fileread.cc (File_read::make_view): Add check for attempt to map
12790 beyond end of file.
12791
12792 2008-09-05 Cary Coutant <ccoutant@google.com>
12793
12794 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12795 explicit instantiations.
12796
12797 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
12798
12799 PR gold/6858
12800 * options.cc (General_options::finalize): Allow undefined symbols
12801 in shlibs if linking -shared.
12802
12803 PR gold/6859
12804 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12805 symbols as not needing a dynsym entry.
12806
12807 2008-08-20 Craig Silverstein <csilvers@google.com>
12808
12809 * fileread.cc (File_read::open): Do not lock the file unless it
12810 was successfully opened.
12811
12812 2008-08-14 Cary Coutant <ccoutant@google.com>
12813
12814 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12815 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12816 * testsuite/tls_test.cc (struct int128): 128-bit struct
12817 for testing TLS relocs with non-zero addend.
12818 (v12): New TLS variable.
12819 (t12): New test.
12820 (t_last): Add check for v12.
12821 * testsuite/tls_test.h (t12): New function.
12822 * testsuite/tls_test_main.cc (thread_routine): Call new test.
12823
12824 2008-08-13 Ian Lance Taylor <iant@google.com>
12825
12826 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12827 set tls_segment_ or relro_segment_.
12828 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12829 when appropriate.
12830 * output.h (Output_section::clear_is_relro): New function.
12831 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12832 sections specially even when output_data_ is empty.
12833 (Output_segment::maximum_alignment): When first section is relro,
12834 only force alignment for PT_LOAD segments.
12835 * script.cc (script_data_segment_align): New function.
12836 (script_data_segment_relro_end): New function.
12837 * script-c.h (script_data_segment_align): Declare.
12838 (script_data_segment_relro_end): Declare.
12839 * script-sections.h (class Script_sections): Declare
12840 data_segment_align and data_segment_relro_end. Add fields
12841 segment_align_index_ and saw_relro_end_.
12842 * script-sections.cc (class Sections_element): Add set_is_relro
12843 virtual function. Add new bool* parameter to place_orphan_here.
12844 Add get_output_section virtual function.
12845 (class Output_section_definition): Add set_is_relro. Add new
12846 bool* parameter to place_orphan_here. Add get_output_section.
12847 Add is_relro_ field.
12848 (Output_section_definition::Output_section_definition): Initialize
12849 evaluated_address_, evaluated_load_address, evaluated_addralign_,
12850 and is_relro_ fields.
12851 (Output_section_definition::place_orphan_here): Add is_relro
12852 parameter.
12853 (Output_section_definition::set_section_addresses): Set relro for
12854 output section.
12855 (Output_section_definition::alternate_constraint): Likewise.
12856 (class Orphan_output_section): Add new bool* parameter to
12857 place_orphan_here. Add get_output_section.
12858 (Orphan_output_section::place_orphan_here): Add is_relro
12859 parameter.
12860 (Script_sections::Script_sections): Initialize
12861 data_segment_align_index_ and saw_relro_end_.
12862 (Script_sections::data_segment_align): New function.
12863 (Script_sections::data_segment_relro_end): New function.
12864 (Script_sections::place_orphan): Set or clear is_relro.
12865 (Script_sections::set_section_addresses): Force alignment of first
12866 TLS section.
12867 * yyscript.y (exp): Call script_data_segment_align and
12868 script_data_segment_relro_end.
12869 * testsuite/relro_script_test.t: New file.
12870 * testsuite/relro_test.cc (using_script): Declare.
12871 (t1, t2): Test using_script.
12872 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12873 (relro_script_test_SOURCES): Define.
12874 (relro_script_test_DEPENDENCIES): Define.
12875 (relro_script_test_LDFLAGS): Define.
12876 (relro_script_test_LDADD): Define.
12877 (relro_script_test.so): New target.
12878 * testsuite/Makefile.in: Rebuild.
12879
12880 2008-08-06 Cary Coutant <ccoutant@google.com>
12881
12882 * archive.cc (Archive::total_archives, Archive::total_members)
12883 (Archive::total_members_loaded): New variables.
12884 (Archive::setup): Add parameter. Add option to preread
12885 archive symbols.
12886 (Archive::read_armap): Add counter.
12887 (Archive::get_file_and_offset): New function.
12888 (Archive::get_elf_object_for_member): New function.
12889 (Archive::read_all_symbols): New function.
12890 (Archive::read_symbols): New function.
12891 (Archive::add_symbols): Add counters.
12892 (Archive::include_all_members): Use armap to find members if it's
12893 already built.
12894 (Archive::include_member): Skip reading symbols if already read.
12895 Factored code into Archive::get_file_and_offset and
12896 Archive::get_elf_object_for_member. Changed call to
12897 Mapfile::report_include_archive_member.
12898 (Archive::print_stats): New function.
12899 * archive.h: Declare Object and Read_symbols_data classes.
12900 (Archive::Archive): Add initializers for new members.
12901 (Archive::setup): Add parameter.
12902 (Archive::print_stats): New function.
12903 (Archive::total_archives, Archive::total_members)
12904 (Archive::total_members_loaded): New variables.
12905 (Archive::get_file_and_offset): New function.
12906 (Archive::get_elf_object_for_member): New function.
12907 (Archive::read_all_symbols): New function.
12908 (Archive::read_symbols): New function.
12909 (Archive::Archive_member): New class.
12910 (Archive::members_): New member.
12911 (Archive::num_members_): New member.
12912 * main.cc: Include archive.h.
12913 (main): Call Archive::print_stats.
12914 * mapfile.cc (Mapfile::report_include_archive_member): Delete
12915 archive parameter; member_name is now the fully-decorated name.
12916 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12917 * options.h: (General_options): Add --preread-archive-symbols option.
12918 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12919 Archive::setup.
12920
12921 2008-08-04 Ian Lance Taylor <iant@google.com>
12922
12923 * symtab.h (Symbol::use_plt_offset): New function.
12924 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12925 * powerpc.cc (Relocate::relocate): Likewise.
12926 * sparc.cc (Relocate::relocate): Likewise.
12927 * x86_64.cc (Relocate::relocate): Likewise.
12928 * testsuite/weak_plt.sh: New test.
12929 * testsuite/weak_plt_main.cc: New test.
12930 * testsuite/weak_plt_shared.cc: New test.
12931 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12932 (check_PROGRAMS): Add weak_plt.
12933 (check_DATA): Add weak_plt_shared.so.
12934 (weak_plt_main_pic.o, weak_plt): New targets.
12935 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12936 * testsuite/Makefile.in: Rebuild.
12937
12938 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12939 gcctestdir/ld.
12940 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12941 * testsuite/Makefile.in: Rebuild.
12942
12943 2008-08-04 Alan Modra <amodra@bigpond.net.au>
12944
12945 * Makefile.am (POTFILES.in): Set LC_ALL=C.
12946 * Makefile.in: Regenerate.
12947 * po/POTFILES.in: Regenerate.
12948
12949 2008-07-29 Ian Lance Taylor <iant@google.com>
12950
12951 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12952 symbols before other symbols.
12953 * testsuite/script_test_2.cc (test_addr): Declare.
12954 (test_addr_alias): Declare.
12955 (main): Check that test_addr and test_addr_alias have the right
12956 values.
12957 * testsuite/script_test_2.t: Define test_addr_alias and
12958 test_addr.
12959
12960 2008-07-24 Ian Lance Taylor <iant@google.com>
12961
12962 PR 5990
12963 * descriptors.cc: New file.
12964 * descriptors.h: New file.
12965 * gold-threads.h (class Hold_optional_lock): New class.
12966 * fileread.cc: Include "descriptors.h".
12967 (File_read::~File_read): Release descriptor rather than closing
12968 it.
12969 (File_read::open) [file]: Call open_descriptor rather than open.
12970 Set is_descriptor_opened_.
12971 (File_read::open) [memory]: Assert that descriptor is not open.
12972 (File_read::reopen_descriptor): New function.
12973 (File_read::release): Release descriptor.
12974 (File_read::do_read): Make non-const. Reopen descriptor.
12975 (File_read::read): Make non-const.
12976 (File_read::make_view): Reopen descriptor.
12977 (File_read::do_readv): Likewise.
12978 * fileread.h (class File_read): Add is_descriptor_opened_ field.
12979 Update declarations.
12980 * layout.cc: Include "descriptors.h".
12981 (Layout::create_build_id): Use open_descriptor rather than open.
12982 * output.cc: Include "descriptors.h".
12983 (Output_file::open): Use open_descriptor rather than open.
12984 * archive.cc (Archive::const_iterator): Change Archive to be
12985 non-const.
12986 (Archive::begin, Archive::end): Make non-const.
12987 (Archive::count_members): Likewise.
12988 * archive.h (class Archive): Update declarations.
12989 * object.h (Object::read): Make non-const.
12990 * Makefile.am (CCFILES): Add descriptors.cc.
12991 (HFILES): Add descriptors.h.
12992 * Makefile.in: Rebuild.
12993
12994 PR 6716
12995 * gold.h: Always include <clocale>. Add Solaris workarounds
12996 following code in binutils/sysdep.h.
12997
12998 PR 6048
12999 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13000 this->eh_frame_hdr_ is NULL before using it.
13001
13002 * dynobj.cc (Versions::Versions): Update comment.
13003
13004 * dynobj.cc (Versions::Versions): If there is an soname, use it as
13005 the base version name.
13006
13007 * stringpool.cc (Stringpool_template::add_with_length): Set key to
13008 array size plus one.
13009 (Stringpool_template::set_string_offsets): Subtract one from key
13010 before using it as an array index.
13011 (Stringpool_template::get_offset_with_length): Likewise.
13012 (Stringpool_template::write_to_buffer): Likewise.
13013 * stringpool.h (Stringpool_template::get_offset_from_key):
13014 Likewise.
13015
13016 2008-07-23 Ian Lance Taylor <iant@google.com>
13017
13018 PR 6658
13019 * object.h (Merged_symbol_value::value): Do our best to handle a
13020 negative addend.
13021
13022 PR 6647
13023 * script.cc (Version_script_info::get_versions): Don't add empty
13024 version tag to return value.
13025 (Version_script_info::get_symbol_version_helper): Change return
13026 type to bool. Add pversion parameter. Change all callers.
13027 (script_register_vers_node): Don't require a non-NULL tag.
13028 * script.h (class Version_script_info): Update declarations.
13029 (Version_script_info::get_symbol_version): Change return type to
13030 bool. Add version parameter. Change all callers.
13031 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13032 handling. Handle an empty version from a version script.
13033 (Symbol_table::define_special_symbol): Likewise.
13034 * testsuite/ver_test_10.script: New file.
13035 * testsuite/ver_test_10.sh: New file.
13036 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13037 (check_DATA): Add ver_test_10.syms.
13038 (ver_test_10.syms, ver_test_10.so): New target.
13039 * testsuite/Makefile.in: Rebuild.
13040
13041 2008-07-23 Simon Baldwin <simonb@google.com>
13042
13043 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13044 to zero for undefined symbols from dynamic libraries.
13045
13046 2008-07-23 Ian Lance Taylor <iant@google.com>
13047
13048 * symtab.cc (Symbol_table::resolve): Remove version parameter.
13049 Change all callers.
13050 * symtab.h (class Symbol_table): Update declaration.
13051 * testsuite/ver_test_9.cc: New file.
13052 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13053 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13054 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13055 (ver_test_9.so, ver_test_9.o): New targets.
13056 * testsuite/Makefile.in: Rebuild.
13057
13058 2008-07-22 Ian Lance Taylor <iant@google.com>
13059
13060 * options.h (class General_options): Define --check-sections.
13061 * layout.cc (Layout::set_segment_offsets): Handle
13062 --check-sections.
13063
13064 * options.h (class General_options): Define -n/--nmagic and
13065 -N/--omagic.
13066 * options.cc (General_options::finalize): For -n/--nmagic or
13067 -N/--omagic, set -static.
13068 * layout.cc (Layout::attach_allocated_section_to_segment): If
13069 -N/--omagic, don't put read-only and read-write sections in
13070 different segments.
13071 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13072 finding a read-only segment.
13073 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13074 don't set the minimum segment alignment to the common page size,
13075 and don't set the file offset to the address modulo the page size.
13076 * script-sections.cc (Script_sections::create_segments): If
13077 -n/--omagic, don't put read-only and read-write sections in
13078 different segments.
13079
13080 * cref.cc: New file.
13081 * cref.h: New file.
13082 * options.h (class General_options): Add --print-symbol-counts.
13083 * main.cc (main): Issue defined symbol report if requested.
13084 * archive.cc (Archive::interpret_header): Make into a const member
13085 function.
13086 (Archive::add_symbols): Call Input_objects::archive_start and
13087 archive_stop.
13088 (Archive::const_iterator): Define new class.
13089 (Archive::begin, Archive::end): New functions.
13090 (Archive::include_all_members): Rewrite to use iterator.
13091 (Archive::count_members): New function.
13092 * archive.h (class Archive): Update declarations.
13093 (Archive::filename): New function.
13094 * object.cc: Include "cref.h".
13095 (Sized_relobj::Sized_relobj): Initialize defined_count_.
13096 (Sized_relobj::do_get_global_symbol_counts): New function.
13097 (Input_objects::add_object): Add object to cross-referencer.
13098 (Input_objects::archive_start): New function.
13099 (Input_objects::archive_stop): New function.
13100 (Input_objects::print_symbol_counts): New function.
13101 * object.h: Declare Cref and Archive.
13102 (Object::get_global_symbol_counts): New function.
13103 (Object::do_get_global_symbol_counts): New pure virtual function.
13104 (class Sized_relobj): Add defined_count_ field. Update
13105 declarations.
13106 (class Input_objects): Add cref_ field. Update constructor.
13107 Update declarations.
13108 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13109 defined_count_.
13110 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13111 symbol counts.
13112 (Sized_dynobj::do_get_global_symbol_counts): New function.
13113 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13114 defined_count_. Update declarations. Define Symbols typedef.
13115 * symtab.cc (Symbol_table::add_from_relobj): Add defined
13116 parameter. Change all callers.
13117 (Symbol_table::add_from_dynobj): Add sympointers and defined
13118 parameters. Change all callers.
13119 * symtab.h (class Symbol_table): Update declarations.
13120 * Makefile.am (CCFILES): Add cref.cc.
13121 (HFILES): Add cref.h.
13122 * Makefile.in: Rebuild.
13123
13124 2008-07-22 Simon Baldwin <simonb@google.com>
13125
13126 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13127 to zero when writing undefined symbols.
13128
13129 2008-07-22 Ian Lance Taylor <iant@google.com>
13130
13131 * output.cc (Output_section::add_input_section): Don't try to
13132 merge empty merge sections.
13133
13134 2008-07-21 Craig Silverstein <csilvers@google.com>
13135
13136 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13137 Include symbol version in error message.
13138
13139 2008-07-20 Chris Demetriou <cgd@google.com>
13140
13141 * configure.ac (gold_cv_c_random_seed): New configured variable.
13142 (RANDOM_SEED_CFLAGS): New substituted variable.
13143 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13144 * configure: Rebuild.
13145 * Makefile.in: Likewise.
13146 * testsuite/Makefile.in: Likewise.
13147
13148 2008-07-18 Ian Lance Taylor <iant@google.com>
13149
13150 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13151 where we see NAME/NULL and NAME/VERSION as separate symbols.
13152 * testsuite/ver_test_main.cc (main): Call t4.
13153 (t4, t4_2a): Define.
13154 * testsuite/ver_test_2.cc (t4_2): Define.
13155 * testsuite/ver_test_2.script: Put t4_2a in VER2.
13156 * testsuite/ver_test_4.cc (t4_2a): Define.
13157 * testsuite/ver_test_4.script: Put t4_2a in VER2.
13158 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13159
13160 2008-07-17 Ian Lance Taylor <iant@google.com>
13161
13162 * dynobj.cc (Versions::add_def): If we give an error about a
13163 missing version, go ahead and create the version anyhow.
13164
13165 2008-07-10 Ian Lance Taylor <iant@google.com>
13166
13167 Handle output sections with more than 0x7fffffff bytes.
13168 * object.h (class Relobj): Change map_to_output_ to
13169 output_sections_, and just keep a section pointer. Change all
13170 uses. Move comdat group support to Sized_relobj.
13171 (Relobj::is_section_specially_mapped): Remove.
13172 (Relobj::output_section): Remove poff parameter. Change all
13173 callers.
13174 (Relobj::output_section_offset): New function.
13175 (Relobj::set_section_offset): Rewrite.
13176 (Relobj::map_to_output): Remove.
13177 (Relobj::output_sections): New function.
13178 (Relobj::do_output_section_offset): New pure virtual function.
13179 (Relobj::do_set_section_offset): Likewise.
13180 (class Sized_relobj): Add section_offsets_ field. Add comdat
13181 group support from Relobj. Update declarations.
13182 (Sized_relobj::get_output_section_offset): New function.
13183 (Sized_relobj::do_output_section_offset): New function.
13184 (Sized_relobj::do_set_section_offset): New function.
13185 * object.cc (Relobj::output_section_address): Remove.
13186 (Sized_relobj::Sized_relobj): Initialize new fields.
13187 (Sized_relobj::include_section_group): Cast find_kept_object to
13188 Sized_relobj.
13189 (Sized_relobj::include_linkonce_section): Likewise.
13190 (Sized_relobj::do_layout): Use separate arrays for output section
13191 and output offset.
13192 (Sized_relobj::do_count_local_symbols): Change map_to_output to
13193 output_sections.
13194 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13195 output_sections and section_offsets.
13196 (Sized_relobj::write_local_symbols): Likewise.
13197 (map_to_kept_section): Compute output address directly.
13198 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13199 output_sections and section_offsets.
13200 (Sized_relobj::write_sections): Likewise.
13201 (Sized_relobj::relocate_sections): Likewise.
13202 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13203 * output.h (class Output_reloc): Update declarations. Change
13204 u2_.relobj to Sized_relobj*.
13205 (class Output_data_reloc): Change add functions to use
13206 Sized_relobj*.
13207 * output.cc (Output_reloc::Output_reloc): Change relobj to
13208 Sized_relobj*.
13209 (Output_reloc::local_section_offset): Change return type to
13210 Elf_Addr. Use get_output_section_offset.
13211 (Output_reloc::get_address): Likewise.
13212 (Output_section::is_input_address_mapped): Don't call
13213 is_section_specially_mapped.
13214 (Output_section::output_offset): Likewise.
13215 (Output_section::output_address): Likewise.
13216 (Output_section::starting_output_address): Likewise.
13217 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13218 parameter to Sized_relobj*.
13219 (Copy_relocs::need_copy_reloc): Likewise.
13220 (Copy_relocs::save): Likewise.
13221 * copy-relocs.h (class Copy_relocs): Update declarations.
13222 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13223 Sized_relobj*. Change relobj_ field to Sized_relobj*.
13224 * target-reloc.h (relocate_for_relocatable): Change
13225 offset_in_output_section type to Elf_Addr. Change code that uses
13226 it as well.
13227 * layout.cc (Layout::layout): Always set *off.
13228 * mapfile.cc (Mapfile::print_input_section): Use
13229 output_section_offset.
13230 * i386.cc (Target_i386::copy_reloc): Change object parameter to
13231 Sized_relobj*.
13232 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13233 * sparc.cc (Target_sparc::copy_reloc): Likewise.
13234 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13235
13236 2008-07-03 Ian Lance Taylor <iant@google.com>
13237
13238 * layout.cc (Layout::include_section): Do not discard unrecognized
13239 SHT_STRTAB sections.
13240
13241 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
13242
13243 * script.cc (Lex::can_continue_name): Make '?' allowable in
13244 version-script names.
13245 * testsuite/version_script.map: Change glob pattern to use '?'
13246
13247 2008-06-30 Manish Singh <yosh@gimp.org>
13248
13249 PR 6585
13250 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13251 Correct typo.
13252
13253 2008-06-30 Ian Lance Taylor <iant@google.com>
13254
13255 PR 6660
13256 PR 6682
13257 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13258 versions]: Don't try to read the value in the contents, since we
13259 don't use it. Use the template endianness when writing.
13260
13261 2008-06-25 Cary Coutant <ccoutant@google.com>
13262
13263 * fileread.cc (File_read::make_view): Assert on zero-length view.
13264 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13265 symbol table when there are no symbols to read.
13266
13267 2008-06-23 Craig Silverstein <csilvers@google.com>
13268
13269 * version.cc (version_string): Bump to 1.7
13270
13271 2008-06-18 Craig Silverstein <csilvers@google.com>
13272
13273 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13274 constant 0xFFFF to type Valtype.
13275 (Powerpc_relocate_functions::rel16_ha): Likewise.
13276
13277 2008-06-17 Ian Lance Taylor <iant@google.com>
13278
13279 * output.h (Output_section::Input_section): Initialize p2align_ to
13280 zero for Output_section_data constructors.
13281 (Output_section::Input_section::addralign): If not an input
13282 section, return the alignment of the Output_section_data.
13283 * testsuite/copy_test.cc: New file.
13284 * testsuite/copy_test_1.cc: New file.
13285 * testsuite/copy_test_2.cc: New file.
13286 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13287 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13288 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13289 (copy_test_1_pic.o, copy_test_1.so): New targets.
13290 (copy_test_2_pic.o, copy_test_2.so): New targets.
13291 * testsuite/Makefile.in: Rebuild.
13292
13293 * script-sections.cc (Script_sections::place_orphan): Initialize
13294 local variable exact.
13295
13296 2008-06-13 David Edelsohn <edelsohn@gnu.org>
13297
13298 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13299
13300 2008-06-12 David Edelsohn <edelsohn@gnu.org>
13301 David S. Miller <davem@davemloft.net>
13302
13303 * powerpc.cc: New file.
13304 * Makefile.am (TARGETSOURCES): Add powerpc.cc
13305 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13306 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13307 * Makefile.in: Rebuild.
13308
13309 2008-06-09 Ian Lance Taylor <iant@google.com>
13310
13311 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13312 <exception>.
13313 (throwing, orig_terminate): New static variables.
13314 (terminate_handler): New static function.
13315 (t2): Set terminate handler.
13316
13317 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
13318
13319 PR 6584
13320 * binary.cc (Binary_to_elf::sized_convert): Fix .data
13321 alignment.
13322
13323 2008-05-30 Cary Coutant <ccoutant@google.com>
13324
13325 * archive.cc (Archive::include_all_members) Correct to step
13326 over symbol table and extended name table in thin archives.
13327
13328 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
13329
13330 PR 6407
13331 * target-reloc.h (relocate_for_relocatable): Fix new_offset
13332 calculation.
13333
13334 2008-05-28 Caleb Howe <cshowe@google.com>
13335
13336 * reduced_debug_output.cc: New file.
13337 * reduced_debug_output.h: New file.
13338 * options.h (class General_options): Add --strip-debug-non-line.
13339 * options.cc (General_options::finalize): Add strip_debug_non_line
13340 to the strip heirarchy.
13341 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13342 fields.
13343 * layout.cc: Include "reduced_debug_output.h".
13344 (Layout::Layout): Initialize new fields.
13345 (line_only_debug_sections): New static array.
13346 (is_lines_only_debug_sections): New static inline function.
13347 (Layout::include_section): Handle --strip-debug-non-line.
13348 (Layout::make_output_section): If --strip-debug-non-line, build
13349 new output sections for .debug_abbrev and .debug_info.
13350 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13351 gold. Warn about possible overflow.
13352 (read_signed_LEB_128): Likewise.
13353 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13354 (read_signed_LEB_128): Declare.
13355 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13356 (HFILES): Add reduced_debug_output.h.
13357 * Makefile.in: Rebuild.
13358
13359 2008-05-21 Ian Lance Taylor <iant@google.com>
13360
13361 * mapfile.cc: New file.
13362 * mapfile.h: New file.
13363 * options.h (class General_options): Add -M/--print-map and -Map.
13364 * options.cc (General_options::finalize): Make -M equivalent to
13365 -Map -.
13366 * main.cc: Include <cstdio> and "mapfile.h".
13367 (main): Open mapfile if requested.
13368 * gold.cc (class Middle_runner): Add mapfile_ field. Update
13369 constructor. Change caller.
13370 (queue_initial_tasks): Add mapfile parameter. Change caller.
13371 (queue_middle_tasks): Likewise.
13372 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13373 declarations.
13374 * archive.cc: Include "mapfile.h".
13375 (Archive::add_symbols): Add mapfile parameter. Change all
13376 callers. Pass mapfile, symbol, and reason to include_member.
13377 (Archive::include_all_members): Add mapfile parameter. Change all
13378 callers.
13379 (Archive::include_member): Add mapfile, sym, and why parameters.
13380 Change all callers. Report inclusion to map file.
13381 * archive.h: Include "fileread.h".
13382 (class Archive): Update declarations.
13383 (Archive::file): New const method.
13384 (class Add_archive_symbols): Add mapfile_ field. Update
13385 constructor. Change all callers.
13386 * readsyms.h (class Read_symbols): Likewise.
13387 (class Finish_group): Likewise.
13388 (class Read_script): Likewise.
13389 * common.cc: Include "mapfile.h".
13390 (Symbol_table::allocate_commons): Add mapfile parameter. Change
13391 all callers.
13392 (Symbol_table::do_allocate_commons): Likewise.
13393 (Symbol_table::do_allocate_commons_list): Likewise. Report common
13394 symbol allocation to mapfile.
13395 * common.h (class Allocate_commons_task): Add mapfile_ field.
13396 Update constructor. Change all callers.
13397 * symtab.h (class Symbol_table): Update declarations.
13398 * layout.cc: Include "mapfile.h".
13399 (Layout_task_runner::run): Print information to mapfile.
13400 (Layout::create_gold_note): Change Output_data_fixed_space to
13401 Output_data_zero_fill.
13402 (Layout::create_build_id): Likewise.
13403 (Layout::print_to_mapfile): New function.
13404 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
13405 constructor. Change caller.
13406 (class Layout): Declare print_to_mapfile.
13407 * output.cc (Output_section::Input_section::print_to_mapfile): New
13408 function.
13409 (Output_section::add_input_section): If producing a map, always
13410 add to input_sections_ list.
13411 (Output_section::do_print_to_mapfile): New function.
13412 (Output_segment::print_sections_to_mapfile): New function.
13413 (Output_segment::print_section_list_to_mapfile): New function.
13414 * output.h: Include "mapfile.h".
13415 (Output_data::print_to_mapfile): New function.
13416 (Output_data::do_print_to_mapfile): New virtual function.
13417 (Output_segment_headers::do_print_to_mapfile): New function.
13418 (Output_file_header::do_print_to_mapfile): New function.
13419 (Output_data_const::do_print_to_mapfile): New function.
13420 (class Output_data_const_buffer): Add map_name_ field. Update
13421 constructor. Change all callers. Add do_print_to_mapfile
13422 function.
13423 (class Output_data_fixed_space): Likewise.
13424 (class Output_data_space): Likewise.
13425 (class Output_data_zero_fill): New class.
13426 (Output_data_strtab::do_print_to_mapfile): New function.
13427 (Output_data_reloc_base::do_print_to_mapfile): New function.
13428 (Output_relocatable_relocs::do_print_to_mapfile): New function.
13429 (Output_data_group::do_print_to_mapfile): New function.
13430 (Output_data_got::do_print_to_mapfile): New function.
13431 (Output_data_dynamic::do_print_to_mapfile): New function.
13432 (Output_symtab_xindex::do_print_to_mapfile): New function.
13433 (class Output_section): Declare do_print_to_mapflie. Declare
13434 print_to_mapfile in Input_section.
13435 (class Output_segment): Declare new functions.
13436 * object.h (Sized_relobj::symbol_count): New function.
13437 * script-sections.cc
13438 (Output_section_element_dot_assignment::set_section_addresses):
13439 Change Output_data_fixed_space to Output_data_zero_fill.
13440 (Output_data_expression::do_print_to_mapfile): New function.
13441 * script.cc (read_input_script): Add mapfile parameter. Change
13442 all callers.
13443 * script.h (read_input_script): Update declaration.
13444 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13445 (Eh_frame::do_print_to_mapfile): New function.
13446 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13447 (Output_merge_string::do_print_to_mapfile): New function.
13448 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13449 function.
13450 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13451 function.
13452 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13453 function.
13454 * Makefile.am (CCFILES): Add mapfile.cc.
13455 (HFILES): Add mapfile.h.
13456 * Makefile.in: Rebuild.
13457
13458 2008-05-19 Ian Lance Taylor <iant@google.com>
13459
13460 * options.h (class General_options): Add -z relro.
13461 * layout.cc (Layout::Layout): Initialize relro_segment_.
13462 (Layout::add_output_section_data): Return the output section.
13463 (Layout::make_output_section): Rcognize relro sections and mark
13464 them appropriately.
13465 (Layout::attach_allocated_section_to_segment): Put relro sections
13466 in a PT_GNU_RELRO segment.
13467 (Layout::create_initial_dynamic_sections): Mark the .dynamic
13468 section as relro.
13469 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13470 PT_TLS segments.
13471 (Layout::linkonce_mapping): Map d.rel.ro.local to
13472 .data.rel.ro.local.
13473 (Layout::output_section_name): Us .data.rel.ro.local for any
13474 section which begins with that.
13475 * layout.h (class Layout): Update add_output_section_data
13476 declaration. Add relro_segment_ field.
13477 * output.cc (Output_section::Output_section): Initialize is_relro_
13478 and is_relro_local_ fields.
13479 (Output_segment::add_output_section): Group relro sections.
13480 (Output_segment::is_first_section_relro): New function.
13481 (Output_segment::maximum_alignment): If there is a relro section,
13482 align the segment to the common page size.
13483 (Output_segment::set_section_addresses): Track whether we are
13484 looking at relro sections. If the last section is a relro
13485 section, align to the common page size.
13486 (Output_segment::set_section_list_addresses): Add in_relro
13487 parameter. Change all callers. Align to the page size when
13488 moving from relro to non-relro section.
13489 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13490 segment.
13491 * output.h (class Output_section): Add is_relro_ and
13492 is_relro_local_ fields.
13493 (Output_section::is_relro): New function.
13494 (Output_section::set_is_relro): New function.
13495 (Output_section::is_relro_local): New function.
13496 (Output_section::set_is_relro_local): New function.
13497 (class Output_segment): Update declarations.
13498 * i386.cc (Target_i386::got_section): Mark .got section as relro.
13499 * sparc.cc (Target_sparc::got_section): Likewise.
13500 * x86_64.cc (Target_x86_64::got_section): Likewise.
13501 * testsuite/relro_test_main.cc: New file.
13502 * testsuite/relro_test.cc: New file.
13503 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13504 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13505 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13506 (relro_test.so, relro_test_pic.o): New targets.
13507 * testsuite/Makefile.in: Rebuild.
13508
13509 2008-05-16 Ian Lance Taylor <iant@google.com>
13510
13511 * output.cc (Output_segment::add_output_section): Remove front
13512 parameter.
13513 * output.h (class Output_segment): Remove
13514 add_initial_output_section and overloaded add_output_section.
13515 Update declaration of remaining add_output_section.
13516 * layout.cc (Layout::create_interp): Call add_output_section
13517 rather than add_initial_output_section.
13518 (Layout::finish_dynamic_section): Likewise.
13519
13520 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13521 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
13522 know the dynamic type.
13523 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13524 field. Initialize it in constructor.
13525 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13526 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13527 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13528 reloc.
13529
13530 * output.cc (Output_reloc::get_address): Change return type to
13531 Elf_Addr.
13532 * output.h (class Output_reloc): Update get_address declaration.
13533 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13534 for section addresses.
13535
13536 2008-05-09 Ian Lance Taylor <iant@google.com>
13537
13538 PR 6493
13539 * gold.cc (gold_nomem): Use return value of write.
13540
13541 2008-05-08 Ian Lance Taylor <iant@google.com>
13542
13543 * symtab.c (Symbol::init_base_output_data): Add version
13544 parameter. Change all callers.
13545 (Symbol::init_base_output_segment): Likewise.
13546 (Symbol::init_base_constant): Likewise.
13547 (Symbol::init_base_undefined): Likewise.
13548 (Sized_symbol::init_output_data): Likewise.
13549 (Sized_symbol::init_output_segment): Likewise.
13550 (Sized_symbol::init_constant): Likewise.
13551 (Sized_symbol::init_undefined): Likewise.
13552 (Symbol_table::do_define_in_output_data): If the new symbol has a
13553 version, mark it as the default.
13554 (Symbol_table::do_define_in_output_segment): Likewise.
13555 (Symbol_table::do_define_as_constant): Likewise.
13556 * symtab.h (class Symbol): Update declarations.
13557 (class Sized_symbol): Likewise.
13558 * resolve.cc (Symbol::override_version): New function.
13559 (Symbol::override_base): Call override_version.
13560 (Symbol::override_base_with_special): Likewise.
13561 * testsuite/ver_script_8.script: New file.
13562 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13563 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13564 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13565 (ver_test_8_1.so, ver_test_8_2.so): New targets.
13566
13567 2008-05-06 Ian Lance Taylor <iant@google.com>
13568
13569 PR 6049
13570 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13571 functions.
13572 (class General_options): Remove existing --undefined, and add
13573 --no-undefined instead. Add new --undefined as synonym for -u.
13574 * archive.cc (Archive::add_symbols): Check whether symbol was
13575 named with -u.
13576 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13577 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13578 all uses. Add IS_UNDEFINED. Update declarations to split
13579 different versions of init_base. Declare init_base_undefined.
13580 (Symbol::is_defined): Handle IS_UNDEFINED.
13581 (Symbol::is_undefined): Likewise.
13582 (Symbol::is_weak_undefined): Call is_undefined.
13583 (Symbol::is_absolute): Handle IS_CONSTANT.
13584 (class Sized_symbol): Update declarations to split different
13585 versions of init. Declare init_undefined.
13586 (class Symbol_table): Declare new functions.
13587 * symtab.cc (Symbol::init_base_object): Rename from init_base.
13588 Change all callers.
13589 (Symbol::init_base_output_data): Likewise.
13590 (Symbol::init_base_output_segment): Likewise.
13591 (Symbol::init_base_constant): Likewise.
13592 (Symbol::init_base_undefined): New function.
13593 (Sized_symbol::init_object): Rename from init. Change all
13594 callers.
13595 (Sized_symbol::init_output_data): Likewise.
13596 (Sized_symbol::init_output_segment): Likewise.
13597 (Sized_symbol::init_constant): Likewise.
13598 (Sized_symbol::init_undefined): New function.
13599 (Symbol_table::add_undefined_symbols_from_command_line): New
13600 function.
13601 (Symbol_table::do_add_undefined_symbols_from_command_line): New
13602 function.
13603 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13604 (Symbol::output_section): Likewise.
13605 (Symbol::set_output_section): Likewise.
13606 (Symbol_table::sized_finalize_symbol): Likewise.
13607 (Symbol_table::sized_write_globals): Likewise.
13608 * resolve.cc (Symbol_table::should_override): Likewise.
13609 (Symbol::override_base_with_special): Likewise.
13610
13611 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13612 symbol, change it to have default visibility.
13613 * testsuite/protected_1.cc: New file.
13614 * testsuite/protected_2.cc: New file.
13615 * testsuite/protected_3.cc: New file.
13616 * testsuite/protected_main_1.cc: New file.
13617 * testsuite/protected_main_2.cc: New file.
13618 * testsuite/protected_main_3.cc: New file.
13619 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13620 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13621 (protected_1_LDFLAGS, protected_1_LDADD): Define.
13622 (protected_1.so): New target.
13623 (protected_1_pic.o, protected_2_pic.o): New targets.
13624 (protected_3_pic.o): New target.
13625 (check_PROGRAMS): Add protected_2.
13626 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13627 (protected_2_LDFLAGS, protected_2_LDADD): Define.
13628 * testsuite/Makefile.in: Rebuild.
13629
13630 * options.h (DEFINE_var): Add set_user_set_##varname__.
13631 (DEFINE_bool_alias): New macro.
13632 (class General_options): Define -Bstatic using DEFINE_bool_alias
13633 rather than DEFINE_special. Add --undefined as an alias for -z
13634 defs.
13635 * options.cc (General_options::parse_Bstatic): Remove.
13636
13637 * options.h (class General_options): Add --fatal-warnings.
13638 * main.cc (main): Implement --fatal-warnings.
13639 * errors.h (Errors::warning_count): New function.
13640
13641 * options.h (class General_options): Add -Bsymbolic-functions.
13642 * symtab.h (Symbol::is_preemptible): Check for
13643 -Bsymbolic-functions.
13644
13645 2008-05-05 Ian Lance Taylor <iant@google.com>
13646
13647 * options.h (DEFINE_bool): For DASH_Z, create the negative option
13648 as noVARNAME rather than no-VARNAME.
13649 (class General_options): Add option -z combreloc.
13650 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13651 get_address.
13652 (Output_reloc::sort_before) [SHT_REL]: New function.
13653 (Output_reloc::sort_before) [SHT_RELA]: New function.
13654 (class Output_data_reloc_base): Add sort_relocs_ field. Define
13655 Sort_relocs_comparison.
13656 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13657 parameter. Change all callers.
13658 (Output_data_reloc::Output_data_reloc) [both versions]: Add
13659 sort_relocs parameter. Change all callers.
13660 * output.cc (Output_reloc::get_address): New function, broken out
13661 of write_rel.
13662 (Output_reloc::write_rel): Call it.
13663 (Output_reloc::compare): New function.
13664 (Output_data_reloc_base::do_write): Optionally sort relocs.
13665
13666 * configure.ac: If targ_extra_obj is set, link it in.
13667 * configure.tgt: Initialize all variables.
13668 (x86_64*): Set targ_extra_obj and targ_extra_size.
13669 * configure: Rebuild.
13670
13671 * object.cc (Sized_relobj::include_section_group): Adjust section
13672 indexes read from group data. Build vector to pass to
13673 layout_group.
13674 * layout.cc (Layout::layout_group): Add flags and shndxes
13675 parameters. Remove contents parameter. Change caller. Update
13676 explicit instantiations.
13677 * layout.h (class Layout): Update layout_group declaration.
13678 * output.cc (Output_data_group::Output_data_group): Add flags and
13679 input_shndxes parameters. Remove contents parameter. Change
13680 caller.
13681 (Output_data_group::do_write): Change input_sections_ to
13682 input_shndxes_.
13683 * output.h (class Output_data_group): Update constructor
13684 declaration. Rename input_sections_ to input_shndxes_.
13685 * testsuite/many_sections_test.cc: Add template.
13686
13687 2008-04-30 Cary Coutant <ccoutant@google.com>
13688
13689 * target-reloc.h (relocate_section): Fix dead-pointer bug.
13690
13691 * layout.cc (Layout::include_section): Refactored check for debug
13692 info section.
13693 (Layout::add_comdat): Add new parameters. Change type
13694 of signature parameter. Add object and shndx to signatures table.
13695 (Layout::find_kept_object): New function.
13696 * layout.h: Include <cstring>.
13697 (Layout::is_debug_info_section): New function.
13698 (Layout::add_comdat): Add new parameters.
13699 (Layout::find_kept_object): New function.
13700 (Layout::Kept_section): New struct.
13701 (Layout::Signatures): Change type of map range.
13702 * object.cc (Relobj::output_section_address): New function.
13703 (Sized_relobj::include_section_group): Add new parameters. Change
13704 calls to Layout::add_comdat. Change to build table of kept comdat
13705 groups and table mapping discarded sections to kept sections.
13706 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
13707 (Sized_relobj::do_layout): Change calls to include_section_group and
13708 include_linkonce_section.
13709 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13710 value to zero when section is discarded.
13711 (Sized_relobj::map_to_kept_section): New function.
13712 * object.h (Relobj::output_section_address): New function.
13713 (Relobj::Comdat_group): New type.
13714 (Relobj::find_comdat_group): New function.
13715 (Relobj::Comdat_group_table): New type.
13716 (Relobj::Kept_comdat_section): New type.
13717 (Relobj::Kept_comdat_section_table): New type.
13718 (Relobj::add_comdat_group): New function.
13719 (Relobj::set_kept_comdat_section): New function.
13720 (Relobj::get_kept_comdat_section): New function.
13721 (Relobj::comdat_groups_): New field.
13722 (Relobj::kept_comdat_sections_): New field.
13723 (Symbol_value::input_value): Update comment.
13724 (Sized_relobj::map_to_kept_section) New function.
13725 (Sized_relobj::include_linkonce_section): Add new parameter.
13726 * target-reloc.h (Comdat_behavior): New type.
13727 (get_comdat_behavior): New function.
13728 (relocate_section): Add code to map a discarded section to the
13729 corresponding kept section when applying a relocation.
13730
13731 2008-04-30 Craig Silverstein <csilvers@google.com>
13732
13733 * dwarf_reader.cc (next_generation_count): New static var.
13734 (Addr2line_cache_entry): New struct.
13735 (addr2line_cache): New static var.
13736 (Dwarf_line_info::one_addr2line): Added caching.
13737 (Dwarf_line_info::clear_addr2line_cache): New function.
13738 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13739 cache-size parameter.
13740 (Dwarf_line_info::one_addr2line_cache): New function.
13741 * symtab.cc (Symbol_table::detect_odr_violations): Pass
13742 new cache-size argument to one_addr2line(), and clear cache.
13743
13744 2008-04-28 Cary Coutant <ccoutant@google.com>
13745
13746 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13747 R_386_PC8 relocations.
13748
13749 2008-04-23 Ian Lance Taylor <iant@google.com>
13750
13751 * object.cc (Sized_relobj::include_section_group): Check for
13752 invalid section group.
13753
13754 * object.cc (make_elf_object): Correct test for 64-bit ELF file
13755 header size.
13756
13757 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13758 than read for file header.
13759 * archive.cc (Archive::include_member): Likewise.
13760
13761 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
13762
13763 * aclocal.m4: Regenerate.
13764 * configure: Regenerate.
13765
13766 2008-04-19 Ian Lance Taylor <iant@google.com>
13767
13768 * version.cc (version_string): Bump to 1.6.
13769
13770 * testsuite/Makefile.am (many_sections_r_test): New target.
13771 (many_sections_r_test_SOURCES): Remove.
13772 (many_sections_r_test_DEPENDENCIES): Remove.
13773 (many_sections_r_test_LDFLAGS): Remove.
13774 (many_sections_r_test_LDADD): Remove.
13775
13776 * object.cc (Sized_relobj::do_add_symbols): Always pass
13777 local_symbol_count_ to add_from_relobj.
13778
13779 * testsuite/Makefile.am (many_sections_check.h): Only check one in
13780 every thousand variables.
13781 * testsuite/Makefile.in: Rebuild.
13782
13783 * object.cc (Xindex::initialize_symtab_xindex): New function.
13784 (Xindex::read_symtab_xindex): New function.
13785 (Xindex::sym_xindex_to_shndx): New function.
13786 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13787 available.
13788 (Sized_relobj::do_initialize_xindex): New function.
13789 (Sized_relobj::do_read_symbols): Adjust section links.
13790 (Sized_relobj::symbol_section_and_value): Add is_ordinary
13791 parameter. Change all callers.
13792 (Sized_relobj::include_section_group): Adjust section links and
13793 symbol section indexes.
13794 (Sized_relobj::do_layout): Adjust section links.
13795 (Sized_relobj::do_count_local_symbols): Adjust section links and
13796 symbol section indexes.
13797 (Sized_relobj::do_finalize_local_symbols): Distinguish between
13798 ordinary and special symbols.
13799 (Sized_relobj::write_local_symbols): Add symtab_xindex and
13800 dynsym_xindex parameters. Change all callers. Adjust section
13801 links. Use SHN_XINDEX when needed.
13802 (Sized_relobj::get_symbol_location_info): Adjust section links.
13803 Don't get fooled by special symbols.
13804 * object.h (class Xindex): Define.
13805 (class Object): Add xindex_ parameter. Declare virtual functoin
13806 do_initialize_xindex.
13807 (Object::adjust_sym_shndx): New function.
13808 (Object::set_xindex): New protected function.
13809 (class Symbol_value): Add is_ordinary_shndx_ field.
13810 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13811 (Symbol_value::value): Assert ordinary section.
13812 (Symbol_value::initialize_input_to_output_map): Likewise.
13813 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13814 Change all callers.
13815 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
13816 all callers.
13817 (class Sized_relobj): Update declarations.
13818 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13819 parameter. Change all callers.
13820 (Sized_relobj::adjust_shndx): New function.
13821 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13822 field.
13823 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13824 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
13825 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
13826 (Sized_dynobj::read_dynsym_section): Adjust section links.
13827 (Sized_dynobj::read_dynamic): Likewise.
13828 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
13829 section links.
13830 (Sized_dynobj::do_initialize_xindex): New function.
13831 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
13832 do_initialize_xindex.
13833 (Sized_dynobj::adjust_shndx): New function.
13834 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13835 dynsym_xindex_ fields.
13836 (Layout::finalize): Add a call to set_section_indexes before
13837 creating the symtab sections.
13838 (Layout::set_section_indexes): Don't do anything if the section
13839 already has a section index.
13840 (Layout::create_symtab_sections): Add shnum parameter. Change
13841 caller. Create .symtab_shndx section if needed.
13842 (Layout::create_shdrs): Add shstrtab_section parameter. Change
13843 caller.
13844 (Layout::allocated_output_section_count): New function.
13845 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13846 needed.
13847 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13848 fields. Update declarations.
13849 (Layout::symtab_xindex): New function.
13850 (Layout::dynsym_xindex): New function.
13851 (class Write_symbols_task): Add layout_ field.
13852 (Write_symbols_task::Write_symbols_task): Add layout parameter.
13853 Change caller.
13854 * output.cc (Output_section_headers::Output_section_headers): Add
13855 shstrtab_section parameter. Change all callers.
13856 (Output_section_headers::do_sized_write): Store overflow values
13857 for section count and section string table section index in
13858 section header zero.
13859 (Output_file_header::do_sized_write): Check for overflow of
13860 section count and section string table section index.
13861 (Output_symtab_xindex::do_write): New function.
13862 (Output_symtab_xindex::endian_do_write): New function.
13863 * output.h (class Output_section_headers): Add shstrtab_section_.
13864 Update declarations.
13865 (class Output_symtab_xindex): Define.
13866 (Output_section::has_out_shndx): New function.
13867 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13868 field.
13869 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13870 Change all callers.
13871 (Sized_symbol::init): Likewise.
13872 (Symbol::output_section): Check for ordinary symbol.
13873 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
13874 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
13875 callers.
13876 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13877 Change all callers. Simplify handling of symbols from sections
13878 not included in the link.
13879 (Symbol_table::add_from_dynobj): Handle ordinary symbol
13880 distinction.
13881 (Weak_alias_sorter::operator()): Assert that symbols are
13882 ordinary.
13883 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13884 distinction.
13885 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13886 parameters. Change all callers.
13887 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
13888 symbol distinction. Use SHN_XINDEX when needed.
13889 (Symbol_table::write_section_symbol): Add symtab_xindex
13890 parameter. Change all callers.
13891 (Symbol_table::sized_write_section_symbol): Likewise. Use
13892 SHN_XINDEX when needed.
13893 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
13894 declarations.
13895 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
13896 (Symbol::is_defined): Check is_ordinary.
13897 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13898 (Symbol::is_absolute, Symbol::is_common): Likewise.
13899 (class Sized_symbol): Update declarations.
13900 (class Symbol_table): Update declarations.
13901 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13902 parameters. Change all callers.
13903 (Sized_symbol::override): Likewise.
13904 (Symbol_table::override): Likewise.
13905 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
13906 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
13907 is_ordinary, and orig_st_shndx parameters. Change all callers.
13908 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13909 to be in an ordinary section.
13910 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13911 object and is_ordinary parameters. Change all callers.
13912 (Sized_dwarf_line_info::read_relocs): Add object parameter.
13913 Change all callers. Don't add undefined or non-ordinary symbols
13914 to reloc_map_.
13915 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13916 Change all callers.
13917 * dwarf_reader.h (class Sized_dwarf_line_info): Update
13918 declarations.
13919 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13920 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13921 (Sized_relobj::relocate_sections): Likewise.
13922 * target-reloc.h (scan_relocs): Adjust section symbol index.
13923 (scan_relocatable_relocs): Likewise.
13924 * i386.cc (Scan::local): Check for ordinary symbols.
13925 * sparc.cc (Scan::local): Likewise.
13926 * x86_64.cc (Scan::local): Likewise.
13927 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13928 to symbol_section_and_value.
13929 * testsuite/many_sections_test.cc: New file.
13930 * testsuite/Makefile.am (BUILT_SOURCES): Define.
13931 (check_PROGRAMS): Add many_sections_test.
13932 (many_sections_test_SOURCES): Define.
13933 (many_sections_test_DEPENDENCIES): Define.
13934 (many_sections_test_LDFLAGS): Define.
13935 (BUILT_SOURCES): Add many_sections_define.h.
13936 (many_sections_define.h): New target.
13937 (BUILT_SOURCES): Add many_sections_check.h.
13938 (many_sections_check.h): New target.
13939 (check_PROGRAMS): Add many_sections_r_test.
13940 (many_sections_r_test_SOURCES): Define.
13941 (many_sections_r_test_DEPENDENCIES): Define.
13942 (many_sections_r_test_LDFLAGS): Define.
13943 (many_sections_r_test_LDADD): Define.
13944 (many_sections_r_test.o): New target.
13945 * testsuite/Makefile.in: Rebuild.
13946
13947 2008-04-17 Cary Coutant <ccoutant@google.com>
13948
13949 * errors.cc (Errors::info): New function.
13950 (gold_info): New function.
13951 * errors.h (Errors::info): New function.
13952 * gold.h (gold_info): New function.
13953 * object.cc (Input_objects::add_object): Print trace output.
13954 * options.cc (options::parse_set): New function.
13955 (General_options::parse_wrap): Deleted.
13956 (General_options::General_options): Deleted initializer.
13957 * options.h (options::String_set): New typedef.
13958 (options::parse_set): New function.
13959 (DEFINE_set): New macro.
13960 (General_options::wrap): Changed to use DEFINE_set. Changed
13961 callers of any_wrap_symbols and is_wrap_symbol.
13962 (General_options::trace, General_options::trace_symbol):
13963 New options.
13964 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13965 (General_options::wrap_symbols_): Deleted.
13966 * symtab.cc (Symbol_table::add_from_object): Print trace output.
13967
13968 2008-04-17 David S. Miller <davem@davemloft.net>
13969
13970 * options.cc (General_options::parse_V): New function.
13971 * options.h: Add entries for -V and -Qy.
13972
13973 2008-04-17 Ian Lance Taylor <iant@google.com>
13974
13975 * common.cc (Symbol_table::allocate_commons): Remove options
13976 parameter. Change caller.
13977 (Symbol_table::do_allocate_commons): Remove options parameter.
13978 Change caller. Just call do_allocate_commons_list twice.
13979 (Symbol_table::do_allocate_commons_list): New function, broken out
13980 of do_allocate_commons.
13981 * common.h (class Allocate_commons_task): Remove options_ field.
13982 Update constructor.
13983 * symtab.cc (Symbol_table::Symbol_table): Initialize
13984 tls_commons_.
13985 (Symbol_table::add_from_object): Put TLS common symbols on
13986 tls_commons_ list.
13987 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13988 which are IN_OUTPUT_DATA.
13989 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
13990 allocate_commons and do_allocate_commons declarations. Declare
13991 do_allocate_commons_list.
13992 * gold.cc (queue_middle_tasks): Update creation of
13993 Allocate_commons_task to not pass options.
13994 * testsuite/Makefile.am (INCLUDES): Add -I.. .
13995 (TLS_TEST_C_FLAGS): New variable.
13996 (tls_test_c_pic.o): New target.
13997 (tls_test_shared.so): Link in tls_test_c_pic.o.
13998 (tls_test_c_pic_ie.o): New target.
13999 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14000 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14001 (tls_test_c.o): New target.
14002 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14003 (tls_pic_test_LDADD): Likewise.
14004 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14005 (tls_shared_gd_to_ie_test_LDADD): Likewise.
14006 (tls_test_c_gnu2.o): New target.
14007 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14008 tls_test_c_gnu2.o.
14009 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14010 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14011 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14012 * testsuite/tls_test.cc: Include "config.h".
14013 (t_last): Call t11_last.
14014 * testsuite/tls_test.h (t11, t11_last): Declare.
14015 * testsuite/tls_test_c.c: New file.
14016 * testsuite/tls_test_main.cc (thread_routine): Call t11.
14017 * configure.ac: Check for OpenMP support.
14018 * configure, config.in, Makefile.in: Rebuild.
14019 * testsuite/Makefile.in: Rebuild.
14020
14021 2008-04-16 Cary Coutant <ccoutant@google.com>
14022
14023 * i386.cc (Target_i386::define_tls_base_symbol): New function.
14024 (Target_i386::tls_base_symbol_defined_): New field.
14025 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14026 (Target_i386::Scan::global): Likewise.
14027 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14028 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14029 (Target_x86_64::tls_base_symbol_defined_): New field.
14030 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14031 (Target_x86_64::Scan::global): Likewise.
14032
14033 2008-04-16 Cary Coutant <ccoutant@google.com>
14034
14035 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14036 (Symbol::needs_plt_entry): Allow weak undefined symbols.
14037 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14038 building shared libraries.
14039 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14040 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14041 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14042 * testsuite/Makefile.in: Rebuild.
14043 * testsuite/weak_undef.h: New file.
14044 * testsuite/weak_undef_file1.cc: Add extra test cases.
14045 * testsuite/weak_undef_file2.cc: Likewise.
14046 * testsuite/weak_undef_test.cc: Likewise.
14047
14048 2008-04-16 David S. Miller <davem@davemloft.net>
14049
14050 * sparc.cc (Target_sparc::Scan): Change from struct to class.
14051 Add issued_non_pic_error_ field. Declare check_non_pic.
14052 (Target_sparc::Scan::check_non_pic): New function.
14053 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14054 (Target_sparc::Scan::global): Likewise.
14055
14056 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14057 * configure: Rebuild.
14058
14059 * options.h (DEFINE_enable): New macro.
14060 (new_dtags): New enable option.
14061 (initfirst, interpose, loadfltr, nodefaultlib,
14062 nodelete, nodlopen, nodump): New -z options.
14063 * layout.cc (Layout:finish_dynamic_section): If new
14064 dtags enabled, emit DT_RUNPATH. Also, emit a
14065 DT_FLAGS_1 containing any specified -z flags.
14066
14067 2008-04-16 Ian Lance Taylor <iant@google.com>
14068
14069 * copy-relocs.cc: New file.
14070 * copy-relocs.h: New file.
14071 * reloc.cc: Remove Copy_relocs code.
14072 * reloc.h: Likewise.
14073 * reloc-types.h (struct Reloc_types) [both versions]: Add
14074 get_reloc_addend_noerror.
14075 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14076 variants of add_global which take an addend which must be zero.
14077 * i386.cc: Include "copy-relocs.h".
14078 (class Target_i386): Change type of copy_relocs_ to variable,
14079 update initializer.
14080 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14081 Change all callers.
14082 (Target_i386::do_finalize_sections): Change handling of
14083 copy_relocs_.
14084 * sparc.cc: Include "copy-relocs.h".
14085 (class Target_sparc): Change type of copy_relocs_ to variable,
14086 update initializer.
14087 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14088 Change all callers.
14089 (Target_sparc::do_finalize_sections): Change handling of
14090 copy_relocs_.
14091 * x86_64.cc: Include "copy-relocs.h".
14092 (class Target_x86_64): Change type of copy_relocs_ to variable,
14093 update initializer.
14094 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14095 class. Change all callers.
14096 (Target_x86_64::do_finalize_sections): Change handling of
14097 copy_relocs_.
14098 * Makefile.am (CCFILES): Add copy-relocs.cc.
14099 (HFILES): Add copy-relocs.h.
14100
14101 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14102
14103 * testsuite/script_test_4.sh: Permit leading zeroes.
14104
14105 2008-04-15 Ian Lance Taylor <iant@google.com>
14106
14107 * script-sections.cc (Script_sections::create_segments): Use
14108 header_size_adjustment even when there is enough room for the
14109 headers.
14110 * testsuite/script_test_4.sh: New file.
14111 * testsuite/script_test_4.t: New file.
14112 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14113 (check_DATA): Add script_test_4.stdout.
14114 (MOSTLYCLEANFILES): Likewise.
14115 (script_test_4): New target.
14116 (script_test_4.stdout): New target.
14117 * testsuite/Makefile.in: Rebuild.
14118
14119 * sparc.cc: Add definitions for Output_data_plt_sparc class
14120 constants.
14121
14122 2008-04-14 David S. Miller <davem@davemloft.net>
14123
14124 * sparc.cc: New file.
14125 * Makefile.am (TARGETSOURCES): Add sparc.cc
14126 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14127 * configure.tgt: Document targ_extra_size and
14128 targ_extra_big_endian. Add entries for sparc-* and
14129 sparc64-*.
14130 * configure.ac: Handle targ_extra_size and
14131 targ_extra_big_endian.
14132 * Makefile.in: Rebuild.
14133 * configure: Likewise.
14134 * po/POTFILES.in: Likewise.
14135 * po/gold.pot: Likewise.
14136
14137 2008-04-14 Ian Lance Taylor <iant@google.com>
14138
14139 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14140 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14141 in the name/type/flags to section mapping. Don't call
14142 allocate_output_section.
14143 (Layout::choose_output_section): Change parameter from adjust_name
14144 to is_input_section. Don't permit input sections after sections
14145 are attached to segments. Don't call allocate_output_section.
14146 (Layout::layout_eh_frame): Call update_flags_for_input_section,
14147 not write_enable_output_section.
14148 (Layout::make_output_section): Don't push to
14149 unattached_section_list_ nor call attach_to_segment. Call
14150 attach_section_to_segment if sections are attached.
14151 (Layout::attach_sections_to_segments): New function.
14152 (Layout::attach_section_to_segment): New function.
14153 (Layout::attach_allocated_section_to_segment): Rename from
14154 attach_to_segment. Remove flags parameter.
14155 (Layout::allocate_output_section): Remove function.
14156 (Layout::write_enable_output_section): Remove function.
14157 * layout.h (class Layout): Update for above changes. Add new
14158 field sections_are_attached_.
14159 * output.h (Output_section::update_flags_for_input_section): New
14160 function.
14161 * output.cc (Output_section::add_input_section): Call
14162 update_flags_for_input_section.
14163 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14164
14165 2008-04-11 Cary Coutant <ccoutant@google.com>
14166
14167 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14168 thought unnecessary.
14169 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14170
14171 2008-04-11 Ian Lance Taylor <iant@google.com>
14172
14173 * output.h (class Output_section_data): Remove inline definition
14174 of set_addralign.
14175 * output.cc (Output_section_data::set_addralign): New function.
14176
14177 2008-04-11 Cary Coutant <ccoutant@google.com>
14178
14179 Add support for TLS descriptors for i386 and x86_64.
14180 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14181 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14182 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14183 GOT_TYPE_TLS_DESC.
14184 (Target_i386::got_mod_index_entry): Remove unnecessary code.
14185 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14186 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
14187 relocations.
14188 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14189 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14190 Fix problem with initial-exec relocations.
14191 (Target_i386::Relocate::relocate_tls): Likewise.
14192 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14193 relaxation.
14194 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14195 support for section-plus-offset dynamic table entries.
14196 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14197 (Output_data_dynamic::Dynamic_entry): Add support for
14198 section-plus-offset dynamic table entries.
14199 (Output_data_dynamic::Classification): Likewise.
14200 (Output_data_dynamic::classification_): Renamed offset_.
14201 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14202 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14203 (Target_x86_64::make_plt_section): New function.
14204 (Target_x86_64::reserve_tlsdesc_entries): New function.
14205 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14206 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14207 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14208 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14209 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14210 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14211 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14212 add extra PLT entry for TLS descriptors.
14213 (Output_data_plt_x86_64::got_): New field.
14214 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14215 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14216 fields.
14217 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14218 descriptors.
14219 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14220 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14221 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14222 R_386_TLS_DESC_CALL relocations.
14223 (Target_x86_64::Scan::global): Likewise.
14224 (Target_x86_64::do_finalize_sections): Add dynamic table entries
14225 for TLS descriptors.
14226 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14227 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14228 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14229 GD-to-IE relaxation.
14230 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14231 and TLS_DESCRIPTORS.
14232 * Makefile.in: Rebuild.
14233 * configure: Rebuild.
14234 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14235 (tls_test_shared2.so): New target.
14236 (tls_shared_gd_to_ie_test_SOURCES): New variable.
14237 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14238 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14239 (tls_shared_gd_to_ie_test_LDADD): New variable.
14240 (tls_shared_gnu2_gd_to_ie_test): New target.
14241 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14242 New targets.
14243 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14244 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14245 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14246 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14247 (tls_shared_gnu2_test): New target.
14248 (tls_test_gnu2_shared.so): New target.
14249 (tls_shared_gnu2_test_SOURCES): New variable.
14250 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14251 (tls_shared_gnu2_test_LDFLAGS): New variable.
14252 (tls_shared_gnu2_test_LDADD): New variable.
14253 * testsuite/Makefile.in: Rebuild.
14254 * testsuite/Makefile.
14255
14256 2008-04-11 Ian Lance Taylor <iant@google.com>
14257
14258 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14259 justsyms.t.
14260 * testsuite/Makefile.in: Rebuild.
14261
14262 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14263 long.
14264 * testsuite/script_test_2.cc (main): Adjust test.
14265
14266 2008-04-11 David S. Miller <davem@davemloft.net>
14267 Ian Lance Taylor <iant@google.com>
14268
14269 * options.h (General_options): Add entries for '-Y' and
14270 '-relax'.
14271 * options.cc (General_options:finalize): If -Y was used, add those
14272 entries to the library path instead of the default "/lib" and
14273 "/usr/lib".
14274
14275 2008-04-11 David S. Miller <davem@davemloft.net>
14276
14277 * testsuite/justsyms.t: Start at 0x100.
14278 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14279 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14280 long.
14281 * testsuite/script_test_2.cc: Adjust string and section length
14282 checks.
14283
14284 2008-04-09 Ian Lance Taylor <iant@google.com>
14285
14286 PR gold/5996
14287 * script-sections.cc (Sections_element::allocate_to_segment): Add
14288 orphan parameter.
14289 (Output_section_definition::allocate_to_segment): Likewise.
14290 (Orphan_output_section::allocate_to_segment): Likewise.
14291 (Script_sections::attach_sections_using_phdrs_clause): Don't
14292 propagate non-PT_LOAD segments to orphan sections.
14293 * testsuite/Makefile.am (script_test_3.stdout): Generate using
14294 readelf rather than objdump.
14295 * testsuite/script_test_3.sh: Adjust accordingly. Test that
14296 .interp section and PT_INTERP segment are the same size.
14297 * testsuite/Makefile.in: Rebuild.
14298
14299 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14300 aliases for symbols defined in the same object.
14301 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14302 (weak_alias_test_SOURCES): New variable.
14303 (weak_alias_test_DEPENDENCIES): New variable.
14304 (weak_alias_test_LDFLAGS): New variable.
14305 (weak_alias_test_LDADD): New variable.
14306 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14307 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14308 (weak_alias_test_3.o): New target.
14309 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14310 * testsuite/weak_alias_test_main.cc: New file.
14311 * testsuite/weak_alias_test_1.cc: New file.
14312 * testsuite/weak_alias_test_2.cc: New file.
14313 * testsuite/weak_alias_test_3.cc: New file.
14314
14315 2008-04-08 Ian Lance Taylor <iant@google.com>
14316
14317 * options.h (class General_options): Add --noinhibit-exec option.
14318 * main.cc (main): Check --noinhibit-exec.
14319
14320 * options.h (class General_options): Define --wrap as a special
14321 option. Add wrap_symbols_ field.
14322 (General_options::any_wrap_symbols): New function.
14323 (General_options::is_wrap_symbol): New function.
14324 * options.cc (General_options::parse_wrap): New function.
14325 (General_options::General_options): Initialize wrap_symbols_.
14326 * symtab.cc (Symbol_table::wrap_symbol): New function.
14327 (Symbol_table::add_from_object): Handle --wrap.
14328 * symtab.h (class Symbol_table): Declare wrap_symbol.
14329 * target.h (Target::wrap_char): New function.
14330 (Target::Target_info): Add wrap_char field.
14331 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14332 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14333 * testsuite/testfile.cc (Target_test::test_target_info):
14334 Likewise.
14335
14336 * errors.cc (Errors::undefined_symbol): Mention symbol version if
14337 there is one.
14338
14339 * layout.h (class Layout): Add added_eh_frame_data_ field.
14340 * layout.cc (Layout::Layout): Initialize new field.
14341 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14342 output section until we find a section we merged successfully.
14343 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14344 that the size be non-zero.
14345
14346 * merge.cc (Object_merge_map::get_output_offset): Remove inline
14347 qualifier.
14348
14349 2008-04-08 Craig Silverstein <csilvers@google.com>
14350
14351 * configure.ac: Export new conditional variable HAVE_ZLIB.
14352 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14353 on HAVE_ZLIB.
14354 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14355 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14356
14357 2008-04-07 Ian Lance Taylor <iant@google.com>
14358
14359 * version.cc (version_string): Set to "1.5".
14360
14361 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14362 Add issued_non_pic_error_ field. Declare check_non_pic.
14363 (Target_x86_64::Scan::check_non_pic): New function.
14364 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14365 (Target_x86_64::Scan::global): Likewise.
14366
14367 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14368 addend parameter. Change caller. Handle merge sections.
14369 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14370 Address to Addend. Don't add in the result of
14371 local_section_offset, pass down the addend and use the returned
14372 value.
14373 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14374 Update declarations of local_section_offset and symbol_value.
14375 * testsuite/two_file_test_1.cc (t18): New function.
14376 * testsuite/two_file_test_2.cc (f18): New function.
14377 * testsuite/two_file_test_main.cc (main): Call t18.
14378 * testsuite/two_file_test.h (t18, f18): Declare.
14379
14380 * configure.ac: Don't test for objdump, c++filt, or readelf.
14381 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14382 conditionals.
14383 (TEST_READELF): New variable.
14384 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14385 (check_PROGRAMS): Add two_file_strip_test.
14386 (two_file_strip_test): New target.
14387 (check_PROGRAMS): Add two_file_same_shared_strip_test.
14388 (two_file_same_shared_strip_test_SOURCES): New variable.
14389 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14390 (two_file_same_shared_strip_test_LDFLAGS): New variable.
14391 (two_file_same_shared_strip_test_LDADD): New variable.
14392 (two_file_shared_strip.so): New target.
14393 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14394 (ver_test_5.syms, ver_test_7.syms): Likewise.
14395 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14396 (strip_test_3.stdout): Use TEST_OBJDUMP.
14397 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14398
14399 2008-04-04 Cary Coutant <ccoutant@google.com>
14400
14401 * symtab.h (Symbol::is_weak_undefined): New function.
14402 (Symbol::is_strong_undefined): New function.
14403 (Symbol::is_absolute): New function.
14404 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14405 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14406 absolute symbols.
14407 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14408 (weak_undef_test): New target.
14409 * testsuite/Makefile.in: Rebuild.
14410 * testsuite/weak_undef_file1.cc: New file.
14411 * testsuite/weak_undef_file2.cc: New file.
14412 * testsuite/weak_undef_test.cc: New file.
14413
14414 2008-04-03 Craig Silverstein <csilvers@google.com>
14415
14416 * compressed_output.h (class Output_compressed_section): Use
14417 unsigned buffer.
14418 * compressed_output.cc (zlib_compress): Use unsigned buffers,
14419 add zlib header.
14420 (zlib_compressed_suffix): Removed.
14421 (Output_compressed_section::set_final_data_size): Use unsigned
14422 buffers.
14423 * testsuite/Makefile.am (flagstest_compress_debug_sections):
14424 Fix linker invocation.
14425 (flagstest_o_specialfile_and_compress_debug_sections):
14426 Likewise.
14427 * testsuite/Makefile.in: Regenerated.
14428
14429 2008-04-02 David S. Miller <davem@davemloft.net>
14430
14431 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14432 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14433
14434 2008-04-02 Craig Silverstein <csilvers@google.com>
14435
14436 * TODO: New file.
14437
14438 2008-04-02 Ian Lance Taylor <iant@google.com>
14439
14440 * fileread.cc (File_read::find_view): Add byteshift and vshifted
14441 parameters. Update for new key type to views_. Change all
14442 callers.
14443 (File_read::read): Adjust for byteshift in returned view.
14444 (File_read::add_view): New function, broken out of
14445 find_and_make_view.
14446 (File_read::make_view): New function, broken out of
14447 find_and_make_view.
14448 (File_read::find_or_make_view): Add offset and aligned
14449 parameters. Rewrite accordingly. Change all callers.
14450 (File_read::get_view): Add offset and aligned parameters. Adjust
14451 for byteshift in return value.
14452 (File_read::get_lasting_view): Likewise.
14453 * fileread.h (class File_read): Update declarations.
14454 (class File_read::View): Add byteshift_ field. Add byteshift to
14455 constructor. Add byteshift method.
14456 * archive.h (Archive::clear_uncached_views): New function.
14457 (Archive::get_view): Add aligned parameter. Change all callers.
14458 * object.h (Object::get_view): Add aligned parameter. Change all
14459 callers.
14460 (Object::get_lasting_view): Likewise.
14461
14462 * fileread.cc (File_read::release): Don't call clear_views if
14463 there are multiple objects.
14464 * fileread.h (File_read::clear_uncached_views): New function.
14465 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14466 on the archive.
14467
14468 2008-03-31 Cary Coutant <ccoutant@google.com>
14469
14470 Add thin archive support.
14471 * archive.cc (Archive::armagt): New const.
14472 (Archive::setup): Remove task parameter and calls to unlock.
14473 (Archive::unlock_nested_archives): New function.
14474 (Archive::read_header): Add nested_off parameter. Change
14475 all callers.
14476 (Archive::interpret_header): Likewise.
14477 (Archive::include_all_members): Change to handle thin
14478 archives.
14479 (Archive::include_member): Likewise.
14480 * archive.h (Archive::Archive): Add new parameters and
14481 initializers.
14482 (Archive::armagt): New const.
14483 (Archive::setup): Remove task parameter.
14484 (Archive::unlock_nested_archives): New function.
14485 (Archive::read_header): Add nested_off parameter.
14486 (Archive::interpret_header): Likewise.
14487 (Archive::Nested_archive_table): New typedef.
14488 (Archive::is_thin_archive_): New field.
14489 (Archive::nested_archives_): New field.
14490 (Archive::options_): New field.
14491 (Archive::dirpath_): New field.
14492 (Archive::task_): New field.
14493 * readsyms.cc (Read_symbols::do_read_symbols): Add check
14494 for thin archives. Pass additional parameters to
14495 Archive::Archive. Unlock the archive file after calling
14496 Archive::setup.
14497
14498 2008-03-29 Ian Lance Taylor <iant@google.com>
14499
14500 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14501 version symbol to be local.
14502 * testsuite/ver_test_4.sh: New file.
14503 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14504 (check_DATA): Add ver_test_4.syms.
14505 (ver_test_4.syms): New target.
14506 * testsuite/Makefile.in: Rebuild.
14507
14508 * output.cc
14509 (Output_section::Input_section_sort_entry::has_priority): New
14510 function.
14511 (Output_section::Input_section_sort_entry::match_file_name): New
14512 function.
14513 (Output_section::Input_section_sort_entry::match_section_name):
14514 Remove.
14515 (Output_section::Input_section_sort_entry::match_section_name_prefix):
14516 Remove.
14517 (Output_section::Input_section_sort_entry::match_section_file):
14518 Remove.
14519 (Output_section::Input_section_sort_compare::operator()): Rewrite
14520 using new Input_section_sort_entry functions. Sort crtbegin and
14521 crtend first. Sort sections with no priority before sections with
14522 a priority.
14523 * testsuite/initpri1.c (d3): Check j != 4.
14524 (cd5): New constructor/destructor function.
14525 (main): Check j != 2.
14526
14527 * symtab.cc (Symbol_table::add_from_object): If we don't use the
14528 new symbol when resolving, don't call set_is_default.
14529 * testsuite/ver_test_7.cc: New file.
14530 * testsuite/ver_test_7.sh: New file.
14531 * testsuite/Makefile.am (ver_test_7.so): New target.
14532 (ver_test_7.o): New target.
14533 (check_SCRIPTS): Add ver_test_7.sh.
14534 (check_DATA): Add ver_test_7.syms.
14535 (ver_test_7.syms): New target.
14536
14537 2008-03-28 Ian Lance Taylor <iant@google.com>
14538
14539 * layout.cc (Layout::layout): If we see an input section with a
14540 name that needs sorting, set the must_sort flag for the output
14541 section.
14542 (Layout::make_output_section): If the name of the output section
14543 indicates that it might require sorting, set the may_sort flag.
14544 * output.h (Output_section::may_sort_attached_input_sections): New
14545 function.
14546 (Output_section::set_may_sort_attached_input_sections): New
14547 function.
14548 (Output_section::must_sort_attached_input_sections): New
14549 function.
14550 (Output_section::set_must_sort_attached_input_sections): New
14551 function.
14552 (class Output_section): Declare Input_section_sort_entry. Define
14553 Input_section_sort_compare. Declare
14554 sort_attached_input_sections. Add new fields:
14555 may_sort_attached_input_sections_,
14556 must_sort_attached_input_sections_,
14557 attached_input_sections_are_sorted_.
14558 * output.cc (Output_section::Output_section): Initialize new
14559 fields.
14560 (Output_section::add_input_section): Add an entry to
14561 input_sections_ if may_sort or must_sort are true.
14562 (Output_section::set_final_data_size): Call
14563 sort_attached_input_sections if necessary.
14564 (Output_section::Input_section_sort_entry): Define new class.
14565 (Output_section::Input_section_sort_compare::operator()): New
14566 function.
14567 (Output_section::sort_attached_input_sections): New function.
14568 * configure.ac: Check whether the compiler supports constructor
14569 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
14570 * testsuite/initpri1.c: New file.
14571 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14572 CONSTRUCTOR_PRIORITY.
14573 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14574 (initpri1_LDFLAGS): New variable.
14575 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14576
14577 2008-03-27 Ian Lance Taylor <iant@google.com>
14578
14579 * common.cc (Sort_commons::operator): Correct sorting algorithm.
14580 * testsuite/common_test_1.c: New file.
14581 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14582 (common_test_1_SOURCES): New variable.
14583 (common_test_1_DEPENDENCIES): New variable.
14584 (common_test_1_LDFLAGS): New variable.
14585
14586 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14587 and commons_ correctly when NAME/VERSION does not override
14588 NAME/NULL.
14589 * testsuite/ver_test_6.c: New file.
14590 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14591 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14592 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14593
14594 2008-03-26 Ian Lance Taylor <iant@google.com>
14595
14596 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14597 of an undefined symbol from a version script.
14598 * testsuite/Makefile.am (ver_test_5.so): New target.
14599 (ver_test_5.o): New target.
14600 (check_SCRIPTS): Add ver_test_5.sh.
14601 (check_DATA): Add ver_test_5.syms.
14602 (ver_test_5.syms): New target.
14603 * testsuite/ver_test_5.cc: New file.
14604 * testsuite/ver_test_5.script: New file.
14605 * testsuite/ver_test_5.sh: New file.
14606 * Makefile.in, testsuite/Makefile.in: Rebuild.
14607
14608 PR gold/5986
14609 Fix problems building gold with gcc 4.3.0.
14610 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14611 (gold_error_at_location, gold_warning_at_location): Use it.
14612 * configure.ac: Check whether we can compile and use a template
14613 function with a printf attribute.
14614 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14615 when jumping over bytes.
14616 * object.cc: Instantiate Object::read_section_data.
14617 * debug.h: Include <cstring>
14618 * dwarf_reader.cc: Include <algorithm>
14619 * main.cc: Include <cstring>.
14620 * options.cc: Include <cstring>.
14621 * output.cc: Include <cstring>.
14622 * script.cc: Include <cstring>.
14623 * script.h: Include <string>.
14624 * symtab.cc: Include <cstring> and <algorithm>.
14625 * target-select.cc: Include <cstring>.
14626 * version.cc: Include <string>.
14627 * testsuite/testmain.cc: Include <cstdlib>.
14628 * configure, config.in: Rebuild.
14629
14630 2008-03-25 Ian Lance Taylor <iant@google.com>
14631
14632 * options.cc: Include "../bfd/bfdver.h".
14633 (options::help): Print bug reporting address.
14634
14635 * version.cc (print_version): Adjust output for current value of
14636 BFD_VERSION_STRING.
14637
14638 * NEWS: New file.
14639
14640 * options.cc (options::help): Print list of supported targets.
14641 * target-select.h: Include <vector>.
14642 (class Target_selector): Make machine_, size_, and is_big_endian_
14643 fields const. Add bfd_name_ and instantiated_target_ fields.
14644 (Target_selector::Target_selector): Add bfd_name parameter.
14645 (Target_selector::recognize): Make non-virtual, call
14646 do_recognize.
14647 (Target_selector::recognize_by_name): Make non-virtual, call
14648 do_recognize_by_name.
14649 (Target_selector::supported_names): New function.
14650 (Target_selector::bfd_name): New function.
14651 (Target_selector::do_instantiate_target): New pure virtual
14652 function.
14653 (Target_selector::do_recognize): New virtual function.
14654 (Target_selector::do_recognize_by_name): New virtual function.
14655 (Target_selector::instantiate_target): New private function.
14656 (supported_target_names): Declare.
14657 * target-select.cc (Target_selector::Target_selector): Update for
14658 new parameter and fields.
14659 (select_target_by_name): Check that the name matches before
14660 calling recognize_by_name.
14661 (supported_target_names): New function.
14662 * i386.cc (class Target_selector_i386): Update Target_selector
14663 constructor call. Remove recognize and recognize_by_name. Add
14664 do_instantiate_target.
14665 * x86_64.cc (class Target_selector_x86_64): Likewise.
14666 * testsuite/testfile.cc (class Target_selector_test): Update for
14667 changes to Target_selector.
14668
14669 * README: Rewrite, with some notes on unsupported features.
14670
14671 2008-03-24 Cary Coutant <ccoutant@google.com>
14672
14673 * i386.cc (Target_i386::Got_type): New enum declaration.
14674 (Target_i386::Scan::local): Updated callers of Output_data_got
14675 member functions.
14676 (Target_i386::Scan::global): Likewise.
14677 (Target_i386::Relocate::relocate): Likewise.
14678 (Target_i386::Relocate::relocate_tls): Likewise.
14679 * object.h (Got_offset_list): New class.
14680 (Sized_relobj::local_has_got_offset): Added got_type parameter.
14681 (Sized_relobj::local_got_offset): Likewise.
14682 (Sized_relobj::set_local_got_offset): Likewise.
14683 (Sized_relobj::local_has_tls_got_offset): Removed.
14684 (Sized_relobj::local_tls_got_offset): Removed.
14685 (Sized_relobj::set_local_tls_got_offset): Removed.
14686 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14687 * output.cc (Output_data_got::add_global): Added got_type parameter.
14688 (Output_data_got::add_global_with_rel): Likewise.
14689 (Output_data_got::add_global_with_rela): Likewise.
14690 (Output_data_got::add_global_pair_with_rel): New function.
14691 (Output_data_got::add_global_pair_with_rela): New function.
14692 (Output_data_got::add_local): Added got_type parameter.
14693 (Output_data_got::add_local_with_rel): Likewise.
14694 (Output_data_got::add_local_with_rela): Likewise.
14695 (Output_data_got::add_local_pair_with_rel): New function.
14696 (Output_data_got::add_local_pair_with_rela): New function.
14697 (Output_data_got::add_global_tls): Removed.
14698 (Output_data_got::add_global_tls_with_rel): Removed.
14699 (Output_data_got::add_global_tls_with_rela): Removed.
14700 (Output_data_got::add_local_tls): Removed.
14701 (Output_data_got::add_local_tls_with_rel): Removed.
14702 (Output_data_got::add_local_tls_with_rela): Removed.
14703 * output.h (Output_data_got::add_global): Added got_type parameter.
14704 (Output_data_got::add_global_with_rel): Likewise.
14705 (Output_data_got::add_global_with_rela): Likewise.
14706 (Output_data_got::add_global_pair_with_rel): New function.
14707 (Output_data_got::add_global_pair_with_rela): New function.
14708 (Output_data_got::add_local): Added got_type parameter.
14709 (Output_data_got::add_local_with_rel): Likewise.
14710 (Output_data_got::add_local_with_rela): Likewise.
14711 (Output_data_got::add_local_pair_with_rel): New function.
14712 (Output_data_got::add_local_pair_with_rela): New function.
14713 (Output_data_got::add_global_tls): Removed.
14714 (Output_data_got::add_global_tls_with_rel): Removed.
14715 (Output_data_got::add_global_tls_with_rela): Removed.
14716 (Output_data_got::add_local_tls): Removed.
14717 (Output_data_got::add_local_tls_with_rel): Removed.
14718 (Output_data_got::add_local_tls_with_rela): Removed.
14719 * resolve.cc (Symbol::override_base_with_special): Removed
14720 reference to has_got_offset_ field.
14721 * symtab.cc (Symbol::init_fields): Replaced initialization
14722 of got_offset_ with got_offsets_. Removed initialization
14723 of has_got_offset_
14724 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14725 (Symbol::got_offset): Likewise.
14726 (Symbol::set_got_offset): Likewise.
14727 (Symbol::has_tls_got_offset): Removed.
14728 (Symbol::tls_got_offset): Removed.
14729 (Symbol::set_tls_got_offset): Removed.
14730 (Symbol::got_offset_): Removed.
14731 (Symbol::tls_mod_got_offset_): Removed.
14732 (Symbol::tls_pair_got_offset_): Removed.
14733 (Symbol::got_offsets_): New field.
14734 (Symbol::has_got_offset): Removed.
14735 (Symbol::has_tls_mod_got_offset): Removed.
14736 (Symbol::has_tls_pair_got_offset): Removed.
14737 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14738 (Target_x86_64::Scan::local): Updated callers of Output_data_got
14739 member functions.
14740 (Target_x86_64::Scan::global): Likewise.
14741 (Target_x86_64::Relocate::relocate): Likewise.
14742 (Target_x86_64::Relocate::relocate_tls): Likewise.
14743
14744 2008-03-25 Ben Elliston <bje@au.ibm.com>
14745
14746 * yyscript.y: Fix spelling error in comment.
14747
14748 2008-03-24 Ian Lance Taylor <iant@google.com>
14749
14750 * options.h (class General_options): Define build_id option.
14751 * layout.h (class Layout): Declare write_build_id, create_note,
14752 create_build_id. Add build_id_note_ member.
14753 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14754 "libiberty.h", "md5.h", "sha1.h".
14755 (Layout::Layout): Initialize eh_frame_data_,
14756 eh_frame_hdr_section_, and build_id_note_.
14757 (Layout::finalize): Call create_build_id.
14758 (Layout::create_note): New function, broken out of
14759 Layout::create_gold_note.
14760 (Layout::create_gold_note): Call create_note.
14761 (Layout::create_build_id): New function.
14762 (Layout::write_build_id): New function.
14763 (Close_task_runner::run): Call write_build_id.
14764
14765 * x86_64.cc: Correct license to GPLv3.
14766
14767 2008-03-23 Ian Lance Taylor <iant@google.com>
14768
14769 * options.cc: Include "demangle.h".
14770 (parse_optional_string): New function.
14771 (parse_long_option): Handle takes_optional_argument.
14772 (parse_short_option): Update dash_z initializer. Handle
14773 takes_optional_argument.
14774 (General_options::General_options): Initialize do_demangle_.
14775 (General_options::finalize): Set do_demangle_. Handle demangling
14776 style.
14777 * options.h (parse_optional_string): Declare.
14778 (struct One_option): Add optional_arg field. Update constructor.
14779 Update call constructor calls. Add takes_optional_argument
14780 function.
14781 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
14782 (DEFINE_optional_string): Define.
14783 (General_options::demangle): Change from DEFINE_bool to
14784 DEFINE_optional_string.
14785 (General_options::no_demangle): New function.
14786 (General_options::do_demangle): New function.
14787 (General_options::set_do_demangle): New function.
14788 (General_options::execstack_status_): Move definition to end of
14789 class definition.
14790 (General_options::static_): Likewise.
14791 (General_options::do_demangle_): New field.
14792 * object.cc (big_endian>::get_symbol_location_info): Call
14793 Options::do_demangle, not Options::demangle.
14794 * symtab.cc (demangle): Likewise.
14795
14796 2008-03-22 Ian Lance Taylor <iant@google.com>
14797
14798 * gold.h: Include <cstddef> and <sys/types.h>
14799 * options.h: Include <cstring>.
14800
14801 2008-03-21 Ian Lance Taylor <iant@google.com>
14802
14803 * Added source code to GNU binutils.
14804 \f
14805 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14806
14807 Copying and distribution of this file, with or without modification,
14808 are permitted in any medium without royalty provided the copyright
14809 notice and this notice are preserved.
14810
14811 Local Variables:
14812 mode: change-log
14813 left-margin: 8
14814 fill-column: 74
14815 version-control: never
14816 End: