Restore empty string handling
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2013-05-01 H.J. Lu <hongjiu.lu@intel.com>
2
3 * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
4 Restore empty string handling.
5
6 2013-05-01 Cary Coutant <ccoutant@google.com>
7
8 * stringpool.cc (Stringpool_template::new_key_offset): Fix
9 uninitialized warning.
10
11 2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
12
13 * output.cc (Output_section::add_merge_input_section): Allow
14 to merge sections if the alignment is more than character size.
15 * merge.h (Output_merge_string::Output_merge_string): Remove
16 assert.
17 * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
18 only not-null strings. Check the alignment of strings.
19 * stringpool.h
20 (Stringpool_template<Stringpool_char>::Stringpool_template): Add
21 alignment as the argument.
22 (Stringpool_template<Stringpool_char>::addralign_): New class member.
23 * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
24 Align non-zero length strings according to the addralign_.
25 (Stringpool_template<Stringpool_char>::set_string_offsets):
26 Updating offsets according to the given alignment.
27 * testsuite/Makefile.am (text_section_grouping): Test if string
28 literals are getting merged.
29 * testsuite/Makefile.in: Regenerate.
30 * testsuite/merge_string_literals_1.c: New file.
31 * testsuite/merge_string_literals_2.c: Ditto.
32 * testsuite/merge_string_literals.sh: Ditto.
33
34 2013-04-26 Ian Lance Taylor <iant@google.com>
35
36 * target-reloc.h (relocate_section): If the reloc offset is out of
37 range, pass VIEW as NULL to relocate.relocate.
38 * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
39 * i386.cc (Target_i386::Relocate::relocate): Likewise.
40 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
41 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
42 * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
43 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
44
45 2013-04-26 Geoff Pike <gpike@chromium.org>
46
47 * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
48 * layout.cc (Hash_task): New class.
49 (Layout::queue_build_id_tasks): New function.
50 (Layout::write_build_id): Handle single-thread portion of build ID
51 computation. (In some cases, all of it is single-threaded.) Replace
52 {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
53 functionality in fewer lines of code.
54 * layout.h (Layout::queue_build_id_tasks): New function declaration.
55 * options.h (General_options): make "--build-id" default to tree
56 rather than sha1. Add two new options related to --build-id=tree:
57 --build-id-chunk-size-for-treehash and
58 --build-id-min-file-size-for-treehash.
59 * Makefile.am: add testing of --build-id=tree and related new options
60 (these tests will be invoked by "make check").
61 * Makefile.in: Regenerate.
62
63 2013-04-25 Alan Modra <amodra@gmail.com>
64
65 * configure.tgt: Add powerpcle and powerpc64le.
66
67 2013-04-22 Alan Modra <amodra@gmail.com>
68
69 PR gold/15355
70 * layout.cc (Layout::segment_precedes): Allow more than one
71 segment with the same type and flags.
72
73 2013-04-15 Cary Coutant <ccoutant@google.com>
74
75 * layout.cc (Layout::set_relocatable_section_offsets): Don't
76 allocate space in file for BSS sections.
77
78 2013-04-15 Cary Coutant <ccoutant@google.com>
79
80 * script-sections.cc (Orphan_output_section): Reset address
81 to zero after each orphaned section for relocatable links.
82
83 2013-04-15 Cary Coutant <ccoutant@google.com>
84
85 * symtab.cc (Symbol_table::sized_write_globals): Subtract
86 section starting address for relocatable link.
87 * testsuite/Makefile.am (script_test_11): New test.
88 * testsuite/Makefile.in: Regenerate.
89 * testsuite/script_test_11.c: New source file.
90 * testsuite/script_test_11.t: New linker script.
91
92 2013-04-13 Alan Modra <amodra@gmail.com>
93
94 * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
95 owner when sections are not adjacent and exceed group size.
96 (Target_powerpc::group_sections): Handle corner case.
97 (Target_powerpc::Branch_info::make_stub): Handle case where
98 stub table doesn't exist due to branches in non-exec sections.
99 (Target_powerpc::Relocate::relocate): Likewise.
100
101 2013-04-11 Alan Modra <amodra@gmail.com>
102
103 PR gold/15354
104 * powerpc.cc (Target_powerpc::make_brlt_section): Name section
105 .branch_lt to match bfd ld. Adjust comments throughout file.
106
107 2013-04-04 Ian Lance Taylor <iant@google.com>
108
109 GCC PR c++/56840
110 * object.cc (do_layout_deferred_sections): Handle .eh_frame
111 sections before checking whether they are included in the link.
112
113 2013-03-29 Sriraman Tallam <tmsriram@google.com>
114
115 * archive.cc (Archive::get_elf_object_for_member): Create the elf
116 object before calling the plugin claim_file handler. Pass the elf
117 object of the archive to the plugin. Delete the elf object if the
118 plugin claims the file.
119
120 2013-03-21 Alan Modra <amodra@gmail.com>
121
122 * layout.cc (Layout::set_segment_offsets): Accept writable .text
123 segment when omagic.
124
125 2013-03-21 Alan Modra <amodra@gmail.com>
126
127 * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
128 comparison warning.
129 * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
130 uninitialized" warning.
131
132 2013-03-20 Alan Modra <amodra@gmail.com>
133
134 * symtab.h (Symbol::clear_version): New function.
135 * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
136 is_needed by weak references. Clear version for symbols defined
137 in as-needed objects that are not needed.
138
139 2013-03-15 Alan Modra <amodra@gmail.com>
140
141 * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
142 static and public. Add report_err param. Return false for data refs.
143 (Target_powerpc::rela_dyn_section): New overloaded function.
144 (Target_powerpc::plt_, iplt_): Elucidate.
145 (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
146 (Output_data_plt_powerpc::do_write): Don't write .iplt.
147 (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
148 (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
149 calls. Put ifunc dynamic relocs in irela_dyn_section. Only
150 push_branch and make_plt_entry for ifunc syms when
151 reloc_needs_plt_for_ifunc.
152 (Target_powerpc::Relocate::relocate): Don't use plt entry value
153 for ifunc unless reloc_needs_plt_for_ifunc.
154
155 2013-03-15 Alan Modra <amodra@gmail.com>
156
157 * gc.h (gc_process_relocs): Don't look through function descriptors.
158 * icf.cc (get_section_contents): Do so here instead.
159
160 2013-03-13 Alan Modra <amodra@gmail.com>
161
162 * powerpc.cc (is_branch_reloc): Forward declare.
163 (Target_powerpc::do_can_check_for_function_pointers): New predicate.
164 (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
165 false for 64-bit, true for 32-bit non-branch relocs.
166 (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
167 * testsuite/Makefile.am (icf_test): Use linker map file instead of
168 nm output.
169 (icf_safe_test): Generate linker map file as well as nm output.
170 (icf_safe_so_test): Likewise.
171 * testsuite/Makefile.in: Regenerate.
172 * testsuite/icf_test.sh: Parse linker map file to determine
173 section folding.
174 * testsuite/icf_safe_test.sh: Likewise. Expect folding for PowerPC.
175 * testsuite/icf_safe_so_test.sh: Likewise.
176 (X86_32_or_ARM_specific_safe_fold): Merge into..
177 (arch_specific_safe_fold): ..this.
178 (X86_64_specific_safe_fold): Delete unused function.
179
180 2013-03-12 Alan Modra <amodra@gmail.com>
181
182 * gc.h (gc_process_relocs): Look through function descriptors
183 to determine shndx, symvalue and addend used by ICF. Tidy
184 variable duplication.
185
186 2013-03-11 Alan Modra <amodra@gmail.com>
187
188 * gold.cc (queue_middle_tasks): Move detect_odr_violations..
189 * layout.cc (Layout_task_runner::run): ..to here.
190 * symtab.h (struct Symbol_location): Extract from..
191 (class Symbol_table): ..here.
192 * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
193 * target.h (class Target): Add function_location and
194 do_function_location functions.
195 (class Sized_target): Add do_function_location.
196 * object.h (class Sized_relobj_file): Move find_shdr..
197 (class Object): ..to here.
198 * object.cc: Likewise. Update to suit. Instantiate.
199 (Sized_relobj_file::find_eh_frame): Update find_shdr call.
200 * powerpc.cc (class Powerpc_dynobj): New.
201 (Target_powerpc::do_function_location): New function.
202 (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
203 (Powerpc_dynobj::do_read_symbols): New function.
204 (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
205
206 2013-03-08 Ian Lance Taylor <iant@google.com>
207
208 * options.cc (General_options::string_to_object_format): Accept
209 "default".
210
211 2013-03-08 Alan Modra <amodra@gmail.com>
212
213 * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
214 pointer to Post_fde.
215 (struct Post_fde): Move definition to here..
216 * ehframe.cc (struct Post_fde): ..from here.
217 (Cie::write): Don't alloc Post_fde.
218 (Eh_frame::do_sized_write): Update. Don't free Post_fde.
219
220 2013-03-07 Alan Modra <amodra@gmail.com>
221
222 * testsuite/discard_locals_relocatable_test.c: Add a powerpc
223 relocation referencing .LC0.
224 * testsuite/discard_locals_test.sh: Remove FIXMEs.
225
226 2013-03-07 Alan Modra <amodra@gmail.com>
227
228 * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
229 always_inline. Add assembly for powerpc to avoid GOT.
230
231 2013-03-07 Alan Modra <amodra@gmail.com>
232
233 * testsuite/script_test_10.sh: Don't test .bss section
234 header number.
235
236 2013-03-06 Alan Modra <amodra@gmail.com>
237
238 * powerpc.cc (class Powerpc_relobj): Move some member functions.
239 (Target_powerpc::symval_for_branch): Add symtab param. Update
240 all callers. Handle folded sections.
241 (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
242 to Powerpc_relobj.
243 (Global_symbol_visitor_opd::operator()): Likewise.
244
245 2013-03-04 Alan Modra <amodra@gmail.com>
246
247 * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
248 * testsuite/Makefile.in: Regenerate.
249
250 2013-03-01 Cary Coutant <ccoutant@google.com>
251
252 Add dwp support for v2 DWARF package file format.
253 * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
254 tu_length parameter. Adjust all callers.
255 * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
256 * dwp.cc: Include dwarf.h.
257 (Section_bounds): New struct type.
258 (Unit_set): New struct type.
259 (Dwo_file::Dwo_file): Initialize new data member.
260 (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
261 Combine and rename to...
262 (Dwo_file::read_unit_index): ...this.
263 (Dwo_file::sized_read_compunit_index)
264 (Dwo_file::sized_read_typeunit_index): Combine and rename to...
265 (Dwo_file::sized_read_unit_index): ...this.
266 (Dwo_file::copy_section): Remove section_name, is_str_offsets
267 parameters; add section_id parameter.
268 (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
269 (Dwo_file::add_unit_set): ...this.
270 (Dwo_file::shndx_map_): Remove.
271 (Dwo_file::sect_offsets_): New data member.
272 (Dwp_output_file::Dwp_output_file): Initialize new data members.
273 (Dwp_output_file::add_section): Rename to...
274 (Dwp_output_file::add_contribution): ...this.
275 (Dwp_output_file::add_cu_set): Combine parameters into a struct.
276 (Dwp_output_file::add_tu_set): Likewise.
277 (Dwp_output_file::Contribution): New type.
278 (Dwp_output_file::Section::contributions): New data member.
279 (Dwp_output_file::Cu_or_tu_set): Remove.
280 (Dwp_output_file::Section::Section): New ctor.
281 (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
282 (Dwp_output_file::Dwp_index::Section_table): New type.
283 (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
284 (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
285 parameter.
286 (Dwp_output_file::Dwp_index::shndx_pool): Remove.
287 (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
288 (Dwp_output_file::Dwp_index::section_table): New member function.
289 (Dwp_output_file::Dwp_index::section_table_end): New member function.
290 (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
291 (Dwp_output_file::Dwp_index::section_table_rows): New member function.
292 (Dwp_output_file::Dwp_index::section_table_cols): New member function.
293 (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
294 (Dwp_output_file::Dwp_index::section_table_): New data member.
295 (Dwp_output_file::Dwp_index::section_mask_): New data member.
296 (Dwp_output_file::add_output_section): New member function.
297 (Dwp_output_file::write_new_section): New member function.
298 (Dwp_output_file::write_contributions): New member function.
299 (Dwp_output_file::section_id_map_): New data member.
300 (class Dwo_id_info_reader): Remove.
301 (class Unit_reader): New class.
302 (get_dwarf_section_name): New function.
303 (Dwo_file::read_executable): Adjust initializations of class data.
304 (Dwo_file::read): Add support for v2 package file format.
305 (Dwo_file::read_unit_index): Likewise.
306 (Dwo_file::sized_read_unit_index): Likewise.
307 (Dwo_file::copy_section): Likewise.
308 (Dwo_file::add_unit_set): Likewise.
309 (Dwp_output_file::add_output_section): Likewise.
310 (Dwp_output_file::add_contribution): Likewise.
311 (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
312 for empty slot.
313 (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
314 file format.
315 (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
316 slot.
317 (Dwp_output_file::initialize): Remove unused function.
318 (Dwp_output_file::finalize): Add support for v2 package file format.
319 (Dwp_output_file::write_index): Likewise.
320 * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
321 function prototype.
322
323 2013-03-01 Cary Coutant <ccoutant@google.com>
324
325 * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
326 function into class definition in header file.
327 (Dwarf_info_reader::warn_corrupt_debug_section): New function.
328 * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
329 New function.
330 (Dwarf_info_reader::check_buffer): Move here from .cc file.
331
332 2013-02-28 Alan Modra <amodra@gmail.com>
333
334 * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
335 * target.cc (Target::do_plt_fde_location): New function.
336 * ehframe.h (class FDE): Add post_map field to u_.from_linker,
337 accessor function, and constructor param.
338 (struct Post_fde, Post_fdes): Declare.
339 (Cie::write): Add post_fdes param.
340 * ehframe.cc (Fde::write): Use plt_fde_location.
341 (struct Post_fde): Define.
342 (Cie::write): Stash FDEs added post merge mapping.
343 (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
344 Adjust Fde constructor call. Bump final_data_size_ for post map FDEs.
345 (Eh_frame::do_sized_write): Arrange to write post map FDES after
346 other FDEs.
347 * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
348 (Target_powerpc::has_glink): New function.
349 (Target_powerpc::do_relax): Add eh_frame info for stubs.
350 (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
351 glink_eh_frame_fde_32, default_fde): New data.
352 (Stub_table::eh_frame_added_): New var.
353 (Stub_table::find_long_branch_entry, stub_address, stub_offset):
354 Make const.
355 (Stub_table::add_eh_frame): New function.
356 (Output_data_glink::add_eh_frame): New function.
357 (Target_powerpc::make_glink_section): Call add_eh_frame.
358
359 2013-02-15 Ian Lance Taylor <iant@google.com>
360
361 * options.h (DEFINE_uint64_alias): Define.
362 (class General_options): Add -Ttext-segment as an alias for
363 -Ttext.
364
365 2013-02-15 Alan Modra <amodra@gmail.com>
366
367 * powerpc.cc (Stub_table::plt_off): New function, extracted from..
368 (Stub_table::do_write): ..here, two places.
369 (Stub_table::plt_call_size): Use it here too.
370
371 2013-02-11 Ian Lance Taylor <iant@google.com>
372
373 * descriptors.cc (Descriptors::close_all): New function.
374 * descriptors.h (class Descriptors): Declare close_all.
375 (close_all_descriptors): New inline function.
376 * plugin.cc: Include "descriptors.h".
377 (Plugin_manager::cleanup): Call close_all_descriptors.
378
379 2013-02-06 Alan Modra <amodra@gmail.com>
380
381 * README: Update coding style link.
382
383 2013-01-28 Cary Coutant <ccoutant@google.com>
384
385 * dwp.cc (File_list): New typedef.
386 (Dwo_name_info_reader): New class.
387 (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
388 (Dwo_id_info_reader::visit_top_die): Remove unused member function.
389 (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
390 (Dwo_file::read_executable): New function.
391 (Dwo_file::read): Move common setup code to ...
392 (Dwo_file::make_object): ... here.
393 (dwp_options): Add --exec/-e.
394 (usage): Likewise.
395 (main): Likewise.
396
397 2013-01-24 Sriraman Tallam <tmsriram@google.com>
398
399 * layout.cc (Layout::layout): Check for option text_reorder.
400 (Layout::make_output_section): Ditto.
401 * options.h (text_reorder): New option.
402 * output.cc (Input_section_sort_compare): Remove special ordering
403 of section names.
404 (Output_section::
405 Input_section_sort_section_name_special_ordering_compare::
406 operator()): New function.
407 (Output_section::sort_attached_input_sections): Use new sort function
408 for .text.
409 * output.h (Input_section_sort_section_name_special_ordering_compare):
410 New struct.
411 * testsuite/Makefile.am (text_section_grouping): Test option
412 --no-text-reorder
413 * testsuite/Makefile.in: Regenerate.
414 * testsuite/text_section_grouping.sh: Check order of functions without
415 default text reordering.
416
417 2013-01-18 Mike Frysinger <vapier@gentoo.org>
418
419 * options.h (General_options): Change default to true for new_dtags.
420
421 2013-01-18 Mike Frysinger <vapier@gentoo.org>
422
423 * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
424 when enable_new_dtags is false. Only add DT_RUNPATH when
425 enable_new_dtags is true.
426
427 2013-01-17 Serge Pavlov <serge.v.pavlov@gmail.com>
428
429 * powerpc.cc (Stub_table::find_plt_call_entry): Make types
430 used in declaration and definition consistent.
431 (Target_powerpc::symval_for_branch): Ditto.
432
433 2013-01-16 Sriraman Tallam <tmsriram@google.com>
434
435 * testsuite/plugin_final_layout.cc: Fix comment.
436
437 2013-01-16 Sriraman Tallam <tmsriram@google.com>
438
439 * layout.cc (Layout::layout): Do not do default sorting for
440 text sections when section ordering is specified.
441 (make_output_section): Ditto.
442 * testsuite/plugin_final_layout.cc: Name the function sections
443 to catch reordering issues.
444
445 2013-01-15 Alan Modra <amodra@gmail.com>
446
447 * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
448 plt-thread-safe.
449
450 2013-01-15 Alan Modra <amodra@gmail.com>
451
452 * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
453 * testsuite/Makefile.in: Regenerate.
454
455 2013-01-14 Alan Modra <amodra@gmail.com>
456
457 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
458 * testsuite/Makefile.in: Regenerate.
459
460 2013-01-11 Pavel Chupin <pavel.v.chupin@intel.com>
461
462 PR bfd/14430
463 Fix mingw gold build with plugins enabled
464 * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
465 * configure.ac: Export DLOPEN_LIBS and add headers check.
466 * plugin.cc: Handle non-dlfcn case.
467 * Makefile.in: Regenerate.
468 * config.in: Regenerate.
469 * configure: Regenerate.
470 * testsuite/Makefile.in: Regenerate.
471
472 2013-01-09 Sriraman Tallam <tmsriram@google.com>
473
474 * output.h (sort_attached_input_sections): Change to be public.
475 * script-sections.cc
476 (Output_section_definition::set_section_addresses): Sort
477 attached input sections according to section order before linker
478 script assigns section addresses.
479 (Orphan_output_section::set_section_addresses): Sort
480 attached input sections according to section order before linker
481 script assigns section addresses.
482 * Makefile.am (final_layout.sh): Use a simple linker script to
483 check if section ordering still works.
484 * Makefile.in: Regenerate.
485
486 2013-01-09 Ben Cheng <bccheng@google.com>
487
488 * arm.cc (Target_arm::attributes_accept_div): New function.
489 (Target_arm::attributes_forbid_div): New function.
490 (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
491 attribute using the same new functions as what bfd/elf32_arm.c
492 does.
493
494 2013-01-07 Cary Coutant <ccoutant@google.com>
495
496 PR gold/14993
497 * output.cc (Output_section::add_input_section): For incremental
498 updates, don't track input sections that are allocated from patch
499 space.
500
501 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
502 Ian Lance Taylor <iant@google.com>
503
504 PR gold/14897
505 * configure.ac (--enable-ld): Removed.
506 (install_as_default): Set to yes only for --enable-gold=default
507 or --disable-ld.
508 * configure: Regenerated.
509
510 2013-01-07 H.J. Lu <hongjiu.lu@intel.com>
511
512 * options.h (General_options): Add -fuse-ld= for GCC linker
513 option compatibility.
514
515 2013-01-04 Cary Coutant <ccoutant@google.com>
516
517 * configure.ac: Fix typo restoring CXXFLAGS.
518 * configure: Regenerate.
519
520 2013-01-04 Cary Coutant <ccoutant@google.com>
521
522 * testsuite/Makefile.am (CXXLINK_S): New macro.
523 (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
524 * testsuite/Makefile.in: Regenerate.
525
526 2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
527
528 * version.cc (print_version): Update copyright year to 2013.
529
530 2012-12-20 Ian Lance Taylor <iant@google.com>
531
532 * layout.cc (Layout::special_ordering_of_input_section): New
533 function.
534 (Layout::layout): If input section requires special ordering, must
535 sort input sections.
536 (Layout::make_output_section): May sort .text input sections.
537 (Layout::is_section_name_prefix_grouped): Remove.
538 * layout.h (class Layout): Declare
539 special_ordering_of_input_section. Don't declare
540 is_section_name_prefix_grouped.
541 * output.cc (Output_section::add_input_section): Revert last
542 change.
543 (Output_section::Input_section_sort::match_file_name): Don't crash
544 if called on output section data.
545 (Output_section::Input_section_sort_compare): Sort based on
546 special ordering.
547 (Output_section::Input_section_sort_section_order_index_compare):
548 Revert last patch.
549 (Output_section::sort_attached_input_sections): Likewise.
550
551 2012-12-18 Sriraman Tallam <tmsriram@google.com>
552
553 * layout.cc (Layout::is_section_name_prefix_grouped): New function.
554 * layout.h (Layout::is_section_name_prefix_grouped): New function.
555 * output.cc (Output_section::add_input_section): Check if section
556 name contains special prefix. Keep input sections to sort such
557 sections.
558 (Output_section::Input_section_sort_section_order_index_compare
559 ::operator()): Group sections according to prefixes.
560 (Output_section::sort_attached_input_sections): Add condition to
561 Input_section_entry constructor call.
562 * testsuite/Makefile.am (text_section_grouping): New test.
563 * testsuite/Makefile.in: Regenerate.
564 * testsuite/text_section_grouping.cc: New file.
565 * testsuite/text_section_grouping.sh: New file.
566
567 2012-12-17 Nick Clifton <nickc@redhat.com>
568
569 * Makefile.am: Add copyright notice.
570 * NEWS: Likewise.
571 * README: Likewise.
572 * configure.ac: Likewise.
573 * ftruncate.c: Likewise.
574 * Makefile.in: Regenerate.
575
576 2012-12-14 Cary Coutant <ccoutant@google.com>
577
578 * testsuite/Makefile.am (exception_separate_shared_12_test): Add
579 --no-as-needed flag.
580 (exception_separate_shared_12_test): Likewise.
581 (incremental_copy_test): Likewise.
582 * testsuite/Makefile.in: Regenerate.
583
584 2012-12-14 Cary Coutant <ccoutant@google.com>
585
586 * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
587 (Dwp_output_file::Dwp_index::enter_set): Add assert.
588
589 2012-12-12 Alan Modra <amodra@gmail.com>
590
591 * powerpc.cc (class Track_tls): New.
592 (class Relocate, class Scan): Inherit Track_tls.
593 (Target_powerpc::Scan::local, global): Track tls optimization
594 and avoid creating plt entry for __tls_get_addr if all uses
595 are optimized away.
596 (Target_powerpc::Relocate::relocate): Update to use Track_tls.
597
598 2012-12-12 Alan Modra <amodra@gmail.com>
599
600 * options.h (General_options): Add --toc-sort/--no-toc-sort.
601 Replace no_toc_optimize with toc_optimize.
602 * output.h (Output_section::input_sections): Provide non-const variant.
603 * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
604 set_has_small_toc_reloc, has_small_toc_reloc): New variable and
605 accessors.
606 (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
607 (class Sort_toc_sections): New.
608 (Target_powerpc::do_finalize_sections): Sort toc sections.
609 (Target_powerpc::Relocate::relocate): Update toc_optimize test.
610
611 2012-12-10 Roland McGrath <mcgrathr@google.com>
612
613 * testsuite/binary_unittest.cc (read_all): New function.
614 (Sized_binary_test): Use it instead of ::read.
615 * fileread.cc (do_read): Don't assume pread always reads the whole
616 amount in a single call.
617
618 2012-12-10 Alan Modra <amodra@gmail.com>
619
620 * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
621 Set EM_PPC64 or EM_PPC here.
622 (Target_selector_powerpc::do_recognize): Delete.
623
624 2012-12-10 Alan Modra <amodra@gmail.com>
625
626 * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
627 stub_table_.
628 (Target_powerpc::Branch_info::make_stub): Don't omit addend.
629
630 2012-12-07 Roland McGrath <mcgrathr@google.com>
631
632 * testsuite/binary_unittest.cc (Sized_binary_test):
633 Use open_descriptor rather than ::open.
634
635 2012-12-07 Alan Modra <amodra@gmail.com>
636
637 * powerpc.cc (Stub_table::do_write): Delete redundant Address
638 typedef and invalid_address constant.
639 (Output_data_glink, Stub_table, Target_powerpc): Explicitly
640 instantiate constants.
641
642 2012-12-06 Roland McGrath <mcgrathr@google.com>
643
644 * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
645 Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
646 * aclocal.m4: Regenerate.
647 * configure: Regenerate.
648 * Makefile.in: Regenerate.
649 * testsuite/Makefile.in: Regenerate.
650
651 2012-12-07 Alan Modra <amodra@gmail.com>
652
653 * options.h (General_options): Add no_toc_optimize.
654 * powerpc.cc (ok_lo_toc_insn): New function.
655 (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
656
657 2012-12-06 Alan Modra <amodra@gmail.com>
658
659 * options.h (General_options): Add plt_align, plt_static_chain,
660 plt_thread_safe. Update stub_group_size help text.
661 * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
662 for new plt_thread_safe_ var.
663 (use_plt_offset): Correct comments.
664 (Target_powerpc::do_relax): Look for thread creation symbols to
665 determine default plt_thread_safe value. Clear plt call stubs
666 as well as branch stubs each iteration.
667 (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
668 insn constants.
669 (l, hi, ha, write_insn): Move earlier.
670 (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
671 (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
672 plt stubs too.
673 (Stub_table::update_size): Adjust.
674 (Stub_table::prev_size, set_prev_size): Delete.
675 (Stub_table::stub_align): Let --plt-align affect result.
676 (Stub_table::plt_call_size): Calculate sizes for various stubs.
677 (Stub_table::branch_stub_size): Use last_plt_size in address calc.
678 (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
679 (Stub_table::do_write): Support more stub variants.
680
681 2012-12-04 Alan Modra <amodra@gmail.com>
682
683 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
684 (Target_powerpc::do_define_standard_symbols): New function.
685
686 2012-12-03 Alan Modra <amodra@gmail.com>
687
688 * output.h: Formatting, whitespace.
689
690 2012-12-03 Alan Modra <amodra@gmail.com>
691
692 * layout.h (Layout::get_executable_sections): Declare.
693 * layout.cc (Layout::get_executable_sections): New function.
694 * arm.cc (Target_arm::group_sections): Use it.
695 (Arm_output_section::group_sections): Delete now redundant test.
696 * output.cc (Output_reloc::Output_reloc): Add is_relative.
697 param to handle relative relocs.
698 * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
699 (Output_data_reloc::add_absolute): Adjust.
700 (Output_data_reloc::add_relative): New function.
701 (Output_data::reset_data_size): New function.
702 (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
703 (Output_section::set_addralign): New function.
704 (Output_section::checkpoint_set_addralign): New function.
705 (Output_section::clear_section_offsets_need_adjustment): New function.
706 (Output_section::input_sections): Make public.
707 * powerpc.cc (class Output_data_brlt_powerpc): New.
708 (class Stub_table, class Stub_control): New.
709 (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
710 stub_table_, set_stub_table, stub_table): New vectors and accessor
711 functions.
712 (Target_powerpc::do_may_relax, do_relax, push_branch,
713 new_stub_table, stub_tables, brlt_section, group_sections,
714 add_branch_lookup_table, find_branch_lookup_table,
715 write_branch_lookup_table, make_brlt_section): New functions.
716 (Target_powerpc::struct Sort_sections, class Branch_info): New.
717 (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
718 branch_info_): New vars.
719 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
720 make call stubs here.
721 (Output_data_glink): Remove all call stub handling from this class.
722 (Target_powerpc::Scan::local, global): Save interesting branch
723 relocs and relocs for ifunc. Adjust calls to plt entry functions.
724 (Target_powerpc::do_finalize_sections): Only make reg save/restore
725 functions on final link.
726 (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
727 Handle long branch destinations too.
728 (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
729 do_plt_address_for_local): Adjust lookup of plt call stubs.
730
731 2012-11-30 Alan Modra <amodra@gmail.com>
732
733 * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
734 relocs against protected symbols when building 32-bit shared libs.
735
736 2012-11-30 Alan Modra <amodra@gmail.com>
737
738 * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
739 param. Call got_section() to make .got. Update all callers
740 and their callers and so on.
741
742 2012-11-30 Alan Modra <amodra@gmail.com>
743
744 * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
745 _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
746 (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
747 value if it already exists.
748
749 2012-11-19 H.J. Lu <hongjiu.lu@intel.com>
750
751 PR gold/14858
752 * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
753
754 2012-11-14 Roland McGrath <mcgrathr@google.com>
755
756 * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
757 than bfc instruction for data sandboxing.
758
759 2012-11-08 Alan Modra <amodra@gmail.com>
760
761 * po/POTFILES.in: Regenerate.
762
763 2012-11-05 Alan Modra <amodra@gmail.com>
764
765 * configure.ac: Apply 2012-09-10 change to config.in here.
766 * configure: Regenerate.
767
768 2012-11-05 Alan Modra <amodra@gmail.com>
769
770 * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
771 (struct Opd_ent): Use "Address" rather than "Offset".
772 (Output_data_got_powerpc::got_base_offset): Return Valtype.
773 (Target_powerpc::got_section): Make public.
774 (Target_powerpc::scan_relocs): Move code setting symbols..
775 (Powerpc_relobj::do_scan_relocs): ..to here, new function.
776 Create _SDA_BASE_ only when referenced.
777
778 2012-11-02 Roland McGrath <mcgrathr@google.com>
779
780 * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
781 from last change.
782
783 2012-11-01 Roland McGrath <mcgrathr@google.com>
784
785 * target.h (Sized_target::relocate_relocs): Use Elf_Off
786 for offset_in_output_section parameter.
787 (Sized_target::relocate_special_relocatable): Likewise.
788 * arm.cc (Target_arm::relocate_relocs): Likewise.
789 (Target_arm::relocate_special_relocatable): Likewise.
790 * i386.cc (Target_i386::relocate_relocs): Likewise.
791 * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
792 * sparc.cc (Target_sparc::relocate_relocs): Likewise.
793 * target-reloc.h (relocate_relocs): Likewise.
794 * testsuite/testfile.cc (Target_test): Likewise.
795 * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
796 * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
797
798 * system.h: Move inclusion of <clocale> to after <libintl.h> in
799 [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
800
801 * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
802 parameter, which is unused in the [!F_SETFD] case.
803
804 * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
805 SYMNDX to off_t before comparing it to this->data_size().
806 * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
807 * incremental.cc (Output_section_incremental_inputs::do_write):
808 Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
809
810 * nacl.cc: Include "libiberty.h" for vasprintf declaration.
811
812 2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
813
814 * gold.cc (Target_arm::do_adjust_elf_header): Add the
815 hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
816 in EABI_VER5.
817
818 2012-10-29 Cary Coutant <ccoutant@google.com>
819
820 * dwp.cc (usage): Add file and exit status parameters;
821 add --help and --version options.
822 (print_version): New function.
823 (main): Add --help and --version options.
824
825 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
826
827 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
828 final_layout_sequence.txt.
829 * testsuite/Makefile.in: Regenerated.
830
831 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
832
833 * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
834 COMPILE generated by automake.
835 (LINK1): Likewise.
836 (CXXCOMPILE1): Likewise.
837 (CXXLINK1): Likewise.
838 (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
839 (LINK): Likewise.
840 (CXXCOMPILE): Likewise.
841 (CXXLINK): Likewise.
842 * testsuite/Makefile.in: Regenerated.
843
844 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
845
846 * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
847 on bad fwrite return.
848
849 2012-10-25 H.J. Lu <hongjiu.lu@intel.com>
850
851 * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
852 on val.
853
854 2012-10-23 Cary Coutant <ccoutant@google.com>
855
856 * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
857 * testsuite/Makefile.in: Regenerate.
858 * testsuite/dwp_test.h: New source file.
859 * testsuite/dwp_test_1.cc: New source file.
860 * testsuite/dwp_test_1.s: New source file.
861 * testsuite/dwp_test_1.sh: New source file.
862 * testsuite/dwp_test_1b.cc: New source file.
863 * testsuite/dwp_test_1b.s: New source file.
864 * testsuite/dwp_test_2.cc: New source file.
865 * testsuite/dwp_test_2.s: New source file.
866 * testsuite/dwp_test_2.sh: New source file.
867 * testsuite/dwp_test_main.cc: New source file.
868 * testsuite/dwp_test_main.s: New source file.
869
870 2012-10-23 Cary Coutant <ccoutant@google.com>
871
872 * dwp.h: New header file.
873 * dwp.cc: New source file.
874 * gold.h: Move shared declarations to system.h.
875 * system.h: New header file.
876 * Makefile.am: Add dwp.
877 * Makefile.in: Regenerate.
878
879 2012-10-23 Cary Coutant <ccoutant@google.com>
880
881 * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
882 Dwarf_info_reader::read_from_pointer.
883 (Dwarf_pubnames_table::read_header): Likewise.
884 (Dwarf_pubnames_table::next_name): Likewise.
885 (Dwarf_die::read_attributes): Likewise.
886 (Dwarf_die::skip_attributes): Likewise.
887 (Dwarf_info_reader::read_from_pointer): New function template.
888 * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
889 (Dwarf_pubnames_table): Likewise.
890 (Dwarf_info_reader::read_from_pointer): New function template.
891 * gdb-index.cc (Gdb_index_info_reader): Adjust call to
892 Dwarf_pubnames_table ctor.
893
894 2012-10-23 Cary Coutant <ccoutant@google.com>
895
896 * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
897 abbrev_shndx.
898 * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
899 abbrev_shndx_.
900 (Dwarf_info_reader::set_abbrev_shndx): New method.
901 (Dwarf_info_reader::abbrev_shndx_): New data member.
902
903 2012-10-23 Cary Coutant <ccoutant@google.com>
904
905 * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
906 from object, not parameters.
907 (Dwarf_info_reader::parse): Likewise.
908 * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
909 (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
910 (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
911 methods.
912
913 2012-10-23 Cary Coutant <ccoutant@google.com>
914
915 * fileread.cc (Input_file::Input_file): New constructor.
916 * fileread.h (class Input_file): Add new constructor.
917
918 2012-10-18 Alan Modra <amodra@gmail.com>
919
920 PR gold/14727
921 * object.cc (Relobj::is_section_name_included): Also match
922 .sdata personality section.
923
924 2012-10-18 Alan Modra <amodra@gmail.com>
925
926 * target-reloc.h (class Default_comdat_behavior): New, package up..
927 (get_comdat_behaviour): ..this.
928 (relocate_section): Add Relocate_comdat_behavior template arg,
929 adjust code to suit.
930 * arm.cc (Target_arm::relocate_section): Adjust to suit.
931 (Target_arm::scan_reloc_section): Likewise.
932 * i386.cc (Target_i386::relocate_section): Likewise.
933 * sparc.cc (Target_sparc::relocate_section): Likewise.
934 * tilegx.cc (Target_tilegx::relocate_section): Likewise.
935 * x86_64.cc (Target_x86_64::relocate_section): Likewise.
936 * powerpc.cc (class Relocate_comdat_behavior): New.
937 (Target_powerpc::relocate_section): Don't zap opd relocs. Supply
938 gold::relocate_section with new template arg.
939
940 2012-10-18 Alan Modra <amodra@gmail.com>
941
942 * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
943 dynamic relocs for GOT_TPREL got entries, without symbol if
944 resolving locally.
945 (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
946 (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
947 (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
948
949 2012-10-17 Alan Modra <amodra@gmail.com>
950
951 PR gold/14726
952 * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
953
954 2012-10-16 Sriraman Tallam <tmsriram@google.com>
955
956 * layout.cc (Layout::include_section): Keep sections marked
957 SHF_EXCLUDE when doing relocatable links.
958
959 2012-10-16 Alan Modra <amodra@gmail.com>
960
961 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
962 (Target_powerpc::do_finalize_sections): Call it.
963 (Output_data_save_res): New class and supporting functions.
964 (Target_powerpc::symval_for_branch): Only look up .opd entry for
965 normal symbols defined in object files.
966
967 2012-10-12 Alan Modra <amodra@gmail.com>
968
969 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
970 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
971 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
972 section if scan_opd_relocs not yet called.
973 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
974
975 2012-10-12 Alan Modra <amodra@gmail.com>
976
977 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
978 add_local_ifunc_entry): Revert last change.
979 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
980
981 2012-10-05 Alan Modra <amodra@gmail.com>
982
983 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
984 do_plt_address_for_global): New functions.
985 (Output_data_got_powerpc::do_write): Don't segfault when linking
986 statically.
987 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
988 add_local_ifunc_entry): Return true on adding entry..
989 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
990 glink->add_entry call. Remove unused symtab param. Adjust calls.
991 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
992 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
993 set up symbols here.
994 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
995 syms here. Do so even when no .iplt. Don't segfault when linking
996 statically.
997 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
998 new variants without reloc param.
999 (Glink_sym_ent::Glink_sym_ent): Likewise.
1000 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1001 reloc when refs will resolve to plt call stub.
1002 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
1003 R_PPC_PLTREL24 to resolve locally.
1004 (Target_powerpc::Scan::global): Correct ifunc handling.
1005 (Target_powerpc::Relocate::relocate): Correct local sym glink
1006 lookup. Don't destroy "value" when we have a plt call stub,
1007 and when checking plt call validity.
1008 (Target_powerpc::do_dynsym_value): Simplify.
1009
1010 2012-10-05 Alan Modra <amodra@gmail.com>
1011
1012 * i386.cc (Output_data_plt_i386::address_for_global,
1013 address_for_local): Add plt offset to returned value. Adjust uses.
1014 * sparc.cc (Output_data_plt_sparc::address_for_global,
1015 address_for_local): Likewise.
1016 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1017 address_for_local): Likewise.
1018 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1019 address_for_local): Likewise.
1020 * target.h (Target::plt_address_for_global, plt_address_for_local):
1021 Update comment.
1022 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1023 (Output_data_got::Got_entry::write): Nor here.
1024 * output.h: Comment fix.
1025
1026 2012-10-02 Jiong Wang <jiwang@tilera.com>
1027
1028 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1029 global_offset_table_ value for larget got.
1030 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1031
1032 2012-09-29 Alan Modra <amodra@gmail.com>
1033
1034 * powerpc.cc (Target_powerpc::iplt_): New output section.
1035 (Target_powerpc::iplt_section, make_iplt_section,
1036 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1037 (Target_powerpc::make_plt_entry): Handle ifunc syms.
1038 Target_powerpc::plt_entry_count): Count iplt entries too.
1039 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1040 reloc section in constructor. New params.
1041 (Target_powerpc::make_plt_section): Create reloc section here instead.
1042 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1043 functions.
1044 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1045 (Output_data_glink::add_entry, find_entry): New functions to
1046 deal with local syms.
1047 (Glink_sym_ent): Add support for local syms.
1048 (Output_data_glink::do_write): Handle ifunc plt entries.
1049 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1050 (Target_powerpc::Scan::local, global): Handle ifunc syms.
1051 (Target_powerpc::Relocate::relocate): Likewise.
1052 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1053
1054 2012-09-25 Alan Modra <amodra@gmail.com>
1055
1056 * object.h (Sized_relobj_file::adjust_local_symbol,
1057 do_adjust_local_symbol): New functions.
1058 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1059 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1060 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1061 and irregular opd entry spacing.
1062 (Powerpc_relobj::do_read_relocs): Add opd size checks.
1063 (Global_symbol_visitor_opd): New functor.
1064 (Target_powerpc::do_finalize_sections): Omit global symbols defined
1065 on deleted opd entries.
1066
1067 2012-09-15 Jiong Wang <jiwang@tilera.com>
1068
1069 * tilegx.cc: New file.
1070 * Makefile.am (TARGETSOURCES): Add tilegx.cc
1071 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1072 * configure.tgt: Add entries for tilegx*.
1073 * configure.ac: Likewise.
1074 * Makefile.in: Rebuild.
1075 * configure: Likewise.
1076 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1077 tilegx.
1078
1079 2012-09-13 Alan Modra <amodra@gmail.com>
1080
1081 * target-reloc.h (scan_relocs): Call scan.local for relocs
1082 against symbols in discarded sections. Pass is_discarded
1083 param.
1084 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1085 Add is_discarded param.
1086 * powerpc (Target_powerpc::Scan::local): Likewise. Use
1087 is_discarded to flag opd entry as discarded. Don't emit dyn
1088 relocs on such entries.
1089 (Target_powerpc::Scan::global): Similarly detect and handle
1090 such opd entries.
1091 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1092 opd_ent_. Update all uses.
1093 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1094 (Target_powerpc::relocate_section): Zero out discarded opd
1095 entry relocs.
1096
1097 2012-09-12 Ian Lance Taylor <iant@google.com>
1098
1099 PR gold/14570
1100 * output.cc: Rename Output_data_got template parameter from size
1101 to got_size for all functions. Compile all variants of
1102 Output_data_got.
1103 (Output_data_got::Got_entry::write): Correct use of size for
1104 symbol value. Use local_is_tls rather than casting to
1105 Sized_relobj_file.
1106 * object.h (class Object): Add local_is_tls and do_local_is_tls.
1107 (class Sized_relobj_file): Add do_local_is_tls.
1108 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1109
1110 2012-09-11 Alan Modra <amodra@gmail.com>
1111
1112 PR gold/14566
1113 * layout.cc (Layout::set_segment_offsets): When using
1114 common-page-size alignment, ensure we are on a new max-page-size
1115 page.
1116 * output.cc (Output_segment::set_section_addresses): Use
1117 abi_pagesize, not common_pagesize for relro boundary.
1118 (Output_segment::set_offset): Likewise.
1119
1120 2012-09-11 Alan Modra <amodra@gmail.com>
1121
1122 * output.h (Output_data_got::add_global_tls, add_local_tls,
1123 add_local_tls_pair): New functions.
1124 (Output_data_got::add_local_pair_with_rel): Remove second
1125 reloc param. Expand comment.
1126 (Output_data_got::Got_entry): Rename use_plt_offset_ to
1127 use_plt_or_tls_offset_, similarly for constructor param.
1128 (Output_data_got::Got_entry::write): Add got_index param.
1129 * output.cc (Output_data_got::add_global_tls, add_local_tls,
1130 add_local_tls_pair): New functions.
1131 (Output_data_got::Got_entry::write): Handle tls symbols
1132 with use_plt_or_tls_offset_ set specially.
1133 (Output_data_got::add_local_pair_with_rel): Only one reloc.
1134 (Output_data_got::do_write): Replace iterator with index, pass
1135 index to entry write function.
1136 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1137 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1138 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1139 call.
1140 * i386.cc (Target_i386::Scan::local): Likewise.
1141 * sparc.cc (Target_sparc::Scan::local): Likewise.
1142 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1143 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1144 do_tls_offset_for_global): New functions.
1145 (Target_powerpc::Scan::local): Correct TLS relocations and got
1146 entry values.
1147 (Target_powerpc::Scan::global): Don't emit unnecessary
1148 dynamic relocations on TLS GOT entries.
1149
1150 2012-09-10 Matthias Klose <doko@ubuntu.com>
1151
1152 * config.in: Disable sanity check for kfreebsd.
1153
1154 2012-09-10 Sterling Augustine <saugustine@google.com>
1155
1156 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1157 (Gdb_index::pubtypes_read): New parameter.
1158 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1159 to calls.
1160 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1161 pubtypes_object_.
1162
1163 2012-09-09 Alan Modra <amodra@gmail.com>
1164
1165 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1166 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1167 * gc.h (gc_process_relocs): Call target gc_add_reference.
1168 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1169 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1170 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1171 unnecessary cast.
1172 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1173 to cater for when we don't need code offset. Update use.
1174 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1175 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1176 set_opd_valid): New functions.
1177 (Target_powerpc::do_gc_add_reference): New function.
1178 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1179 stashed refs.
1180 (Target_powerpc::do_gc_mark_symbol): New function.
1181
1182 2012-09-06 Cary Coutant <ccoutant@google.com>
1183
1184 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1185 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1186 (Dwarf_die::skip_attributes): Likewise.
1187 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1188 * testsuite/gdb_index_test.cc (inline_func_1): New function.
1189 (main): Call it.
1190 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1191
1192 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
1193
1194 * testsuite/script_test_3.t: Add .got.plt output section
1195 statement.
1196 * testsuite/script_test_4.t: Likewise.
1197
1198 2012-09-05 Alan Modra <amodra@gmail.com>
1199
1200 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1201 update all uses and lose "enum" when using type.
1202
1203 2012-09-05 Alan Modra <amodra@gmail.com>
1204
1205 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1206 * configure: Regenerate.
1207 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1208 (plugin_final_layout.stdout): Likewise.
1209 (memory_test): Set page sizes to 0x1000.
1210 * testsuite/Makefile.in: Regenerate.
1211 * testsuite/discard_locals_test.sh: Add FIXME comment.
1212 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1213 * testsuite/pr14265.t: Add .got output section statement.
1214 * testsuite/script_test_2.t: Likewise.
1215 * testsuite/script_test_3.t: Likewise.
1216 * testsuite/script_test_4.t: Likewise.
1217 * testsuite/script_test_5.t: Likewise.
1218 * testsuite/script_test_6.t: Likewise.
1219 * testsuite/script_test_7.t: Likewise.
1220 * testsuite/script_test_9.t: Likewise.
1221
1222 2012-09-05 Alan Modra <amodra@gmail.com>
1223
1224 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1225 (Powerpc_relocate_functions::Status): New typedef.
1226 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1227 (Target_powerpc::Scan::local): Handle REL64.
1228 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1229 for REL32 and REL64.
1230 (Target_powerpc::symval_for_branch): New function, extracted from..
1231 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
1232 checks. Report overflow errors.
1233
1234 2012-09-05 Alan Modra <amodra@gmail.com>
1235
1236 * object.h (Sized_relobj_file::emit_relocs): Delete.
1237 (Sized_relobj_file::emit_relocs_reltype): Delete.
1238 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1239 relocate_relocs for --emit-relocs.
1240 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1241 * output.h: Update comment.
1242 (Output_segment::first_section): New function.
1243 (Output_segment::first_section_load_address): Use first_section.
1244 * output.cc (Output_segment::first_section): New function extracted..
1245 (Output_segment::first_section_load_address): ..from here. Delete.
1246 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1247 * target.h (Sized_target::relocate_for_relocatable): Likewise.
1248 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1249 adjust call to target.h function.
1250 * i386.cc (Target_i386): Likewise.
1251 * sparc.cc (Target_sparc): Likewise.
1252 * x86_64.cc (Target_x86_64): Likewise.
1253 * powerpc.cc (Target_powerpc): Likewise.
1254 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
1255 first tls section has section symbol for optimised local dynamic
1256 output relocs.
1257 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1258 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1259 optimised tls code.
1260 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1261 Rename to relocate_relocs. Update error message.
1262
1263 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
1264
1265 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1266 --just-symbols.
1267
1268 2012-08-31 Alan Modra <amodra@gmail.com>
1269
1270 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1271 (Powerpc_relobj::toc_base_offset): New stub function.
1272 (Target_powerpc): Add tp_offset, dtp_offset. Rename
1273 got_mod_index_offset to tlsld_got_offset. Update all refs.
1274 (Target_powerpc::Relocate::enum skip_tls): New.
1275 (Target_powerpc::call_tls_get_addr_): New var.
1276 (Target_powerpc::is_branch_reloc): Move to file scope.
1277 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1278 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1279 New functions.
1280 (Target_powerpc::enum Got_type): Delete old values, add new ones.
1281 (powerpc_info): Correct common_pagesize for ppc64.
1282 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1283 (Powerpc_relocate_functions): Add overflow check enums and functions.
1284 Add non-shift version of rela, rela_ua. Delete all rel public
1285 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
1286 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1287 addr16_ha3, addr14 functions.
1288 (Output_data_got_powerpc::add_constant_pair): New function.
1289 (Output_data_got_powerpc::got_base_offset): Likewise.
1290 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1291 (instruction constants): Sort, add some more.
1292 (Output_data_glink::do_write): Add and use Address typedef. Use
1293 object->toc_base_offset() stub for 64-bit.
1294 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1295 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1296 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1297 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
1298 Always treat .opd relocs as against locally defined symbol.
1299 Correct condition for RELATIVE relocs.
1300 (Target_powerpc::do_finalize_sections): Test for NULL sections.
1301 (Target_powerpc::Relocate::relocate): Use plt call stub as value
1302 for 32-bit syms with a plt entry. Correct ppc64 toc base
1303 calculations. Handle TLS relocs, and more. Add overflow
1304 checking and adjust for Powerpc_relocate_functions changes.
1305 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1306 Reinstate --emit-relocs code with FIXME.
1307
1308 2012-08-30 Alan Modra <amodra@gmail.com>
1309
1310 * layout.cc (Layout::set_segment_offsets): Set p_align to
1311 abi_pagesize, not common_pagesize.
1312 (Layout::relaxation_loop_body): Similarly use abi_pagesize
1313 to determine whether file header can go in segment.
1314
1315 2012-08-30 Alan Modra <amodra@gmail.com>
1316
1317 * output.h (Output_reloc::Output_reloc <output section>): Add
1318 is_relative param. Adjust calls.
1319 (Output_reloc::add_output_section_relative): New functions.
1320 * output.cc (Output_reloc::Output_reloc <output section>): Handle
1321 is_relative.
1322 (Output_reloc::symbol_value): Handle SECTION_CODE.
1323
1324 2012-08-24 Sriraman Tallam <tmsriram@google.com>
1325
1326 * gold.cc (queue_middle_tasks): Call layout again when unique
1327 segments for sections is desired.
1328 * layout.cc (Layout::Layout): Initialize new members.
1329 (Layout::get_output_section_flags): New function.
1330 (Layout::choose_output_section): Call get_output_section_flags.
1331 (Layout::layout): Make output section for mapping to a unique segment.
1332 (Layout::insert_section_segment_map): New function.
1333 (Layout::attach_allocated_section_to_segment): Make unique segment for
1334 output sections marked so.
1335 (Layout::segment_precedes): Check for unique segments when sorting.
1336 * layout.h (Layout::Unique_segment_info): New struct.
1337 (Layout::Section_segment_map): New typedef.
1338 (Layout::insert_section_segment_map): New function.
1339 (Layout::get_output_section_flags): New function.
1340 (Layout::is_unique_segment_for_sections_specified): New function.
1341 (Layout::set_unique_segment_for_sections_specified): New function.
1342 (Layout::unique_segment_for_sections_specified_): New member.
1343 (Layout::section_segment_map_): New member.
1344 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1345 Rename is_gc_pass_one to is_pass_one.
1346 Rename is_gc_pass_two to is_pass_two.
1347 Rename is_gc_or_icf to is_two_pass.
1348 Check for which pass based on whether symbols data is present.
1349 Make it two pass when unique segments for sections is desired.
1350 * output.cc (Output_section::Output_section): Initialize new
1351 members.
1352 * output.h (Output_section::is_unique_segment): New function.
1353 (Output_section::set_is_unique_segment): New function.
1354 (Output_section::is_unique_segment_): New member.
1355 (Output_section::extra_segment_flags): New function.
1356 (Output_section::set_extra_segment_flags): New function.
1357 (Output_section::extra_segment_flags_): New member.
1358 (Output_section::segment_alignment): New function.
1359 (Output_section::set_segment_alignment): New function.
1360 (Output_section::segment_alignment_): New member.
1361 (Output_segment::Output_segment): Initialize is_unique_segment_.
1362 (Output_segment::is_unique_segment): New function.
1363 (Output_segment::set_is_unique_segment): New function.
1364 (Output_segment::is_unique_segment_): New member.
1365 * plugin.cc (allow_unique_segment_for_sections): New function.
1366 (unique_segment_for_sections): New function.
1367 (Plugin::load): Add new functions to transfer vector.
1368 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1369 * Makefile.in: Regenerate.
1370 * testsuite/plugin_final_layout.sh: Check if unique segment
1371 functionality works.
1372 * testsuite/plugin_section_order.c (onload): Check if new interfaces
1373 are available.
1374 (allow_unique_segment_for_sections): New global.
1375 (unique_segment_for_sections): New global.
1376 (claim_file_hook): Call allow_unique_segment_for_sections.
1377 (all_symbols_read_hook): Call unique_segment_for_sections.
1378
1379 2012-08-22 Cary Coutant <ccoutant@google.com>
1380
1381 * layout.cc (Layout::include_section): Don't assert on GROUP
1382 sections with --emit-relocs.
1383
1384 2012-08-21 Cary Coutant <ccoutant@google.com>
1385
1386 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1387 if --export-dynamic-symbol names an undef symbol.
1388
1389 2012-08-18 Alan Modra <amodra@gmail.com>
1390
1391 * powerpc.cc: Formatting and white space.
1392 (Powerpc_relobj): Rename got2_section_ to special_.
1393 Add opd_ent_shndx_ and opd_ent_off_ vectors.
1394 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1395 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1396 (Target_powerpc): Add Address typedef and invalid_address. Use
1397 throughout.
1398 (Target_powerpc::is_branch_reloc): New function.
1399 (Powerpc_relocate_functions): Add Address typedef, use throughout.
1400 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1401 for dst_mask, value and addend.
1402 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1403 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1404 (Output_data_glink::do_write): Correct toc base. Don't try to use
1405 uint16_t for 24-bit offset. Use get_output_section_offset and
1406 check return.
1407 (Target_powerpc::Scan::local): Handle more relocs.
1408 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1409 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1410 Plug in toc restoring insn after plt calls. Translate branches
1411 to function descriptor symbols to corresponding entry point.
1412 (Target_powerpc::relocate_for_relocatable): Check return from
1413 get_output_section_offset.
1414 * symtab.h: Comment typo.
1415
1416 2012-08-14 Ian Lance Taylor <iant@google.com>
1417
1418 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1419 unsupported_relocal_local to call unsupported_reloc_global.
1420
1421 2012-08-14 Nick Clifton <nickc@redhat.com>
1422
1423 PR ld/14265
1424 * script-sections.cc (Sections_element::output_section_name): Add
1425 keep return parameter.
1426 (Output_section_element::match_name): Add keep return parameter.
1427 Return the value of the keep_ member.
1428 * script-sections.h (class Output_section): Update
1429 output_section_name prototype.
1430 * layout.cc (Layout::keep_input_section): New public member
1431 function.
1432 (Layout::choose_output_section): Pass keep parameter to
1433 output_section_name.
1434 * layout.h (class Layout): Add keep_input_section.
1435 * object.cc (Sized_relobj_file::do_layout): Check for kept input
1436 sections.
1437 * testsuite/Makefile.am: Add a test.
1438 * testsuite/Makefile.in: Regenerate.
1439 * testsuite/pr14265.c: Source file for the test.
1440 * testsuite/pr14265.t: Linker script for the test.
1441 * testsuite/pr14265.sh: Shell script for the test.
1442
1443 2012-08-14 Alan Modra <amodra@gmail.com>
1444
1445 * target.h (Target::output_section_name): New function.
1446 (Target::do_output_section_name): New function.
1447 * layout.cc (Layout::choose_output_section): Call the above.
1448 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1449
1450 2012-08-14 Alan Modra <amodra@gmail.com>
1451
1452 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1453 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1454 for replace_constant call.
1455 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1456 (Output_data_glink::do_print_to_mapfile): New function.
1457 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1458 (Target_powerpc::Relocate::relocate): Likewise.
1459
1460 2012-08-14 Alan Modra <amodra@gmail.com>
1461
1462 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1463 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1464 (Output_data_glink::add_entry,find_entry): Remove shndx param.
1465 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
1466 all references to shndx_. Handle special case for R_PPC_PLTREL24
1467 here.
1468 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1469 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1470 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1471 here.
1472 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1473 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1474
1475 2012-08-12 Alan Modra <amodra@gmail.com>
1476
1477 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
1478 (glink insn constants): Use uint32_t.
1479 (Output_data_glink::add_entry): Use insert, not [] operator.
1480
1481 2012-08-11 Alan Modra <amodra@gmail.com>
1482
1483 * object.h (Sized_relobj_file::find_shdr): New function.
1484 (Sized_relobj_file::find_special_sections): New function.
1485 * object.cc (Sized_relobj_file::find_shdr): New function.
1486 (Sized_relobj_file::find_eh_frame): Use find_shdr.
1487 (Sized_relobj_file::find_special_sections): New function, split out..
1488 (Sized_relobj_file::do_read_symbols): ..from here.
1489 * output.h (Output_data_got::replace_constant): New function.
1490 (Output_data_got::num_entries): New function.
1491 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1492 (Output_data_got::got_offset): Protected rather than private.
1493 (Output_data_got::replace_got_entry): New function.
1494 * output.cc (Output_data_got::replace_got_entry): New function.
1495 * powerpc.cc (class Powerpc_relobj): New.
1496 (class Powerpc_relocate_functions): Delete all psymval variants or
1497 convert to value,addend type. Delete pcrela, pcrela_unaligned.
1498 Implement _ha functions using corresponding _hi function.
1499 (Powerpc_relobj::find_special_sections): New function.
1500 (Target_powerpc::do_make_elf_object): New function.
1501 (class Output_data_got_powerpc): New.
1502 (class Output_data_glink): New.
1503 (class Powerpc_scan_relocatable_reloc): New.
1504 Many more changes througout file.
1505
1506 2012-08-09 Nick Clifton <nickc@redhat.com>
1507
1508 * po/vi.po: Updated Vietnamese translation.
1509
1510 2012-08-07 Ian Lance Taylor <iant@google.com>
1511
1512 * layout.cc (Layout::add_target_dynamic_tags): If
1513 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1514 plt_rel.
1515
1516 2012-07-30 Nick Clifton <nickc@redhat.com>
1517
1518 * po/gold.pot: Updated template.
1519 * po/es.po: Updated Spanish translation.
1520
1521 2012-07-18 Cary Coutant <ccoutant@google.com>
1522
1523 PR gold/14344
1524 * configure.ac: Add check for -gpubnames support.
1525 * configure: Regenerate.
1526 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1527 support; force -gno-pubnames.
1528 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1529 support.
1530 (gdb_index_test_4): New test.
1531 * testsuite/Makefile.in: Regenerate.
1532 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1533 * testsuite/gdb_index_test_2.sh: Likewise.
1534 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1535 * testsuite/gdb_index_test_4.sh: New script.
1536 * testsuite/gdb_index_test_comm.sh: New script with common code;
1537 don't look for space after colon.
1538
1539 2012-07-16 Sriraman Tallam <tmsriram@google.com>
1540
1541 * gold.cc (queue_middle_tasks): Update function order only after
1542 deferred objects due to plugins are processed.
1543
1544 2012-07-11 Ian Lance Taylor <iant@google.com>
1545
1546 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1547 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1548 (Target_arm::scan_reloc_for_stub): Likewise.
1549 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1550 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1551 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1552 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1553 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1554
1555 2012-07-10 Dodji Seketeli <dodji@redhat.com>
1556 Ian Lance Taylor <iant@google.com>
1557
1558 PR gold/14309
1559 * configure.ac: Test whether std::tr1::hash<off_t> works.
1560 * gold.h: Add a specialization for std::tr1::hash<off_t> if
1561 needed.
1562 * output.h (class Output_fill): Add virtual destructor.
1563 * configure, config.in: Rebuild.
1564
1565 2012-06-22 Roland McGrath <mcgrathr@google.com>
1566
1567 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1568
1569 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
1570
1571 * plugin.cc (Plugin::load): Handle position independent executables.
1572
1573 2012-06-06 Cary Coutant <ccoutant@google.com>
1574
1575 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1576 add .debug_macro.
1577 (lines_only_debug_sections): Likewise.
1578 (gdb_fast_lookup_sections): New static array.
1579 (is_gdb_debug_section): Rename formal parameter.
1580 (is_lines_only_debug_section): Likewise.
1581 (is_gdb_fast_lookup_section): New function.
1582 (Layout::include_section): Check for ".zdebug_" prefix; pass
1583 section name suffix to is_gdb_debug_section, et al.; check for
1584 fast-lookup sections when building .gdb_index.
1585 * options.h (--strip-debug-gdb): Update GDB version number.
1586
1587 2012-06-06 Cary Coutant <ccoutant@google.com>
1588
1589 * configure.ac: Add check for fallocate.
1590 * configure: Regenerate.
1591 * config.in: Regenerate.
1592
1593 * options.h (class General_options): Add --mmap-output-file and
1594 --posix-fallocate options.
1595 * output.cc: (posix_fallocate): Remove; replace with...
1596 (gold_fallocate): New function.
1597 (Output_file::map_no_anonymous): Call gold_fallocate.
1598 (Output_file::map): Check --mmap-output-file option.
1599
1600 2012-06-05 Jing Yu <jingyu@google.com>
1601
1602 * gold.h (textdomain): Add do {} to empty while(0).
1603 (bindtextdomain): Likewise.
1604
1605 2012-06-04 Cary Coutant <ccoutant@google.com>
1606
1607 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1608 has_dynsym_index.
1609
1610 2012-05-25 Sriraman Tallam <tmsriram@google.com>
1611
1612 * symtab.cc (Symbol_table::define_special_symbol):
1613 Initialize *poldsym to prevent uninitialized variable errors.
1614
1615 2012-05-23 Cary Coutant <ccoutant@google.com>
1616
1617 * layout.cc (Layout::section_name_mapping): Add rules to handle
1618 exact match on .data.rel.ro.local or .data.rel.ro.
1619 (Layout::output_section_name): Check for exact matches.
1620
1621 2012-05-23 Cary Coutant <ccoutant@google.com>
1622
1623 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1624 more carefully.
1625
1626 2012-05-22 Cary Coutant <ccoutant@google.com>
1627
1628 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1629 object before exporting symbol.
1630
1631 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
1632
1633 * testsuite/tls_test.cc: Include "config.h" first.
1634 * testsuite/tls_test_c.c: Likewise.
1635
1636 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
1637 Nick Clifton <nickc@redhat.com>
1638
1639 PR 14072
1640 * configure.in: Add check that sysdep.h has been included before
1641 any system header files.
1642 * configure: Regenerate.
1643 * config.in: Regenerate.
1644
1645 2012-05-14 Cary Coutant <ccoutant@google.com>
1646
1647 * layout.cc (Layout::make_output_section): Mark .tdata section
1648 as RELRO.
1649 * testsuite/relro_test.cc: Add a TLS variable.
1650
1651 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
1652
1653 PR gold/14091
1654 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1655 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1656 R_X86_64_64.
1657
1658 2012-05-08 Cary Coutant <ccoutant@google.com>
1659
1660 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1661 (lines_only_debug_sections): Likewise.
1662
1663 2012-05-02 Roland McGrath <mcgrathr@google.com>
1664
1665 * nacl.cc: New file.
1666 * nacl.h: New file.
1667 * Makefile.am (CCFILES, HFILES): Add them.
1668 * Makefile.in: Regenerate.
1669 * i386.cc (Output_data_plt_i386_nacl): New class.
1670 (Output_data_plt_i386_nacl_exec): New class.
1671 (Output_data_plt_i386_nacl_dyn): New class.
1672 (Target_i386_nacl): New class.
1673 (Target_selector_i386_nacl): New class.
1674 (target_selector_i386): Use it instead of Target_selector_i386.
1675 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1676 (Target_x86_64_nacl): New class.
1677 (Target_selector_x86_64_nacl): New class.
1678 (target_selector_x86_64, target_selector_x32): Use it instead of
1679 Target_selector_x86_64.
1680 * arm.cc (Output_data_plt_arm_nacl): New class.
1681 (Target_arm_nacl): New class.
1682 (Target_selector_arm_nacl): New class.
1683 (target_selector_arm, target_selector_armbe): Use it instead of
1684 Target_selector_arm.
1685
1686 * target-select.cc (select_target): Take new Input_file* and off_t
1687 arguments, pass them on to recognize method of selector.
1688 * object.cc (make_elf_sized_object): Update caller.
1689 * parameters.cc (parameters_force_valid_target): Likewise.
1690 * incremental.cc (make_sized_incremental_binary): Likewise.
1691 * target-select.h: Update decl.
1692 (Target_selector::recognize): Take new Input_file* argument,
1693 pass it on to do_recognize.
1694 (Target_selector::do_recognize): Take new Input_file* argument.
1695 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1696 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1697 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1698 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1699
1700 * target.h (Target::Target_info): New members isolate_execinstr
1701 and rosegment_gap.
1702 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1703 * arm.cc (Target_arm::arm_info): Update initializer.
1704 * i386.cc (Target_i386::i386_info): Likewise.
1705 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1706 * sparc.cc (Target_sparc::sparc_info): Likewise.
1707 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1708 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1709 * layout.cc (Layout::attach_allocated_section_to_segment):
1710 Take new const Target* argument. If target->isolate_execinstr(), act
1711 like --rosegment.
1712 (Layout::find_first_load_seg): Take new const Target* argument;
1713 if target->isolate_execinstr(), reject PF_X segments.
1714 (Layout::relaxation_loop_body): Update caller.
1715 (Layout::set_segment_offsets): If target->isolate_execinstr(),
1716 reset file offset to zero when we hit LOAD_SEG, and then do a second
1717 loop over the segments before LOAD_SEG to reassign offsets after
1718 addresses have been determined. Handle target->rosegment_gap().
1719 (Layout::attach_section_to_segment): Take new const Target* argument;
1720 pass it to attach_allocated_section_to_segment.
1721 (Layout::make_output_section): Update caller.
1722 (Layout::attach_sections_to_segments): Take new const Target* argument;
1723 pass it to attach_section_to_segment.
1724 * gold.cc (queue_middle_tasks): Update caller.
1725 * layout.h (Layout): Update method decls with new arguments.
1726
1727 * arm.cc (Target_arm::Target_arm): Take optional argument for the
1728 Target_info pointer to use.
1729 (Target_arm::do_make_data_plt): New virtual method.
1730 (Target_arm::make_data_plt): New method that calls it.
1731 (Target_arm::make_plt_entry): Use it.
1732 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1733 for the section alignment.
1734 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1735 method.
1736 (Output_data_plt_arm::first_plt_entry_offset): Call it.
1737 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1738 method.
1739 (Output_data_plt_arm::get_plt_entry_size): Call it.
1740 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1741 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1742 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1743 method.
1744 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1745 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1746 method instead of sizeof(plt_entry).
1747 (Output_data_plt_arm::add_entry): Likewise.
1748 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1749 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1750 than static method.
1751 (Target_arm::plt_entry_size): Likewise.
1752 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1753 Move to ...
1754 (Output_data_plt_arm_standard): ... here, new class.
1755 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1756 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1757 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1758
1759 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1760 Take additional argument for the PLT entry size.
1761 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1762 Use get_plt_entry_size method rather than plt_entry_size variable.
1763 (Output_data_plt_x86_64::reserve_slot): Likewise.
1764 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1765 (Output_data_plt_x86_64::add_entry): Likewise.
1766 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1767 (Output_data_plt_x86_64::address_for_global): Likewise.
1768 (Output_data_plt_x86_64::address_for_local): Likewise.
1769 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1770 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1771 Make method non-static.
1772 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1773 method.
1774 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1775 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1776 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1777 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1778 virtual method.
1779 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1780 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1781 virtual method.
1782 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1783 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1784 virtual method.
1785 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1786 (Output_data_plt_x86_64::plt_entry_size)
1787 (Output_data_plt_x86_64::first_plt_entry)
1788 (Output_data_plt_x86_64::plt_entry)
1789 (Output_data_plt_x86_64::tlsdesc_plt_entry)
1790 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1791 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1792 (Output_data_plt_x86_64_standard): ... here, new class.
1793 (Target_x86_64::Target_x86_64): Take optional argument for the
1794 Target_info pointer to use.
1795 (Target_x86_64::do_make_data_plt): New virtual method.
1796 (Target_x86_64::make_data_plt): New method to call it.
1797 (Target_x86_64::init_got_plt_for_update): Use that.
1798 Call this->plt_->add_eh_frame method here.
1799 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1800 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1801 rather than static method.
1802 (Target_x86_64::plt_entry_size): Likewise.
1803 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1804 rather than plt_entry_size variable. Move guts of PLT filling to...
1805 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1806 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1807 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1808
1809 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1810 additional argument for the section alignment.
1811 Don't do add_eh_frame_for_plt here.
1812 (Output_data_plt_i386::first_plt_entry_offset): Make the method
1813 non-static. Use get_plt_entry_size method rather than plt_entry_size
1814 variable.
1815 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1816 method.
1817 (Output_data_plt_i386::get_plt_entry_size): Call it.
1818 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1819 (Output_data_plt_i386::add_eh_frame): New method to call it.
1820 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1821 method.
1822 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1823 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1824 method.
1825 (Output_data_plt_i386::fill_plt_entry): New method to call it.
1826 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1827 method instead of plt_entry_size.
1828 (Output_data_plt_i386::plt_entry_size)
1829 (Output_data_plt_i386::plt_eh_frame_fde_size)
1830 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1831 (Output_data_plt_i386_standard): ... here, new class.
1832 (Output_data_plt_i386_exec): New class.
1833 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1834 (Output_data_plt_i386_exec::first_plt_entry): ... here.
1835 (Output_data_plt_i386::exec_plt_entry): Move to ...
1836 (Output_data_plt_i386_exec::plt_entry): ... here.
1837 (Output_data_plt_i386_dyn): New class.
1838 (Output_data_plt_i386::first_plt_entry): Move to ...
1839 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1840 (Output_data_plt_i386::dyn_plt_entry): Move to ...
1841 (Output_data_plt_i386_dyn::plt_entry): ... here.
1842 (Target_i386::Target_i386): Take optional argument for the Target_info
1843 pointer to use.
1844 (Target_i386::do_make_data_plt): New virtual method.
1845 (Target_i386::make_data_plt): New method to call it.
1846 (Target_i386::make_plt_section): Use that.
1847 Call this->plt_->add_eh_frame method here.
1848 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1849 rather than plt_entry_size variable.
1850 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1851 (Output_data_plt_i386::address_for_local): Likewise.
1852 (Output_data_plt_i386::do_write): Likewise.
1853 Move guts of PLT filling to...
1854 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1855 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1856 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1857 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1858
1859 2012-05-01 Cary Coutant <ccoutant@google.com>
1860
1861 * dwarf_reader.cc (Dwarf_die::read_attributes)
1862 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1863 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1864 * reduced_debug_output.cc
1865 (Output_reduced_debug_info_section::get_die_end): Remove
1866 DW_FORM_GNU_ref_index. Add default case.
1867
1868 2012-04-26 Mark Wielaard <mjw@redhat.com>
1869
1870 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1871 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1872 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1873 DW_AT_high_pc as offset from DW_AT_low_pc.
1874
1875 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1876 * testsuite/Makefile.in: Regenerate.
1877 * testsuite/gdb_index_test_3.c: New test source file.
1878 * testsuite/gdb_index_test_3.sh: New test source file.
1879
1880 2012-04-25 Ian Lance Taylor <iant@google.com>
1881
1882 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1883 pointer.
1884 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1885 as a class, not a struct.
1886 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1887 (Target_arm::apply_cortex_a8_workaround): Likewise.
1888 * gc.h: Declare Reloc_types as a struct, not a class.
1889 * object.h: Declare Symbols_data as a struct.
1890 * reloc.h: Declare Read_relocs_data as a struct.
1891 * target.h: Declare Relocate_info as a struct.
1892
1893 2012-04-24 David S. Miller <davem@davemloft.net>
1894
1895 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1896 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1897 and R_SPARC_WPLT30.
1898
1899 2012-04-24 Cary Coutant <ccoutant@google.com>
1900
1901 * incremental-dump.cc (find_input_containing_global): Replace
1902 magic number with symbolic constant.
1903 (dump_incremental_inputs): Update version number.
1904 * incremental.cc (Output_section_incremental_inputs): Update version
1905 number; import symbolic constants from Incremental_inputs_reader.
1906 (Incremental_inputs::create_data_sections): Align relocations
1907 section correctly for 64-bit targets.
1908 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1909 constants; add padding.
1910 (Output_section_incremental_inputs::write_header): Add assert for
1911 header_size.
1912 (Output_section_incremental_inputs::write_input_files): Add assert
1913 for input_entry_size.
1914 (Output_section_incremental_inputs::write_info_blocks): Add padding;
1915 add assert for object_info_size, input_section_entry_size,
1916 global_sym_entry_size.
1917 * incremental.h (Incremental_inputs_reader): Add symbolic constants
1918 for data structure sizes; use them.
1919 (Incremental_input_entry_reader): Import symbolic constants from
1920 Incremental_inputs_reader; use them.
1921
1922 2012-04-23 David S. Miller <davem@davemloft.net>
1923
1924 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1925 and elf_flags_set_.
1926 (Target_sparc::Target_sparc): Initialize new fields.
1927 (Target_sparc::do_make_elf_object): New function.
1928 (Target_sparc::do_adjust_elf_header): New function.
1929
1930 2012-04-23 Cary Coutant <ccoutant@google.com>
1931
1932 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1933 CU range table of gdb index.
1934
1935 2012-04-20 David S. Miller <davem@davemloft.net>
1936
1937 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1938 instead of false.
1939
1940 2012-04-16 David S. Miller <davem@davemloft.net>
1941
1942 * sparc.cc (Target_sparc::got_address): New function.
1943 (Sparc_relocate_functions::gdop_hix22): New function.
1944 (Sparc_relocate_functions::gdop_lox10): New function.
1945 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1946 relocs.
1947 (Target_sparc::Scan::local): Likewise if the global symbol is not
1948 preemptible and is not IFUNC.
1949 (Target_sparc::Relocate::relocate): Perform GOTDATA code
1950 transformations for local and non-preemptible non-IFUNC global
1951 symbols.
1952
1953 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1954 writing out 64-bit part of ranges.
1955
1956 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1957 -fpic and -fpie respectively.
1958 * Makefile.in: Regenerate.
1959
1960 * sparc.cc (class Target_sparc): Add rela_ifunc_.
1961 (Target_sparc::Target_sparc): Initialize new field.
1962 (Target_sparc::do_plt_section_for_global): New function.
1963 (Target_sparc::do_plt_section_for_local): New function.
1964 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1965 (Target_sparc::make_plt_section): New function, broken out of
1966 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
1967 (Target_sparc::make_plt_entry): Call make_plt_section.
1968 (Target_sparc::make_local_ifunc_plt_entry): New function.
1969 (Target_sparc::rela_ifunc_section): New function.
1970 (Target_sparc::plt_section): Remove const.
1971 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
1972 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1973 and ifunc_count_ fields.
1974 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1975 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1976 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1977 (Output_data_plt_sparc::rela_ifunc): New function.
1978 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1979 (Output_data_plt_sparc::has_ifunc_section): New function.
1980 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1981 (Output_data_plt_sparc::address_for_global): New function.
1982 (Output_data_plt_sparc::address_for_local): New function.
1983 (Output_data_plt_sparc::plt_index_to_offset): New function.
1984 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1985 and entry_count.
1986 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1987 entry_count.
1988 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1989 R_SPARC_JMP_IREL to switch.
1990 (Target_sparc::Scan::check_non_pic): Likewise.
1991 (Target_sparc::Scan::local): Handle IFUNC symbols.
1992 (Target_sparc::Scan::local): Likewise.
1993 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1994 and plt_address_for_local.
1995 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1996 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1997
1998 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1999 (class Output_data_reloc): Adjust calls to Output_reloc_type.
2000 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2001 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2002 global relocs too.
2003 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2004 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2005 calls.
2006 * sparc.cc (Target_sparc::Scan::global): Likewise.
2007 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2008
2009 2012-04-16 Cary Coutant <ccoutant@google.com>
2010
2011 * archive.cc (Library_base::should_include_member): Check for
2012 --export-dynamic-symbol.
2013 * options.h (class General_options): Add --export-dynamic-symbol.
2014 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2015 --export-dynamic-symbol.
2016 (Symbol_table::gc_mark_undef_symbols): Likewise.
2017 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2018
2019 2012-04-12 David S. Miller <davem@davemloft.net>
2020
2021 * sparc.cc (Reloc::wdisp10): New relocation method.
2022 (Reloc::h34): Likewise.
2023 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2024 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2025 R_SPARC_WDISP10.
2026 (Target_sparc::Scan::local): Likewise.
2027 (Target_sparc::Scan::global): Likewise.
2028 (Target_sparc::Relocate::relocate): Likewise.
2029
2030 2012-04-09 Cary Coutant <ccoutant@google.com>
2031
2032 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2033 low_pc == 0.
2034
2035 2012-04-06 Ian Lance Taylor <iant@google.com>
2036
2037 * timer.cc: #include <unistd.h>.
2038
2039 2012-04-06 Roland McGrath <mcgrathr@google.com>
2040
2041 * configure.in (AC_CHECK_HEADERS): Add locale.h.
2042 * config.in: Regenerate.
2043 * configure: Regenerate.
2044
2045 2012-04-05 Nick Clifton <nickc@redhat.com>
2046
2047 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2048 (AM_LC_MESSAGES): Add.
2049 * aclocal.m4: Regenerate.
2050 * config.in: Regenerate.
2051 * configure: Regenerate.
2052
2053 2012-03-21 Cary Coutant <ccoutant@google.com>
2054
2055 * Makefile.am: Add gdb-index.cc, gdb-index.h.
2056 * Makefile.in: Regenerate.
2057 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2058 (Sized_elf_reloc_mapper::symbol_section): New function.
2059 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2060 (make_elf_reloc_mapper): New function.
2061 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2062 (Dwarf_abbrev_table::do_read_abbrevs): New function.
2063 (Dwarf_abbrev_table::do_get_abbrev): New function.
2064 (Dwarf_ranges_table::read_ranges_table): New function.
2065 (Dwarf_ranges_table::read_range_list): New function.
2066 (Dwarf_pubnames_table::read_section): New function.
2067 (Dwarf_pubnames_table::read_header): New function.
2068 (Dwarf_pubnames_table::next_name): New function.
2069 (Dwarf_die::Dwarf_die): New function.
2070 (Dwarf_die::read_attributes): New function.
2071 (Dwarf_die::skip_attributes): New function.
2072 (Dwarf_die::set_name): New function.
2073 (Dwarf_die::set_linkage_name): New function.
2074 (Dwarf_die::attribute): New function.
2075 (Dwarf_die::string_attribute): New function.
2076 (Dwarf_die::int_attribute): New function.
2077 (Dwarf_die::uint_attribute): New function.
2078 (Dwarf_die::ref_attribute): New function.
2079 (Dwarf_die::child_offset): New function.
2080 (Dwarf_die::sibling_offset): New function.
2081 (Dwarf_info_reader::check_buffer): New function.
2082 (Dwarf_info_reader::parse): New function.
2083 (Dwarf_info_reader::do_parse): New function.
2084 (Dwarf_info_reader::do_read_string_table): New function.
2085 (Dwarf_info_reader::lookup_reloc): New function.
2086 (Dwarf_info_reader::get_string): New function.
2087 (Dwarf_info_reader::visit_compilation_unit): New function.
2088 (Dwarf_info_reader::visit_type_unit): New function.
2089 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2090 Sized_elf_reloc_mapper.
2091 (Sized_dwarf_line_info::symbol_section): Remove function.
2092 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2093 (Sized_dwarf_line_info::read_line_mappings): Remove object
2094 parameter, adjust callers.
2095 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2096 * dwarf_reader.h: Include <sys/types.h>.
2097 (class Track_relocs): Remove forward declaration.
2098 (class Elf_reloc_mapper): New class.
2099 (class Sized_elf_reloc_mapper): New class.
2100 (class Dwarf_abbrev_table): New class.
2101 (class Dwarf_range_list): New class.
2102 (class Dwarf_ranges_table): New class.
2103 (class Dwarf_pubnames_table): New class.
2104 (class Dwarf_die): New class.
2105 (class Dwarf_info_reader): New class.
2106 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2107 (Sized_dwarf_line_info::symbol_section): Remove member function.
2108 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2109 base class.
2110 * gdb-index.cc: New source file.
2111 * gdb-index.h: New source file.
2112 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2113 and .debug_types sections, call Layout::add_to_gdb_index.
2114 (Sized_relobj_incr::do_section_name): Implement.
2115 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2116 return type; Implement.
2117 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2118 return type.
2119 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2120 parameter list and return type.
2121 (Sized_incr_dynobj::do_section_contents): Likewise.
2122 * layout.cc: Include gdb-index.h.
2123 (Layout::Layout): Initialize gdb_index_data_.
2124 (Layout::init_fixed_output_section): Check for .gdb_index section.
2125 (Layout::add_to_gdb_index): New function. Instantiate.
2126 * layout.h: Add forward declaration for class Gdb_index.
2127 (Layout::add_to_gdb_index): New member function.
2128 (Layout::gdb_index_data_): New data member.
2129 * main.cc: Include gdb-index.h.
2130 (main): Print statistics for gdb index.
2131 * object.cc (Object::section_contents): Move code into
2132 do_section_contents.
2133 (need_decompressed_section): Check for sections needed when building
2134 gdb index.
2135 (build_compressed_section_map): Likewise.
2136 (Sized_relobj_file::do_read_symbols): Need local symbols when building
2137 gdb index.
2138 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2139 sections; call Layout::add_to_gdb_index.
2140 (Sized_relobj_file::do_decompressed_section_contents): Call
2141 do_section_contents directly.
2142 * object.h (Object::do_section_contents): Adjust parameter list and
2143 return type.
2144 (Object::do_decompressed_section_contents): Call do_section_contents
2145 directly.
2146 (Sized_relobj_file::do_section_contents): Adjust parameter list and
2147 return type.
2148 * options.h (class General_options): Add --gdb-index option.
2149 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2150 list and return type.
2151 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2152 * reloc.h (Track_relocs::checkpoint): New function.
2153 (Track_relocs::reset): New function.
2154
2155 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2156 New test cases.
2157 * testsuite/Makefile.in: Regenerate.
2158 * testsuite/gdb_index_test.cc: New test source file.
2159 * testsuite/gdb_index_test_1.sh: New test source file.
2160 * testsuite/gdb_index_test_2.sh: New test source file.
2161
2162 2012-03-19 Doug Kwan <dougkwan@google.com>
2163
2164 * arm.cc (Target_arm::do_define_standard_symbols): New method.
2165 (Target_arm::do_finalize_sections): Remove code which defines
2166 __exidx_start and __exidx_end. Make symbol table parameter
2167 anonymous as it is not used.
2168 * gold.cc (queue_middle_tasks): Call target hook to define any
2169 target-specific symbols.
2170 * target.h (Target::define_standard_symbols): New method.
2171 (Target::do_define_standard_symbols): Same.
2172 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2173 * testsuite/Makefile.in: Regenerate.
2174 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2175 and __exidx_end.
2176 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2177 relocations are generated for __exidx_start and __exidx_end.
2178
2179 2012-03-16 Doug Kwan <dougkwan@google.com>
2180
2181 * testsuite/Makefile.am: Disable test initpri3b.
2182 * testsuite/Makefile.in: Regenerate.
2183
2184 2012-03-15 Doug Kwan <dougkwan@google.com>
2185
2186 * arm.cc (Target_arm::got_section): Make .got section read-only
2187 if -z now is given.
2188
2189 2012-03-15 Ian Lance Taylor <iant@google.com>
2190
2191 PR gold/13850
2192 * layout.cc (Layout::make_output_section): Correctly mark
2193 SHT_INIT_ARRAY, et. al., as relro.
2194
2195 2012-03-14 Doug Kwan <dougkwan@google.com>
2196
2197 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2198 dynamic relocations for protected symbols in shared objects.
2199
2200 2012-03-13 Ian Lance Taylor <iant@google.com>
2201
2202 * resolve.cc (Symbol_table::resolve): When merging common symbols,
2203 keep the larger alignment.
2204
2205 2012-03-12 Cary Coutant <ccoutant@google.com>
2206
2207 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2208 handling of DW_LNE_define_file.
2209
2210 2012-03-12 Cary Coutant <ccoutant@google.com>
2211
2212 * reduced_debug_output.cc
2213 (Output_reduced_debug_info_section::get_die_end): Add new FORM
2214 codes to switch.
2215
2216 2012-02-29 Cary Coutant <ccoutant@google.com>
2217
2218 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2219
2220 2012-02-29 Cary Coutant <ccoutant@google.com>
2221
2222 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2223 Call Object::decompressed_section_contents.
2224 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2225 New dtor.
2226 (Sized_dwarf_line_info::buffer_start_): New data member.
2227 * merge.cc (Output_merge_data::do_add_input_section): Call
2228 Object::decompressed_section_contents.
2229 (Output_merge_string::do_add_input_section): Likewise.
2230 * object.cc (need_decompressed_section): New function.
2231 (build_compressed_section_map): Decompress sections needed later.
2232 (Sized_relobj_file::do_decompressed_section_contents): New function.
2233 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2234 * object.h (Object::decompressed_section_contents): New function.
2235 (Object::discard_decompressed_sections): New function.
2236 (Object::do_decompressed_section_contents): New function.
2237 (Object::do_discard_decompressed_sections): New function.
2238 (Compressed_section_info): New type.
2239 (Compressed_section_map): Include decompressed section contents.
2240 (Sized_relobj_file::do_decompressed_section_contents): New function.
2241 (Sized_relobj_file::do_discard_decompressed_sections): New function.
2242
2243 2012-02-16 Cary Coutant <ccoutant@google.com>
2244
2245 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2246 * testsuite/Makefile.in: Regenerate.
2247
2248 2012-02-14 Cary Coutant <ccoutant@google.com>
2249
2250 * options.cc (General_options::finalize): Disallow -pie and -static.
2251
2252 2012-02-03 Doug Kwan <dougkwan@google.com>
2253
2254 * arm.cc (Arm_relocate_functions::abs8,
2255 Arm_relocate_functions::abs16): Use
2256 Bits::has_signed_unsigned_overflow32.
2257 (Arm_relocate_functions::thm_abs8): Correct range of
2258 overflow check.
2259 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2260 in assertions.
2261
2262 2012-02-02 Doug Kwan <dougkwan@google.com>
2263
2264 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2265 position independent outputs, not just shared objects.
2266
2267 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
2268
2269 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2270 * configure: Regenerated.
2271
2272 2012-01-27 Ian Lance Taylor <iant@google.com>
2273
2274 * reloc.h (Bits): New class with static functions, copied from
2275 namespace utils in arm.cc.
2276 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
2277 instead.
2278
2279 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2280
2281 * incremental.cc (write_info_blocks): Correct relocation offset.
2282
2283 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2284
2285 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2286 (Relocate::tls_gd_to_le): Likewise.
2287
2288 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2289
2290 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2291
2292 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
2293
2294 * configure.ac: Check if -mcmodel=medium works.
2295 * configure: Regenerated.
2296
2297 2012-01-24 Cary Coutant <ccoutant@google.com>
2298
2299 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2300 definition and ...
2301 (read_unsigned_LEB_128_x): ... this new function.
2302 (read_signed_LEB_128): Replaced with inline definition and ...
2303 (read_signed_LEB_128_x): ... this new function.
2304 * int_encoding.h (read_unsigned_LEB_128_x): New function.
2305 (read_unsigned_LEB_128): Add inline definition.
2306 (read_signed_LEB_128_x): New function.
2307 (read_signed_LEB_128): Add inline definition.
2308 * testsuite/Makefile.am (leb128_unittest): New unit test.
2309 * testsuite/Makefile.in: Regenerate.
2310 * testsuite/leb128_unittest.cc: New unit test.
2311
2312 2012-01-23 Ian Lance Taylor <iant@google.com>
2313
2314 PR gold/13617
2315 * i386.cc (Target_i386::do_code_fill): When using a jmp
2316 instruction, pad with nop instructions.
2317 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2318
2319 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
2320
2321 * x86_64.cc (gc_process_relocs): Add typename on types used in
2322 template.
2323 (scan_relocs): Likewise.
2324 (relocate_section): Likewise.
2325 (apply_relocation): Likewise.
2326
2327 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
2328
2329 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2330 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2331 under x32.
2332
2333 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
2334
2335 * x86_64.cc: Initial support for x32.
2336
2337 2012-01-03 Cary Coutant <ccoutant@google.com>
2338
2339 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2340 Use abstract base class for GOT.
2341 * gold/output.h (class Output_data_got_base): New abstract base class.
2342 (class Output_data_got): Derive from new base class, adjust ctors.
2343 (Output_data_got::reserve_slot): Make virtual; rename to
2344 do_reserve_slot; Adjust callers.
2345 * gold/target.h (Sized_target::init_got_plt_for_update): Return
2346 pointer to abstract base class.
2347 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2348
2349 2011-12-18 Ian Lance Taylor <iant@google.com>
2350
2351 * object.h (Relobj::local_symbol_value): New function.
2352 (Relobj::local_plt_offset): New function.
2353 (Relobj::local_has_got_offset): New function.
2354 (Relobj::local_got_offset): New function.
2355 (Relobj::set_local_got_offset): New function.
2356 (Relobj::do_local_symbol_value): New pure virtual function.
2357 (Relobj::do_local_plt_offset): Likewise.
2358 (Relobj::do_local_has_got_offset): Likewise.
2359 (Relobj::do_local_got_offset): Likewise.
2360 (Relobj::do_set_local_got_offset): Likewise.
2361 (Sized_relobj::do_local_has_got_offset): Rename from
2362 local_has_got_offset.
2363 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2364 (Sized_relobj::do_set_local_got_offset): Rename from
2365 set_local_got_offset.
2366 (Sized_relobj_file::do_local_plt_offset): Rename from
2367 local_plt_offset.
2368 (Sized_relobj_file::do_local_symbol_value): New function.
2369 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2370 local_plt_offset.
2371 * output.cc (Output_data_got::Got_entry::write): Change object to
2372 Relobj. Use local_symbol_value.
2373 (Output_data_got::add_global_with_rel): Change rel_dyn to
2374 Output_data_reloc_generic*. Use add_global_generic.
2375 (Output_data_got::add_global_with_rela): Remove. Change all
2376 callers to use add_global_with_rel.
2377 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2378 Output_data_reloc_generic*. Use add_global_generic.
2379 (Output_data_got::add_global_pair_with_rela): Remove. Change all
2380 callers to use add_global_pair_with_rel.
2381 (Output_data_got::add_local): Change object to Relobj*.
2382 (Output_data_got::add_local_plt): Likewise.
2383 (Output_data_got::add_local_with_rel): Change object to Relobj*,
2384 change rel_dyn to Output_data_reloc_generic*. Use
2385 add_local_generic.
2386 (Output_data_got::add_local_with_rela): Remove. Change all
2387 callers to use all_local_with_rel.
2388 (Output_data_got::add_local_pair_with_rel): Change object to
2389 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
2390 add_output_section_generic.
2391 (Output_data_got::add_local_pair_with_rela): Remove. Change all
2392 callers to use add_local_pair_with_rel.
2393 (Output_data_got::reserve_local): Change object to Relobj*.
2394 * output.h: (class Output_data_reloc_generic): Add pure virtual
2395 declarations for add_global_generic, add_local_generic,
2396 add_output_section_generic.
2397 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2398 functions for Output_data_reloc_generic. Update declarations for
2399 changes listed in output.cc.
2400 (class Output_data_got): Change template parameter to got_size.
2401 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
2402 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2403 function.
2404 (Sized_relobj_incr::do_local_plt_offset): New function.
2405 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2406 add_global_generic.
2407
2408 2011-12-17 Cary Coutant <ccoutant@google.com>
2409
2410 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2411 * resolve.cc (Symbol_table::resolve): Likewise.
2412 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2413 arrays.
2414 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2415
2416 2011-12-16 Ian Lance Taylor <iant@google.com>
2417
2418 * output.h (Output_data_reloc_generic::add): Only call
2419 add_dynamic_reloc if this is a dynamic reloc section.
2420
2421 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
2422
2423 PR gold/13505
2424 * target-reloc.h (apply_relocation): Replace <64, false> with
2425 <size, big_endian>.
2426
2427 2011-11-25 Nick Clifton <nickc@redhat.com>
2428
2429 * po/it.po: New Italian translation.
2430
2431 2011-11-17 Sterling Augustine <saugustine@google.com>
2432
2433 * script.cc (script_include_directive): Implement.
2434 (read_script_file): New local variables name and search_path. Update
2435 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2436 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2437 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2438
2439 2011-11-11 Sterling Augustine <saugustine@google.com>
2440
2441 * yyscript.y (section_cmd): Add support for INCLUDE directive.
2442 (file_or_sections_cmd): Likewise.
2443
2444 2011-11-11 Doug Kwan <dougkwan@google.com>
2445
2446 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2447 if --just-symbols is given.
2448
2449 2011-11-10 Doug Kwan <dougkwan@google.com>
2450
2451 PR gold/13362
2452 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2453 when processing data relocs.
2454 * reloc.h (Relocate_functions::rel_unaligned): New method.
2455 (Relocate_functions::pcrel_unaligned): Ditto.
2456 (Relocate_functions::rel32_unaligned): Ditto.
2457 (Relocate_functions::pcrel32_unaligned): Ditto.
2458
2459 2011-11-09 Doug Kwan <dougkwan@google.com>
2460
2461 PR gold/13362
2462 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2463 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2464 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2465 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2466 (Relocate_functions::rel_unaligned): New.
2467 (Relocate_functions::rel32_unaligned): New.
2468 * target-reloc.h (relocate_for_relocatable): Add code to handle
2469 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2470 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2471 arm_unaligned_reloc_r): New targets.
2472 * testsuite/Makefile.in: Regenerate.
2473 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2474 linking.
2475
2476 2011-11-02 Ian Lance Taylor <iant@google.com>
2477
2478 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
2479 NATIVE_LINKER.
2480 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2481 * options.cc (General_options::finalize): Use library search path
2482 from configure script if specified. If not native and no sysroot,
2483 only search TOOLLIBDIR.
2484 * options.h (Search_directory::Search_directory): Change name to
2485 const std::string&.
2486 (General_options::add_to_library_path_with_sysroot): Change arg to
2487 const std::string&.
2488 * configure, Makefile.in, config.in: Rebuild.
2489
2490 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2491
2492 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2493 we are working around the ARM1176 Erratum.
2494 * options.h (General_options::fix_arm1176): Add option.
2495 * testsuite/Makefile.am: Add testcases, and keep current ones
2496 working.
2497 * testsuite/Makefile.in: Regenerate.
2498 * testsuite/arm_fix_1176.s: New file.
2499 * testsuite/arm_fix_1176.sh: Likewise.
2500
2501 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
2502
2503 * arm.cc (Target_arm::Target_arm): Remove initialisation of
2504 may_use_blx_.
2505 (Target_arm::may_use_blx): Remove method.
2506 (Target_arm::set_may_use_blx): Likewise.
2507 (Target_arm::may_use_v4t_interworking): New method.
2508 (Target_arm::may_use_v5t_interworking): Likewise.
2509 (Target_arm::may_use_blx_): Remove member variable.
2510 (Arm_relocate_functions::arm_branch_common): Check for v5T
2511 interworking.
2512 (Arm_relocate_functions::thumb_branch_common): Likewise.
2513 (Reloc_stub::stub_type_for_reloc): Likewise.
2514 (Target_arm::do_finalize_sections): Correct interworking checks.
2515 * testsuite/Makefile.am: Add new tests.
2516 * testsuite/Makefile.in: Regenerate.
2517 * testsuite/arm_farcall_arm_arm.s: New test.
2518 * testsuite/arm_farcall_arm_arm.sh: Likewise.
2519 * testsuite/arm_farcall_arm_thumb.s: Likewise.
2520 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2521 * testsuite/arm_farcall_thumb_arm.s: Likewise.
2522 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2523 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2524 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2525
2526 2011-10-31 Cary Coutant <ccoutant@google.com>
2527
2528 PR gold/13023
2529 * expression.cc (Expression::eval_with_dot): Add
2530 is_section_dot_assignment parameter.
2531 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
2532 absolute and assigning to dot within a section.
2533 * script-sections.cc
2534 (Output_section_element_assignment::set_section_addresses): Pass
2535 dot_section to set_if_absolute.
2536 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2537 as is_section_dot_assignment flag to eval_with_dot.
2538 (Output_section_element_dot_assignment::set_section_addresses):
2539 Likewise.
2540 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2541 parameter. Also set value if relative to dot_section; set the
2542 symbol's output_section.
2543 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2544 parameter. Adjust all callers.
2545 (Expression::eval_maybe_dot): Likewise.
2546 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2547 Adjust all callers.
2548 * testsuite/script_test_2.t: Test assignment of an absolute value
2549 to dot within an output section element.
2550
2551 2011-10-31 Cary Coutant <ccoutant@google.com>
2552
2553 * options.h (class General_options): Add --[no-]gnu-unique options.
2554 * symtab.cc (Symbol_table::sized_write_globals): Convert
2555 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2556
2557 2011-10-31 Cary Coutant <ccoutant@google.com>
2558
2559 PR gold/13359
2560 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2561 unnecessary assertion.
2562 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2563
2564 2011-10-31 Sriraman Tallam <tmsriram@google.com>
2565
2566 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2567 gc_mark_symbol.
2568 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2569 gc_mark_symbol.
2570 Change to just keep the section associated with symbol.
2571 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2572 they are externally visible and --export-dynamic is turned on.
2573 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2574
2575 2011-10-19 Ian Lance Taylor <iant@google.com>
2576
2577 PR gold/13163
2578 * script-sections.cc
2579 (Output_section_element_dot_assignment::needs_output_section): New
2580 function.
2581
2582 2011-10-19 Ian Lance Taylor <iant@google.com>
2583
2584 PR gold/13204
2585 * layout.cc (Layout::segment_precedes): Don't assert failure if a
2586 --section-start option was seen.
2587 * options.h (General_options::any_section_start): New function.
2588
2589 2011-10-18 David S. Miller <davem@davemloft.net>
2590
2591 PR binutils/13301
2592 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2593 member to track relocation locations that have moved during TLS
2594 reloc optimizations.
2595 (Target_sparc::Relocate::Relocate): Initialize to NULL.
2596 (Target_sparc::Relocate::relocate): Adjust view down by 4
2597 bytes if it matches reloc_adjust_addr_.
2598 (Target_sparc::Relocate::relocate_tls): Always move the
2599 __tls_get_addr call delay slot instruction forward 4 bytes when
2600 performing relaxation.
2601
2602 2011-10-18 Cary Coutant <ccoutant@google.com>
2603
2604 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2605 (Output_file::map_no_anonymous): Check for non-zero
2606 return code from posix_fallocate.
2607
2608 2011-10-17 Cary Coutant <ccoutant@google.com>
2609
2610 PR gold/13245
2611 * plugin.cc (is_visible_from_outside): Check for symbols
2612 referenced from dynamic objects.
2613 * resolve.cc (Symbol_table::resolve): Don't count references
2614 from dynamic objects as references from real ELF files.
2615 * testsuite/plugin_test_2.sh: Adjust expected result.
2616
2617 2011-10-17 Cary Coutant <ccoutant@google.com>
2618
2619 * gold.cc: Include timer.h.
2620 (queue_middle_tasks): Stamp time.
2621 (queue_final_tasks): Likewise.
2622 * main.cc (main): Store timer in parameters. Print timers
2623 for each pass.
2624 * parameters.cc (Parameters::Parameters): Initialize timer_.
2625 (Parameters::set_timer): New function.
2626 (set_parameters_timer): New function.
2627 * parameters.h (Parameters::set_timer): New function.
2628 (Parameters::timer): New function.
2629 (Parameters::timer_): New data member.
2630 (set_parameters_timer): New function.
2631 * timer.cc (Timer::stamp): New function.
2632 (Timer::get_pass_time): New function.
2633 * timer.h (Timer::stamp): New function.
2634 (Timer::get_pass_time): New function.
2635 (Timer::pass_times_): New data member.
2636
2637 2011-10-17 Cary Coutant <ccoutant@google.com>
2638
2639 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2640 task for members of lib groups.
2641
2642 2011-10-17 Cary Coutant <ccoutant@google.com>
2643
2644 PR gold/13288
2645 * fileread.cc (File_read::find_view): Add assert.
2646 (File_read::make_view): Move bounds check (replace with assert)...
2647 (File_read::find_or_make_view): ... to here.
2648
2649 2011-10-12 Cary Coutant <ccoutant@google.com>
2650
2651 * output.cc (Output_file::open_base_file): Handle case where
2652 ::read returns less than requested size.
2653
2654 2011-10-10 Cary Coutant <ccoutant@google.com>
2655
2656 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2657 Initialize defined_count_.
2658 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2659 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2660 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2661 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2662 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2663 * incremental.h (Sized_relobj_incr::defined_count_): New data
2664 member.
2665 (Sized_incr_dynobj::defined_count_): New data member.
2666 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2667 Return zeroes instead of internal error.
2668
2669 2011-10-10 Cary Coutant <ccoutant@google.com>
2670
2671 PR gold/13249
2672 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2673 (Output_reloc::symbol_value): Return PLT offset if flag is set.
2674 * output.h (class Output_reloc): Add use_plt_offset flag.
2675 (Output_reloc::type_): Adjust size of bit field.
2676 (Output_reloc::use_plt_offset_): New bit field.
2677 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2678 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2679 flag. Adjust all callers.
2680 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2681 creating RELATIVE relocations.
2682
2683 2011-10-10 Nick Clifton <nickc@redhat.com>
2684
2685 * po/es.po: Updated Spanish translation.
2686 * po/fi.po: Updated Finnish translation.
2687
2688 2011-10-03 Diego Novillo <dnovillo@google.com>
2689
2690 * options.cc (parse_uint): Fix dereference of RETVAL.
2691
2692 2011-09-29 Sriraman Tallam <tmsriram@google.com>
2693
2694 * layout.h (section_order_map_): New member.
2695 (get_section_order_map): New member function.
2696 * output.cc (Output_section::add_input_section): Check for patterns
2697 only when --section-ordering-file is specified.
2698 * gold.cc (queue_middle_tasks): Delay updating order of sections till
2699 output_sections have been formed.
2700 * layout.cc (Layout_Layout): Initialize section_order_map_.
2701 * plugin.cc (update_section_order): Store order in order_map. Do not
2702 update the order.
2703 * testsuite/Makefile.am: Add test case for plugin_final_layout.
2704 * testsuite/Makefile.in: Regenerate.
2705 * testsuite/plugin_section_order.c: New file.
2706 * testsuite/plugin_final_layout.cc: New file.
2707 * testsuite/plugin_final_layout.sh: New file.
2708
2709 2011-09-29 Cary Coutant <ccoutant@google.com>
2710
2711 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2712 Check for NULL.
2713 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2714 symbols during incremental update.
2715 (Symbol_table::add_from_dynobj): Likewise.
2716
2717 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2718 Ian Lance Taylor <iant@google.com>
2719
2720 * symtab.cc (Symbol_table::define_special_symbol): Always
2721 canonicalize version string.
2722
2723 2011-09-26 Cary Coutant <ccoutant@google.com>
2724
2725 * gold.cc (queue_initial_tasks): Move option checks ...
2726 * options.cc (General_options::finalize): ... to here. Disable
2727 some options; make others fatal.
2728
2729 2011-09-26 Cary Coutant <ccoutant@google.com>
2730
2731 gcc PR lto/47247
2732 * plugin.cc (get_symbols_v2): New function.
2733 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2734 (is_referenced_from_outside): New function.
2735 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2736 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2737 (get_symbols): Pass version parameter.
2738 (get_symbols_v2): New function.
2739 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2740 parameter.
2741 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2742 (onload): Add LDPT_GET_SYMBOLS_V2.
2743 (all_symbols_read_hook): Use get_symbols_v2; check for
2744 LDPR_PREVAILING_DEF_IRONLY_EXP.
2745 * testsuite/plugin_test_3.sh: Update expected results.
2746
2747 2011-09-23 Simon Baldwin <simonb@google.com>
2748
2749 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2750 configuration options.
2751 * configure: Regenerate.
2752 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2753 * Makefile.in: Regenerate.
2754 * testsuite/Makefile.in: Regenerate.
2755
2756 2011-09-19 Sriraman Tallam <tmsriram@google.com>
2757
2758 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2759
2760 2011-09-19 Cary Coutant <ccoutant@google.com>
2761
2762 * incremental.cc (can_incremental_update): Fix typo in comment.
2763 * incremental.h (can_incremental_update): Likewise.
2764
2765 2011-09-18 Cary Coutant <ccoutant@google.com>
2766
2767 * incremental.cc (can_incremental_update): New function.
2768 * incremental.h (can_incremental_update): New function.
2769 * layout.cc (Layout::init_fixed_output_section): Call it.
2770 (Layout::make_output_section): Don't allow patch space in .eh_frame.
2771 * object.cc (Sized_relobj_file::do_layout): Call
2772 can_incremental_update.
2773
2774 2011-09-13 Cary Coutant <ccoutant@google.com>
2775
2776 * configure.ac: Check for glibc support for gnu_indirect_function
2777 support with static linking, setting automake conditional
2778 IFUNC_STATIC.
2779 * Makefile.in: Regenerate.
2780 * configure: Regenerate.
2781
2782 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2783 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2784 for IFUNC_STATIC.
2785 * testsuite/Makefile.in: Regenerate.
2786
2787 2011-09-13 Cary Coutant <ccoutant@google.com>
2788
2789 * incremental.cc (Sized_relobj_incr::do_layout): Call
2790 report_comdat_group for kept comdat sections.
2791 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2792 * testsuite/Makefile.in: Regenerate.
2793 * testsuite/incr_comdat_test_1.cc: New source file.
2794 * testsuite/incr_comdat_test_2_v1.cc: New source file.
2795 * testsuite/incr_comdat_test_2_v2.cc: New source file.
2796 * testsuite/incr_comdat_test_2_v3.cc: New source file.
2797
2798 2011-09-13 Ian Lance Taylor <iant@google.com>
2799
2800 * object.cc (Sized_relobj_file::do_layout): Remove unused local
2801 variable external_symbols_offset.
2802
2803 2011-09-12 Ian Lance Taylor <iant@google.com>
2804
2805 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2806 triggered if object has no symbols.
2807
2808 2011-09-09 David S. Miller <davem@davemloft.net>
2809
2810 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2811 (Output_fill_debug_line::do_write): Likewise.
2812
2813 2011-08-29 Cary Coutant <ccoutant@google.com>
2814
2815 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2816 casts to match formatting specs.
2817 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2818
2819 2011-08-26 Cary Coutant <ccoutant@google.com>
2820
2821 * layout.cc (Free_list::allocate): Provide guarantee of minimum
2822 remaining hole size when allocating.
2823 (Layout::make_output_section): Set fill methods for debug sections.
2824 * layout.h (Free_list::Free_list_node): Move from private to
2825 public.
2826 (Free_list::set_min_hole_size): New function.
2827 (Free_list::begin, Free_list::end): New functions.
2828 (Free_list::min_hole_): New data member.
2829 * output.cc: Include dwarf.h.
2830 (Output_fill_debug_info::do_minimum_hole_size): New function.
2831 (Output_fill_debug_info::do_write): New function.
2832 (Output_fill_debug_line::do_minimum_hole_size): New function.
2833 (Output_fill_debug_line::do_write): New function.
2834 (Output_section::Output_section): Initialize new data member.
2835 (Output_section::set_final_data_size): Ensure patch space is larger
2836 than minimum hole size.
2837 (Output_section::do_write): Fill holes in debug sections.
2838 * output.h (Output_fill): New class.
2839 (Output_fill_debug_info): New class.
2840 (Output_fill_debug_line): New class.
2841 (Output_section::set_free_space_fill): New function.
2842 (Output_section::free_space_fill_): New data member.
2843 * testsuite/Makefile.am (incremental_test_3): Add
2844 --incremental-patch option.
2845 (incremental_test_4): Likewise.
2846 (incremental_test_5): Likewise.
2847 (incremental_test_6): Likewise.
2848 (incremental_copy_test): Likewise.
2849 (incremental_common_test_1): Likewise.
2850 * testsuite/Makefile.in: Regenerate.
2851
2852 2011-08-26 Nick Clifton <nickc@redhat.com>
2853
2854 * po/es.po: Updated Spanish translation.
2855
2856 2011-08-01 Cary Coutant <ccoutant@google.com>
2857
2858 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2859 * gold/testsuite/Makefile.in: Regenerate.
2860 * gold/testsuite/justsyms_exec.c: New source file.
2861 * gold/testsuite/justsyms_lib.c: New source file.
2862
2863 2011-08-01 Cary Coutant <ccoutant@google.com>
2864
2865 * layout.cc (Layout::set_segment_offsets): Don't realign text
2866 segment if -Ttext was specified.
2867 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2868 file type.
2869 * object.h (Sized_relobj_file::e_type): New function.
2870 (Sized_relobj_file::e_type_): New data member.
2871 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2872 base address for ET_EXEC files.
2873 * target.cc (Target::do_make_elf_object_implementation): Allow
2874 ET_EXEC files with --just-symbols option.
2875
2876 2011-07-28 Cary Coutant <ccoutant@google.com>
2877
2878 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2879 Add thread_number parameter.
2880 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2881 * workqueue-threads.cc
2882 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2883 current thread if its thread number is greater than desired thread
2884 count.
2885 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2886 Add thread_number parameter.
2887 (Workqueue::should_cancel_thread): Likewise.
2888 (Workqueue::find_runnable_or_wait): Pass thread_number to
2889 should_cancel_thread.
2890 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2891 parameter.
2892
2893 2011-07-22 Sriraman Tallam <tmsriram@google.com>
2894
2895 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2896 only after checking if it cannot be forced local.
2897 * symtab.h (is_externally_visible): Check if the symbol is not forced
2898 local.
2899
2900 2011-07-15 Ian Lance Taylor <iant@google.com>
2901
2902 * options.h (class General_options): Add --print-output-format.
2903 Move -EL next to -EB, for better --help output.
2904 * target-select.cc: Include <cstdio>, "options.h", and
2905 "parameters.h".
2906 (Target_selector::do_target_bfd_name): New function.
2907 (print_output_format): New function.
2908 * target-select.h (class Target_selector): Update declarations.
2909 (Target_selector::target_bfd_name): New function.
2910 (print_output_format): Declare.
2911 * main.cc: Include "target-select.h".
2912 (main): Handle --print-output-format.
2913 * gold.cc: Include "target-select.h".
2914 (queue_initial_tasks): Handle --print-output-format when there are
2915 no input files.
2916 * parameters.cc (parameters_force_valid_target): Give a better
2917 error message if -EB/-EL does not match target.
2918 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2919 function.
2920
2921 2011-07-15 Ian Lance Taylor <iant@google.com>
2922
2923 * i386.cc (class Output_data_plt_i386): Add layout_ field.
2924 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2925 (Output_data_plt_i386::do_write): Write address of .dynamic
2926 section to first entry in .got.plt section.
2927 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2928 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2929 Initialize layout_.
2930 (Output_data_plt_x86_64::do_write): Write address of .dynamic
2931 section to first entry in .got.plt section.
2932 * layout.h (Layout::dynamic_section): New function.
2933
2934 2011-07-13 Sriraman Tallam <tmsriram@google.com>
2935
2936 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2937 to claim_file call.
2938 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2939 input_section_position_, and input_section_glob_.
2940 (read_layout_from_file): Call function section_ordering_specified.
2941 * layout.h (is_section_ordering_specified): New function.
2942 (section_ordering_specified): New function.
2943 (section_ordering_specified_): New boolean member.
2944 * main.cc(main): Call load_plugins after layout object is defined.
2945 * output.cc (Output_section::add_input_section): Use
2946 function section_ordering_specified to check if section ordering is
2947 needed.
2948 * output.cc (Output_section::add_relaxed_input_section): Use
2949 function section_ordering_specified to check if section ordering is
2950 needed.
2951 (Output_section::update_section_layout): New function.
2952 (Output_section::sort_attached_input_sections): Check if input section
2953 must be reordered.
2954 * output.h (Output_section::update_section_layout): New function.
2955 * plugin.cc (get_section_count): New function.
2956 (get_section_type): New function.
2957 (get_section_name): New function.
2958 (get_section_contents): New function.
2959 (update_section_order): New function.
2960 (allow_section_ordering): New function.
2961 (Plugin::load): Add the new interfaces to the transfer vector.
2962 (Plugin_manager::load_plugins): New parameter.
2963 (Plugin_manager::all_symbols_read): New parameter.
2964 (Plugin_manager::claim_file): New parameter. Save the elf object for
2965 unclaimed objects.
2966 (Plugin_manager::get_elf_object): New function.
2967 (Plugin_manager::get_view): Change to directly use the bool to check
2968 if get_view is called from claim_file_hook.
2969 * plugin.h (input_objects): New function
2970 (Plugin__manager::load_plugins): New parameter.
2971 (Plugin_manager::claim_file): New parameter.
2972 (Plugin_manager::get_elf_object): New function.
2973 (Plugin_manager::in_claim_file_handler): New function.
2974 (Plugin_manager::in_claim_file_handler_): New member.
2975 (layout): New function.
2976 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2977 handler with an extra parameter. Make the elf object before calling
2978 claim_file handler.
2979 * testsuite/plugin_test.c (get_section_count): New function pointer.
2980 (get_section_type): New function pointer.
2981 (get_section_name): New function pointer.
2982 (get_section_contents): New function pointer.
2983 (update_section_order): New function pointer.
2984 (allow_section_ordering): New function pointer.
2985 (onload): Check if the new interfaces exist.
2986
2987 2011-07-13 Ian Lance Taylor <iant@google.com>
2988
2989 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2990 relro section.
2991 * x86_64.cc (Target_x86_64::got_section): Likewise.
2992 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2993 (relro_now_test_SOURCES): New variable.
2994 (relro_now_test_DEPENDENCIES): New variable.
2995 (relro_now_test_LDFLAGS): New variable.
2996 (relro_now_test_LDADD): New variable.
2997 (relro_now_test.so): New target.
2998 * testsuite/Makefile.in: Rebuild.
2999
3000 2011-07-12 Ian Lance Taylor <iant@google.com>
3001
3002 PR gold/12980
3003 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3004 GLOB_DAT relocation rather than a RELATIVE relocation for a
3005 protected symbol when creating a shared library.
3006 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3007 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3008 * testsuite/protected_main_1.cc (main): Test that protected
3009 function has same address.
3010
3011 2011-07-11 Ian Lance Taylor <iant@google.com>
3012
3013 PR gold/12979
3014 * options.h (class General_options): Add -Bgroup.
3015 * options.cc (General_options::finalize): If -Bgroup is set,
3016 default to --unresolved-symbols=report-all.
3017 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3018 * target-reloc.h (issue_undefined_symbol_error): Handle
3019 --unresolved-symbols=report-all.
3020
3021 2011-07-08 Ian Lance Taylor <iant@google.com>
3022
3023 PR gold/11985
3024 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3025 if linker script discards key sections.
3026 (Layout::create_dynamic_symtab): Likewise.
3027 (Layout::assign_local_dynsym_offsets): Likewise.
3028 (Layout::sized_create_version_sections): Likewise.
3029 (Layout::create_interp): Likewise.
3030 (Layout::finish_dynamic_section): Likewise.
3031 (Layout::set_dynamic_symbol_size): Likewise.
3032
3033 2011-07-08 Ian Lance Taylor <iant@google.com>
3034
3035 PR gold/12386
3036 * options.h (class General_options): Add --unresolved-symbols.
3037 * target-reloc.h (issue_undefined_symbol_error): Check
3038 --unresolved-symbols. Add comments.
3039
3040 2011-07-08 Ian Lance Taylor <iant@google.com>
3041
3042 * testsuite/odr_violation2.cc (Ordering::operator()): Make
3043 expression more complex.
3044
3045 2011-07-08 Ian Lance Taylor <iant@google.com>
3046
3047 PR gold/11317
3048 * target-reloc.h (issue_undefined_symbol_error): New inline
3049 function, broken out of relocate_section.
3050 (relocate_section): Call issue_undefined_symbol_error.
3051 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3052 there is no TLS segment if we are about to issue an undefined
3053 symbol error.
3054 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3055
3056 2011-07-08 Ian Lance Taylor <iant@google.com>
3057
3058 PR gold/12279
3059 * resolve.cc (Symbol_table::should_override): Add fromtype
3060 parameter. Change all callers. Give error when linking together
3061 TLS and non-TLS symbol.
3062 (Symbol_table::should_override_with_special): Add fromtype
3063 parameter. Change all callers.
3064 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3065 there is no TLS segment if we have reported some errors.
3066 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3067
3068 2011-07-08 Ian Lance Taylor <iant@google.com>
3069
3070 PR gold/12372
3071 * target.h (Target::plt_address_for_global): New function.
3072 (Target::plt_address_for_local): New function.
3073 (Target::plt_section_for_global): Remove.
3074 (Target::plt_section_for_local): Remove.
3075 (Target::do_plt_address_for_global): New virtual function.
3076 (Target::do_plt_address_for_local): New virtual function.
3077 (Target::do_plt_section_for_global): Remove.
3078 (Target::do_plt_section_for_local): Remove.
3079 (Target::register_global_plt_entry): Add Symbol_table and Layout
3080 parameters.
3081 * output.cc (Output_data_got::Got_entry::write): Use
3082 plt_address_for_global and plt_address_for_local.
3083 * layout.cc (Layout::add_target_dynamic_tags): Use size and
3084 address of output section.
3085 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3086 got_irelative_, and irelative_count_ fields. Update
3087 declarations.
3088 (Output_data_plt_i386::has_irelative_section): New function.
3089 (Output_data_plt_i386::entry_count): Add irelative_count_.
3090 (Output_data_plt_i386::set_final_data_size): Likewise.
3091 (class Target_i386): Add got_irelative_ and rel_irelative_
3092 fields. Update declarations.
3093 (Target_i386::Target_i386): Initialize new fields.
3094 (Target_i386::do_plt_address_for_global): New function replacing
3095 do_plt_section_for_global.
3096 (Target_i386::do_plt_address_for_local): New function replacing
3097 do_plt_section_for_local.
3098 (Target_i386::got_section): Create got_irelative_.
3099 (Target_i386::rel_irelative_section): New function.
3100 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3101 fields. Don't define __rel_iplt_{start,end}.
3102 (Output_data_plt_i386::add_entry): Add symtab and layout
3103 parameters. Change all callers. Use different PLT and GOT for
3104 IFUNC symbols.
3105 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3106 layout parameters. Change all callers. Use different PLT and
3107 GOT.
3108 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3109 (Output_data_plt_i386::rel_irelative): New function.
3110 (Output_data_plt_i386::address_for_global): New function.
3111 (Output_data_plt_i386::address_for_local): New function.
3112 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
3113 IRELATIVE GOT when changing IFUNC GOT entries.
3114 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3115 reloc.
3116 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3117 if we didn't create an IRELATIVE GOT.
3118 (Target_i386::Relocate::relocate): Use plt_address_for_global and
3119 plt_address_for_local.
3120 (Target_i386::do_dynsym_value): Use plt_address_for_global.
3121 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3122 got_irelative_, and irelative_count_ fields. Update
3123 declarations.
3124 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3125 Initialize new fields. Remove symtab parameter. Change all
3126 callers.
3127 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3128 irelative_count_.
3129 (Output_data_plt_x86_64::has_irelative_section): New function.
3130 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3131 (class Target_x86_64): Add got_irelative_ and rel_irelative_
3132 fields. Update declarations.
3133 (Target_x86_64::Target_x86_64): Initialize new fields.
3134 (Target_x86_64::do_plt_address_for_global): New function replacing
3135 do_plt_section_for_global.
3136 (Target_x86_64::do_plt_address_for_local): New function replacing
3137 do_plt_section_for_local.
3138 (Target_x86_64::got_section): Create got_irelative_.
3139 (Target_x86_64::rela_irelative_section): New function.
3140 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
3141 all callers. Don't create __rel_iplt_{start,end}.
3142 (Output_data_plt_x86_64::add_entry): Add symtab and layout
3143 parameters. Change all callers. Use different PLT and GOT for
3144 IFUNC symbols.
3145 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3146 layout parameters. Change all callers. Use different PLT and
3147 GOT.
3148 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3149 parameters. Change all callers. Use different PLT and GOT for
3150 IFUNC symbols.
3151 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3152 (Output_data_plt_x86_64::rela_irelative): New function.
3153 (Output_data_plt_x86_64::address_for_global): New function.
3154 (Output_data_plt_x86_64::address_for_local): New function.
3155 (Output_data_plt_x86_64::set_final_data_size): Likewise.
3156 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3157 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3158 (Target_x86_64::register_global_plt_entry): Add symtab and layout
3159 parameters.
3160 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3161 reloc.
3162 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3163 symbols if we didn't create an IRELATIVE GOT.
3164 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3165 plt_address_for_local.
3166 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3167 * testsuite/ifuncvar1.c: New test file.
3168 * testsuite/ifuncvar2.c: New test file.
3169 * testsuite/ifuncvar3.c: New test file.
3170 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3171 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3172 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3173 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3174 * testsuite/Makefile.in: Rebuild.
3175
3176 2011-07-07 Cary Coutant <ccoutant@google.com>
3177
3178 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3179 (two_file_test_1_ndebug.o): Likewise.
3180 (two_file_test_1b_ndebug.o): Likewise.
3181 (two_file_test_2_ndebug.o): Likewise.
3182 (two_file_test_main_ndebug.o): Likewise.
3183 (incremental_test_2): Link with no-debug versions.
3184
3185 2011-07-06 Cary Coutant <ccoutant@google.com>
3186
3187 * gold/incremental.cc
3188 (Output_section_incremental_inputs::write_info_blocks): Check for
3189 hidden and internal symbols.
3190
3191 2011-07-06 Cary Coutant <ccoutant@google.com>
3192
3193 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3194 Check disposition for startup file.
3195 (Incremental_inputs::report_command_line): Ignore
3196 --incremental-startup-unchanged option.
3197 * options.cc (General_options::parse_incremental_startup_unchanged):
3198 New function.
3199 (General_options::General_options): Initialize new data member.
3200 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3201 (General_options): Add --incremental-startup-unchanged option.
3202 (General_options::incremental_startup_disposition): New function.
3203 (General_options::incremental_startup_disposition_): New data member.
3204
3205 2011-07-06 Cary Coutant <ccoutant@google.com>
3206
3207 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3208 input file index to Script_info ctor.
3209 (Sized_incremental_binary::do_file_has_changed): Find the
3210 command-line argument for files named in scripts.
3211 * incremental.h (Script_info::Script_info): New ctor
3212 with input file index.
3213 (Script_info::input_file_index): New function.
3214 (Script_info::input_file_index_): New data member.
3215 (Incremental_binary::get_library): Add const.
3216 (Incremental_binary::get_script_info): Add const.
3217 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3218 * testsuite/Makefile.am (incremental_test_5): New test case.
3219 (incremental_test_6): New test case.
3220 * testsuite/Makefile.in: Regenerate.
3221
3222 2011-07-06 Cary Coutant <ccoutant@google.com>
3223
3224 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3225 debug output when command lines differ.
3226
3227 2011-07-06 Cary Coutant <ccoutant@google.com>
3228
3229 * incremental.cc (Incremental_inputs::report_command_line): Ignore
3230 --incremental-patch option.
3231 * layout.cc (Free_list::allocate): Extend allocation beyond original
3232 end if enabled.
3233 (Layout::make_output_section): Mark sections that should get
3234 patch space.
3235 * options.cc (parse_percent): New function.
3236 * options.h (parse_percent): New function.
3237 (DEFINE_percent): New macro.
3238 (General_options): Add --incremental-patch option.
3239 * output.cc (Output_section::Output_section): Initialize new data
3240 members.
3241 (Output_section::add_input_section): Print section name when out
3242 of patch space.
3243 (Output_section::add_output_section_data): Likewise.
3244 (Output_section::set_final_data_size): Add patch space when
3245 doing --incremental-full.
3246 (Output_section::do_reset_address_and_file_offset): Remove patch
3247 space.
3248 (Output_segment::set_section_list_addresses): Print debug output
3249 only if --incremental-update.
3250 * output.h (Output_section::set_is_patch_space_allowed): New function.
3251 (Output_section::is_patch_space_allowed_): New data member.
3252 (Output_section::patch_space_): New data member.
3253 * parameters.cc (Parameters::incremental_full): New function.
3254 * parameters.h (Parameters::incremental_full): New function
3255 * testsuite/Makefile.am (incremental_test_2): Add test for
3256 --incremental-patch option.
3257 * testsuite/Makefile.in: Regenerate.
3258 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3259 (t18): Remove function body.
3260
3261 2011-07-05 Doug Kwan <dougkwan@google.com>
3262
3263 PR gold/12771
3264 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3265 Arm_Address type for relocation result.
3266 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
3267 overflow check.
3268 (Arm_relocate_functions::abs32): Use unaligned access.
3269 (Arm_relocate_functions::rel32): Ditto.
3270 (Arm_relocate_functions::prel31): Ditto.
3271 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3272 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3273 static data relocations.
3274 * testsuite/Makefile.in: Regnerate.
3275 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3276
3277 2011-07-05 Ian Lance Taylor <iant@google.com>
3278
3279 PR gold/12392
3280 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3281 symbols if necessary.
3282 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3283
3284 2011-07-05 Ian Lance Taylor <iant@google.com>
3285
3286 PR gold/12952
3287 * resolve.cc (Symbol::override_base_with_special): Simply override
3288 version with special symbol version, ignoring previous version.
3289
3290 2011-07-05 Ian Lance Taylor <iant@google.com>
3291
3292 * object.cc (Sized_relobj_file::include_section_group): Add
3293 information to comment about signature location.
3294
3295 2011-07-02 Ian Lance Taylor <iant@google.com>
3296
3297 PR gold/12957
3298 * options.h (class General_options): Add -f and -F.
3299 * options.cc (General_options::finalize): Fatal error if -f/-F
3300 are used without -shared.
3301 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3302
3303 2011-07-02 Ian Lance Taylor <iant@google.com>
3304
3305 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3306
3307 2011-07-01 Ian Lance Taylor <iant@google.com>
3308
3309 PR gold/12525
3310 PR gold/12952
3311 * resolve.cc (Symbol::override_base_with_special): Don't override
3312 the version if the overriding symbol has a different name.
3313 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
3314 all callers. If we give an error about an undefined version,
3315 define the base version if necessary.
3316 * dynobj.h (class Versions): Update declaration.
3317 * testsuite/weak_alias_test_5.cc: New file.
3318 * testsuite/weak_alias_test.script: New file.
3319 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3320 and versioned_alias have the right value, and call t2.
3321 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3322 weak_alias_test_5.so.
3323 (weak_alias_test_LDADD): Likewise.
3324 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3325 * testsuite/Makefile.in: Rebuild.
3326
3327 2011-07-01 Ian Lance Taylor <iant@google.com>
3328
3329 PR gold/12525
3330 * options.h (class General_options): Support -z notext.
3331 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3332 -Wl,-z,notext.
3333 (two_file_shared_nonpic.so): Likewise.
3334 (two_file_shared_mixed.so): Likewise.
3335 (two_file_shared_mixed_1.so): Likewise.
3336 (weak_undef_lib_nonpic.so): Likewise.
3337 (alt/weak_undef_lib_nonpic.so): Likewise.
3338 (tls_test_shared_nonpic.so): Likewise.
3339 * testsuite/Makefile.in: Rebuild.
3340
3341 2011-07-01 Ian Lance Taylor <iant@google.com>
3342
3343 PR gold/12525
3344 * configure.ac: Test whether static linking works, setting
3345 the automake conditional HAVE_STATIC.
3346 * testsuite/Makefile.am: Disable tests using -static if
3347 HAVE_STATIC is not true.
3348 * configure, testsuite/Makefile.in: Rebuild.
3349
3350 2011-07-01 Ian Lance Taylor <iant@google.com>
3351
3352 PR gold/12525
3353 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3354 Assert if we see DW_EH_PE_indirect.
3355 * target.h (Target::ehframe_datarel_base): New function.
3356 (Target::do_ehframe_datarel_base): New target function.
3357 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3358 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3359 function.
3360
3361 2011-07-01 Ian Lance Taylor <iant@google.com>
3362
3363 PR gold/12571
3364 * options.h (class General_options): Add
3365 --ld-generated-unwind-info.
3366 * ehframe.cc (Fde::write): Add address parameter. Change all
3367 callers. If associated with PLT, fill in address and size.
3368 (Cie::set_output_offset): Only add merge mapping if there is an
3369 object.
3370 (Cie::write): Add address parameter. Change all callers.
3371 (Eh_frame::add_ehframe_for_plt): New function.
3372 * ehframe.h (class Fde): Update declarations. Move shndx_ and
3373 input_offset_ fields into union u_, with new plt field.
3374 (Fde::Fde): Adjust for new union field.
3375 (Fde::Fde) [Output_data version]: New constructor.
3376 (Fde::add_mapping): Only add merge mapping if there is an object.
3377 (class Cie): Update declarations.
3378 (class Eh_frame): Declare add_ehframe_for_plt.
3379 * layout.cc (Layout::layout_eh_frame): Break out code into
3380 make_eh_frame_section, and call it.
3381 (Layout::make_eh_frame_section): New function.
3382 (Layout::add_eh_frame_for_plt): New function.
3383 * layout.h (class Layout): Update declarations.
3384 * merge.cc (Merge_map::add_mapping): Add assertion.
3385 * i386.cc: Include "dwarf.h".
3386 (class Output_data_plt_i386): Make first_plt_entry,
3387 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
3388 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3389 and plt_eh_frame_fde.
3390 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3391 boundary. Call add_eh_frame_for_plt if appropriate.
3392 * x86_64.cc: Include "dwarf.h".
3393 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
3394 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
3395 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3396 and plt_eh_frame_fde.
3397 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3398 appropriate.
3399
3400 2011-06-29 Ian Lance Taylor <iant@google.com>
3401
3402 PR gold/12629
3403 * object.cc (Sized_relobj_file::layout_section): Change shdr
3404 parameter to be const.
3405 (Sized_relobj_file::layout_eh_frame_section): New function, broken
3406 out of do_layout.
3407 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3408 appropriate. Call layout_eh_frame_section.
3409 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3410 sections.
3411 * object.h (class Sized_relobj_file): Update declarations.
3412
3413 2011-06-29 Ian Lance Taylor <iant@google.com>
3414
3415 PR gold/12652
3416 * script.cc (Token::integer_value): Accept trailing M/m/K/k
3417 modifier.
3418 (Lex::gather_token): Accept trailing M/m/K/k for integers.
3419
3420 2011-06-29 Ian Lance Taylor <iant@google.com>
3421
3422 PR gold/12675
3423 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3424 SHT_X86_64_UNWIND.
3425 * layout.cc (Layout::layout_eh_frame): Likewise.
3426
3427 2011-06-29 Ian Lance Taylor <iant@google.com>
3428
3429 PR gold/12695
3430 * layout.cc (Layout::symtab_section_shndx): New function.
3431 * layout.h (class Layout): Declare symtab_section_shndx.
3432 * output.cc (Output_section::write_header): Call it.
3433
3434 2011-06-29 Ian Lance Taylor <iant@google.com>
3435
3436 PR gold/12818
3437 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3438 symbols which are not used in a relocation.
3439
3440 2011-06-28 Ian Lance Taylor <iant@google.com>
3441
3442 PR gold/12898
3443 * layout.cc (Layout::segment_precedes): Don't crash if a linker
3444 script create indistinguishable segments.
3445 (Layout::set_segment_offsets): Use stable_sort when sorting
3446 segments. Pass this to Compare_segments constructor.
3447 * layout.h (class Layout): Make segment_precedes non-static.
3448 (class Compare_segments): Change from struct to class. Add
3449 layout_ field. Add constructor.
3450 * script-sections.cc
3451 (Script_sections::attach_sections_using_phdrs_clause): Rename
3452 local orphan to is_orphan. Don't report failure to put empty
3453 section in segment. On attachment failure, report name of
3454 section, and attach to first PT_LOAD segment.
3455
3456 2011-06-28 Ian Lance Taylor <iant@google.com>
3457
3458 PR gold/12934
3459 * target-select.cc (Target_selector::Target_selector): Add
3460 emulation parameter. Change all callers.
3461 (select_target_by_bfd_name): Rename from select_target_by_name.
3462 Change all callers.
3463 (select_target_by_emulation): New function.
3464 (supported_emulation_names): New function.
3465 * target-select.h (class Target_selector): Add emulation_ field.
3466 Update declarations.
3467 (Target_selector::recognize_by_bfd_name): Rename from
3468 recognize_by_name. Change all callers.
3469 (Target_selector::supported_bfd_names): Rename from
3470 supported_names. Change all callers.
3471 (Target_selector::recognize_by_emulation): New function.
3472 (Target_selector::supported_emulations): New function.
3473 (Target_selector::emulation): New function.
3474 (Target_selector::do_recognize_by_bfd_name): Rename from
3475 do_recognize_by_name. Change all callers.
3476 (Target_selector::do_supported_bfd_names): Rename from
3477 do_supported_names. Change all callers.
3478 (Target_selector::do_recognize_by_emulation): New function.
3479 (Target_selector::do_supported_emulations): New function.
3480 (select_target_by_bfd_name): Change name in declaration.
3481 (select_target_by_emulation): Declare.
3482 (supported_emulation_names): Declare.
3483 * parameters.cc (parameters_force_valid_target): Try to find
3484 target based on emulation from -m option.
3485 * options.h (class General_options): Change doc string for -m.
3486 * options.cc (help): Print emulations.
3487 (General_options::parse_V): Likewise.
3488 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3489 Add emulation parameter. Change all callers.
3490
3491 2011-06-28 Ian Lance Taylor <iant@google.com>
3492
3493 * target.h (class Target): Add osabi_ field.
3494 (Target::osabi): New function.
3495 (Target::set_osabi): New function.
3496 (Target::Target): Initialize osabi_.
3497 (Target::do_adjust_elf_header): Make pure virtual.
3498 (Sized_target::do_adjust_elf_header): Declare.
3499 * target.cc (Sized_target::do_adjust_elf_header): New function.
3500 (class Sized_target): Instantiate all versions.
3501 * freebsd.h (class Target_freebsd): Remove.
3502 (Target_selector_freebsd::do_recognize): Call set_osabi on
3503 Target.
3504 (Target_selector_freebsd::do_recognize_by_name): Likewise.
3505 (Target_selector_freebsd::set_osabi): Remove.
3506 * i386.cc (class Target_i386): Inherit from Sized_target rather
3507 than Target_freebsd.
3508 * x86_64.cc (class Target_x86_64): Likewise.
3509
3510 2011-06-28 Ian Lance Taylor <iant@google.com>
3511
3512 * target.h (Target::can_check_for_function_pointers): Rewrite.
3513 Make non-virtual.
3514 (Target::can_icf_inline_merge_sections): Likewise.
3515 (Target::section_may_have_icf_unsafe_poineters): Likewise.
3516 (Target::Target_info): Add can_icf_inline_merge_sections field.
3517 (Target::do_can_check_for_function_pointers): New virtual
3518 function.
3519 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3520 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3521 from can_check_for_function_pointers, move in file.
3522 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3523 section_may_have_icf_unsafe_poineters, move in file.
3524 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3525 * i386.cc (Target_i386::do_can_check_for_function_pointers):
3526 Rename from can_check_for_function_pointers, move in file.
3527 (Target_i386::can_icf_inline_merge_sections): Remove.
3528 (Target_i386::i386_info): Initialize
3529 can_icf_inline_merge_sections.
3530 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3531 Initialize can_icf_inline_merge_sections.
3532 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3533 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3534 Rename from can_check_for_function_pointers, move in file.
3535 (Target_x86_64::can_icf_inline_merge_sections): Remove.
3536 (Target_x86_64::x86_64_info): Initialize
3537 can_icf_inline_merge_sections.
3538 * testsuite/testfile.cc (Target_test::test_target_info):
3539 Likewise.
3540 * icf.cc (get_section_contents): Correct formatting.
3541
3542 2011-06-27 Ian Lance Taylor <iant@google.com>
3543
3544 * symtab.cc (Symbol::versioned_name): New function.
3545 (Symbol_table::add_to_final_symtab): Use versioned_name when
3546 appropriate.
3547 (Symbol_table::sized_write_symbol): Likewise.
3548 * symtab.h (class Symbol): Declare versioned_name.
3549 * stringpool.h (class Stringpool_template): Add variant of add
3550 which takes a std::basic_string.
3551 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3552 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3553 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3554 (ver_test_12.o): New target.
3555 * testsuite/Makefile.in: Rebuild.
3556
3557 2011-06-27 Doug Kwan <dougkwan@google.com>
3558
3559 * arm.cc (Arm_relocate_functions::thm_jump8,
3560 Arm_relocate_functions::thm_jump11): Use a wider signed
3561 type to compute offset.
3562 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3563 arm_thm_jump8.
3564 * testsuite/Makefile.in: Regenerate.
3565 * testsuite/arm_branch_in_range.sh: Check test results of
3566 arm_thm_jump11 and arm_thm_jump8.
3567 * testsuite/arm_thm_jump11.s: New test source file.
3568 * testsuite/arm_thm_jump11.t: New linker script.
3569 * testsuite/arm_thm_jump8.s: New test source file.
3570 * testsuite/arm_thm_jump8.t: New linker script.
3571
3572 2011-06-24 Ian Lance Taylor <iant@google.com>
3573
3574 * layout.cc: Include "object.h".
3575 (ctors_sections_in_init_array): New static variable.
3576 (Layout::is_ctors_in_init_array): New function.
3577 (Layout::layout): Add entry to ctors_sections_in_init_array if
3578 appropriate.
3579 * layout.h (class Layout): Declare is_ctors_in_init_array.
3580 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3581 is_ctors_reverse_view is set.
3582 (Sized_relobj_file::write_sections): Add layout parameter. Change
3583 all callers. Set is_ctors_reverse_view field of View_size.
3584 (Sized_relobj_file::reverse_words): New function.
3585 * object.h (Sized_relobj_file::View_size): Add
3586 is_ctors_reverse_view field.
3587 (class Sized_relobj_file): Update declarations.
3588 * testsuite/initpri3.c: New test.
3589 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3590 initpri3b.
3591 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3592 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3593 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3594 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3595 * testsuite/Makefile.in: Rebuild.
3596
3597 2011-06-24 Cary Coutant <ccoutant@google.com>
3598
3599 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3600 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3601 (debug_msg_cdebug.err): New targets.
3602 * testsuite/Makefile.in: Regenerate.
3603 * testsuite/debug_msg.sh: Check output of link with compressed debug.
3604 Fix checks for link with shared library.
3605
3606 2011-06-24 Doug Kwan <dougkwan@google.com>
3607
3608 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3609 skip empty text sections.
3610 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3611
3612 2011-06-22 Ian Lance Taylor <iant@google.com>
3613
3614 PR gold/12910
3615 * options.h (class General_options): Add --ctors-in-init-array.
3616 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3617 friends as SHT_PROGBITS for merging sections.
3618 (Layout::layout): Remove special handling of .init_array and
3619 friends. Don't sort if doing relocatable link. Sort for .ctors
3620 and .dtors if ctors_in_init_array.
3621 (Layout::make_output_section): Force correct section types for
3622 .init_array and friends. Don't sort if doing relocatable link,
3623 Don't sort .ctors and .dtors if ctors_in_init_array.
3624 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3625 (Layout::output_section_name): Add relobj parameter. Change all
3626 callers. Handle .ctors. and .dtors. in code rather than table.
3627 Handle .ctors and .dtors if ctors_in_init_array.
3628 (Layout::match_file_name): New function, moved from output.cc.
3629 * layout.h (class Layout): Update declarations.
3630 * output.cc: Include "layout.h".
3631 (Input_section_sort_entry::get_priority): New function.
3632 (Input_section_sort_entry::match_file_name): Just call
3633 Layout::match_file_name.
3634 (Output_section::Input_section_sort_init_fini_compare::operator()):
3635 Handle .ctors and .dtors. Sort by explicit priority rather than
3636 by name.
3637 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3638 * testsuite/initpri2.c: New test.
3639 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3640 (check_PROGRAMS): Add initpri2.
3641 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3642 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3643 * configure, testsuite/Makefile.in: Rebuild.
3644
3645 2011-06-19 Ian Lance Taylor <iant@google.com>
3646
3647 PR gold/12880
3648 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3649 .interp section to a PT_INTERP segment even if we have seen a
3650 --dynamic-linker option. Don't do it if we have seen a PHDRS
3651 clause in a linker script.
3652 (Layout::finalize): Don't create a .interp section if we've
3653 already create a PT_INTERP segment.
3654 (Layout::create_interp): Always call choose_output_section (revert
3655 patch of 2011-06-17). Don't create PT_INTERP segment.
3656 * script-sections.cc
3657 (Script_sections::create_note_and_tls_segments): Add a .interp
3658 section to a PT_INTERP segment even if we have seen a
3659 --dynamic-linker option.
3660
3661 2011-06-18 Ian Lance Taylor <iant@google.com>
3662
3663 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3664 merely because a non-PT_LOAD segment has a dynamic reloc.
3665
3666 2011-06-18 Ian Lance Taylor <iant@google.com>
3667
3668 * layout.cc (Layout::finish_dynamic_section): Don't create
3669 DT_FLAGS entry if not needed.
3670
3671 2011-06-18 Ian Lance Taylor <iant@google.com>
3672
3673 PR gold/12745
3674 * layout.cc (Layout::layout_eh_frame): Correct handling of
3675 writable .eh_frame section.
3676
3677 2011-06-17 Ian Lance Taylor <iant@google.com>
3678
3679 PR gold/12893
3680 * resolve.cc (Symbol_table::resolve): Don't give an error if a
3681 symbol is redefined with the exact same object and value.
3682
3683 2011-06-17 Ian Lance Taylor <iant@google.com>
3684
3685 PR gold/12880
3686 * layout.h (class Layout): Add interp_segment_ field.
3687 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3688 (Layout::attach_allocated_section_to_segment): If making shared
3689 library, put .interp section in PT_INTERP segment.
3690 (Layout::finalize): Also call create_interp if -dynamic-linker
3691 option was used.
3692 (Layout::create_interp): Assert that there is no PT_INTERP
3693 segment. If not using a SECTIONS clause, use make_output_section.
3694 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3695 * script-sections.cc
3696 (Script_sections::create_note_and_tls_segments): If making shared
3697 library, put .interp section in PT_INTERP segment.
3698
3699 2011-06-17 Ian Lance Taylor <iant@google.com>
3700
3701 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3702 when making a shared library.
3703
3704 2011-06-17 Ian Lance Taylor <iant@google.com>
3705
3706 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3707 parameter. Change all callers. Don't issue warning about PC32
3708 against locally defined symbol.
3709
3710 2011-06-16 Ian Lance Taylor <iant@google.com>
3711
3712 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3713 occurs in same object.
3714
3715 2011-06-14 Alan Modra <amodra@gmail.com>
3716
3717 * po/POTFILES.in: Regenerate.
3718
3719 2011-06-09 Ian Lance Taylor <iant@google.com>
3720
3721 * script-sections.cc
3722 (Orphan_output_section::set_section_addresses): For a relocatable
3723 link set address to 0.
3724
3725 2011-06-09 Cary Coutant <ccoutant@google.com>
3726
3727 PR gold/12804
3728 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3729 used with --compress-debug-sections.
3730 * gold/object.cc (Sized_relobj_file::do_layout): Report
3731 uncompressed size of compressed input sections.
3732
3733 2011-06-08 Cary Coutant <ccoutant@google.com>
3734
3735 PR gold/12804
3736 * testsuite/two_file_test_2_v1.cc: Change initialization of
3737 v2 to keep it in .data.
3738
3739 2011-06-07 Cary Coutant <ccoutant@google.com>
3740
3741 * common.cc (Symbol_table::do_allocate_commons_list): Call
3742 gold_fallback.
3743 * errors.cc (Errors::fatal): Adjust call to gold_exit.
3744 (Errors::fallback): New function.
3745 (gold_fallback): New function.
3746 * errors.h (Errors::fallback): New function.
3747 * gold.cc (gold_exit): Change status parameter to enum; adjust
3748 all callers.
3749 (queue_initial_tasks): Call gold_fallback.
3750 * gold.h: Include cstdlib.
3751 (Exit_status): New enum type.
3752 (gold_exit): Change status parameter to enum.
3753 (gold_fallback): New function.
3754 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3755 (Layout::create_symtab_sections): Likewise.
3756 (Layout::create_shdrs): Likewise.
3757 * main.cc (main): Adjust call to gold_exit.
3758 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3759 (Output_data_got::add_got_entry_pair): Likewise.
3760 (Output_section::add_input_section): Likewise.
3761 (Output_section::add_output_section_data): Likewise.
3762 (Output_segment::set_section_list_addresses): Likewise.
3763 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3764
3765 2011-06-07 Cary Coutant <ccoutant@google.com>
3766
3767 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3768 for incremental links.
3769 * output.cc (Output_segment::set_section_list_addresses): Remove
3770 FIXME and test for TLS or BSS.
3771
3772 2011-06-07 Cary Coutant <ccoutant@google.com>
3773
3774 * testsuite/Makefile.am: Add incremental_copy_test,
3775 incremental_common_test_1.
3776 * testsuite/Makefile.in: Regenerate.
3777 * testsuite/common_test_1_v1.c: New source file.
3778 * testsuite/common_test_1_v2.c: New source file.
3779 * testsuite/copy_test_v1.cc: New source file.
3780
3781 2011-06-07 Cary Coutant <ccoutant@google.com>
3782
3783 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3784 update, allocate common from bss section's free list.
3785 * incremental-dump.cc (dump_incremental_inputs): Print flag for
3786 linker-defined symbols.
3787 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3788 Skip GOT and PLT entries that are no longer referenced.
3789 (Output_section_incremental_inputs::write_info_blocks): Mark
3790 linker-defined symbols.
3791 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3792 * output.cc (Output_section::allocate): New function.
3793 * output.h (Output_section::allocate): New function.
3794 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3795 linker-defined symbols.
3796 (Symbol::override_base_with_special): Copy is_predefined_ flag.
3797 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3798 (Symbol::init_base_output_data): Likewise.
3799 (Symbol::init_base_output_segment): Likewise.
3800 (Symbol::init_base_constant): Likewise.
3801 (Sized_symbol::init_output_data): Likewise.
3802 (Sized_symbol::init_output_segment): Likewise.
3803 (Sized_symbol::init_constant): Likewise.
3804 (Symbol_table::do_define_in_output_data): Likewise.
3805 (Symbol_table::do_define_in_output_segment): Likewise.
3806 (Symbol_table::do_define_as_constant): Likewise.
3807 * symtab.h (Symbol::is_predefined): New function.
3808 (Symbol::init_base_output_data): Add is_predefined parameter.
3809 (Symbol::init_base_output_segment): Likewise.
3810 (Symbol::init_base_constant): Likewise.
3811 (Symbol::is_predefined_): New data member.
3812 (Sized_symbol::init_output_data): Add is_predefined parameter.
3813 (Sized_symbol::init_output_segment): Likewise.
3814 (Sized_symbol::init_constant): Likewise.
3815 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3816
3817 2011-06-07 Cary Coutant <ccoutant@google.com>
3818
3819 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3820 instead of emit_copy_reloc.
3821 (Copy_relocs::emit_copy_reloc): Refactor.
3822 (Copy_relocs::make_copy_reloc): New function.
3823 (Copy_relocs::add_copy_reloc): Remove.
3824 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3825 section.
3826 (Copy_relocs::make_copy_reloc): New function.
3827 (Copy_relocs::add_copy_reloc): Remove.
3828 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3829 unchanged input files.
3830 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3831 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3832 Reserve BSS space for COPY relocations.
3833 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3834 (Output_section_incremental_inputs::write_info_blocks): Record
3835 whether a symbol is copied from a shared object.
3836 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3837 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3838 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3839 (Incremental_input_entry_reader::get_output_symbol_index): Add
3840 is_copy parameter.
3841 (Incremental_binary::emit_copy_relocs): New function.
3842 (Incremental_binary::do_emit_copy_relocs): New function.
3843 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3844 new data member.
3845 (Sized_incremental_binary::add_copy_reloc): New function.
3846 (Sized_incremental_binary::do_emit_copy_relocs): New function.
3847 (Sized_incremental_binary::Copy_reloc): New struct.
3848 (Sized_incremental_binary::Copy_relocs): New typedef.
3849 (Sized_incremental_binary::copy_relocs_): New data member.
3850 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3851 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3852 * target.h (Sized_target::emit_copy_reloc): New function.
3853 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3854
3855 2011-06-02 Cary Coutant <ccoutant@google.com>
3856
3857 PR gold/12163
3858 * gold/archive.cc (Archive::Archive): Initialize new data member.
3859 (Archive::include_all_members): Return if archive has already been
3860 included.
3861 * gold/archive.h (Archive::include_all_members_): New data member.
3862
3863 2011-06-02 Nick Clifton <nickc@redhat.com>
3864
3865 * dynobj.h: Fix spelling mistake in comment.
3866 * output.cc: Likewise.
3867
3868 2011-05-31 Doug Kwan <dougkwan@google.com>
3869 Asier Llano
3870
3871 PR gold/12826
3872 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3873 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3874 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
3875 redundant arm_exidx_test.so.
3876 * testsuite/Makefile.in: Regenerate.
3877 (check_SCRIPTS): Add pr12826.sh
3878 (check_DATA): Add pr12826.stdout
3879 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3880 * testsuite/pr12826.sh: New file.
3881 * testsuite/pr12826_1.s: Ditto.
3882 * testsuite/pr12826_1.s: Ditto.
3883
3884 2011-05-30 Ian Lance Taylor <iant@google.com>
3885
3886 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3887 sections.
3888
3889 2011-05-29 Ian Lance Taylor <iant@google.com>
3890
3891 PR gold/12804
3892 * testsuite/Makefile.am: Use different file name for two_file_test
3893 temporary file for each incremental test.
3894 * testsuite/Makefile.in: Rebuild.
3895
3896 2011-05-29 Ian Lance Taylor <iant@google.com>
3897
3898 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3899 binary input file is empty.
3900
3901 2011-05-27 Ian Lance Taylor <iant@google.com>
3902
3903 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3904 (ver_test_9.so): Likewise.
3905 * testsuite/Makefile.in: Rebuild.
3906
3907 2011-05-26 Cary Coutant <ccoutant@google.com>
3908
3909 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3910 * incremental.cc (Incremental_inputs::report_input_section): Fix
3911 comment, indentation.
3912 (Incremental_inputs::report_comdat_group): New function.
3913 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3914 of data for incremental input file entry.
3915 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3916 group count, COMDAT group signatures.
3917 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3918 an unchanged input file.
3919 * incremental.h (Incremental_object_entry::Incremental_object_entry):
3920 Initialize new data member.
3921 (Incremental_object_entry::add_comdat_group): New function.
3922 (Incremental_object_entry::get_comdat_group_count): New function.
3923 (Incremental_object_entry::get_comdat_signature_key): New function.
3924 (Incremental_object_entry::groups_): New data member.
3925 (Incremental_inputs::report_comdat_group): New function.
3926 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3927 data for incremental input file entry.
3928 (Incremental_input_entry_reader::get_comdat_group_count): New function.
3929 (Incremental_input_entry_reader::get_input_section): Adjust size of
3930 data for incremental input file entry.
3931 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3932 (Incremental_input_entry_reader::get_comdat_group_signature): New
3933 function.
3934 * object.cc (Sized_relobj::include_section_group): Report kept
3935 COMDAT groups for incremental links.
3936
3937 2011-05-24 David Meyer <pdox@google.com>
3938
3939 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3940 with name parameter. Add found_name parameter.
3941 * fileread.cc (Input_file::find_file): Adjust code accordingly.
3942 * dirsearch.h (class Dirsearch): Update declaration.
3943
3944 2011-05-24 Ian Lance Taylor <iant@google.com>
3945
3946 * archive.cc (Library_base::should_include_member): Pull in object
3947 from archive if it defines the entry symbol.
3948 * parameters.cc (Parameters::entry): New function.
3949 * parameters.h (class Parameters): Declare entry.
3950 * output.h (class Output_file_header): Remove entry_ field.
3951 * output.cc (Output_file_header::Output_file_header): Remove entry
3952 parameter. Change all callers.
3953 (Output_file_header::entry): Use parameters->entry.
3954 * gold.cc (queue_middle_tasks): Likewise.
3955 * plugin.cc (Plugin_hook::run): Likewise.
3956
3957 2011-05-24 Cary Coutant <ccoutant@google.com>
3958
3959 * gold.cc (queue_initial_tasks): Pass incremental base filename
3960 to Output_file::open_base_file; don't print error message.
3961 * incremental-dump.cc (main): Adjust call to
3962 Output_file::open_for_modification.
3963 * incremental-dump.cc (main): Likewise.
3964 * incremental.cc (Incremental_inputs::report_command_line):
3965 Ignore --incremental-base option when comparing command lines.
3966 Ignore parameter when given as separate argument.
3967 * options.h (class General_options): Add --incremental-base.
3968 * output.cc (Output_file::Output_file):
3969 (Output_file::open_base_file): Add base_name and writable parameters;
3970 read base file into new file; print error message here.
3971 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3972 callers.
3973 * output.h (Output_file::open_for_modification): Rename to...
3974 (Output_file::open_base_file): ...this; add base_name and
3975 writable parameters; adjust all callers.
3976 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3977 callers.
3978 * testsuite/Makefile.am (incremental_test_4): Test
3979 --incremental-base.
3980 * testsuite/Makefile.in: Regenerate.
3981
3982 2011-05-24 Cary Coutant <ccoutant@google.com>
3983
3984 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3985 incremental_test_4.
3986 * testsuite/Makefile.in: Regenerate.
3987 * testsuite/two_file_test_1_v1.cc: New test source file.
3988 * testsuite/two_file_test_1b_v1.cc: New test source file.
3989 * testsuite/two_file_test_2_v1.cc: New test source file.
3990
3991 2011-05-24 Cary Coutant <ccoutant@google.com>
3992
3993 * dynobj.h (Dynobj::do_dynobj): New function.
3994 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3995 flag and soname for shared objects.
3996 * incremental.cc (Incremental_inputs::report_object): Make
3997 either Incremental_object_entry or Incremental_dynobj_entry; add
3998 soname to string table.
3999 (Incremental_inputs::report_input_section): Add assertion.
4000 (Output_section_incremental_inputs::set_final_data_size): Adjust
4001 type of input file entry for shared libraries; adjust size of
4002 shared library info entry.
4003 (Output_section_incremental_inputs::write_input_files): Write
4004 as_needed flag for shared libraries.
4005 (Output_section_incremental_inputs::write_info_blocks): Adjust type
4006 of input file entry for shared libraries; write soname.
4007 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4008 soname from incremental info.
4009 * incremental.h (enum Incremental_input_flags): Add
4010 INCREMENTAL_INPUT_AS_NEEDED.
4011 (Incremental_input_entry::Incremental_input_entry): Initialize new
4012 data member.
4013 (Incremental_input_entry::set_as_needed): New function.
4014 (Incremental_input_entry::as_needed): New function.
4015 (Incremental_input_entry::do_dynobj_entry): New function.
4016 (Incremental_input_entry::as_needed_): New data member.
4017 (Incremental_object_entry::Incremental_object_entry): Don't check
4018 for shared library.
4019 (Incremental_object_entry::do_type): Likewise.
4020 (class Incremental_dynobj_entry): New class.
4021 (Incremental_input_entry_reader::as_needed): New function.
4022 (Incremental_input_entry_reader::get_soname): New function.
4023 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4024 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4025 size of shared library info entry.
4026 * layout.cc (Layout::finish_dynamic_section): Don't test for
4027 incremental link when adding DT_NEEDED entries.
4028 * object.h (Object::Object): Initialize new data member.
4029 (Object::dynobj): New function.
4030 (Object::set_as_needed): New function.
4031 (Object::as_needed): New function.
4032 (Object::do_dynobj): New function.
4033 (Object::as_needed_): New data member.
4034
4035 2011-05-24 Cary Coutant <ccoutant@google.com>
4036
4037 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4038 info; adjust display of GOT entries.
4039 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4040 vector of input objects; remove file_status_.
4041 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4042 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4043 got_plt reader; call target hooks to reserve GOT entries.
4044 (Output_section_incremental_inputs::set_final_data_size): Adjust size
4045 of input file info header and GOT info entry.
4046 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4047 relocation info.
4048 (Got_plt_view_info::got_descriptor): Remove.
4049 (Got_plt_view_info::sym_index): New data member.
4050 (Got_plt_view_info::input_index): New data member.
4051 (Local_got_offset_visitor::visit): Write input file index.
4052 (Global_got_offset_visitor::visit): Write 0 for input file index.
4053 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4054 with sym_index and input_index.
4055 (Output_section_incremental_inputs::write_got_plt): Adjust size of
4056 incremental info GOT entry; replace got_descriptor with input_index.
4057 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4058 map from input file index to object.
4059 (Sized_relobj_incr::do_layout): Replace direct data member reference
4060 with accessor function.
4061 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4062 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4063 Adjust size of input file info header.
4064 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4065 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4066 (Incremental_input_entry_reader::get_input_section): Adjust size of
4067 input file info header.
4068 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4069 of incremental info GOT entry.
4070 (Incremental_got_plt_reader::get_got_desc): Remove.
4071 (Incremental_got_plt_reader::get_got_symndx): New function.
4072 (Incremental_got_plt_reader::get_got_input_index): New function.
4073 (Sized_incremental_binary::Sized_incremental_binary): Remove
4074 file_status_; add input_objects_.
4075 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4076 (Sized_incremental_binary::set_file_is_unchanged): Remove.
4077 (Sized_incremental_binary::file_is_unchanged): Remove.
4078 (Sized_incremental_binary::set_input_object): New function.
4079 (Sized_incremental_binary::input_object): New function.
4080 (Sized_incremental_binary::file_status_): Remove.
4081 (Sized_incremental_binary::input_objects_): New data member.
4082 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4083 references.
4084 (Sized_relobj_incr::invalid_address): Move to base class.
4085 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4086 class.
4087 (Sized_relobj_incr::do_output_section_offset): Likewise.
4088 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4089 (Sized_relobj_incr::section_offsets_): Likewise.
4090 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4091 function.
4092 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4093 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4094 with accessor function.
4095 (Sized_relobj_file::do_layout): Likewise.
4096 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4097 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4098 (Sized_relobj_file::compute_final_local_value): Replace refs to
4099 section_offsets_ with accessor function.
4100 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4101 * object.h (Relobj::Relobj): Initialize new data members.
4102 (Relobj::add_dyn_reloc): New function.
4103 (Relobj::first_dyn_reloc): New function.
4104 (Relobj::dyn_reloc_count): New function.
4105 (Relobj::first_dyn_reloc_): New data member.
4106 (Relobj::dyn_reloc_count_): New data member.
4107 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4108 references.
4109 (Sized_relobj::Address): New typedef.
4110 (Sized_relobj::invalid_address): Move here from child class.
4111 (Sized_relobj::Sized_relobj): Initialize new data members.
4112 (Sized_relobj::sized_relobj): New function.
4113 (Sized_relobj::is_output_section_offset_invalid): Move here from
4114 child class.
4115 (Sized_relobj::get_output_section_offset): Likewise.
4116 (Sized_relobj::local_has_got_offset): Likewise.
4117 (Sized_relobj::local_got_offset): Likewise.
4118 (Sized_relobj::set_local_got_offset): Likewise.
4119 (Sized_relobj::do_for_all_local_got_entries): Likewise.
4120 (Sized_relobj::clear_got_offsets): New function.
4121 (Sized_relobj::section_offsets): Move here from child class.
4122 (Sized_relobj::do_output_section_offset): Likewise.
4123 (Sized_relobj::do_set_section_offset): Likewise.
4124 (Sized_relobj::Local_got_offsets): Likewise.
4125 (Sized_relobj::local_got_offsets_): Likewise.
4126 (Sized_relobj::section_offsets_): Likewise.
4127 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4128 references.
4129 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4130 class.
4131 (Sized_relobj_file::sized_relobj): New function
4132 (Sized_relobj_file::local_has_got_offset): Move to base class.
4133 (Sized_relobj_file::local_got_offset): Likewise.
4134 (Sized_relobj_file::set_local_got_offset): Likewise.
4135 (Sized_relobj_file::get_output_section_offset): Likewise.
4136 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4137 (Sized_relobj_file::do_output_section_offset): Likewise.
4138 (Sized_relobj_file::do_set_section_offset): Likewise.
4139 (Sized_relobj_file::Local_got_offsets): Likewise.
4140 (Sized_relobj_file::local_got_offsets_): Likewise.
4141 (Sized_relobj_file::section_offsets_): Likewise.
4142 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4143 (all constructors).
4144 (set_needs_dynsym_index): Convert relobj to derived class pointer.
4145 (Output_reloc::get_symbol_index): Likewise.
4146 (Output_reloc::local_section_offset): Likewise.
4147 (Output_reloc::get_address): Likewise.
4148 (Output_reloc::symbol_value): Likewise.
4149 (Output_data_got::reserve_slot): Move to class definition.
4150 (Output_data_got::reserve_local): New function.
4151 (Output_data_got::reserve_slot_for_global): Remove.
4152 (Output_data_got::reserve_global): New function.
4153 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4154 (all constructors, two instantiations).
4155 (Output_reloc::get_relobj): New function (two instantiations).
4156 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4157 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4158 (Output_data_reloc::add_global): Adjust type of relobj.
4159 (Output_data_reloc::add_global_relative): Likewise.
4160 (Output_data_reloc::add_symbolless_global_addend): Likewise.
4161 (Output_data_reloc::add_local): Likewise.
4162 (Output_data_reloc::add_local_relative): Likewise.
4163 (Output_data_reloc::add_symbolless_local_addend): Likewise.
4164 (Output_data_reloc::add_local_section): Likewise.
4165 (Output_data_reloc::add_output_section): Likewise.
4166 (Output_data_reloc::add_absolute): Likewise.
4167 (Output_data_reloc::add_target_specific): Likewise.
4168 (Output_data_got::reserve_slot): Move definition here.
4169 (Output_data_got::reserve_local): New function.
4170 (Output_data_got::reserve_global): New function.
4171 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4172 section_offsets_ with accessor function.
4173 (Sized_relobj_file::write_sections): Likewise.
4174 (Sized_relobj_file::do_relocate_sections): Likewise.
4175 * target.h (Sized_target::reserve_local_got_entry): New function.
4176 (Sized_target::reserve_global_got_entry): New function.
4177 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4178 (Target_x86_64::reserve_global_got_entry): New function.
4179 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4180
4181 2011-05-23 Cary Coutant <ccoutant@google.com>
4182
4183 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4184 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4185 bit when checking got_type.
4186 * incremental.cc (Sized_incremental_binary::setup_readers):
4187 Store symbol table and string table locations; initialize bit vector
4188 of file status flags.
4189 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4190 unchanged files.
4191 (Sized_incremental_binary::do_process_got_plt): New function.
4192 (Sized_incremental_binary::get_symtab_view): Use stored locations.
4193 (Output_section_incremental_inputs::set_final_data_size): Record
4194 file index for each input file.
4195 (Output_section_incremental_inputs::write_got_plt): Store file index
4196 instead of input entry offset for each GOT entry.
4197 * incremental.h
4198 (Incremental_input_entry::Incremental_input_entry): Initialize new
4199 data member.
4200 (Incremental_input_entry::set_offset): Store file index.
4201 (Incremental_input_entry::get_file_index): New function.
4202 (Incremental_input_entry::file_index_): New data member.
4203 (Incremental_binary::process_got_plt): New function.
4204 (Incremental_binary::do_process_got_plt): New function.
4205 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4206 data members.
4207 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4208 (Sized_incremental_binary::set_file_is_unchanged): New function.
4209 (Sized_incremental_binary::file_is_unchanged): New function.
4210 (Sized_incremental_binary::do_process_got_plt): New function.
4211 (Sized_incremental_binary::file_status_): New data member.
4212 (Sized_incremental_binary::main_symtab_loc_): New data member.
4213 (Sized_incremental_binary::main_strtab_loc_): New data member.
4214 * output.cc (Output_data_got::Got_entry::write): Add case
4215 RESERVED_CODE.
4216 (Output_data_got::add_global): Call add_got_entry.
4217 (Output_data_got::add_global_plt): Likewise.
4218 (Output_data_got::add_global_with_rel): Likewise.
4219 (Output_data_got::add_global_with_rela): Likewise.
4220 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4221 (Output_data_got::add_global_pair_with_rela): Likewise.
4222 (Output_data_got::add_local): Call add_got_entry.
4223 (Output_data_got::add_local_plt): Likewise.
4224 (Output_data_got::add_local_with_rel): Likewise.
4225 (Output_data_got::add_local_with_rela): Likewise.
4226 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4227 (Output_data_got::add_local_pair_with_rela): Likewise.
4228 (Output_data_got::reserve_slot): New function.
4229 (Output_data_got::reserve_slot_for_global): New function.
4230 (Output_data_got::add_got_entry): New function.
4231 (Output_data_got::add_got_entry_pair): New function.
4232 (Output_section::add_output_section_data): Edit FIXME.
4233 * output.h
4234 (Output_section_data_build::Output_section_data_build): New
4235 constructor with size parameter.
4236 (Output_data_space::Output_data_space): Likewise.
4237 (Output_data_got::Output_data_got): Initialize new data member; new
4238 constructor with size parameter.
4239 (Output_data_got::add_constant): Call add_got_entry.
4240 (Output_data_got::reserve_slot): New function.
4241 (Output_data_got::reserve_slot_for_global): New function.
4242 (class Output_data_got::Got_entry): Add RESERVED_CODE.
4243 (Output_data_got::add_got_entry): New function.
4244 (Output_data_got::add_got_entry_pair): New function.
4245 (Output_data_got::free_list_): New data member.
4246 * target.h (Sized_target::init_got_plt_for_update): New function.
4247 (Sized_target::register_global_plt_entry): New function.
4248 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4249 Initialize new data member; call init; add constructor with PLT count.
4250 (Output_data_plt_x86_64::init): New function.
4251 (Output_data_plt_x86_64::add_relocation): New function.
4252 (Output_data_plt_x86_64::reserve_slot): New function.
4253 (Output_data_plt_x86_64::free_list_): New data member.
4254 (Target_x86_64::init_got_plt_for_update): New function.
4255 (Target_x86_64::register_global_plt_entry): New function.
4256 (Output_data_plt_x86_64::add_entry): Allocate from free list for
4257 incremental updates.
4258 (Output_data_plt_x86_64::add_relocation): New function.
4259 * testsuite/object_unittest.cc (Object_test): Set default options.
4260
4261 2011-05-16 Ian Lance Taylor <iant@google.com>
4262
4263 * options.h (class General_options): Make -i a synonym for -r.
4264
4265 2011-05-16 Ian Lance Taylor <iant@google.com>
4266
4267 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4268
4269 2011-05-10 Cary Coutant <ccoutant@google.com>
4270
4271 * object.cc (Sized_relobj::do_count_local_symbols): Check for
4272 strip_all (-s).
4273
4274 2011-05-06 Ian Lance Taylor <iant@google.com>
4275
4276 * layout.cc (Layout::layout): If the output section flags change,
4277 update the ordering.
4278
4279 2011-04-25 Cary Coutant <ccoutant@google.com>
4280
4281 * incremental-dump.cc (dump_incremental_inputs): Print local
4282 symbol info for each input file.
4283 * incremental.cc
4284 (Output_section_incremental_inputs::set_final_data_size): Add local
4285 symbol info to input file entries in incremental info.
4286 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4287 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4288 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4289 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4290 implementation.
4291 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4292 (Sized_incr_relobj::do_relocate): Write the local symbols.
4293 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4294 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4295 Adjust size of input file header.
4296 (Incremental_inputs_reader::get_local_symbol_offset): New function.
4297 (Incremental_inputs_reader::get_local_symbol_count): New function.
4298 (Incremental_inputs_reader::get_input_section): Adjust size of input
4299 file header.
4300 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4301 (Sized_incr_relobj::This): New typedef.
4302 (Sized_incr_relobj::sym_size): New const data member.
4303 (Sized_incr_relobj::Local_symbol): New struct.
4304 (Sized_incr_relobj::do_output_local_symbol_count): New function.
4305 (Sized_incr_relobj::do_local_symbol_offset): New function.
4306 (Sized_incr_relobj::local_symbol_count_): New data member.
4307 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4308 (Sized_incr_relobj::local_symbol_index_): New data member.
4309 (Sized_incr_relobj::local_symbol_offset_): New data member.
4310 (Sized_incr_relobj::local_dynsym_offset_): New data member.
4311 (Sized_incr_relobj::local_symbols_): New data member.
4312 * object.h (Relobj::output_local_symbol_count): New function.
4313 (Relobj::local_symbol_offset): New function.
4314 (Relobj::do_output_local_symbol_count): New function.
4315 (Relobj::do_local_symbol_offset): New function.
4316 (Sized_relobj::do_output_local_symbol_count): New function.
4317 (Sized_relobj::do_local_symbol_offset): New function.
4318
4319 2011-04-22 Vladimir Simonov <sv@sw.ru>
4320
4321 * descriptors.cc (set_close_on_exec): New function.
4322 (Descriptors::open): Use set_close_on_exec.
4323 * output.cc (S_ISLNK): Define if not defined.
4324
4325 2011-04-22 Cary Coutant <ccoutant@google.com>
4326
4327 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4328 global symbol map.
4329 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4330 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4331 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4332 relocations.
4333 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4334 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4335 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4336 * incremental.h
4337 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4338 function.
4339 (Incremental_binary::apply_incremental_relocs): New function.
4340 (Incremental_binary::do_apply_incremental_relocs): New function.
4341 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4342 data member.
4343 (Sized_incremental_binary::add_global_symbol): New function.
4344 (Sized_incremental_binary::global_symbol): New function.
4345 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4346 (Sized_incremental_binary::symbol_map_): New data member.
4347 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4348 * target.h (Sized_target::apply_relocation): New function.
4349 * target-reloc.h (apply_relocation): New function.
4350 * x86_64.cc (Target_x86_64::apply_relocation): New function.
4351
4352 2011-04-22 Doug Kwan <dougkwan@google.com>
4353
4354 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4355 flag of a SHT_ARM_EXIDX section.
4356 * testsuite/Makefile.am (arm_exidx_test): New test rules.
4357 * testsuite/Makefile.in: Regenerate.
4358 * testsuite/arm_exidx_test.s: New file.
4359 * testsuite/arm_exidx_test.sh: Same.
4360
4361 2011-04-20 Cary Coutant <ccoutant@google.com>
4362
4363 PR gold/12689
4364 * archive.h (Incremental_archive_entry::Archive_member):
4365 Initialize arg_serial_ (second constructor).
4366
4367 2011-04-17 Ian Lance Taylor <iant@google.com>
4368
4369 * object.cc (Relocate_info::location): Simplify location string.
4370 * errors.cc (Errors::error_at_location): Don't print program
4371 name.
4372 (Errors::warning_at_location): Likewise.
4373 (Errors::undefined_symbol): Likewise.
4374 * testsuite/debug_msg.sh: Update accordingly.
4375
4376 2011-04-14 Cary Coutant <ccoutant@google.com>
4377
4378 * gold/layout.cc (Layout::symtab_section_offset): New function.
4379 * gold/layout.h (Layout::symtab_section_offset): New function.
4380 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4381
4382 2011-04-12 Ian Lance Taylor <iant@google.com>
4383
4384 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
4385 with MREMAP_MAYMOVE.
4386 * output.h (class Output_file): Add map_is_allocated_ field.
4387 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
4388 not available, provide stubs. If mremap is not available, #define
4389 it to gold_mremap.
4390 (MREMAP_MAYMOVE): Define if not defined.
4391 (Output_file::Output_file): Initialize map_is_allocated_.
4392 (Output_file::resize): Check map_is_allocated_.
4393 (Output_file::map_anonymous): If mmap fails, use malloc.
4394 (Output_file::unmap): Don't do anything for an anonymous map.
4395 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
4396 is not available, provide stubs.
4397 (File_read::View::~View): Use free rather than delete[].
4398 (File_read::make_view): Use malloc rather than new[]. If mmap
4399 fails, use malloc.
4400 (File_read::find_or_make_view): Use malloc rather than new[].
4401 * gold.h: Remove HAVE_REMAP code.
4402 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
4403 exists. Rename mremap to gold_mremap. If mmap is not available
4404 don't do anything.
4405 * configure, config.in: Rebuild.
4406
4407 2011-04-11 Ian Lance Taylor <iant@google.com>
4408
4409 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4410 initialize local variable v.
4411
4412 2011-04-11 Cary Coutant <ccoutant@google.com>
4413
4414 * archive.cc (Archive::include_member): Adjust call to
4415 report_object.
4416 (Add_archive_symbols::run): Track argument serial numbers.
4417 (Lib_group::include_member): Likewise.
4418 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4419 * archive.h (Incremental_archive_entry::Archive_member):
4420 Initialize arg_serial_.
4421 (Archive_member::arg_serial_): New data member.
4422 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4423 (Sized_dynobj::do_add_symbols): Track symbols when doing an
4424 incremental link.
4425 (Sized_dynobj::do_for_all_local_got_entries): New function.
4426 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4427 function.
4428 * fileread.cc (get_mtime): New function.
4429 * fileread.h (get_mtime): New function.
4430 * gold.cc (queue_initial_tasks): Check for incremental update.
4431 (process_incremental_input): New function.
4432 (queue_middle_tasks): Don't force valid target for incremental
4433 update.
4434 * incremental-dump.cc (find_input_containing_global): Adjust
4435 size of symbol info entry.
4436 (dump_incremental_inputs): Dump argument serial number and
4437 in_system_directory flag; bias shndx by 1; print symbol names
4438 when dumping per-file symbol lists; use new symbol info readers.
4439 * incremental.cc
4440 (Output_section_incremental_inputs:update_data_size): New function.
4441 (Sized_incremental_binary::setup_readers): Setup input readers
4442 for each input file; build maps for files added from libraries
4443 and scripts.
4444 (Sized_incremental_binary::check_input_args): New function.
4445 (Sized_incremental_binary::do_check_inputs): Build map of argument
4446 serial numbers to input arguments.
4447 (Sized_incremental_binary::do_file_has_changed): Rename
4448 do_file_is_unchanged to this; compare file modification times.
4449 (Sized_incremental_binary::do_init_layout): New function.
4450 (Sized_incremental_binary::do_reserve_layout): New function.
4451 (Sized_incremental_binary::do_get_input_reader): Remove.
4452 (Sized_incremental_binary::get_symtab_view): New function.
4453 (Incremental_checker::can_incrementally_link_output_file): Remove.
4454 (Incremental_inputs::report_command_line): Exclude --debug options.
4455 (Incremental_inputs::report_archive_begin): Add parameter; track
4456 argument serial numbers; don't put input file entry for archive
4457 before archive members.
4458 (Incremental_inputs::report_archive_end): Put input file entry
4459 for archive after archive members.
4460 (Incremental_inputs::report_object): Add parameter; track argument
4461 serial numbers and in_system_directory flag.
4462 (Incremental_inputs::report_script): Add parameter; track argument
4463 serial numbers.
4464 (Output_section_incremental_inputs::set_final_data_size): Adjust
4465 size of symbol info entry; check for forwarding symbols.
4466 (Output_section_incremental_inputs::write_input_files): Write
4467 in_system_directory flag and argument serial number.
4468 (Output_section_incremental_inputs::write_info_blocks): Map section
4469 indices between incremental info and original input file; store
4470 input section index for each symbol.
4471 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4472 change operator() to visit().
4473 (class Global_got_offset_visitor): Likewise.
4474 (class Global_symbol_visitor_got_plt):
4475 (Output_section_incremental_inputs::write_got_plt): Use new visitor
4476 classes.
4477 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4478 (Sized_incr_relobj::do_read_symbols): New function.
4479 (Sized_incr_relobj::do_layout): New function.
4480 (Sized_incr_relobj::do_layout_deferred_sections): New function.
4481 (Sized_incr_relobj::do_add_symbols): New function.
4482 (Sized_incr_relobj::do_should_include_member): New function.
4483 (Sized_incr_relobj::do_for_all_global_symbols): New function.
4484 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4485 (Sized_incr_relobj::do_section_size): New function.
4486 (Sized_incr_relobj::do_section_name): New function.
4487 (Sized_incr_relobj::do_section_contents): New function.
4488 (Sized_incr_relobj::do_section_flags): New function.
4489 (Sized_incr_relobj::do_section_entsize): New function.
4490 (Sized_incr_relobj::do_section_address): New function.
4491 (Sized_incr_relobj::do_section_type): New function.
4492 (Sized_incr_relobj::do_section_link): New function.
4493 (Sized_incr_relobj::do_section_info): New function.
4494 (Sized_incr_relobj::do_section_addralign): New function.
4495 (Sized_incr_relobj::do_initialize_xindex): New function.
4496 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4497 (Sized_incr_relobj::do_read_relocs): New function.
4498 (Sized_incr_relobj::do_gc_process_relocs): New function.
4499 (Sized_incr_relobj::do_scan_relocs): New function.
4500 (Sized_incr_relobj::do_count_local_symbols): New function.
4501 (Sized_incr_relobj::do_finalize_local_symbols): New function.
4502 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4503 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4504 (Sized_incr_relobj::do_relocate): New function.
4505 (Sized_incr_relobj::do_set_section_offset): New function.
4506 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4507 (Sized_incr_dynobj::do_read_symbols): New function.
4508 (Sized_incr_dynobj::do_layout): New function.
4509 (Sized_incr_dynobj::do_add_symbols): New function.
4510 (Sized_incr_dynobj::do_should_include_member): New function.
4511 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4512 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4513 (Sized_incr_dynobj::do_section_size): New function.
4514 (Sized_incr_dynobj::do_section_name): New function.
4515 (Sized_incr_dynobj::do_section_contents): New function.
4516 (Sized_incr_dynobj::do_section_flags): New function.
4517 (Sized_incr_dynobj::do_section_entsize): New function.
4518 (Sized_incr_dynobj::do_section_address): New function.
4519 (Sized_incr_dynobj::do_section_type): New function.
4520 (Sized_incr_dynobj::do_section_link): New function.
4521 (Sized_incr_dynobj::do_section_info): New function.
4522 (Sized_incr_dynobj::do_section_addralign): New function.
4523 (Sized_incr_dynobj::do_initialize_xindex): New function.
4524 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4525 (make_sized_incremental_object): New function.
4526 (Incremental_library::copy_unused_symbols): New function.
4527 (Incremental_library::do_for_all_unused_symbols): New function.
4528 * incremental.h (enum Incremental_input_flags): New type.
4529 (class Incremental_checker): Remove.
4530 (Incremental_input_entry::Incremental_input_entry): Add argument
4531 serial number.
4532 (Incremental_input_entry::arg_serial): New function.
4533 (Incremental_input_entry::set_is_in_system_directory): New function.
4534 (Incremental_input_entry::is_in_system_directory): New function.
4535 (Incremental_input_entry::arg_serial_): New data member.
4536 (Incremental_input_entry::is_in_system_directory_): New data member.
4537 (class Script_info): Move here from script.h.
4538 (Script_info::Script_info): Add filename parameter.
4539 (Script_info::filename): New function.
4540 (Script_info::filename_): New data member.
4541 (Incremental_script_entry::Incremental_script_entry): Add argument
4542 serial number.
4543 (Incremental_object_entry::Incremental_object_entry): Likewise.
4544 (Incremental_object_entry::add_input_section): Build list of input
4545 sections with map to original shndx.
4546 (Incremental_object_entry::get_input_section_index): New function.
4547 (Incremental_object_entry::shndx_): New data member.
4548 (Incremental_object_entry::name_key_): Rename; adjust all refs.
4549 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4550 (Incremental_archive_entry::Incremental_archive_entry): Add argument
4551 serial number.
4552 (Incremental_inputs::report_archive_begin): Likewise.
4553 (Incremental_inputs::report_object): Likewise.
4554 (Incremental_inputs::report_script): Likewise.
4555 (class Incremental_global_symbol_reader): New class.
4556 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4557 and store flags and input file type.
4558 (Incremental_input_entry_reader::arg_serial): New function.
4559 (Incremental_input_entry_reader::type): Extract type from flags.
4560 (Incremental_input_entry_reader::is_in_system_directory): New function.
4561 (Incremental_input_entry_reader::get_input_section_count): Call
4562 accessor function for type.
4563 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4564 function for type; adjust size of global symbol entry.
4565 (Incremental_input_entry_reader::get_global_symbol_count): Call
4566 accessor function for type.
4567 (Incremental_input_entry_reader::get_object_count): Likewise.
4568 (Incremental_input_entry_reader::get_object_offset): Likewise.
4569 (Incremental_input_entry_reader::get_member_count): Likewise.
4570 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4571 (Incremental_input_entry_reader::get_member_offset): Likewise.
4572 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4573 (Incremental_input_entry_reader::Global_symbol_info): Remove.
4574 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4575 (Incremental_input_entry_reader::get_global_symbol_reader): New
4576 function.
4577 (Incremental_input_entry_reader::get_output_symbol_index): New
4578 function.
4579 (Incremental_input_entry_reader::type_): Remove.
4580 (Incremental_input_entry_reader::flags_): New data member.
4581 (Incremental_inputs_reader::input_file_offset): New function.
4582 (Incremental_inputs_reader::input_file_index): New function.
4583 (Incremental_inputs_reader::input_file): Call input_file_offset.
4584 (Incremental_inputs_reader::input_file_at_offset): New function.
4585 (Incremental_relocs_reader::get_r_type): Reformat.
4586 (Incremental_relocs_reader::get_r_shndx): Reformat.
4587 (Incremental_relocs_reader::get_r_offset): Reformat.
4588 (Incremental_relocs_reader::data): New function.
4589 (Incremental_binary::Incremental_binary): Initialize new data members.
4590 (Incremental_binary::check_inputs): Add cmdline parameter.
4591 (Incremental_binary::file_is_unchanged): Remove.
4592 (Input_reader::arg_serial): New function.
4593 (Input_reader::get_unused_symbol_count): New function.
4594 (Input_reader::get_unused_symbol): New function.
4595 (Input_reader::do_arg_serial): New function.
4596 (Input_reader::do_get_unused_symbol_count): New function.
4597 (Input_reader::do_get_unused_symbol): New function.
4598 (Incremental_binary::input_file_count): New function.
4599 (Incremental_binary::get_input_reader): Change signature to use
4600 index instead of filename.
4601 (Incremental_binary::file_has_changed): New function.
4602 (Incremental_binary::get_input_argument): New function.
4603 (Incremental_binary::get_library): New function.
4604 (Incremental_binary::get_script_info): New function.
4605 (Incremental_binary::init_layout): New function.
4606 (Incremental_binary::reserve_layout): New function.
4607 (Incremental_binary::output_file): New function.
4608 (Incremental_binary::do_check_inputs): New function.
4609 (Incremental_binary::do_file_is_unchanged): Remove.
4610 (Incremental_binary::do_file_has_changed): New function.
4611 (Incremental_binary::do_init_layout): New function.
4612 (Incremental_binary::do_reserve_layout): New function.
4613 (Incremental_binary::do_input_file_count): New function.
4614 (Incremental_binary::do_get_input_reader): Change signature.
4615 (Incremental_binary::input_args_map_): New data member.
4616 (Incremental_binary::library_map_): New data member.
4617 (Incremental_binary::script_map_): New data member.
4618 (Sized_incremental_binary::Sized_incremental_binary): Initialize
4619 new data members.
4620 (Sized_incremental_binary::output_section): New function.
4621 (Sized_incremental_binary::inputs_reader): Add const.
4622 (Sized_incremental_binary::symtab_reader): Add const.
4623 (Sized_incremental_binary::relocs_reader): Add const.
4624 (Sized_incremental_binary::got_plt_reader): Add const.
4625 (Sized_incremental_binary::get_symtab_view): New function.
4626 (Sized_incremental_binary::Inputs_reader): New typedef.
4627 (Sized_incremental_binary::Input_entry_reader): New typedef.
4628 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4629 (Sized_incremental_binary::do_file_is_unchanged): Remove.
4630 (Sized_incremental_binary::do_file_has_changed): New function.
4631 (Sized_incremental_binary::do_init_layout): New function.
4632 (Sized_incremental_binary::do_reserve_layout): New function.
4633 (Sized_input_reader::Inputs_reader): Remove.
4634 (Sized_input_reader::Input_entry_reader): Remove.
4635 (Sized_input_reader::do_arg_serial): New function.
4636 (Sized_input_reader::do_get_unused_symbol_count): New function.
4637 (Sized_input_reader::do_get_unused_symbol): New function.
4638 (Sized_incremental_binary::do_input_file_count): New function.
4639 (Sized_incremental_binary::do_get_input_reader): Change signature;
4640 use index instead of filename.
4641 (Sized_incremental_binary::section_map_): New data member.
4642 (Sized_incremental_binary::input_entry_readers_): New data member.
4643 (class Sized_incr_relobj): New class.
4644 (class Sized_incr_dynobj): New class.
4645 (make_sized_incremental_object): New function.
4646 (class Incremental_library): New class.
4647 * layout.cc (Free_list::num_lists): New static data member.
4648 (Free_list::num_nodes): New static data member.
4649 (Free_list::num_removes): New static data member.
4650 (Free_list::num_remove_visits): New static data member.
4651 (Free_list::num_allocates): New static data member.
4652 (Free_list::num_allocate_visits): New static data member.
4653 (Free_list::init): New function.
4654 (Free_list::remove): New function.
4655 (Free_list::allocate): New function.
4656 (Free_list::dump): New function.
4657 (Free_list::print_stats): New function.
4658 (Layout_task_runner::run): Resize output file for incremental updates.
4659 (Layout::Layout): Initialize new data members.
4660 (Layout::set_incremental_base): New function.
4661 (Layout::init_fixed_output_section): New function.
4662 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4663 incremental updates.
4664 (Layout::create_gold_note): Do not create gold note section for
4665 incremental updates.
4666 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4667 for incremental updates.
4668 (Layout::set_section_offsets): For incremental updates, allocate space
4669 from free list.
4670 (Layout::create_symtab_sections): Layout with offsets relative to
4671 start of section; for incremental updates, allocate space from free
4672 list.
4673 (Layout::create_shdrs): For incremental updates, allocate space from
4674 free list.
4675 (Layout::finish_dynamic_section): For incremental updates, do not
4676 check --as-needed (fixed in subsequent patch).
4677 * layout.h (class Free_list): New class.
4678 (Layout::set_incremental_base): New function.
4679 (Layout::incremental_base): New function.
4680 (Layout::init_fixed_output_section): New function.
4681 (Layout::allocate): New function.
4682 (Layout::incremental_base_): New data member.
4683 (Layout::free_list_): New data member.
4684 * main.cc (main): Print Free_list statistics.
4685 * object.cc (Relobj::finalize_incremental_relocs): Add
4686 clear_counts parameter; clear counts only when clear_counts is set.
4687 (Sized_relobj::Sized_relobj): Initialize new base class.
4688 (Sized_relobj::do_layout): Don't report special sections.
4689 (Sized_relobj::do_for_all_local_got_entries): New function.
4690 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4691 symtab_off to all symbol table offsets.
4692 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4693 * object.h (class Got_offset_list): Move to top of file.
4694 (Object::Object): Allow case where input_file == NULL.
4695 (Object::~Object): Likewise.
4696 (Object::input_file): Assert that input_file != NULL.
4697 (Object::lock): Allow case where input_file == NULL.
4698 (Object::unlock): Likewise.
4699 (Object::is_locked): Likewise.
4700 (Object::token): Likewise.
4701 (Object::release): Likewise.
4702 (Object::is_incremental): New function.
4703 (Object::get_mtime): New function.
4704 (Object::for_all_local_got_entries): New function.
4705 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4706 (Object::set_is_in_system_directory): New function.
4707 (Object::is_in_system_directory): New function.
4708 (Object::do_is_incremental): New function.
4709 (Object::do_get_mtime): New function.
4710 (Object::do_for_all_local_got_entries): New function.
4711 (Object::is_in_system_directory_): New data member.
4712 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4713 (class Sized_relobj_base): New class.
4714 (class Sized_relobj): Derive from Sized_relobj_base.
4715 (class Sized_relobj::Symbols): Redeclare from base class.
4716 (class Sized_relobj::local_got_offset_list): Remove.
4717 (class Sized_relobj::Output_sections): Redeclare from base class.
4718 (class Sized_relobj::do_for_all_local_got_entries): New function.
4719 (class Sized_relobj::write_local_symbols): Add offset parameter.
4720 (class Sized_relobj::local_symbol_offset_): Update comment.
4721 (class Sized_relobj::local_dynsym_offset_): Update comment.
4722 * options.cc (Input_arguments::add_file): Remove const.
4723 * options.h (Input_file_argument::Input_file_argument):
4724 Initialize arg_serial_ (all constructors).
4725 (Input_file_argument::set_arg_serial): New function.
4726 (Input_file_argument::arg_serial): New function.
4727 (Input_file_argument::arg_serial_): New data member.
4728 (Input_arguments::Input_arguments): Initialize file_count_.
4729 (Input_arguments::add_file): Remove const.
4730 (Input_arguments::number_of_input_files): New function.
4731 (Input_arguments::file_count_): New data member.
4732 (Command_line::number_of_input_files): Call
4733 Input_arguments::number_of_input_files.
4734 * output.cc (Output_segment_headers::Output_segment_headers):
4735 Set current size.
4736 (Output_section::Input_section::current_data_size): New function.
4737 (Output_section::Output_section): Initialize new data members.
4738 (Output_section::add_input_section): Don't do merge sections for
4739 an incremental link; allocate space from free list for an
4740 incremental update.
4741 (Output_section::add_output_section_data): Allocate space from
4742 free list for an incremental update.
4743 (Output_section::update_data_size): New function.
4744 (Output_section::set_fixed_layout): New function.
4745 (Output_section::reserve): New function.
4746 (Output_segment::set_section_addresses): Remove const.
4747 (Output_segment::set_section_list_addresses): Remove const; allocate
4748 space from free list for an incremental update.
4749 (Output_segment::set_offset): Adjust size of RELRO segment for an
4750 incremental update.
4751 * output.h (Output_data::current_data_size): Move here from
4752 child classes.
4753 (Output_data::pre_finalize_data_size): New function.
4754 (Output_data::update_data_size): New function.
4755 (Output_section_headers::update_data_size): new function.
4756 (Output_section_data_build::current_data_size): Move to Output_data.
4757 (Output_data_strtab::update_data_size): New function.
4758 (Output_section::current_data_size): Move to Output_data.
4759 (Output_section::set_fixed_layout): New function.
4760 (Output_section::has_fixed_layout): New function.
4761 (Output_section::reserve): New function.
4762 (Output_section::update_data_size): New function.
4763 (Output_section::has_fixed_layout_): New data member.
4764 (Output_section::free_list_): New data member.
4765 (Output_segment::set_section_addresses): Remove const.
4766 (Output_segment::set_section_list_addresses): Remove const.
4767 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4768 New function.
4769 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4770 New function.
4771 * readsyms.cc (Read_symbols::do_read_symbols): Add library
4772 parameter when calling Add_symbols constructor; store argument
4773 serial number for members of a lib group.
4774 (Add_symbols::locks): Allow case where token == NULL.
4775 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4776 (Read_member::~Read_member): New function.
4777 (Read_member::is_runnable): New function.
4778 (Read_member::locks): New function.
4779 (Read_member::run): New function.
4780 (Check_script::~Check_script): New function.
4781 (Check_script::is_runnable): New function.
4782 (Check_script::locks): New function.
4783 (Check_script::run): New function.
4784 (Check_library::~Check_library): New function.
4785 (Check_library::is_runnable): New function.
4786 (Check_library::locks): New function.
4787 (Check_library::run): New function.
4788 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4789 (Add_symbols::library_): New data member.
4790 (class Read_member): New class.
4791 (class Check_script): New class.
4792 (class Check_library): New class.
4793 * reloc.cc (Read_relocs::is_runnable): Allow case where
4794 token == NULL.
4795 (Read_relocs::locks): Likewise.
4796 (Scan_relocs::locks): Likewise.
4797 (Relocate_task::locks): Likewise.
4798 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4799 to clear counters.
4800 (Sized_relobj::incremental_relocs_scan): Fix comment.
4801 (Sized_relobj::do_relocate): Pass output file offset to
4802 write_local_symbols.
4803 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4804 from class declaration.
4805 * script.cc (read_input_script): Allocate Script_info; pass
4806 argument serial number to report_script.
4807 * script.h (class Script_info): Move to incremental.h.
4808 * symtab.cc (Symbol_table::add_from_incrobj): New function.
4809 * symtab.h (Symbol_table::add_from_incrobj): New function.
4810 (Symbol_table::set_file_offset): New function.
4811
4812 2011-04-05 Cary Coutant <ccoutant@google.com>
4813
4814 * incremental-dump.cc (dump_incremental_inputs): Change signature
4815 to take a Sized_incremental_binary; change caller. Use readers
4816 in Sized_incremental_binary.
4817 * incremental.cc
4818 (Sized_incremental_binary::find_incremental_inputs_sections):
4819 Rename do_find_incremental_inputs_sections to this.
4820 (Sized_incremental_binary::setup_readers): New function.
4821 (Sized_incremental_binary::do_check_inputs): Check
4822 has_incremental_info_ flag; move setup code to setup_readers;
4823 use input readers.
4824 (Sized_incremental_binary::do_file_is_unchanged): New function.
4825 (Sized_incremental_binary::do_get_input_reader): New function.
4826 * incremental.h (class Incremental_binary): Move to end of file.
4827 (Incremental_binary::file_is_unchanged): New function.
4828 (Incremental_binary::do_file_is_unchanged): New function.
4829 (Incremental_binary::Input_reader): New class.
4830 (Incremental_binary::get_input_reader): New function.
4831 (class Sized_incremental_binary): Move to end of file.
4832 (Sized_incremental_binary::Sized_incremental_binary): Setup the
4833 input section reader classes.
4834 (Sized_incremental_binary::has_incremental_info): New function.
4835 (Sized_incremental_binary::inputs_reader): New function.
4836 (Sized_incremental_binary::symtab_reader): New function.
4837 (Sized_incremental_binary::relocs_reader): New function.
4838 (Sized_incremental_binary::got_plt_reader): New function.
4839 (Sized_incremental_binary::do_file_is_unchanged): New function.
4840 (Sized_incremental_binary::Sized_input_reader): New class.
4841 (Sized_incremental_binary::get_input_reader): New function.
4842 (Sized_incremental_binary::find_incremental_inputs_sections):
4843 Rename do_find_incremental_inputs_sections to this.
4844 (Sized_incremental_binary::setup_readers): New function.
4845 (Sized_incremental_binary::has_incremental_info_): New data member.
4846 (Sized_incremental_binary::inputs_reader_): New data member.
4847 (Sized_incremental_binary::symtab_reader_): New data member.
4848 (Sized_incremental_binary::relocs_reader_): New data member.
4849 (Sized_incremental_binary::got_plt_reader_): New data member.
4850 (Sized_incremental_binary::current_input_file_): New data member.
4851
4852 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
4853
4854 PR gold/12640
4855 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4856 violation.
4857
4858 2011-03-30 Cary Coutant <ccoutant@google.com>
4859
4860 * archive.cc (Archive::include_member): Adjust call to report_object.
4861 (Add_archive_symbols::run): Add script_info to call to
4862 report_archive_begin.
4863 (Lib_group::include_member): Adjust call to report_object.
4864 (Add_lib_group_symbols::run): Adjust call to report_object.
4865 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4866 blocks. Add object count for script input files.
4867 * incremental.cc (Incremental_inputs::report_archive_begin): Add
4868 script_info parameter; change all callers.
4869 (Incremental_inputs::report_object): Add script_info parameter;
4870 change all callers.
4871 (Incremental_inputs::report_script): Store backpointer to
4872 incremental info entry.
4873 (Output_section_incremental_inputs::set_final_data_size): Record
4874 additional information for scripts.
4875 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4876 * incremental.h (Incremental_script_entry::add_object): New function.
4877 (Incremental_script_entry::get_object_count): New function.
4878 (Incremental_script_entry::get_object): New function.
4879 (Incremental_script_entry::objects_): New data member; adjust
4880 constructor.
4881 (Incremental_inputs::report_archive_begin): Add script_info parameter.
4882 (Incremental_inputs::report_object): Add script_info parameter.
4883 (Incremental_inputs_reader::get_object_count): New function.
4884 (Incremental_inputs_reader::get_object_offset): New function.
4885 * options.cc (Input_arguments::add_file): Return reference to
4886 new input argument.
4887 * options.h (Input_argument::set_script_info): New function.
4888 (Input_argument::script_info): New function.
4889 (Input_argument::script_info_): New data member; adjust all
4890 constructors.
4891 (Input_file_group::add_file): Return reference to new input argument.
4892 (Input_file_lib::add_file): Likewise.
4893 (Input_arguments::add_file): Likewise.
4894 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4895 * script.cc (Parser_closure::Parser_closure): Add script_info
4896 parameter; adjust all callers.
4897 (Parser_closure::script_info): New function.
4898 (Parser_closure::script_info_): New data member.
4899 (read_input_script): Report scripts earlier to incremental info.
4900 (script_add_file): Set script_info in Input_argument.
4901 (script_add_library): Likewise.
4902 * script.h (Script_options::Script_info): Rewrite class.
4903
4904 2011-03-29 Cary Coutant <ccoutant@google.com>
4905
4906 * archive.cc (Library_base::should_include_member): Move
4907 method here from class Archive.
4908 (Archive::Archive): Initialize base class.
4909 (Archive::should_include_member): Move to base class.
4910 (Archive::do_for_all_unused_symbols): New function.
4911 (Add_archive_symbols::run): Remove redundant access to
4912 incremental_inputs.
4913 (Lib_group::Lib_group): Initialize base class.
4914 (Lib_group::do_filename): New function.
4915 (Lib_group::include_member): Pass pointer to Lib_group to
4916 report_object.
4917 (Lib_group::do_for_all_unused_symbols): New function.
4918 (Add_lib_group_symbols::run): Report archive information for
4919 incremental links.
4920 * archive.h (class Library_base): New base class.
4921 (class Archive): Derive from Library_base.
4922 (Archive::filename): Move to base class.
4923 (Archive::set_incremental_info): Likewise.
4924 (Archive::incremental_info): Likewise.
4925 (Archive::Should_include): Likewise.
4926 (Archive::should_include_member): Likewise.
4927 (Archive::Armap_entry): Remove.
4928 (Archive::Unused_symbol_iterator): Remove.
4929 (Archive::unused_symbols_begin): Remove.
4930 (Archive::unused_symbols_end): Remove.
4931 (Archive::do_filename): New function.
4932 (Archive::do_get_mtime): New function.
4933 (Archive::do_for_all_unused_symbols): New function.
4934 (Archive::task_): Move to base class.
4935 (Archive::incremental_info_): Likewise.
4936 (class Lib_group): Derive from Library_base.
4937 (Lib_group::do_filename): New function.
4938 (Lib_group::do_get_mtime): New function.
4939 (Lib_group::do_for_all_unused_symbols): New function.
4940 (Lib_group::task_): Move to base class.
4941 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4942 function.
4943 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4944 function.
4945 * incremental.cc (Incremental_inputs::report_archive_begin):
4946 Use Library_base; call library's get_mtime; add incremental inputs
4947 entry before members.
4948 (class Unused_symbol_visitor): New class.
4949 (Incremental_inputs::report_archive_end): Use Library_base; use
4950 visitor class to record unused symbols; don't add incremental inputs
4951 entry after members.
4952 (Incremental_inputs::report_object): Use Library_base.
4953 * incremental.h
4954 (Incremental_archive_entry::Incremental_archive_entry): Remove
4955 unused Archive parameter.
4956 (Incremental_inputs::report_archive_begin): Use Library_base.
4957 (Incremental_inputs::report_archive_end): Likewise.
4958 (Incremental_inputs::report_object): Likewise.
4959 * object.cc (Sized_relobj::do_for_all_global_symbols): New
4960 function.
4961 * object.h (Object::for_all_global_symbols): New function.
4962 (Object::do_for_all_global_symbols): New function.
4963 (Sized_relobj::do_for_all_global_symbols): New function.
4964 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
4965 function.
4966 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
4967 function.
4968
4969 2011-03-27 Ian Lance Taylor <iant@google.com>
4970
4971 * archive.cc (Archive::interpret_header): Return -1 if something
4972 goes wrong. Change callers accordingly.
4973
4974 2011-03-25 Cary Coutant <ccoutant@google.com>
4975
4976 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4977 * testsuite/Makefile.in: Regenerate.
4978
4979 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
4980
4981 * plugin.cc (get_view): New.
4982 (Plugin::load): Pass get_view to the plugin.
4983 (Plugin_manager::get_view): New.
4984
4985 2011-03-21 Ian Lance Taylor <iant@google.com>
4986
4987 * testsuite/final_layout.sh: Rewrite to not use dc.
4988 * testsuite/relro_test.sh: Fail if dc is not present.
4989
4990 2011-03-21 Sriraman Tallam <tmsriram@google.com>
4991
4992 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4993 Change == to -eq.
4994 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4995 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4996 Change == to -eq.
4997 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4998 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4999
5000 2011-03-14 Ian Lance Taylor <iant@google.com>
5001
5002 * script-sections.cc (Sort_output_sections::script_compare):
5003 Rename from is_before, change return type.
5004 (Sort_output_sections::operator()): Adjust accordingly.
5005
5006 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
5007
5008 PR gold/12572
5009 * testsuite/odr_violation2.cc: Add comment to make all error line
5010 numbers double digits.
5011 * testsuite/debug_msg.sh: Adjust expected errors.
5012
5013 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
5014
5015 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5016 but mark earlier ones as non-canonical
5017 (offset_to_iterator): Update search target and example
5018 (do_addr2line): Return extra lines in a vector*
5019 (format_file_lineno): Extract from do_addr2line
5020 (one_addr2line): Add vector* out-param
5021 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5022 when a lineno entry appeared last for its instruction
5023 (Dwarf_line_info): Add vector* out-param
5024 * object.cc (Relocate_info): Pass NULL for the vector* out-param
5025 * symtab.cc (Odr_violation_compare): Include the lineno in the
5026 comparison again.
5027 (linenos_from_loc): New. Combine the canonical line for an
5028 address with its other lines.
5029 (True_if_intersect): New. Helper functor to make
5030 std::set_intersection a query.
5031 (detect_odr_violations): Compare sets of lines instead of just
5032 one line for each function. This became less deterministic, but
5033 has fewer false positives.
5034 * symtab.h: Declarations.
5035 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5036 mix an optimized and non-optimized object in the same binary
5037 (odr_violation2.so): Same.
5038 * testsuite/Makefile.in: Regenerate from Makefile.am.
5039 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5040 * testsuite/debug_msg.sh: Update line numbers and add
5041 assertions.
5042 * testsuite/odr_violation1.cc: Use OdrDerived, in a
5043 non-optimized context.
5044 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5045 isn't inlined, and use OdrDerived in an optimized context.
5046 * testsuite/odr_header1.h: Defines OdrDerived, where
5047 optimization will change the
5048 first-instruction-in-the-destructor's file and line number.
5049 * testsuite/odr_header2.h: Defines OdrBase.
5050
5051 2011-03-09 Ian Lance Taylor <iant@google.com>
5052
5053 * fileread.cc (File_read::clear_views): Don't delete the whole
5054 file view.
5055
5056 2011-03-08 Ian Lance Taylor <iant@google.com>
5057
5058 PR gold/12525
5059 * fileread.cc: #include <climits>.
5060 (GOLD_IOV_MAX): Define.
5061 (File_read::read_multiple): Limit number of entries by iov_max.
5062 * fileread.h (class File_read): Always set max_readv_entries to
5063 128.
5064
5065 2011-03-07 Ian Lance Taylor <iant@google.com>
5066
5067 PR gold/12525
5068 * options.h (class General_options): Add -dy and -dn.
5069
5070 2011-03-02 Cary Coutant <ccoutant@google.com>
5071
5072 * testsuite/script_test_9.t: Add TLS segment.
5073
5074 2011-03-02 Simon Baldwin <simonb@google.com>
5075
5076 * configure.ac: Add check for gnu_indirect_function support in
5077 the toolchain building binutils.
5078 * configure: Rebuild.
5079
5080 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
5081
5082 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5083 plugin only symbols.
5084 (Symbol_table::sized_finalize_symbol) Mark symbol only present
5085 in plugin files as not needed in the symbol table.
5086
5087 2011-02-11 Sriraman Tallam <tmsriram@google.com>
5088
5089 * output.cc (Output_section::add_input_section): Delay fill
5090 generation for section ordering.
5091
5092 2011-02-09 Ian Lance Taylor <iant@google.com>
5093
5094 PR gold/12316
5095 * object.h (class Sized_relobj): Remove clear_local_symbols.
5096 * reloc.cc (Sized_relobj::do_relocate): Don't call
5097 clear_local_symbols.
5098
5099 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
5100
5101 * plugin.cc (is_visible_from_outside): Return true for symbols
5102 in the -u option.
5103
5104 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
5105
5106 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5107 filename.
5108
5109 2011-02-02 Sriraman Tallam <tmsriram@google.com>
5110
5111 * icf.h (is_section_foldable_candidate): Change type of parameter
5112 to std::string.
5113 * icf.cc (Icf::find_identical_sections): Change type of local variable
5114 section_name to be std::string.
5115 (is_function_ctor_or_dtor): Change type of parameter to std::string.
5116
5117 2011-01-25 Ian Lance Taylor <iant@google.com>
5118
5119 * script.cc (script_add_extern): Rewrite to use
5120 add_symbol_reference.
5121
5122 2011-01-25 Doug Kwan <dougkwan@google.com>
5123
5124 * icf.cc (get_section_contents): Always lock section's object.
5125
5126 2011-01-24 Ian Lance Taylor <iant@google.com>
5127
5128 * options.h (class General_options): Accept
5129 --no-detect-odr-violations.
5130
5131 2011-01-24 Ian Lance Taylor <iant@google.com>
5132
5133 * version.cc (version_string): Bump to 1.11.
5134
5135 2011-01-24 Ian Lance Taylor <iant@google.com>
5136
5137 * plugin.cc (class Plugin_rescan): Define new class.
5138 (Plugin_manager::claim_file): Set any_claimed_.
5139 (Plugin_manager::save_archive): New function.
5140 (Plugin_manager::save_input_group): New function.
5141 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5142 necessary.
5143 (Plugin_manager::new_undefined_symbol): New function.
5144 (Plugin_manager::rescan): New function.
5145 (Plugin_manager::rescannable_defines): New function.
5146 (Plugin_manager::add_input_file): Set any_added_.
5147 * plugin.h (class Plugin_manager): define new fields rescannable_,
5148 undefined_symbols_, any_claimed_, and any_added_. Declare
5149 Plugin_rescan as friend. Declare new functions.
5150 (Plugin_manager::Rescannable): Define type.
5151 (Plugin_manager::Rescannable_list): Define type.
5152 (Plugin_manager::Undefined_symbol_list): Define type.
5153 (Plugin_manager::Plugin_manager): Initialize new fields.
5154 * archive.cc (Archive::defines_symbol): New function.
5155 (Add_archive_symbols::run): Pass archive to plugins if any.
5156 * archive.h (class Archive): Declare defines_symbol.
5157 * readsyms.cc (Input_group::~Input_group): New function.
5158 (Finish_group::run): Pass input_group to plugins if any.
5159 * readsyms.h (class Input_group): Declare destructor.
5160 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5161 any.
5162
5163 2011-01-10 Ian Lance Taylor <iant@google.com>
5164
5165 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5166 section as relro.
5167 (Layout::set_segment_offsets): Reset increase_relro before calling
5168 set_section_addresses a second time.
5169
5170 2011-01-04 Cary Coutant <ccoutant@google.com>
5171
5172 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5173 sections before NOBITS sections.
5174
5175 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
5176
5177 * version.cc (print_version): Update copyright to 2011.
5178
5179 2010-12-23 Cary Coutant <ccoutant@google.com>
5180
5181 * output.h (Output_data_reloc::add_output_section): Pass OD instead
5182 of OS to this->add. Add OD parameter to second form of the function.
5183
5184 2010-12-20 Ian Lance Taylor <iant@google.com>
5185
5186 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5187 second of two consecutive entries with same offset.
5188
5189 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5190
5191 * testsuite/Makefile.am (ifuncmain2static_LDADD)
5192 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5193 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5194 to avoid unneeded links against $(LDADD).
5195 * testsuite/Makefile.in: Regenerate.
5196
5197 2010-12-15 Ian Lance Taylor <iant@google.com>
5198
5199 PR gold/12324
5200 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5201 for R_X86_64_32 and R_X86_64_PC32.
5202 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5203 ver_matching_def_pic.o.
5204 (ver_matching_def_pic.o): New target.
5205
5206 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5207
5208 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5209 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5210 Move definition before File_read::View member definitions.
5211 (File_read::View::~View): Initialize and hold lock before
5212 updating current_mapped_bytes.
5213
5214 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5215
5216 * dwarf_reader.cc: Remove outdated comment.
5217 * gold-threads.cc: Fix typo in error message.
5218 * archive.cc: Fix typos in comments.
5219 * archive.h: Likewise.
5220 * arm-reloc-property.cc: Likewise.
5221 * arm-reloc-property.h: Likewise.
5222 * arm-reloc.def: Likewise.
5223 * arm.cc: Likewise.
5224 * attributes.h: Likewise.
5225 * cref.cc: Likewise.
5226 * ehframe.cc: Likewise.
5227 * fileread.h: Likewise.
5228 * gold.h: Likewise.
5229 * i386.cc: Likewise.
5230 * icf.cc: Likewise.
5231 * incremental.h: Likewise.
5232 * int_encoding.cc: Likewise.
5233 * layout.h: Likewise.
5234 * main.cc: Likewise.
5235 * merge.h: Likewise.
5236 * object.cc: Likewise.
5237 * object.h: Likewise.
5238 * options.cc: Likewise.
5239 * readsyms.cc: Likewise.
5240 * reduced_debug_output.cc: Likewise.
5241 * reloc.cc: Likewise.
5242 * script-sections.cc: Likewise.
5243 * sparc.cc: Likewise.
5244 * symtab.h: Likewise.
5245 * target-reloc.h: Likewise.
5246 * target.cc: Likewise.
5247 * target.h: Likewise.
5248 * timer.cc: Likewise.
5249 * timer.h: Likewise.
5250 * x86_64.cc: Likewise.
5251
5252 2010-12-09 Cary Coutant <ccoutant@google.com>
5253
5254 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5255 stack.
5256 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5257 parameter; change all callers.
5258 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5259 * options.h (warn_execstack): New option.
5260
5261 2010-12-07 Doug Kwan <dougkwan@google.com>
5262
5263 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5264 like function call relocations.
5265
5266 2010-12-07 Ian Lance Taylor <iant@google.com>
5267
5268 * archive.cc (Archive::get_elf_object_for_member): Permit
5269 punconfigured to be NULL.
5270 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5271 (Archive::include_member): Pass NULL to get_elf_object_for_member
5272 if we searched for the archive and this is the first included
5273 object.
5274
5275 2010-12-01 Ian Lance Taylor <iant@google.com>
5276
5277 * dwarf_reader.h (class Sized_dwarf_line_info): Add
5278 track_relocs_type_ field.
5279 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5280 Set track_relocs_type_.
5281 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5282 contents when using RELA relocs.
5283 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5284 reloc_map_.
5285 * reloc.cc (Track_relocs::next_addend): New function.
5286 * reloc.h (class Track_relocs): Declare next_addend.
5287
5288 2010-12-01 Ian Lance Taylor <iant@google.com>
5289
5290 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5291 virtual destructor.
5292
5293 2010-12-01 Ian Lance Taylor <iant@google.com>
5294
5295 * README: Update compilers known to work and fail.
5296
5297 2010-11-23 Matthias Klose <doko@ubuntu.com>
5298
5299 * configure.in: For --enable-gold, handle value `default' instead of
5300 `both*'. Always install ld as ld.bfd, install as ld if gold is
5301 not the default.
5302 * configure: Regenerate.
5303
5304 2010-11-18 Doug Kwan <dougkwan@google.com>
5305
5306 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5307 and right_alignment to be zero. Store result alignment only if it is
5308 greater than existing alignment.
5309
5310 2010-11-16 Cary Coutant <ccoutant@google.com>
5311
5312 PR gold/12220
5313 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5314 Check for ".zdebug_line".
5315
5316 2010-11-16 Doug Kwan <dougkwan@google.com>
5317 Cary Coutant <ccoutant@google.com>
5318
5319 * output.h (Output_segment::set_section_addresses): Pass increase_relro
5320 by reference; adjust all callers.
5321 * output.cc (Output_segment::set_section_addresses): Adjust references
5322 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5323 list is empty.
5324 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5325 end at page boundary.
5326
5327 2010-11-16 Cary Coutant <ccoutant@google.com>
5328
5329 PR gold/12220
5330 * layout.cc (Layout::choose_output_section): Transform names of
5331 compressed sections even when using a script with a SECTIONS clause.
5332 (Layout::output_section_name): Remove code to transform
5333 compressed debug section names.
5334 * output.cc (Output_section::add_input_section): Use uncompressed
5335 section size when tracking input sections.
5336
5337 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
5338
5339 * symtab.h (Symbol::NON_PIC_REF): Remove.
5340 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5341 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
5342 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5343 (Symbol::use_plt_offset): Take a flags argument and pass it
5344 directly to needs_dynamic_reloc. Restrict check for undefined
5345 weak symbols to function calls.
5346 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5347 (Target_arm::Scan::global): Use it.
5348 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5349 (Target_arm::Relocate::relocate): Likewise.
5350 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5351 parameter with an r_type parameter. Use get_reference_flags
5352 to get the flags.
5353 (Target_arm::Relocate::relocate): Update accordingly.
5354 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5355 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5356 (Target_i386::Scan::global): Likewise.
5357 (Target_i386::Relocate::relocate): Likewise.
5358 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5359 parameter with an r_type parameter. Use get_reference_flags
5360 to get the flags.
5361 (Target_i386::Relocate::relocate): Update accordingly.
5362 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5363 (Target_powerpc::Scan::global): Use it.
5364 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5365 (Target_powerpc::Relocate::relocate): Likewise.
5366 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5367 (Target_sparc::Scan::global): Use it.
5368 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5369 (Target_sparc::Relocate::relocate): Likewise.
5370 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5371 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5372 (Target_x86_64::Scan::global): Likewise.
5373 (Target_x86_64::Relocate::relocate): Likewise.
5374
5375 2010-11-08 Doug Kwan <dougkwan@google.com>
5376 Cary Coutant <ccoutant@google.com>
5377
5378 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5379 (Arm_exidx_merge_section::section_contents_): New data member.
5380 (Arm_input_section::Arm_input_section): Initialize original_contents_.
5381 (Arm_input_section::~Arm_input_section): De-allocate memory.
5382 (Arm_input_section::original_contents_): New data member.
5383 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5384 in parameters instead of calling Object::section_contents without
5385 locking.
5386 (Arm_output_section::group_section): New parameter TASK. Pass it
5387 to callees that need locking objects.
5388 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
5389 to lock EXIDX input sections. Fix a formatting issue. Call
5390 Arm_exidx_merged_section::build_contents to create merged section
5391 contents.
5392 (Arm_output_section::create_stub_group): New parameter TASK. Use it
5393 to lock object of stub table owner.
5394 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5395 TEXT_SIZE to initialize data member TEXT_SIZE_.
5396 (Arm_exidx_input_section::addralign): Fix typo in comment.
5397 (Arm_exidx_input_section::text_size): New method.
5398 (Target_arm::do_relax): New parameter TASK. Pass it to callees
5399 that require locking objects. Lock objects before scanning for stubs
5400 and updating local symbols.
5401 (Arm_input_section<big_endian>::init): Copy contents of original
5402 input section.
5403 (Arm_input_section<big_endian>::do_write): Use saved contents of
5404 original input section instead of calling Object::section_contents
5405 without locking.
5406 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5407 size without calling Object::section_size().
5408 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5409 for size. Allocate a buffer for merged EXIDX entries.
5410 (Arm_exidx_merged_section::build_contents): New method.
5411 (Arm_exidx_merged_section::do_write): Move merge section contents
5412 building code to Arm_exidx_merged_section::build_contetns. Write
5413 out contetns in buffer instead of building it on the fly.
5414 (Arm_relobj::make_exidx_input_section): Also pass text section size
5415 to Arm_exidx_input_section constructor.
5416 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
5417 (Arm_dynobj::do_read_symbols): Fix memory leak.
5418 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5419 * target.h: (class Task): Add forward declaration.
5420 (Target::relax): Add new parameter TASK and pass it to
5421 Target::do_relax().
5422 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
5423
5424 2010-11-05 Cary Coutant <ccoutant@google.com>
5425
5426 PR gold/10708
5427 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5428 object when reading from the file.
5429 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5430 second layout pass.
5431 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5432 when reading section contents.
5433 (get_section_contents): Likewise.
5434 (icf::find_identical_sections): Likewise.
5435 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5436 object when reading from the file.
5437 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5438 the object when doing deferred section layout.
5439
5440 2010-11-03 Nick Clifton <nickc@redhat.com>
5441
5442 PR gold/12001
5443 * script.h (class Symbol_assignment: name): New member. Returns
5444 the name of the symbol.
5445 * scrfipt.cc (Script_options::is_pending_assignment): New member.
5446 Returns true if the given symbol name is on the list of
5447 assignments wating to be processed.
5448 * archive.cc (should_incldue_member): If the symbol is undefined,
5449 check to see if it is on the list of symbols pending assignment.
5450
5451 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
5452
5453 * script-sections.cc (Script_sections::find_memory_region): Check
5454 for a NULL output section pointer.
5455
5456 2010-10-29 Doug Kwan <dougkwan@google.com>
5457
5458 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5459 Output_section::add_relaxed_input_section.
5460 * output.cc (Output_section::add_relaxed_input_section): Add new
5461 arguments LAYOUT and NAME. Set section order index.
5462 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5463 Copy section order index.
5464 * output.h (Output_section::add_relaxed_input_section): Add new
5465 arguments LAYOUT and NAME.
5466
5467 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5468
5469 * testsuite/Makefile.am: Move gcctestdir/ld rule to
5470 NATIVE_OR_CROSS_LINKER.
5471 * testsuite/Makefile.in: Regenerate.
5472
5473 2010-10-20 Doug Kwan <dougkwan@google.com>
5474
5475 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5476 without SHF_LINK_ORDER flags.
5477 * layout.cc (Layout::choose_output_section): Do not filter
5478 SHF_LINK_ORDER flag in a relocatable link.
5479
5480 2010-10-17 Cary Coutant <ccoutant@google.com>
5481
5482 * output.h (Output_segment::set_section_addresses): Change function
5483 signature. Update all callers.
5484 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5485 sections.
5486 (Output_segment::set_section_addresses): Align after last TLS
5487 section. Add padding before last relro section instead of after.
5488
5489 2010-10-17 Doug Kwan <dougkwan@google.com>
5490
5491 * gold/arm.cc (Target_arm::got_section): Use correct order and set
5492 GOT output section to be writable.
5493
5494 2010-10-14 Cary Coutant <ccoutant@google.com>
5495
5496 * debug.h (DEBUG_INCREMENTAL): New flag.
5497 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5498 * gold.cc (queue_initial_tasks): Check parameters for incremental link
5499 mode.
5500 * incremental.cc (report_command_line): Ignore all forms of
5501 --incremental.
5502 * layout.cc (Layout::Layout): Check parameters for incremental link
5503 mode.
5504 * options.cc (General_options::parse_incremental): New function.
5505 (General_options::parse_no_incremental): New function.
5506 (General_options::parse_incremental_full): New function.
5507 (General_options::parse_incremental_update): New function.
5508 (General_options::incremental_mode_): New data member.
5509 (General_options::finalize): Check incremental_mode_.
5510 * options.h (General_options): Update help text for --incremental.
5511 Add --no-incremental, --incremental-full, --incremental-update.
5512 (General_options::Incremental_mode): New enum type.
5513 (General_options::incremental_mode): New function.
5514 (General_options::incremental_mode_): New data member.
5515 * parameters.cc (Parameters::incremental_mode_): New data member.
5516 (Parameters::set_options): Set incremental_mode_.
5517 (Parameters::set_incremental_full): New function.
5518 (Parameters::incremental): New function.
5519 (Parameters::incremental_update): New function.
5520 (set_parameters_incremental_full): New function.
5521 * parameters.h (Parameters::set_incremental_full): New function.
5522 (Parameters::incremental): New function.
5523 (Parameters::incremental_update): New function.
5524 (Parameters::incremental_mode_): New data member.
5525 (set_parameters_incremental_full): New function.
5526 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5527 incremental link mode.
5528 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5529 (Sized_relobj::do_relocate_sections): Likewise.
5530 * testsuite/Makefile.am (incremental_test): Use --incremental-full
5531 option.
5532 * testsuite/Makefile.in: Regenerate.
5533 * testsuite/incremental_test.sh: Filter all forms of --incremental.
5534
5535 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5536
5537 * script-sections.h (class Script_sections): Make
5538 Sections_elements typedef public.
5539 * script-sections.cc (class Sort_output_sections): Add elements_
5540 field. Add constructor which sets it; change all callers.
5541 (Sort_output_sections::is_before): New function.
5542 (Sort_output_sections::operator()): Call is_before.
5543 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5544 conditional.
5545 * testsuite/script_test_10.sh: New test. Test script section
5546 order.
5547 * testsuite/script_test_10.t: Likewise.
5548 * testsuite/script_test_10.s: Likewise.
5549 * testsuite/Makefile.am: Wrap the cross linker tests and the
5550 common tests into NATIVE_OR_CROSS_LINKER.
5551 (check_SCRIPTS): Add script_test_10.sh.
5552 (check_DATA): Add script_test_10.stdout.
5553 (script_test_10.o, script_test_10): New targets.
5554 (script_test_10.stdout): New target.
5555 * configure, testsuite/Makefile.in: Regenerate.
5556
5557 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5558
5559 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5560 error for the deprecated relocations.
5561 (Target_arm::Scan::global): Likewise.
5562 (Target_arm::Relocate::relocate): Likewise.
5563
5564 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
5565
5566 * fileread.cc (Input_file::find_file): Initialize *found_name
5567 and *namep when using the fallback search for case 4.
5568
5569 2010-10-11 Cary Coutant <ccoutant@google.com>
5570
5571 * options.h (class General_options): Redefine -z lazy as an alias for
5572 the negation of -z now.
5573
5574 2010-10-11 Ian Lance Taylor <iant@google.com>
5575
5576 * resolve.cc (symbol_to_bits): Report the value of the unsupported
5577 binding.
5578
5579 2010-10-06 Nick Clifton <nickc@redhat.com>
5580
5581 * script-sections.cc(class Memory_region): Remove
5582 current_lma_offset_ field. Rename current_vma_offset_ to
5583 current_offset_. Add last_section_ field.
5584 (Memory_region::get_current_vma_address): Rename to
5585 get_current_address.
5586 (Memory_region::get_current_lma_address): Delete.
5587 (Memory_region::increment_vma_offset): Rename to
5588 increment_offset.
5589 (Memory_region::increment_lma_offset): Delete.
5590 (Memory_region::attributes_compatible): New method. Returns
5591 true if the provided section is compatible with the region.
5592 (Memory_region::get_last_section): New method. Returns the last
5593 section to use the region.
5594 (Memory_region::set_last_section): New method. Stores the last
5595 section to use the region.
5596 (Script_sections::block_in_region): New method. Returns true if
5597 a block of memory is contained within a region.
5598 (Script_sections::find_memory_region): New method. Locates a
5599 memory region to be used to set a VMA or LMA address.
5600 (Output_section_definition::set_section_addresses): Add code to
5601 check for addresses set by memory regions.
5602 (Output_segment::set_section_addresses): Remove memory region
5603 walking code.
5604 (Script_sections::create_segment): Add a warning if a header
5605 segment is created outside of any region.
5606 * script-sections.h (class Script_sections): Add prototypes for
5607 find_memory_region and block_in_region methods.
5608 * testsuite/memory_test.s: Use .long instead of .word.
5609 * testsuite/memory_test.t: Add some more output sections.
5610 * testsuite/memory_test.sh: Update expected output.
5611
5612 2010-10-02 Doug Kwan <dougkwan@google.com>
5613
5614 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5615 defintion to symtab.h
5616 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5617 declaration to defintion.
5618
5619 2010-10-01 Nick Clifton <nickc@redhat.com>
5620
5621 * expression.cc (eval): Replace dummy argument with NULL.
5622 (eval_maybe_dot): Check for a NULL result section pointer.
5623 (Symbol_expression::value): Likewise.
5624 (Dot_expression::value): Likewise.
5625 (BINARY_EXPRESSION): Likewise.
5626 (Max_expression::value): Likewise.
5627 (Min_expression::value): Likewise.
5628 (Absolute_expression::value): Likewise.
5629 (Addr_expression::value_from_output_section): Likewise.
5630 (Loaddddr_expression::value_from_output_section): Likewise.
5631 (Segment_start_expression::value): Likewise.
5632 * script-sections.cc
5633 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5634 argument with NULL.
5635 (Sections_elememt_dot_assignment::set_section_addresses):
5636 Likewise.
5637 (Output_data_expression::do_write_to_buffer): Likewise.
5638 (Output_section_definition::finalize_symbols): Likewise.
5639 (Output_section_definition::set_section_addresses): Likewise.
5640
5641 2010-09-30 Doug Kwan <dougkwan@google.com>
5642
5643 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5644
5645 2010-09-28 Sriraman Tallam <tmsriram@google.com>
5646
5647 * target.h (Target::can_icf_inline_merge_sections): New virtual
5648 function.
5649 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5650 virtual function.
5651 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5652 virtual function.
5653 * icf.cc (get_section_contents): Inline merge sections only when
5654 target allows it.
5655
5656 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5657
5658 * configure: Regenerate.
5659
5660 2010-09-17 Ian Lance Taylor <iant@google.com>
5661
5662 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5663 * testsuite/Makefile.am (memory_test.o): New target.
5664 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5665 memory_test.t.
5666 * testsuite/Makefile.in: Rebuild.
5667
5668 2010-09-17 Doug Kwan <dougkwan@google.com>
5669
5670 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5671 defintion if relocation uses GOT entries of the symbol.
5672 * testsuite/icf_safe_test.sh: Fix test.
5673 * testsuite/icf_safe_so_test.sh: Fix test.
5674
5675 2010-09-16 Cary Coutant <ccoutant@google.com>
5676
5677 * script_sections.cc (class Memory_region): Remove "NULL" from
5678 vector initializations.
5679
5680 2010-09-15 Cary Coutant <ccoutant@google.com>
5681
5682 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5683 Resolve forwarding symbols.
5684
5685 2010-09-15 Doug Kwan <dougkwan@google.com>
5686
5687 * gold/testsuite/script_test_3.t: Add ARM special sections.
5688 * gold/testsuite/script_test_4.t: Same.
5689 * gold/testsuite/script_test_5.t: Same.
5690 * gold/testsuite/script_test_6.t: Same.
5691 * gold/testsuite/script_test_7.t: Same.
5692 * gold/testsuite/script_test_7.t: Same.
5693 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5694
5695 2010-09-14 Cary Coutant <ccoutant@google.com>
5696
5697 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5698 (Target_x86_64::Relocate::relocate_tls): Replace check for
5699 saw_tls_block_reloc_ with test for executable section.
5700
5701 2010-09-12 Cary Coutant <ccoutant@google.com>
5702
5703 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5704 position-independent executables to shared libraries need dynamic
5705 relocations.
5706 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5707 position-independent executables.
5708 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5709 * testsuite/Makefile.in: Regenerate.
5710
5711 2010-09-10 Nick Clifton <nickc@redhat.com>
5712
5713 PR gold/11997
5714 * testsuite/memory_test.t: Discard any sections that are not
5715 needed.
5716
5717 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
5718
5719 PR gold/11996
5720 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5721 "This::" to work around a bug in gcc 4.2.
5722
5723 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5724
5725 2010-09-09 Rafael Espindola <espindola@google.com>
5726
5727 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5728 sections with different PF_X flags in the same segment.
5729 (Layout::find_first_load_seg): Search all segments to find the first
5730 one.
5731 * options.h (rosegment): New.
5732
5733 2010-09-08 Rafael Espindola <espindola@google.com>
5734
5735 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5736
5737 2010-09-08 Doug Kwan <dougkwan@google.com>
5738
5739 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5740 (Arm_relobj::do_relocate_sections): Add new parameter for output
5741 file to match the parent.
5742 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5743 of local symbols instead of input values. Update code to track
5744 changes in gold::relocate_section.
5745 * object.cc (Sized_relobj::compute_final_local_value): New methods.
5746 (Sized_relobj::compute_final_local_value_internal): New methods.
5747 (Sized_relobj::do_finalize_local_symbols): Move code from loop
5748 body into private version of Sized_relobj::compute_final_local_value.
5749 Call the inline method.
5750 * object.h (Symbol_value::Symbol_value): Define destructor. Free
5751 merged symbol value if there is one.
5752 (Symbol_value::has_output_value): New method defintiion.
5753 (Sized_relobj::Compute_final_local_value_status): New enum type.
5754 (Sized_relobj::compute_final_local_value): New methods.
5755 (Sized_relobj::compute_final_local_value_internal): New methods.
5756 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5757 and arm_cortex_a8.sh.
5758 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5759 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5760 New tests.
5761 * Makefile.in: Regenerate.
5762 * testsuite/arm_bl_out_of_range.s: Update test.
5763 * testsuite/thumb_bl_out_of_range.s: Ditto.
5764 * testsuite/thumb_blx_out_of_range.s: Ditto.
5765 * testsuite/arm_branch_out_of_range.sh: New file.
5766 * testsuite/arm_cortex_a8.sh: Ditto.
5767 * testsuite/arm_cortex_a8_b.s: Ditto.
5768 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5769 * testsuite/arm_cortex_a8_b_local.s: Ditto.
5770 * testsuite/arm_cortex_a8_bl.s: Ditto.
5771 * testsuite/arm_cortex_a8_blx.s: Ditto.
5772 * testsuite/arm_cortex_a8_local.s: Ditto.
5773 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5774 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5775
5776 2010-09-08 Rafael Espindola <espindola@google.com>
5777
5778 * Makefile.am (memory_test.stdout): Run readelf with -W.
5779 * Makefile.in: Regenerate.
5780 * testsuite/memory_test.sh: Make the regexps accept both 32 and
5781 64 bit output.
5782
5783 2010-09-08 Rafael Espindola <espindola@google.com>
5784
5785 * script-sections.cc (Script_sections::add_memory_region): Convert
5786 field precision to int.
5787 * script.cc (script_set_section_region, script_set_section_region):
5788 Convert field precision to int.
5789
5790 2010-09-08 Rafael Espindola <espindola@google.com>
5791
5792 * arm.cc (do_finalize_sections): Create the __exidx_start and
5793 __exdix_end symbols even when the section is missing.
5794
5795 2010-09-08 Nick Clifton <nickc@redhat.com>
5796
5797 * README: Remove claim that MEMORY is not supported.
5798 * expression.cc (script_exp_function_origin)
5799 (script_exp_function_length): Move from here to ...
5800 * script.cc: ... here.
5801 (script_set_section_region, script_add_memory)
5802 (script_parse_memory_attr, script_include_directive): New
5803 functions.
5804 * script-sections.cc
5805 (class Memory_region): New class.
5806 (class Output_section_definition): Add set_memory_region,
5807 set_section_vma, set_section_lma and get_section_name methods.
5808 (class Script_Sections): Add add_memory_region,
5809 find_memory_region, find_memory_region_origin,
5810 find_memory_region_length and set_memory_region methods.
5811 Have set_section_addresses method walk the list of set memory
5812 regions.
5813 Extend the print methos to display memory regions.
5814 * script-sections.h: Add prototypes for new methods.
5815 Add enum for MEMORY region attributes.
5816 * yyscript.y: Add support for parsing MEMORY regions.
5817 * script-c.h: Add prototypes for new functions.
5818 * testsuite/Makefile.am: Add test of MEMORY region functionality.
5819 * testsuite/Makefile.in: Regenerate.
5820 * testsuite/memory_test.sh: New script.
5821 * testsuite/memory_test.s: New assembler source file.
5822 * testsuite/memory_test.t: New linker script.
5823
5824 2010-08-27 Doug Kwan <dougkwan@google.com>
5825
5826 * gold/resolve.cc (Symbol_table::should_override): Let a weak
5827 reference override an existing dynamic weak reference.
5828 * testsuite/Makefile.am: Add new test dyn_weak_ref.
5829 * testsuite/Makefile.in: Regenerate.
5830 * testsuite/dyn_weak_ref.sh: New file.
5831 * testsuite/dyn_weak_ref_1.c: Ditto.
5832 * testsuite/dyn_weak_ref_2.c: Ditto.
5833
5834 2010-08-27 Ian Lance Taylor <iant@google.com>
5835
5836 * incremental.h (class Incremental_input_entry): Add virtual
5837 destructor.
5838
5839 2010-08-27 Ian Lance Taylor <iant@google.com>
5840
5841 * testsuite/start_lib_test_3.c: Mark t3 as used.
5842
5843 2010-08-27 Nick Clifton <nickc@redhat.com>
5844
5845 * options.cc (version_script): Fix small typo in previous
5846 whitespace tidyup.
5847
5848 2010-08-25 Nick Clifton <nickc@redhat.com>
5849
5850 * archive.cc: Formatting fixes: Remove whitespace between
5851 typename and following asterisk. Remove whitespace between
5852 function name and opening parenthesis.
5853 * archive.h: Likewise.
5854 * arm.cc: Likewise.
5855 * attributes.cc: Likewise.
5856 * attributes.h: Likewise.
5857 * common.cc: Likewise.
5858 * copy-relocs.cc: Likewise.
5859 * dirsearch.h: Likewise.
5860 * dynobj.cc: Likewise.
5861 * ehframe.cc: Likewise.
5862 * ehframe.h: Likewise.
5863 * expression.cc: Likewise.
5864 * fileread.cc: Likewise.
5865 * fileread.h: Likewise.
5866 * gc.h: Likewise.
5867 * gold-threads.cc: Likewise.
5868 * gold.cc: Likewise.
5869 * i386.cc: Likewise.
5870 * icf.h: Likewise.
5871 * incremental-dump.cc: Likewise.
5872 * incremental.cc: Likewise.
5873 * layout.cc: Likewise.
5874 * layout.h: Likewise.
5875 * main.cc: Likewise.
5876 * merge.cc: Likewise.
5877 * merge.h: Likewise.
5878 * object.cc: Likewise.
5879 * object.h: Likewise.
5880 * options.cc: Likewise.
5881 * options.h: Likewise.
5882 * output.cc: Likewise.
5883 * output.h: Likewise.
5884 * plugin.cc: Likewise.
5885 * plugin.h: Likewise.
5886 * powerpc.cc: Likewise.
5887 * reloc.cc: Likewise.
5888 * script-c.h: Likewise.
5889 * script-sections.cc: Likewise.
5890 * script.cc: Likewise.
5891 * stringpool.cc: Likewise.
5892 * symtab.cc: Likewise.
5893 * symtab.h: Likewise.
5894 * target.cc: Likewise.
5895 * timer.cc: Likewise.
5896 * timer.h: Likewise.
5897 * version.cc: Likewise.
5898 * x86_64.cc: Likewise.
5899
5900 2010-08-24 Nick Clifton <nickc@redhat.com>
5901
5902 PR 11899
5903 * layout.cc (segment_precedes): Sort segments by their physical
5904 addresses, if they have been set.
5905
5906 2010-08-23 Cary Coutant <ccoutant@google.com>
5907
5908 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5909 symbols data.
5910 (Lib_group::include_member): Unlock object after deleting its
5911 symbols data.
5912 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5913 the bug fixed here.
5914
5915 2010-08-19 Neil Vachharajani <nvachhar@google.com>
5916 Cary Coutant <ccoutant@google.com>
5917
5918 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5919 constructor, and set_blocker.
5920 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5921 readsyms_blocker_.
5922 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5923 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5924 * testsuite/Makefile.am (start_lib_test): New test case.
5925 * testsuite/Makefile.in: Regenerate.
5926 * testsuite/start_lib_test_main.c: New file.
5927 * testsuite/start_lib_test_1.c: New file.
5928 * testsuite/start_lib_test_2.c: New file.
5929 * testsuite/start_lib_test_3.c: New file.
5930
5931 2010-08-19 Ian Lance Taylor <iant@google.com>
5932
5933 * Makefile.in: Rebuild with automake 1.11.1.
5934 * aclocal.m4: Likewise.
5935 * testsuite/Makefile.in: Likewise.
5936
5937 2010-08-19 Ian Lance Taylor <iant@google.com>
5938
5939 PR 10893
5940 * i386.cc (class Output_data_plt_i386): Update declarations.
5941 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
5942 local_ifuncs_ fields.
5943 (Target_i386::do_plt_section_for_global): New function.
5944 (Target_i386::do_plt_section_for_local): New function.
5945 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5946 parameter; change all callers. Initialize global_ifuncs_ and
5947 local_ifuncs_. If doing a static link define __rel_iplt_start and
5948 __rel_iplt_end.
5949 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5950 (Output_data_plt_i386::add_local_ifunc_entry): New function.
5951 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5952 symbols.
5953 (Target_i386::make_plt_section): New function, broken out of
5954 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
5955 (Target_i386::make_plt_entry): Call make_plt_section.
5956 (Target_i386::make_local_ifunc_plt_entry): New function.
5957 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5958 (Target_i386::Scan::local): Handle IFUNC symbols. Add
5959 R_386_IRELATIVE to switch.
5960 (Target_i386::Scan::global): Likewise.
5961 (Target_i386::Relocate::relocate): Likewise.
5962 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5963 switch.
5964 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5965 (Target_x86_64::do_plt_section_for_global): New function.
5966 (Target_x86_64::do_plt_section_for_local): New function.
5967 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5968 parameter; change all callers. If doing a static link define
5969 __rela_iplt_start and __rela_iplt_end.
5970 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5971 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5972 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5973 to point to .plt.
5974 (Target_x86_64::make_local_ifunc_plt_entry): New function.
5975 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5976 switch.
5977 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5978 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
5979 R_X86_64_IRELATIVE to switch.
5980 (Target_x86_64::Scan::global): Likewise.
5981 (Target_x86_64::Relocate::relocate): Likewise.
5982 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5983 switch.
5984 * target.h (class Target): Add plt_section_for_global and
5985 plt_section_for_local functions. Add do_plt_section_for_global
5986 and do_plt_section_for_local virtual functions.
5987 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
5988 clarifying comments.
5989 (Symbol::use_plt_offset): Handle IFUNC symbol.
5990 * object.cc (Sized_relobj::Sized_relobj): Initialize
5991 local_plt_offsets_.
5992 (Sized_relobj::local_has_plt_offset): New function.
5993 (Sized_relobj::local_plt_offset): New function.
5994 (Sized_relobj::set_local_plt_offset): New function.
5995 (Sized_relobj::do_count): Handle IFUNC symbol.
5996 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
5997 a bit away from input_shndx_ field. Add set_is_func_symbol and
5998 is_ifunc_symbol functions.
5999 (class Sized_relobj): Update declarations. Remove Tls_got_entry
6000 and Local_tls_got_offsets. Define Local_plt_offsets. Add
6001 local_plt_offsets_ field.
6002 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6003 * output.h (class Output_section_data): Add non-const
6004 output_section function.
6005 (class Output_data_got): Update declarations.
6006 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6007 Add use_plt_offset parameter to global and local constructors.
6008 Change all callers. Change local_sym_index_ field to 31 bits.
6009 Change GSYM_CODE and CONSTANT_CODE accordingly.
6010 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6011 doing a static link don't set sh_link field.
6012 (Output_data_got::Got_entry::write): Use PLT offset if
6013 appropriate.
6014 (Output_data_got::add_global_plt): New function.
6015 (Output_data_got::add_local_plt): New function.
6016 * target-reloc.h (relocate_section): Handle IFUNC symbol.
6017 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6018 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6019 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6020 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6021 IFUNC conditional.
6022 * testsuite/ifunc-sel.h: New file.
6023 * testsuite/ifuncmain1.c: New file.
6024 * testsuite/ifuncmain1vis.c: New file.
6025 * testsuite/ifuncmod1.c: New file.
6026 * testsuite/ifuncdep2.c: New file.
6027 * testsuite/ifuncmain2.c: New file.
6028 * testsuite/ifuncmain3.c: New file.
6029 * testsuite/ifuncmod3.c: New file.
6030 * testsuite/ifuncmain4.c: New file.
6031 * testsuite/ifuncmain5.c: New file.
6032 * testsuite/ifuncmod5.c: New file.
6033 * testsuite/ifuncmain6pie.c: New file.
6034 * testsuite/ifuncmod6.c: New file.
6035 * testsuite/ifuncmain7.c: New file.
6036 * configure, testsuite/Makefile.in: Rebuild.
6037
6038 2010-08-18 Ian Lance Taylor <iant@google.com>
6039
6040 * incremental.cc
6041 (Output_section_incremental_inputs::write_input_files): Add cast
6042 to avoid signed/unsigned comparison warning.
6043 (Output_section_incremental_inputs::write_info_blocks): Likewise.
6044
6045 2010-08-12 Cary Coutant <ccoutant@google.com>
6046
6047 * common.cc (Sort_commons::operator()): Remove unnecessary code.
6048
6049 2010-08-13 Ian Lance Taylor <iant@google.com>
6050
6051 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6052
6053 2010-08-12 Cary Coutant <ccoutant@google.com>
6054 Doug Kwan <dougkwan@google.com>
6055
6056 * resolve.cc (Symbol_table::should_override): When a weak dynamic
6057 defintion overrides non-weak undef, remember that the original undef
6058 is not weak.
6059 * symtab.cc (Symbol_table::sized_write_global): For undef without
6060 an original weak binding, set binding to global in output.
6061 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6062 * testsuite/Makefile.in: Regenerate.
6063 * testsuite/strong_ref_weak_def.sh: New file.
6064 * testsuite/strong_ref_weak_def_1.c: Ditto.
6065 * testsuite/strong_ref_weak_def_2.c: Ditto.
6066
6067 2010-08-12 Cary Coutant <ccoutant@google.com>
6068
6069 * testsuite/incremental_test.sh: Rewrite.
6070 * testsuite/incremental_test_1.c: Rewrite.
6071 * testsuite/incremental_test_2.c: Rewrite.
6072
6073 2010-08-12 Cary Coutant <ccoutant@google.com>
6074
6075 * arm.cc (Target_arm::got_size): Add const.
6076 (Target_arm::got_entry_count): New function.
6077 (Target_arm::plt_entry_count): New function.
6078 (Target_arm::first_plt_entry_offset): New function.
6079 (Target_arm::plt_entry_size): New function.
6080 (Output_data_plt_arm::entry_count): New function.
6081 (Output_data_plt_arm::first_plt_entry_offset): New function.
6082 (Output_data_plt_arm::get_plt_entry_size): New function.
6083 * i386.cc (Target_i386::got_size): Add const.
6084 (Target_i386::got_entry_count): New function.
6085 (Target_i386::plt_entry_count): New function.
6086 (Target_i386::first_plt_entry_offset): New function.
6087 (Target_i386::plt_entry_size): New function.
6088 (Output_data_plt_i386::entry_count): New function.
6089 (Output_data_plt_i386::first_plt_entry_offset): New function.
6090 (Output_data_plt_i386::get_plt_entry_size): New function.
6091 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6092 find_incremental_inputs_sections. Dump incremental_got_plt section.
6093 * incremental.cc: Include target.h.
6094 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6095 parameter. Adjust all callers. Find incremental_got_plt section.
6096 (Incremental_inputs::create_data_sections): Create incremental_got_plt
6097 section.
6098 (Output_section_incremental_inputs::set_final_data_size): Calculate
6099 size of incremental_got_plt section.
6100 (Output_section_incremental_inputs::do_write): Write the
6101 incremental_got_plt section.
6102 (Got_plt_view_info): New struct.
6103 (Local_got_offset_visitor): New class.
6104 (Global_got_offset_visitor): New class.
6105 (Global_symbol_visitor_got_plt): New class.
6106 (Output_section_incremental_inputs::write_got_plt): New function.
6107 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6108 Add parameter. Adjust all callers.
6109 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6110 (Incremental_inputs::got_plt_section): New function.
6111 (Incremental_inputs::got_plt_section_): New data member.
6112 (Incremental_got_plt_reader): New class.
6113 * layout.cc (Layout::create_incremental_info_sections): Add the
6114 incremental_got_plt section.
6115 * object.h (Got_offset_list::get_list): New function.
6116 (Got offset_list::for_all_got_offsets): New function.
6117 (Sized_relobj::local_got_offset_list): New function.
6118 * powerpc.cc (Target_powerpc::got_size): Add const.
6119 (Target_powerpc::got_entry_count): New function.
6120 (Target_powerpc::plt_entry_count): New function.
6121 (Target_powerpc::first_plt_entry_offset): New function.
6122 (Target_powerpc::plt_entry_size): New function.
6123 (Output_data_plt_powerpc::entry_count): New function.
6124 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6125 (Output_data_plt_powerpc::get_plt_entry_size): New function.
6126 * sparc.cc (Target_sparc::got_size): Add const.
6127 (Target_sparc::got_entry_count): New function.
6128 (Target_sparc::plt_entry_count): New function.
6129 (Target_sparc::first_plt_entry_offset): New function.
6130 (Target_sparc::plt_entry_size): New function.
6131 (Output_data_plt_sparc::entry_count): New function.
6132 (Output_data_plt_sparc::first_plt_entry_offset): New function.
6133 (Output_data_plt_sparc::get_plt_entry_size): New function.
6134 * symtab.h (Symbol::got_offset_list): New function.
6135 (Symbol_table::for_all_symbols): New function.
6136 * target.h (Sized_target::got_entry_count): New function.
6137 (Sized_target::plt_entry_count): New function.
6138 (Sized_target::plt_entry_size): New function.
6139 * x86_64.cc (Target_x86_64::got_size): Add const.
6140 (Target_x86_64::got_entry_count): New function.
6141 (Target_x86_64::plt_entry_count): New function.
6142 (Target_x86_64::first_plt_entry_offset): New function.
6143 (Target_x86_64::plt_entry_size): New function.
6144 (Output_data_plt_x86_64::entry_count): New function.
6145 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6146 (Output_data_plt_x86_64::get_plt_entry_size): New function.
6147
6148 2010-08-12 Cary Coutant <ccoutant@google.com>
6149
6150 * archive.cc: Include incremental.h.
6151 (Archive::Archive): Initialize incremental_info_.
6152 (Archive::include_member): Record archive members in incremental info.
6153 (Add_archive_symbols::run): Record begin and end of an archive in
6154 incremental info.
6155 (Lib_group::include_member): Record objects in incremental info.
6156 * archive.h (Incremental_archive_entry): Forward declaration.
6157 (Archive::set_incremental_info): New member function.
6158 (Archive::incremental_info): New member function.
6159 (Archive::Unused_symbol_iterator): New class.
6160 (Archive::unused_symbols_begin): New member function.
6161 (Archive::unused_symbols_end): New member function.
6162 (Archive::incremental_info_): New data member.
6163 * incremental-dump.cc (find_input_containing_global): New function.
6164 (dump_incremental_inputs): Dump new incremental info sections.
6165 * incremental.cc: Include symtab.h.
6166 (Output_section_incremental_inputs): New class.
6167 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6168 new incremental info sections.
6169 (Sized_incremental_binary::do_check_inputs): Likewise.
6170 (Incremental_inputs::report_archive): Remove.
6171 (Incremental_inputs::report_archive_begin): New function.
6172 (Incremental_inputs::report_archive_end): New function.
6173 (Incremental_inputs::report_object): New function.
6174 (Incremental_inputs::finalize_inputs): Remove.
6175 (Incremental_inputs::report_input_section): New function.
6176 (Incremental_inputs::report_script): Rewrite.
6177 (Incremental_inputs::finalize): Do nothing but finalize string table.
6178 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6179 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6180 (Incremental_inputs::create_data_sections): New function.
6181 (Incremental_inputs::relocs_entsize): New function.
6182 (Output_section_incremental_inputs::set_final_data_size): New function.
6183 (Output_section_incremental_inputs::do_write): New function.
6184 (Output_section_incremental_inputs::write_header): New function.
6185 (Output_section_incremental_inputs::write_input_files): New function.
6186 (Output_section_incremental_inputs::write_info_blocks): New function.
6187 (Output_section_incremental_inputs::write_symtab): New function.
6188 * incremental.h (Incremental_script_entry): Forward declaration.
6189 (Incremental_object_entry): Forward declaration.
6190 (Incremental_archive_entry): Forward declaration.
6191 (Incremental_inputs): Forward declaration.
6192 (Incremental_inputs_header_data): Remove.
6193 (Incremental_inputs_header): Remove.
6194 (Incremental_inputs_header_write): Remove.
6195 (Incremental_inputs_entry_data): Remove.
6196 (Incremental_inputs_entry): Remove.
6197 (Incremental_inputs_entry_write): Remove.
6198 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6199 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6200 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6201 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6202 Likewise.
6203 (Incremental_input_entry): New class.
6204 (Incremental_script_entry): New class.
6205 (Incremental_object_entry): New class.
6206 (Incremental_archive_entry): New class.
6207 (Incremental_inputs::Incremental_inputs): Initialize new data members.
6208 (Incremental_inputs::report_inputs): Remove.
6209 (Incremental_inputs::report_archive): Remove.
6210 (Incremental_inputs::report_archive_begin): New function.
6211 (Incremental_inputs::report_archive_end): New function.
6212 (Incremental_inputs::report_object): Change prototype.
6213 (Incremental_inputs::report_input_section): New function.
6214 (Incremental_inputs::report_script): Change prototype.
6215 (Incremental_inputs::get_reloc_count): New function.
6216 (Incremental_inputs::set_reloc_count): New function.
6217 (Incremental_inputs::create_data_sections): New function.
6218 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6219 (Incremental_inputs::inputs_section): New function.
6220 (Incremental_inputs::symtab_section): New function.
6221 (Incremental_inputs::relocs_section): New function.
6222 (Incremental_inputs::get_stringpool): Add const.
6223 (Incremental_inputs::command_line): Add const.
6224 (Incremental_inputs::inputs): Remove.
6225 (Incremental_inputs::command_line_key): New function.
6226 (Incremental_inputs::input_file_count): New function.
6227 (Incremental_inputs::input_files): New function.
6228 (Incremental_inputs::relocs_entsize): New function.
6229 (Incremental_inputs::sized_create_inputs_section_data): Remove.
6230 (Incremental_inputs::finalize_inputs): Remove.
6231 (Incremental_inputs::Input_info): Remove.
6232 (Incremental_inputs::lock_): Remove.
6233 (Incremental_inputs::inputs_): Change type.
6234 (Incremental_inputs::inputs_map_): Remove.
6235 (Incremental_inputs::current_object_entry_): New data member.
6236 (Incremental_inputs::inputs_section_): New data member.
6237 (Incremental_inputs::symtab_section_): New data member.
6238 (Incremental_inputs::relocs_section_): New data member.
6239 (Incremental_inputs::reloc_count_): New data member.
6240 (Incremental_inputs_reader): New class.
6241 (Incremental_symtab_reader): New class.
6242 (Incremental_relocs_reader): New class.
6243 * layout.cc (Layout::finalize): Move finalization of incremental info
6244 and creation of incremental info sections to follow finalization of
6245 symbol table. Set offsets for postprocessing sections.
6246 (Layout::create_incremental_info_sections): Call
6247 Incremental_inputs::create_data_sections. Add incremental symtab
6248 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
6249 sections to layout after input sections.
6250 * layout.h (struct Timespec): Forward declaration.
6251 (Layout::incremental_inputs): Add const.
6252 (Layout::create_incremental_info_sections): Add parameter.
6253 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6254 * object.cc: Include incremental.h.
6255 (Relobj::finalize_incremental_relocs): New function.
6256 (Sized_relobj::do_layout): Record input sections in incremental info.
6257 * object.h (Object::output_section): New function.
6258 (Object::output_section_offset): Moved from Relobj.
6259 (Object::get_incremental_reloc_base): New function.
6260 (Object::get_incremental_reloc_count): New function.
6261 (Object::do_output_section): New function.
6262 (Object::do_output_section_offset): Moved from Relobj.
6263 (Object::do_get_incremental_reloc_base): New function.
6264 (Object::do_get_incremental_reloc_count): New function.
6265 (Object::Object): Initialize new data members.
6266 (Relobj::output_section): Renamed do_output_section and moved to
6267 protected.
6268 (Relobj::output_section_offset): Moved to Object.
6269 (Relobj::do_get_incremental_reloc_base): New function.
6270 (Relobj::do_get_incremental_reloc_count): New function.
6271 (Relobj::allocate_incremental_reloc_counts): New function.
6272 (Relobj::count_incremental_reloc): New function.
6273 (Relobj::finalize_incremental_relocs): New function.
6274 (Relobj::next_incremental_reloc_index): New function.
6275 (Relobj::reloc_counts_): New data member.
6276 (Relobj::reloc_bases_): New data member.
6277 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
6278 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
6279 (Sized_relobj::incremental_relocs_scan): New function.
6280 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6281 (Sized_relobj::incremental_relocs_write): New function.
6282 (Sized_relobj::incremental_relocs_write_reltype): New function.
6283 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6284 incremental link.
6285 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6286 archives and object files elsewhere.
6287 (Add_symbols::run): Report object files here.
6288 (Finish_group::run): Report end of archive at end of group.
6289 * reloc.cc: Include layout.h, incremental.h.
6290 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6291 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6292 (Sized_relobj::incremental_relocs_scan): New function.
6293 (Sized_relobj::incremental_relocs_scan_reltype): New function.
6294 (Sized_relobj::do_relocate_sections): Write incremental relocations.
6295 (Sized_relobj::incremental_relocs_write): New function.
6296 (Sized_relobj::incremental_relocs_write_reltype): New function.
6297 * script.cc (read_input_script): Rewrite test for incremental link.
6298 Change call to Incremental_inputs::report_script.
6299 * symtab.h (Symbol_table::first_global_index): New function.
6300 (Symbol_table::output_count): New function.
6301
6302 2010-08-12 Doug Kwan <dougkwan@google.com>
6303
6304 * arm.cc (Target_arm::merge_object_attributes): Check command line
6305 options --no-wchar-size-warning and --no-enum-size-warning.
6306 * options.h (General_options): Add ld-compatible options
6307 --no-enum-size-warning and --no-wchar-size-warning.
6308
6309 2010-08-04 Ian Lance Taylor <iant@google.com>
6310
6311 * x86_64.cc (Target_x86_64::Scan::local): Use
6312 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6313 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6314 (Target_x86_64::Scan::global): Likewise.
6315 (Target_x86_64::Relocate::relocate): Likewise.
6316 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6317 Likewise.
6318
6319 2010-08-03 Cary Coutant <ccoutant@google.com>
6320
6321 * merge.cc (Output_merge_string::do_add_input_section): Count strings
6322 to reserve space in merged_strings vector. Keep total input size
6323 for stats.
6324 (Output_merge_string::do_print_merge_stats): Print total input size.
6325 * merge.h (Output_merge_string): Add input_size_ field.
6326 * stringpool.cc (Stringpool_template::string_length): Move
6327 implementations out of Stringpool_template class and place in
6328 stringpool.h.
6329 * stringpool.h (string_length): Move out of Stringpool_template.
6330
6331 2010-08-03 Ian Lance Taylor <iant@google.com>
6332
6333 PR 11712
6334 * layout.cc (relaxation_loop_body): If address of load segment is
6335 set, adjust address to include headers if possible.
6336
6337 2010-08-03 Ian Lance Taylor <iant@google.com>
6338
6339 * version.cc (version_string): Bump to 1.10.
6340
6341 2010-08-03 Ian Lance Taylor <iant@google.com>
6342
6343 PR 11805
6344 * layout.h (enum Output_section_order): Define.
6345 (class Layout): Update declarations.
6346 * layout.cc (Layout::get_output_section): Add order parameter.
6347 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6348 is_first_non_relro parameters. Change all callers.
6349 (Layout::choose_output_section): Likewise.
6350 (Layout::add_output_section_data): Likewise.
6351 (Layout::make_output_section): Likewise. Set order.
6352 (Layout::default_section_order): New function.
6353 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6354 * output.cc (Output_section::Output_section): Initialize order_.
6355 Don't initialize deleted fields.
6356 (Output_segment::Output_segment): Don't initialize deleted
6357 fields.
6358 (Output_segment::add_output_section_to_load): New function
6359 replacing add_output_section. Change all callers to call this or
6360 add_output_section_to_nonload.
6361 (Output_segment::add_output_section_to_nonload): New function.
6362 (Output_segment::remove_output_section): Rewrite.
6363 (Output_segment::add_initial_output_data): Likewise.
6364 (Output_segment::has_any_data_sections): Likewise.
6365 (Output_segment::is_first_section_relro): Likewise.
6366 (Output_segment::maximum_alignment): Likewise.
6367 (Output_segment::has_dynamic_reloc): New function replacing
6368 dynamic_reloc_count. Change all callers.
6369 (Output_segment::has_dynamic_reloc_list): New function replacing
6370 dynamic_reloc_count_list. Change all callers.
6371 (Output_segment::set_section_addresses): Rewrite.
6372 (Output_segment::set_offset): Rewrite.
6373 (Output_segment::find_first_and_last_list): Remove.
6374 (Output_segment::set_tls_offsets): Rewrite.
6375 (Output_segment::first_section_load_address): Likewise.
6376 (Output_segment::output_section_count): Likewise.
6377 (Output_segment::section_with_lowest_load_address): Likewise.
6378 (Output_segment::write_section_headers): Likewise.
6379 (Output_segment::print_sections_to_map): Likewise.
6380 * output.h (class Output_data): Remove dynamic_reloc_count_
6381 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
6382 (Output_data::add_dynamic_reloc): Rewrite.
6383 (Output_data::has_dynamic_reloc): New function.
6384 (Output_data::dynamic_reloc_count): Remove.
6385 (class Output_section): Add order_ field. Remvoe is_relro_local_,
6386 is_last_relro_, is_first_non_relro_, is_interp_,
6387 is_dynamic_linker_section_ fields. Add order and set_order
6388 functions. Remove is_relro_local, set_is_relro_local,
6389 is_last_relro, set_is_last_relro, is_first_non_relro,
6390 set_is_first_non_relro functions, is_interp, set_is_interp,
6391 is_dynamic_linker_section, and set_is_dynamic_linker_section
6392 functions.
6393 (class Output_segment): Change Output_data_list from std::list to
6394 std:;vector. Add output_lists_ field. Remove output_data_ and
6395 output_bss_ fields. Update declarations.
6396
6397 2010-08-02 Ian Lance Taylor <iant@google.com>
6398
6399 * arm.cc (Target_arm::gc_process_relocs): Use typename.
6400 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6401 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6402
6403 2010-08-02 Ian Lance Taylor <iant@google.com>
6404
6405 PR 11855
6406 * script.cc (Script_options::Script_options): Initialize
6407 symbol_definitions_ and symbol_references_.
6408 (Script_options::add_symbol_assignment): Update
6409 symbol_definitions_ and symbol_references_.
6410 (Script_options::add_symbol_reference): New function.
6411 (script_symbol): New function.
6412 * script.h (class Script_options): Add symbol_definitions_ and
6413 symbol_references_ fields.
6414 (Script_options::referenced_const_iterator): New type.
6415 (Script_options::referenced_begin): New function.
6416 (Script_options::referenced_end): New function.
6417 (Script_options::is_referenced): New function.
6418 (Script_options::any_unreferenced): New function.
6419 * script-c.h (script_symbol): Declare.
6420 * yyscript.y (exp): Call script_symbol.
6421 * symtab.cc: Include "script.h".
6422 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6423 Change all callers. Check symbols referenced by scripts.
6424 (Symbol_table::add_undefined_symbols_from_command_line): Add
6425 layout parameter. Change all callers.
6426 (Symbol_table::do_add_undefined_symbols_from_command_line):
6427 Likewise. Break out loop body. Check symbols referenced by
6428 scripts.
6429 (Symbol_table::add_undefined_symbol_from_command_line): New
6430 function broken out of
6431 do_add_undefined_symbols_from_command_line.
6432 * symtab.h (class Symbol_table): Update declarations.
6433 * archive.cc: Include "layout.h".
6434 (Archive::should_include_member): Add layout parameter. Change
6435 all callers. Check for symbol mentioned in expression.
6436 * archive.h (class Archive): Update declaration.
6437 * object.cc (Sized_relobj::do_should_include_member): Add layout
6438 parameter.
6439 * object.h (Object::should_include_member): Add layout parameter.
6440 Change all callers.
6441 (Object::do_should_include_member): Add layout parameter.
6442 (class Sized_relobj): Update declaration.
6443 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6444 parameter.
6445 * dynobj.h (class Sized_dynobj): Update declaration.
6446 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6447 layout parameter.
6448 * plugin.h (class Sized_pluginobj): Update declaration.
6449
6450 2010-08-02 Ian Lance Taylor <iant@google.com>
6451
6452 PR 11866
6453 * output.cc (Output_segment::set_offset): Search for the first and
6454 last sections rather than assuming that the list is in order.
6455 (Output_segment::find_first_and_last_list): New function.
6456 * output.h (class Output_segment): Update declarations.
6457 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6458 (relro_strip_test_SOURCES): New variable.
6459 (relro_strip_test_DEPENDENCIES): New variable.
6460 (relro_strip_test_LDFLAGS): New variable.
6461 (relro_strip_test_LDADD): New variable.
6462 (relro_strip_test.so): New target.
6463
6464 2010-08-02 Ian Lance Taylor <iant@google.com>
6465
6466 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6467 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6468 (Target_i386::got_tlsdesc_section): New function.
6469 (Target_i386::got_section): Create space for GOT entries for
6470 TLSDESC relocations.
6471 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6472 R_386_TLS_GOTDESC.
6473 (Target_i386::Scan::global): Likewise.
6474 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6475 using TLSDESC GOT.
6476 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6477 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6478 (Target_x86_64::got_tlsdesc_section): New function.
6479 (Target_x86_64::got_section): Create space for GOT entries for
6480 TLSDESC relocations.
6481 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6482 R_386_TLS_GOTDESC.
6483 (Target_x86_64::Scan::global): Likewise.
6484 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6485 using TLSDESC GOT.
6486
6487 2010-08-02 Ian Lance Taylor <iant@google.com>
6488
6489 * testsuite/final_layout.sh: Use dc to convert from hex to
6490 decimal.
6491
6492 2010-07-29 Sriraman Tallam <tmsriram@google.com>
6493
6494 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6495 paramter to the call to gold::gc_process_relocs.
6496 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6497 paramter to the call to gold::gc_process_relocs.
6498 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6499 parameter to the call to gold::gc_process_relocs.
6500 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6501 template parameter to the call to gold::gc_process_relocs.
6502 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6503 paramter to the call to gold::gc_process_relocs.
6504 * gc.h (get_embedded_addend_size): New function.
6505 (gc_process_relocs): Save the size of the reloc for use by ICF.
6506 * icf.cc (get_section_contents): Get the addend from the text section
6507 for SHT_REL relocation sections.
6508 * icf.h (Icf::Reloc_addend_size_info): New typedef.
6509 (Icf::Reloc_info): Add new member reloc_addend_size_info.
6510 * int_encoding.h (read_from_pointer): New overloaded function.
6511 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6512 * testsuite/icf_sht_rel_addend_test.sh: New file.
6513 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6514 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6515
6516 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6517
6518 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6519 * Makefile.in: Regenerate.
6520 * testsuite/Makefile.in: Regenerate.
6521
6522 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
6523
6524 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6525 * gold/testsuite/debug_msg.cc: Likewise.
6526 * gold/testsuite/odr_violation1.cc
6527 * gold/testsuite/odr_violation2.cc
6528
6529 2010-07-21 Cary Coutant <ccoutant@google.com>
6530
6531 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6532 string, and length fields.
6533 (Output_merge_string::Merged_strings_list): New type.
6534 (Output_merge_string::Merged_strings_lists): New typedef.
6535 (Output_merge_string): Replace merged_strings_ with
6536 merged_strings_lists_.
6537 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6538 Merged_strings_list per input object and section. Don't store pointer
6539 to the string. Don't store length with each merged string entry.
6540 (Output_merge_string::finalize_merged_data): Loop over list of merged
6541 strings lists. Recompute length of each merged string.
6542
6543 2010-07-15 Cary Coutant <ccoutant@google.com>
6544
6545 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6546 here.
6547
6548 2010-07-14 Ian Lance Taylor <iant@google.com>
6549
6550 * descriptors.cc (Descriptors::open): Report correct name in error
6551 message.
6552
6553 2010-07-13 Doug Kwan <dougkwan@google.com>
6554
6555 * arm.cc (Arm_input_section::Arm_input_section): For a
6556 SHT_ARM_EXIDX section, always keeps the input sections.
6557 (Arm_input_section::set_exidx_section_link): New method.
6558 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6559 has_errors_ to false.
6560 (Arm_exidx_input_section::has_errors,
6561 Arm_exidx_input_section::set_has_errors): New methods.
6562 (Arm_exidx_input_section::has_errors_): New data member.
6563 (Arm_relobj::get_exidx_shndx_list): New method.
6564 (Arm_output_section::append_text_sections_to_list): Do not skip
6565 section without SHF_EXECINSTR.
6566 (Arm_output_section::fix_exidx_coverage): Skip input sections with
6567 errors.
6568 (Arm_relobj::make_exidx_input_section): Add new parameter for text
6569 section header. Make error messages more verbose. Check for
6570 a non-executable section linked to an EXIDX section.
6571 (Arm_relobj::do_read_symbols): Remove error checking, which has been
6572 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
6573 check that there is no deferred EXIDX section if we exit early.
6574 Instead of not making an EXIDX section in case of an error, make one
6575 and set the has_errors flag of it.
6576 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6577 in a relocatable link.
6578 (Target_arm::do_relax): Look for the EXIDX output section instead of
6579 assuming that it is called .ARM.exidx.
6580 (Target_arm::fix_exidx_coverage): Add a new parameter for input
6581 section list. Do not check for SHF_EXECINSTR section flags but
6582 skip any input section with errors.
6583 * output.cc (Output_section::Output_section): Initialize
6584 always_keeps_input_sections_ to false.
6585 (Output_section::add_input_section): Check for
6586 always_keeps_input_sections_.
6587 * output.h (Output_section::always_keeps_input_sections,
6588 Output_section::set_always_keeps_input_sections): New methods.
6589 (Output_section::always_keeps_input_sections): New data member.
6590
6591 2010-07-13 Rafael Espindola <espindola@google.com>
6592
6593 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6594 * fileread.h (Input_file): Add try_extra_search_path and find_file.
6595
6596 2010-07-13 Philip Herron <herron.philip@googlemail.com>
6597 Ian Lance Taylor <iant@google.com>
6598
6599 * output.h (Output_section_lookup_maps::add_merge_section):
6600 Correct check of whether value was inserted.
6601 (Output_section_lookup_maps::add_merge_input_section): Likewise.
6602 (Output_section_lookup_maps::add_relaxed_input_section):
6603 Likewise.
6604 * arm.cc (Target_arm::got_section): Remove used local os.
6605 * i386.cc (Target_i386::got_section): Likewise.
6606 * x86_64.cc (Target_x86_64::got_section): Likewise.
6607 * sparc.cc (Target_sparc::got_section): Likewise.
6608 (Target_sparc::relocate): Remove unused local have_got_offset.
6609 * powerpc.cc (Target_powerpc::relocate): Likewise.
6610
6611 2010-07-13 Ian Lance Taylor <iant@google.com>
6612
6613 * compressed_output.cc (zlib_decompress): Fix signature in
6614 !HAVE_ZLIB_H case.
6615
6616 * archive.cc (Archive::include_member): Unlock an external member
6617 of a thin archive. Don't bother to delete an object we know is
6618 NULL.
6619
6620 2010-07-12 Cary Coutant <ccoutant@google.com>
6621
6622 * compressed_output.cc (zlib_decompress): New function.
6623 (get_uncompressed_size): New function.
6624 (decompress_input_section): New function.
6625 * compressed_output.h (get_uncompressed_size): New function.
6626 (decompress_input_section): New function.
6627 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6628 Handle compressed debug sections.
6629 * layout.cc (is_compressed_debug_section): New function.
6630 (Layout::output_section_name): Map compressed section names to
6631 canonical names.
6632 * layout.h (is_compressed_debug_section): New function.
6633 (is_debug_info_section): Recognize compressed debug sections.
6634 * merge.cc: Include compressed_output.h.
6635 (Output_merge_data::do_add_input_section): Handle compressed
6636 debug sections.
6637 (Output_merge_string::do_add_input_section): Handle compressed
6638 debug sections.
6639 * object.cc: Include compressed_output.h.
6640 (Sized_relobj::Sized_relobj): Initialize new data members.
6641 (build_compressed_section_map): New function.
6642 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6643 * object.h (Object::section_is_compressed): New method.
6644 (Object::do_section_is_compressed): New method.
6645 (Sized_relobj::Compressed_section_map): New type.
6646 (Sized_relobj::do_section_is_compressed): New method.
6647 (Sized_relobj::compressed_sections_): New data member.
6648 * output.cc (Output_section::add_input_section): Handle compressed
6649 debug sections.
6650 * reloc.cc: Include compressed_output.h.
6651 (Sized_relobj::write_sections): Handle compressed debug sections.
6652
6653 2010-07-08 Cary Coutant <ccoutant@google.com>
6654
6655 * resolve.cc (Symbol_table::resolve): Remember whether undef was
6656 weak when resolving to a dynamic def.
6657 (Symbol_table::should_override): Add adjust_dyndef flag; set it
6658 for weak undef/dynamic def cases. Adjust callers.
6659 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6660 undef_binding_weak_.
6661 (Symbol_table::sized_write_globals): Adjust symbol binding.
6662 (Symbol_table::sized_write_symbol): Add binding parameter.
6663 * symtab.h (Symbol::set_undef_binding): New method.
6664 (Symbol::is_undef_binding_weak): New method.
6665 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6666 (Symbol_table::should_override): Add new parameter.
6667 (Symbol_table::sized_write_symbol): Add new parameter.
6668
6669 * testsuite/weak_undef_file1.cc: Add new test case.
6670 * testsuite/weak_undef_file2.cc: Fix header comment.
6671 * testsuite/weak_undef_test.cc: Add new test case.
6672
6673 2010-06-29 Doug Kwan <dougkwan@google.com>
6674
6675 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6676 Initialize USE_SYMBOL_.
6677 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6678 definition.
6679 (Arm_reloc_property::uses_symbol_): New data member declaration.
6680 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6681 uses symbol value and symbol is undefined but not weakly undefined.
6682
6683 2010-06-28 Rafael Espindola <espindola@google.com>
6684
6685 * plugin.cc (Plugin::load): Use dlerror.
6686
6687 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
6688
6689 * symtab.cc (detect_odr_violations): When reporting an ODR
6690 violation, report an object where the symbol is defined.
6691
6692 2010-06-25 Doug Kwan <dougkwan@google.com>
6693
6694 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6695 (Target_arm::section_may_have_icf_unsafe_pointers): New method
6696 definition.
6697 (Target_arm::Scan::local_reloc_may_be_function_pointer,
6698 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6699 target hook to detect function points.
6700 (Target_arm::Scan::possible_function_pointer_reloc): New method.
6701 * icf.h (Icf::check_section_for_function_pointers): Change type of
6702 parameter SECTION_NAME to const reference to std::string. Use
6703 target hook to determine if section may have unsafe pointers.
6704 * target.h (Target::section_may_have_icf_unsafe_pointers): New
6705 method definition.
6706
6707 2010-06-21 Rafael Espindola <espindola@google.com>
6708
6709 * fileread.cc (Input_file::find_fie): New
6710 (Input_file::open): Use Input_file::find_fie.
6711 * fileread.h (Input_file::find_fie): New
6712 * plugin.cc (set_extra_library_path): New.
6713 (Plugin::load): Add set_extra_library_path to the transfer vector.
6714 (Plugin_manager::set_extra_library_path): New.
6715 (Plugin_manager::add_input_file): Use the extra search path if set.
6716 (set_extra_library_path(): New.
6717 * plugin.h (Plugin_manager): Add set_extra_library_path and
6718 extra_search_path_.
6719
6720 2010-06-19 Cary Coutant <ccoutant@google.com>
6721
6722 * layout.cc (gdb_sections): Add .debug_types.
6723 (lines_only_debug_sections): Likewise.
6724
6725 2010-06-18 Rafael Espindola <espindola@google.com>
6726
6727 * plugin.cc (add_input_file,add_input_library)
6728 (Plugin_manager::add_input_file): Make filename arguments const.
6729 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6730 const.
6731
6732 2010-06-16 Doug Kwan <dougkwan@google.com>
6733
6734 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6735 .ARM.attributes section if we have not merged any input
6736 attributes sections.
6737
6738 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6739
6740 * arm.cc: Allow combining objects with no EABI version
6741 information.
6742
6743 2010-06-15 Rafael Espindola <espindola@google.com>
6744
6745 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6746
6747 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6748
6749 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6750 (struct iovec): Correct !HAVE_READV definition.
6751
6752 2010-06-10 Cary Coutant <ccoutant@google.com>
6753
6754 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6755 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6756 reloc sections.
6757 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6758
6759 PR 11683
6760 * symtab.h (Symbol::is_placeholder): New member function.
6761 * target-reloc.h (relocate_section): Check for placeholder symbols.
6762
6763 * testsuite/Makefile.am (plugin_test_8): New test.
6764 (plugin_test_9): New test.
6765 * testsuite/Makefile.in: Regenerate.
6766
6767 2010-06-09 Nick Clifton <nickc@redhat.com>
6768
6769 * yyscript.y (input_list_element): Allow strings prefixed with
6770 the '-' character. Treat these as libraries.
6771 * script.cc (script_add_library): New function. Adds a library
6772 specified by "-l<name>" found in an input script.
6773 * script-c.h: Add prototype for script_add_library.
6774
6775 2010-06-07 Doug Kwan <dougkwan@google.com>
6776
6777 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6778 Restrict stub-group size to be within long conditional branch
6779 range when working around cortex-A8 erratum.
6780
6781 2010-06-07 Damien Diederen <dd@crosstwine.com>
6782
6783 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6784 #ifdef typo.
6785
6786 2010-06-03 Sriraman Tallam <tmsriram@google.com>
6787
6788 PR gold/11658
6789 * output.cc
6790 (Output_section::Input_section_sort_entry::compare_section_ordering):
6791 Change to return non-zero correctly.
6792 (Output_section::Input_section_sort_section_order_index_compare
6793 ::operator()): Change to fix ambiguity in comparisons.
6794
6795 2010-06-01 Sriraman Tallam <tmsriram@google.com>
6796
6797 * gold.h (is_wildcard_string): New function.
6798 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6799 (Layout::layout_eh_frame): Ditto.
6800 (Layout::find_section_order_index): New method.
6801 (Layout::read_layout_from_file): New method.
6802 * layout.h (Layout::find_section_order_index): New method.
6803 (Layout::read_layout_from_file): New method.
6804 (Layout::input_section_position_): New private member.
6805 (Layout::input_section_glob_): New private member.
6806 * main.cc (main): Call read_layout_from_file here.
6807 * options.h (--section-ordering-file): New option.
6808 * output.cc (Output_section::input_section_order_specified_): New
6809 member.
6810 (Output_section::Output_section): Initialize new member.
6811 (Output_section::add_input_section): Add new parameter.
6812 Keep input sections when --section-ordering-file is used.
6813 (Output_section::set_final_data_size): Sort input sections when
6814 section ordering file is specified.
6815 (Output_section::Input_section_sort_entry): Add new parameter.
6816 Check sorting type.
6817 (Output_section::Input_section_sort_entry::compare_section_ordering):
6818 New method.
6819 (Output_section::Input_section_sort_compare::operator()): Change to
6820 consider section_order_index.
6821 (Output_section::Input_section_sort_init_fini_compare::operator()):
6822 Change to consider section_order_index.
6823 (Output_section::Input_section_sort_section_order_index_compare
6824 ::operator()): New method.
6825 (Output_section::sort_attached_input_sections): Change to sort
6826 according to section order when specified.
6827 (Output_section::add_input_section<32, true>): Add new parameter.
6828 (Output_section::add_input_section<64, true>): Add new parameter.
6829 (Output_section::add_input_section<32, false>): Add new parameter.
6830 (Output_section::add_input_section<64, false>): Add new parameter.
6831 * output.h (Output_section::add_input_section): Add new parameter.
6832 (Output_section::input_section_order_specified): New
6833 method.
6834 (Output_section::set_input_section_order_specified): New method.
6835 (Input_section::Input_section): Initialize section_order_index_.
6836 (Input_section::section_order_index): New method.
6837 (Input_section::set_section_order_index): New method.
6838 (Input_section::section_order_index_): New member.
6839 (Input_section::Input_section_sort_section_order_index_compare): New
6840 struct.
6841 (Output_section::input_section_order_specified_): New member.
6842 * script-sections.cc (is_wildcard_string): Delete and move modified
6843 method to gold.h.
6844 (Output_section_element_input::Output_section_element_input): Modify
6845 call to is_wildcard_string.
6846 (Output_section_element_input::Input_section_pattern
6847 ::Input_section_pattern): Ditto.
6848 (Output_section_element_input::Output_section_element_input): Ditto.
6849 * testsuite/Makefile.am (final_layout): New test case.
6850 * testsuite/Makefile.in: Regenerate.
6851 * testsuite/final_layout.cc: New file.
6852 * testsuite/final_layout.sh: New file.
6853
6854 2010-06-01 Rafael Espindola <espindola@google.com>
6855
6856 * plugin.cc (Plugin::load): Pass the output name to the plugin.
6857
6858 2010-06-01 Rafael Espindola <espindola@google.com>
6859
6860 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6861 visibility of symbols.
6862
6863 2010-05-27 Doug Kwan <dougkwan@google.com>
6864
6865 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6866 from start of output section instead of address for a local symbol
6867 in a merged or relaxed section when doing a relocatable link.
6868
6869 2010-05-26 Rafael Espindola <espindola@google.com>
6870
6871 PR 11604
6872 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6873 adding sections the garbage collector removed.
6874 * gold/testsuite/Makefile.am: Add test.
6875 * gold/testsuite/Makefile.in: Regenerate.
6876 * gold/testsuite/plugin_test_7.sh: New.
6877 * gold/testsuite/plugin_test_7_1.c: New.
6878 * gold/testsuite/plugin_test_7_2.c: New.
6879
6880 2010-05-26 Rafael Espindola <espindola@google.com>
6881
6882 * script-sections.cc (Output_section_definition::set_section_addresses):
6883 Check for --section-start.
6884
6885 2010-05-26 Doug Kwan <dougkwan@google.com>
6886
6887 * arm.cc (Arm_scan_relocatable_relocs): New class.
6888 (Target_arm::relocate_special_relocatable): New method.
6889 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6890 (Arm_relocate_functions::thumb_branch_common): Same.
6891 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6892 instead of Default_scan_relocatable_relocs.
6893 * target-reloc.h (relocate_for_relocatable): Let target handle
6894 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6895 * target.h (Sized_target::relocate_special_relocatable): New method.
6896
6897 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6898
6899 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6900
6901 2010-05-23 Doug Kwan <dougkwan@google.com>
6902
6903 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6904 instead of a cast.
6905 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6906 with a direct branch, not a conditional branch, to a stub.
6907 * merge.cc (Output_merge_base::record_input_section): New method
6908 defintion.
6909 (Output_merge_data::do_add_input_section): Record input section if
6910 keeps-input-sections flag is set.
6911 (Output_merge_string::do_add_input_section): Ditto.
6912 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6913 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6914 INPUT_SECTIONS_.
6915 (Output_merge_base::keeps_input_sections,
6916 Output_merge_base::set_keeps_input_sections,
6917 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6918 method definitions.
6919 (Output_merge_base::Input_sections): New type declaration.
6920 (Output_merge_base::input_sections_begin,
6921 Output_merge_base::input_sections_end,
6922 Output_merge_base::do_set_keeps_input_sections): New method definitions.
6923 (Output_merge_base::bool keeps_input_sections_,
6924 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6925 Output_merge_base::input_sections_): New data members.
6926 (Output_merge_data::do_set_keeps_input_sections): New method
6927 defintion.
6928 (Output_merge_string::do_set_keeps_input_sections): Ditto.
6929 * output.cc (Output_section::Input_section::relobj): Move method
6930 defintion from class declaration to here and handle merge sections.
6931 (Output_section::Input_section::shndx): Ditto.
6932 (Output_section::Output_section): Remove initializations of removed
6933 data members and initialize new data member LOOKUP_MAPS_.
6934 (Output_section::add_input_section): Set keeps-input-sections flag
6935 for a newly created merge output section as appropriate. Adjust code
6936 to use Output_section_lookup_maps class.
6937 (Output_section::add_relaxed_input_section): Adjst code for lookup
6938 maps code refactoring.
6939 (Output_section::add_merge_input_section): Add a new parameter
6940 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
6941 class. If adding input section to a newly created merge output
6942 section fails, remove the new merge section.
6943 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6944 Adjust code for use of the Output_section_lookup_maps class.
6945 (Output_section::find_merge_section): Ditto.
6946 (Output_section::build_lookup_maps): New method defintion.
6947 (Output_section::find_relaxed_input_section): Adjust code to use
6948 Output_section_lookup_maps class.
6949 (Output_section::get_input_sections): Export merge sections. Adjust
6950 code to use Output_section_lookup_maps class.
6951 (Output_section:::add_script_input_section): Adjust code to use
6952 Output_section_lookup_maps class. Update lookup maps for merge
6953 sections also.
6954 (Output_section::discard_states): Use Output_section_lookup_maps.
6955 (Output_section::restore_states): Same.
6956 * output.h (Merge_section_properties): Move class defintion out of
6957 Output_section.
6958 (Output_section_lookup_maps): New class.
6959 (Output_section::Input_section::is_merge_section): New method
6960 defintion.
6961 (Output_section::Input_section::relobj): Move defintion out of class
6962 defintion. Declare method only.
6963 (Output_section::Input_section::shndx): Ditto.
6964 (Output_section::Input_section::output_merge_base): New method defintion.
6965 (Output_section::Input_section::u2_.pomb): New union field.
6966 (Output_section::Merge_section_by_properties_map,
6967 Output_section::Output_section_data_by_input_section_map,
6968 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6969 Remove types.
6970 (Output_section::add_merge_input_section): Add new parameter
6971 KEEPS_INPUT_SECTIONS.
6972 (Output_section::build_lookup_maps): New method declaration.
6973 (Output_section::merge_section_map_,
6974 Output_section::merge_section_by_properties_map_,
6975 Output_section::relaxed_input_section_map_,
6976 Output_section::is_relaxed_input_section_map_valid_): Remove data
6977 members.
6978 (Output_section::lookup_maps_): New data member.
6979
6980 2010-05-21 Doug Kwan <dougkwan@google.com>
6981
6982 PR gold/11619
6983 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6984 avoid a compilation error.
6985
6986 2010-05-19 Rafael Espindola <espindola@google.com>
6987
6988 * script-sections.cc (Output_section_definition::allocate_to_segment):
6989 Update the phdrs_list even when the output section is NULL.
6990 * testsuite/Makefile.am: Add test.
6991 * testsuite/Makefile.in: Regenerate.
6992 * testsuite/script_test_9.cc: New.
6993 * testsuite/script_test_9.sh: New.
6994 * testsuite/script_test_9.t: New.
6995
6996 2010-05-19 Doug Kwan <dougkwan@google.com>
6997
6998 * arm.cc (Arm_input_section::original_size): New method.
6999 (Arm_input_section::do_addralign): Add a cast.
7000 (Arm_input_section::do_output_offset): Remove static cast.
7001 (Arm_input_section::original_addralign,
7002 Arm_input_section::original_size_): Change type to uint32_t.
7003 (Arm_input_section::init): Add safe casts for section alignment
7004 and size.
7005 (Arm_input_section::set_final_data_size): Do not set address and
7006 offset of stub table.
7007 (Arm_output_section::fix_exidx_coverage): Change use of of
7008 Output_section::Simple_input_section to that of
7009 Output_section::Input_section.
7010 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7011 except for the first pass.
7012 * output.cc (Output_section::get_input_sections): Change type of
7013 input_sections to std::list<Input_section>.
7014 (Output_section::add_script_input_section): Rename from
7015 Output_section::add_simple_input_section. Change type of SIS
7016 parameter from Simple_input_section to Input_section.
7017 * output.h (Output_section::Simple_input_section): Remove class.
7018 (Output_section::Input_section): Change class visibility to public.
7019 (Output_section::Input_section::addralign): Use stored alignments
7020 for special input sections if set.
7021 (Output_section::Input_section::set_addralign): New method.
7022 (Output_section::get_input_sections): Change parameter type from
7023 list of Simple_input_section to list of Input_section.
7024 (Output_section::add_script_input_section): Rename from
7025 Output_section::add_simple_input_section. Change first parameter's
7026 type from Simple_input_section to Input_section and remove the
7027 second and third parameters.
7028 * script-sections.cc (Input_section::Input_section_list): Change
7029 type to list of Output_section::Input_section/
7030 (Input_section_info::Input_section_info): Change parameter type of
7031 INPUT_SECTION to Output_section::Input_section.
7032 (Input_section_info::input_section): Change return type.
7033 (Input_section_info::input_section_): Change type to
7034 Output_section::Input_section.
7035 (Output_section_element_input::set_section_addresses): Adjust code
7036 to use Output_section::Input_section instead of
7037 Output_section::Simple_input_section. Adjust code for renaming
7038 of Output_section::add_simple_input_section.
7039 (Orphan_output_section::set_section_addresses): Ditto.
7040
7041 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7042
7043 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7044 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7045
7046 2010-05-18 Rafael Espindola <espindola@google.com>
7047
7048 * options.cc (General_options::finalize): Handle -nostdlib.
7049 * options.h (nostdlib): New option.
7050 * script.cc (script_add_search_dir): Handle -nostdlib.
7051
7052 2010-05-12 Doug Kwan <dougkwan@google.com>
7053
7054 * arm.cc (Target_arm::do_finalize_sections): Create an empty
7055 attributes section only if there no attributes section after merging.
7056 (Target_arm::merge_object_attributes): Move value of
7057 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7058 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7059 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7060 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7061 and arm_attr_merge_7.stdout.
7062 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7063 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7064 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7065 arm_attr_merge_7b.o): New rules.
7066 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7067 arm_attr_merge_7
7068 * testsuite/Makefile.in: Regenerate.
7069 * testsuite/arm_attr_merge.sh: New file.
7070 * testsuite/arm_attr_merge_[67][ab].s: Same.
7071
7072 2010-05-05 Nick Clifton <nickc@redhat.com>
7073
7074 * po/es.po: Updated Spanish translation.
7075
7076 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7077
7078 * Makefile.am (install-exec-local): Properly install gold as
7079 default cross linker.
7080 * Makefile.in: Regenerated.
7081
7082 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
7083 Nick Clifton <nickc@redhat.com>
7084
7085 * configure.ac (install_as_default): Define and set to false
7086 unless --enable-gold or --enable-gold=both/gold has been
7087 specified.
7088 * configure: Regenerate.
7089
7090 * Makefile.am (install-exec-local): Install the executable as
7091 'ld.gold'. If install_as_default is true then also install it as
7092 'ld'.
7093 * Makefile.in: Regenerated.
7094
7095 2010-04-24 Ian Lance Taylor <iant@google.com>
7096
7097 * layout.cc (Layout::layout_reloc): In relocatable link don't
7098 combine reloc sections for grouped sections.
7099
7100 2010-04-23 Sriraman Tallam <tmsriram@google.com>
7101
7102 * gc.h (gc_process_relocs): Pass information on relocs pointing to
7103 sections that are not ordinary to icf.
7104 * icf.cc (get_section_contents): Handle relocation pointing to section
7105 with no object or shndx information.
7106 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7107 * testsuite/Makefile.in: Regenerate.
7108 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7109 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7110
7111 2010-04-22 Ian Lance Taylor <iant@google.com>
7112
7113 * expression.cc (Expression::Expression_eval_info): Add
7114 result_alignment_pointer field.
7115 (Expression::eval_with_dot): Add result_alignment_pointer
7116 parameter. Change all callers.
7117 (Expression::eval_maybe_dot): Likewise.
7118 (class Binary_expression): Add alignment_pointer parameter to
7119 left_value and right_value. Change all callers.
7120 (BINARY_EXPRESSION): Set result alignment.
7121 (class Trinary_expression): Add alignment_pointer parameter to
7122 arg2_value and arg3_value. Change all callers.
7123 (Trinary_cond::value): Set result alignment.
7124 (Max_expression::value, Min_expression::value): Likewise.
7125 (Align_expression::value): Likewise.
7126 * script-sections.cc (class Sections_element): Add dot_alignment
7127 parameter to set_section_addresses virtual function. Update
7128 instantiations.
7129 (class Output_section_element): Likewise.
7130 (Script_sections::create_segments): Add dot_alignment parameter.
7131 Change all callers.
7132 (Script_sections::create_segments_from_phdrs_clause): Likewise.
7133 (Script_sections::set_phdrs_clause_addresses): Likewise.
7134 * script-sections.h: Update declarations.
7135 * script.h: Update declarations.
7136 * output.h (Output_segment::set_minimum_p_align): Don't decrease
7137 min_p_align.
7138 * testsuite/script_test_3.t: Set large alignment.
7139 * testsuite/script_test_3.sh: Make sure that at least one LOAD
7140 segment has expected alignment.
7141
7142 2010-04-22 Nick Clifton <nickc@redhat.com>
7143
7144 * po/gold.pot: Updated by the Translation project.
7145 * po/vi.po: Updated Vietnamese translation.
7146
7147 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
7148
7149 * testsuite/Makefile.am (check_PROGRAMS): Add
7150 icf_virtual_function_folding_test.
7151 * testsuite/Makefile.in: Regenerated.
7152
7153 2010-04-15 Andrew Haley <aph@redhat.com>
7154
7155 * options.h (merge_exidx_entries): New option.
7156 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7157 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7158 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7159 (Target_arm::merge_exidx_entries): New function.
7160 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7161 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7162 to Arm_exidx_fixup constructor.
7163 Add new arg, merge_exidx_entries.
7164 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7165 Arm_output_section::fix_exidx_coverage.
7166
7167 2010-04-18 Sriraman Tallam <tmsriram@google.com>
7168
7169 * icf.cc (get_section_contents): Check for preemptible functions.
7170 Ignore addend when appropriate.
7171 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
7172 section folded.
7173 (add_from_relobj): Check for section folded.
7174 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7175 * symtab.h (should_add_dynsym_entry): Add new parameter.
7176 * target-reloc.h (scan_relocs): Check for section folded.
7177 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7178 Check reloc types for function pointers in shared objects.
7179 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7180 case.
7181 (icf_preemptible_functions_test): New test case.
7182 (icf_string_merge_test): New test case.
7183 * testsuite.Makefile.in: Regenerate.
7184 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7185 bar_glob. Refactor code.
7186 * testsuite/icf_preemptible_functions_test.cc: New file.
7187 * testsuite/icf_preemptible_functions_test.sh: New file.
7188 * testsuite/icf_string_merge_test.cc: New file.
7189 * testsuite/icf_string_merge_test.sh: New file.
7190 * testsuite/icf_virtual_function_folding_test.cc: New file.
7191 * testsuite/icf_virtual_function_folding_test.sh: New file.
7192
7193 2010-04-14 Doug Kwan <dougkwan@google.com>
7194
7195 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7196 for local symbol recounting if we remove a section due to ICF.
7197 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7198 there are no regular objects in input.
7199
7200 2010-04-13 Doug Kwan <dougkwan@google.com>
7201
7202 * arm.cc (Arm_input_section::set_final_data_size): Compute
7203 accurate final data size instead of using current data size.
7204
7205 2010-04-09 Doug Kwan <dougkwan@google.com>
7206
7207 * layout.cc (Layout::choose_output_section): Handle script section
7208 types.
7209 (Layout::make_output_section_for_script): Add section type parameter.
7210 Handle script section types.
7211 * layout.h (Layout::make_output_section_for_script): Add section
7212 type parameter.
7213 * output.cc (Output_section::Output_section): Initialize data member
7214 is_noload_.
7215 (Output_section::do_reset_address_and_file_offset): Do not set address
7216 to 0 if section is a NOLOAD section.
7217 * output.h (Output_section::is_noload): New method.
7218 (Output_section::set_is_noload): Ditto.
7219 (Output_section::is_noload_): New data member.
7220 * script-c.h (Script_section_type): New enum type.
7221 (struct Parser_output_section_header): Add new file section_type.
7222 * script-sections.cc (Sections_element::output_section_name): Add
7223 parameter for returning script section type.
7224 (Output_section_definition::output_section_name): Ditto.
7225 (Output_section_definition::section_type)P; New method.
7226 (Output_section_definiton::script_section_type_name): Ditto.
7227 (Output_section_definition::script_section_type_): New data member.
7228 (Output_section_definition::Output_section_definition): Initialize
7229 data member Output_section_definition::script_section_type_.
7230 (Output_section_definition::create_sections): Pass script section type
7231 to Layout::make_output_section_for_script.
7232 (Output_section_definition::output_section_name): Return script
7233 section type to caller.
7234 (Output_section_definition::set_section_address): Do not advance
7235 dot value and load address if section type is NOLOAD. Set address
7236 of NOLOAD sections regardless of section flags.
7237 (Output_section_definition::print): Print section type if it is
7238 not SCRIPT_SECTION_TYPE_NONE.
7239 (Output_section_definition::section_type): New method.
7240 (Output_section_definition::script_section_type_name): Ditto.
7241 (Script_sections::output_section_name): Add new parameter
7242 PSECTION_TYPE for returning script section type. Pass it to
7243 section elements. Handle discard sections.
7244 (Sort_output_sections::operator()): Handle NOLOAD sections.
7245 * script-sections.h (Script_sections::Section_type): New enum type.
7246 (Script_sections::output_section_name): Add a new parameter for
7247 returning script section type.
7248 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7249 INFO and NOLOAD.
7250 * yyscript.y (union): Add new field SECTION_TYPE.
7251 (COPY, DSECT, INFO, NOLOAD): New tokens.
7252 (opt_address_and_section_type): Change type to output_section_header.
7253 (section_type): New non-terminal
7254 (section_header): Handle section type.
7255 (opt_address_and_section_type): Return section type value.
7256
7257 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
7258
7259 * testsuite/plugin_common_test_1.c (foo): Add prototype.
7260 * testsuite/plugin_common_test_2.c (foo): Likewise.
7261
7262 2010-04-08 Doug Kwan <dougkwan@google.com>
7263
7264 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7265 Output_merge_data.
7266 * output.cc (Output_section::add_merge_input_section): Simplify
7267 code and return status of Output_merge_base::add_input_section.
7268 Update merge section map only if Output_merge_base::add_input_section
7269 returns true.
7270
7271 2010-04-07 Doug Kwan <dougkwan@google.com>
7272
7273 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7274 if section is marked as containing instructions but has no mapping
7275 symbols.
7276 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7277 correct section index.
7278 (Arm_relobj::find_linked_text_section): Ditto.
7279
7280 2010-04-07 Cary Coutant <ccoutant@google.com>
7281
7282 * archive.cc (include_member): Destroy Read_symbols_data object before
7283 releasing file.
7284 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7285 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7286 (Read_symbols_data::~Read_symbols_data) New destructor.
7287 (Section_relocs::Section_relocs) New constructor.
7288 (Section_relocs::~Section_relocs) New destructor.
7289 (Read_relocs_data::Read_relocs_data) New constructor.
7290 (Read_relocs_data::~Read_relocs_data) New destructor.
7291 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7292 pointers to NULL after deleting.
7293
7294 2010-04-07 Doug Kwan <dougkwan@google.com>
7295
7296 * arm.cc: Replace "endianity" with "endianness" in comments.
7297 (Arm_exidx_cantunwind): Ditto.
7298 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7299 (Arm_relobj::merge_flags_and_attributes): New method.
7300 (Arm_relobj::merge_flags_and_attributes_): New data member.
7301 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7302 (Arm_relobj::scan_sections_for_stubs): Ditto.
7303 (Arm_relobj::do_read_symbols): Check to see if we really want to
7304 merge processor-specific flags and attributes. Exit early if
7305 an object is empty except for section names and the undefined symbol.
7306 (Target_arm::do_finalize_sections): Move check for ELF format to
7307 Arm_relobj::do_read_symbols. Merge processor specific flags and
7308 attributes from a regular object only when we have determined that
7309 it is aapropriate. Do not create an .ARM.attributes section in
7310 output if there is no regular input object.
7311 (Target_arm::merge_processor_specific_flags): Check
7312 --warn-mismatch before printing any error.
7313 (Target_arm::merge_object_attributes): Ditto.
7314 * gold.cc (queue_middle_tasks): Handle the case in which there is
7315 no regular object in input.
7316 * options.cc (General_options::parse_EB): New method.
7317 (General_options::parse_EL): Same.
7318 (General_options::General_options): Initialize endianness_.
7319 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7320 New options.
7321 (General_options::Endianness): New enum.
7322 (General_options::endianness): New method.
7323 (General_options::endianness_): New data member.
7324 * parameters.cc (Parameters::set_options): Check target endianness.
7325 (Parameters::set_target_once): Ditto.
7326 (Parameters::check_target_endianness): New method.
7327 (parameters_force_valid_target): If either -EL or -EB is specified,
7328 use it to define endianness of default target.
7329 * parameters.h (Parameters::check_target_endianness): New method
7330 declaration.
7331 * target.h (class Target): Change "endianity" to "endianness"
7332 in comments.
7333
7334 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7335
7336 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7337 * configure: Regenerate.
7338 * Makefile.in: Regenerate.
7339 * testsuite/Makefile.in: Regenerate.
7340
7341 2010-04-06 Cary Coutant <ccoutant@google.com>
7342
7343 gcc PR lto/42757
7344 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7345 prevailing definitions of common symbols.
7346 * testsuite/plugin_test_6.sh: New test case.
7347 * testsuite/plugin_common_test_1.c: New test case.
7348 * testsuite/plugin_common_test_2.c: New test case.
7349 * testsuite/Makefile.am (plugin_test_6): New test case.
7350 * testsuite/Makefile.in: Regenerate.
7351
7352 2010-04-06 Nick Clifton <nickc@redhat.com>
7353
7354 * po/vi.po: New Vietnamese translation.
7355
7356 2010-03-30 Doug Kwan <dougkwan@google.com>
7357
7358 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7359
7360 2010-03-25 Doug Kwan <dougkwan@google.com>
7361
7362 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7363 to avoid a conversion warning on a 32-bit host.
7364
7365 2010-03-24 Ian Lance Taylor <iant@google.com>
7366
7367 * testsuite/script_test_3.t: Add a TLS segment.
7368 * testsuite/Makefile.am (check_PROGRAMS): Add
7369 tls_phdrs_script_test.
7370 (tls_phdrs_script_test_SOURCES): Define.
7371 (tls_phdrs_script_test_DEPENDENCIES): Define.
7372 (tls_phdrs_script_test_LDFLAGS): Define.
7373 (tls_phdrs_script_test_LDADD): Define.
7374 * testsuite/Makefile.in: Rebuild.
7375
7376 2010-03-23 Cary Coutant <ccoutant@google.com>
7377
7378 * fileread.cc (find_or_make_view): Fix comment.
7379
7380 2010-03-23 Ian Lance Taylor <iant@google.com>
7381
7382 * script-sections.cc (class Orphan_section_placement): Define
7383 PLACE_TLS and PLACE_TLS_BSS.
7384 (Orphan_section_placement::Orphan_section_placement): Initialize
7385 new places.
7386 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7387 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7388 (tls_script_test_SOURCES): Define.
7389 (tls_script_test_DEPENDENCIES): Define.
7390 (tls_script_test_LDFLAGS): Define.
7391 (tls_script_test_LDADD): Define.
7392 * testsuite/Makefile.in: Rebuild.
7393
7394 2010-03-22 Doug Kwan <dougkwan@google.com>
7395
7396 * arm.cc (Arm_relocate_functions::abs8,
7397 Arm_relocate_functions::abs16): Use correct check for overflow
7398 specified in the ARM ELF specs.
7399 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
7400 target of a BLX instruction specially.
7401 (Reloc_stub::stub_type_for_reloc): Ditto.
7402 (Relocate::relocate): Use symbolic names instead of numeric relocation
7403 codes to report error.
7404 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7405 workaround.
7406 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7407 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7408 thumb2_blx_out_of_range.stdout
7409 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7410 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7411 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7412 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7413 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7414 thumb2_blx_in_range, thumb2_blx_in_range.o,
7415 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7416 thumb2_blx_out_of_range.o): New rules.
7417 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7418 thumb2_blx_in_range and thumb2_blx_out_of_range.
7419 * testsuite/Makefile.in: Regenerate.
7420 * arm_branch_in_range.sh: Add tests for THUMB BLX.
7421 * testsuite/thumb_blx_in_range.s: New file.
7422 * testsuite/thumb_blx_out_of_range.s: New file.
7423
7424 2010-03-22 Rafael Espindola <espindola@google.com>
7425
7426 * archive.cc (Should_include): Move to archive.h.
7427 (should_include_member): Make it a member of Archive.
7428 (Lib_group): New.
7429 (Add_lib_group_symbols): New.
7430 * archive.h: Include options.h.
7431 (Archive_member): Moved from Archive.
7432 (Should_include): Moved from archive.cc.
7433 (Lib_group): New.
7434 (Add_lib_group_symbols): New.
7435 * dynobj.cc (do_should_include_member): New.
7436 * dynobj.h (do_should_include_member): New.
7437 * gold.cc (queue_initial_tasks): Update call to queue.
7438 * main.cc (main): Print lib group stats.
7439 * object.cc (do_should_include_member): New.
7440 * object.h: Include archive.h.
7441 (Object::should_include_member): New.
7442 (Object::do_should_include_member): New.
7443 (Sized_relobj::do_should_include_member): New.
7444 * options.cc (General_options::parse_start_lib): New.
7445 (General_options::parse_end_lib): New.
7446 (Input_arguments::add_file): Handle lib groups.
7447 (Input_arguments::start_group): Check we are not in a lib.
7448 (Input_arguments::start_lib): New.
7449 (Input_arguments::end_lib): New.
7450 * options.h (General_options): Add start_lib and end_lib.
7451 (Input_argument::lib_): New.
7452 (Input_argument::lib): New.
7453 (Input_argument::is_lib): New.
7454 (Input_file_lib): New.
7455 (Input_arguments::in_lib_): New.
7456 (Input_arguments::in_lib): New.
7457 (Input_arguments::start_lib): New.
7458 (Input_arguments::end_lib_): New.
7459 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7460 in unused members as preempted.
7461 (Sized_pluginobj::do_should_include_member): New.
7462 * plugin.h (Sized_pluginobj::do_should_include_member): New.
7463 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7464 return the blocker.
7465 (Read_symbols::do_whole_lib_group): New.
7466 (Read_symbols::do_lib_group): New.
7467 (Read_symbols::do_read_symbols): Handle lib groups.
7468 (Read_symbols::get_name): Handle lib groups.
7469 * readsyms.h (Read_symbols): Add an archive member pointer.
7470 (Read_symbols::do_whole_lib_group): New.
7471 (Read_symbols::do_lib_group): New.
7472 (Read_symbols::member_): New.
7473 * script.cc (read_input_script): Update call to queue_soon.
7474
7475 2010-03-19 Doug Kwan <dougkwan@google.com>
7476
7477 * arm.cc (Stub_table::Stub_table): Initialize new data members
7478 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7479 (Stub_table::add_reloc_stub): Assign stub offset and update
7480 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7481 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7482 New data members.
7483 (Stub_table::update_data_size_and_addralign): Use
7484 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7485 instead of going over all reloc stubs.
7486 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7487 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7488 Stringpool_template::offset_ to size of Stringpool_char.
7489 (Stringpool_template::new_key_offset): Remove code to initialize
7490 Stringpool_template::offset_.
7491 * stringpool.h (Stringpool_template::set_no_zero_null): Set
7492 Stringpool_template::offset_ to zero.
7493
7494 2010-03-15 Doug Kwan <dougkwan@google.com>
7495
7496 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7497 offset_.
7498 (Stringpool_template::new_key_offset): New method.
7499 (Stringpool_template::add_string): Assign offsets when adding new
7500 strings.
7501 (Stringpool_template::set_string_offsets): Do not set string offsets
7502 when not optimizing.
7503 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7504 member size_.
7505 (Chunked_vector::clear): Clear size_.
7506 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7507 (Chunked_vector::size): Return size_.
7508 (Chunked_vector::push_back): Use size_ to find insert position.
7509 (Chunked_vector::size_): New data member.
7510 (Stringpool_template::set_no_zero_null): Assert string set is empty.
7511 (Stringpool_template::new_key_offset): New method declaration.
7512 (Stringpool_template::offset_): New data member.
7513
7514 2010-03-15 Rafael Espindola <espindola@google.com>
7515
7516 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7517 Add_symbols' constructor.
7518 * readsyms.h (Add_symbols): Remove the input_group member.
7519
7520 2010-03-10 Ian Lance Taylor <iant@google.com>
7521
7522 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7523 target to ask whether a reference to a symbol requires a stack
7524 split.
7525 * target.h (Target::is_call_to_non_split): New function.
7526 (Target::do_is_call_to_non_split): Declare virtual function.
7527 * target.cc: Include "symtab.h".
7528 (Target::do_is_call_to_non_split): New function.
7529 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7530
7531 2010-03-10 Cary Coutant <ccoutant@google.com>
7532
7533 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7534 (File_read::open[1]): Remove initial mapping of whole_file_view_.
7535 (File_read::open[2]): Add whole_file_view_ to list of views.
7536 (File_read::make_view): Remove test of whole_file_view_.
7537 (File_read::find_or_make_view): Create whole_file_view_ if
7538 necessary.
7539 (File_read::clear_views): Replace bool parameter with enum;
7540 adjust all callers. Don't delete views with permanent data;
7541 do delete cached views and views from archives if
7542 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
7543 if clearing the corresponding view.
7544 * fileread.h (File_read::Clear_views_mode): New enum.
7545 (File_read::View::is_permanent_view): New method.
7546 (File_read::clear_views): Replace bool parameter
7547 with enum; adjust all callers.
7548 * options.h (General_options): Change keep_files_mapped option;
7549 add map_whole_files.
7550 * readsyms.cc (Add_symbols::run): Delete sd_ object before
7551 releasing the file.
7552 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7553 the file.
7554
7555 2010-03-10 David S. Miller <davem@davemloft.net>
7556
7557 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7558
7559 2010-03-09 Sriraman Tallam <tmsriram@google.com>
7560
7561 * icf.cc (get_section_contents): Add '@' marker after processing the
7562 merge reloc.
7563
7564 2010-03-08 Doug Kwan <dougkwan@google.com>
7565
7566 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7567 due to a conversion warning.
7568 (Arm_relobj::update_output_local_symbol_count): Check for local
7569 symbol with unset output index.
7570
7571 2010-03-05 Ian Lance Taylor <iant@google.com>
7572
7573 * options.h (class General_options): Add --spare-dynamic-tags.
7574 * output.cc (Output_data_dynamic::set_final_data_size): Implement
7575 --spare-dynamic-tags.
7576
7577 2010-03-05 Ian Lance Taylor <iant@google.com>
7578
7579 * incremental.cc: Include "libiberty.h".
7580
7581 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
7582
7583 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7584 function, is_info_ member.
7585 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7586 (Versions::Versions): Update caller.
7587 (Versions::define_base_version): Likewise.
7588 (Versions::add_def): Likewise.
7589
7590 2010-03-03 Sriraman Tallam <tmsriram@google.com>
7591
7592 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7593 (Scan::possible_function_pointer_reloc): New function.
7594 (Scan::local_reloc_may_be_function_pointer): Change to call
7595 possible_function_pointer_reloc.
7596 (Scan::global_reloc_may_be_function_pointer): Ditto.
7597 * icf.h (Icf::check_section_for_function_pointers): Change to reject
7598 relocations in ".data.rel.ro._ZTV" section.
7599 * testsuite/icf_safe_so_test.sh: Change to pass i386.
7600 * testsuite/icf_safe_so_test.cc: Ditto.
7601 * testsuite/icf_safe_test.cc: Ditto.
7602 * testsuite/icf_safe_test.sh: Ditto.
7603
7604 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7605 Ian Lance Taylor <iant@google.com>
7606
7607 * target-reloc.h (relocate_section): Check the symbol table index
7608 for -1U before setting the local symbol index.
7609 (scan_relocatable_relocs): If copying the relocation, record that
7610 the local symbol is required.
7611 * object.h (Symbol_value::is_output_symtab_index_set): New
7612 function.
7613 (Symbol_value::may_be_discarded_from_output_symtab): New
7614 function.
7615 (Symbol_value::has_output_symtab_entry): New function.
7616 (Symbol_value::needs_output_symtab_entry): Remove.
7617 (Symbol_value::output_symtab_index): Make sure the symbol index is
7618 set.
7619 (Symbol_value::set_output_symtab_index): Make sure the symbol
7620 index is not set. Make sure the new index is valid.
7621 (Symbol_value::set_must_have_output_symtab_entry): New function.
7622 (Symbol_value::has_output_dynsym_entry): New function.
7623 (Symbol_value::set_output_dynsym_index): Make sure the new index
7624 is valid.
7625 (Sized_relobj::set_must_have_output_symtab_entry): New function.
7626 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7627 local symbol if permitted.
7628 (Sized_relobj::do_finalize_local_symbols): Call
7629 is_output_symtab_index_set rather than needs_output_symtab_entry.
7630 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7631 rather than needs_output_symtab_entry. Call
7632 has_output_dynsym_entry rather than needs_output_dynsym_entry.
7633 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7634 is_output_symtab_index_set rather than needs_output_symtab_entry.
7635 * testsuite/discard_locals_relocatable_test.c: New file.
7636 * testsuite/discard_locals_test.sh: Test -r.
7637 * testsuite/Makefile.am (check_DATA): Add
7638 discard_locals_relocatable_test1.syms,
7639 discard_local_relocatable_test2.syms.
7640 (MOSTLYCLEANFILES): Likewise. Also add
7641 discard_locals_relocatable_test1.lout and
7642 discard_locals_relocatable_test2.out.
7643 (discard_locals_relocatable_test1.syms): New target.
7644 (discard_locals_relocatable_test.o): New target.
7645 (discard_locals_relocatable_test1.out): New target.
7646 (discard_locals_relocatable_test2.syms): New target.
7647 (discard_locals_relocatable_test2.out): New target.
7648 (various): Add missing ../ld-new dependencies.
7649 * testsuite/Makefile.in: Rebuild.
7650
7651 2010-03-03 Nick Clifton <nickc@redhat.com>
7652
7653 * po/fi.po: New Finnish translation.
7654
7655 2010-03-01 Doug Kwan <dougkwan@google.com>
7656
7657 * layout.cc (Layout::Layout): Force section types of .init_array*,
7658 .preinit_array* and .fini_array* sections.
7659 * output.cc (Output_section::Input_section_sort_entry::has_priority):
7660 Fix check of return value of std::string::find.().
7661 (Output_section::Input_section_sort_compare::operator()): Remove
7662 comment about .init_array.
7663 (Output_section::Input_section_sort_init_fini_compare::operator()):
7664 New method.
7665 (Output_section::sort_attached_input_sections): Handle .init_array
7666 and .fini_array specially.
7667 * output.h (Output_section::Inut_section_sort_compare): Update
7668 comment.
7669 (Output_section::Input_section_sort_init_fini_compare): New struct.
7670
7671 2010-02-26 Doug Kwan <dougkwan@google.com>
7672
7673 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7674 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7675 * testsuite/debug_msg.sh: Avoid matching source line number for
7676 use of global variable undef_int.
7677
7678 2010-02-26 Doug Kwan <dougkwan@google.com>
7679
7680 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7681 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7682 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7683 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7684 * options.cc (General_options::General_options): Initialize member
7685 fix_v4bx_.
7686 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7687 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7688 and rm_no_fix_v4bx.stdout
7689 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7690 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7691 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7692 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7693 and arm_no_fix_v4bx.
7694 * Makefile.in: Regenerate.
7695 * testsuite/arm_fix_v4bx.s: New file.
7696 * testsuite/arm_fix_v4bx.sh: Ditto.
7697
7698 2010-02-24 Doug Kwan <dougkwan@google.com>
7699
7700 * arm.cc (Target_arm::got_section): Make the .got section the first
7701 non RELRO section in the data segment.
7702 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7703 suffixes of section names.
7704
7705 2010-02-24 Doug Kwan <dougkwan@google.com>
7706
7707 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7708 flags and attributes merging if an input file is a binary file.
7709 * fileread.cc (Input_file::open): Record format of original file.
7710 * fileread.h (Input_file::Format): New enum type.
7711 (Input_file::Input_file): Initialize data member format_.
7712 (Input_file::format): New method definition.
7713 (Input_file::format_):: New data member.
7714
7715 2010-02-24 Doug Kwan <dougkwan@google.com>
7716
7717 * arm.cc (Arm_output_data_got): New class.
7718 (ARM_TCB_SIZE): New constant
7719 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7720 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7721 If user uses a script with a SECTIONS clause, issue only a warning
7722 for a misplaced EXIDX input section. Otherwise, issue an error.
7723 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7724 garbage collection.
7725 (Target_arm::got_mode_index_entry): Handle static linking.
7726 (Target_arm::Scan::local): Ditto.
7727 (Target_arm::Scan::global): Ditto.
7728 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
7729 all incorrectly implemented relocations.
7730 (Target_arm::fix_exidx_coverage): Pass layout to
7731 Arm_output_section::fix_exidx_coverage.
7732 * layout.cc (Layout::section_name_mapping): Remove trailing dots
7733 from ".ARM.exidx." and ".ARM.extab.".
7734
7735 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7736
7737 * arm.cc (Target_arm::do_finalize_sections): Create attribute
7738 section if it does not already exist.
7739 * attributes.cc (Attributes_section_data::Attributes_section_data):
7740 Don't crash if size is zero.
7741
7742 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7743 Ian Lance Taylor <iant@google.com>
7744
7745 * gold.cc (queue_middle_tasks): If no input files were opened,
7746 exit.
7747 * workqueue.h (Task_function::Task_function): Assert that there is
7748 a blocker.
7749
7750 2010-02-22 Doug Kwan <dougkwan@google.com>
7751
7752 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7753 * icf.cc (get_section_contents): Cast snprintf arguments to long long
7754 types to avoid warnings due to different uint64_t implementations
7755 on different hosts.
7756
7757 2010-02-21 Doug Kwan <dougkwan@google.com>
7758
7759 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7760 handling of the maximum backward branch offset.
7761 (Arm_relocate_functions::thumb_branch_common): Ditto.
7762 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7763 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7764 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7765 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7766 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7767 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7768 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7769 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7770 thumb_bl_out_of_range thumb_bl_out_of_range.o,
7771 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7772 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7773 thumb2_bl_out_of_range.o): New rules.
7774 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7775 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7776 thumb2_bl_out_of_range
7777 * testsuite/Makefile.in: Regenerate.
7778 * testsuite/arm_bl_in_range.s: New file.
7779 * testsuite/arm_bl_out_of_range.s: Ditto.
7780 * testsuite/arm_branch_in_range.sh: Ditto.
7781 * testsuite/arm_branch_range.t: Ditto.
7782 * testsuite/thumb2_branch_range.t: Ditto.
7783 * testsuite/thumb_bl_in_range.s: Ditto.
7784 * testsuite/thumb_bl_out_of_range.s: Ditto.
7785 * testsuite/thumb_branch_range.t: Ditto.
7786
7787 2010-02-20 Sriraman Tallam <tmsriram@google.com>
7788
7789 * gc.h (gc_process_relocs): Change vectors to point to the new list.
7790 Add reloc offset information.
7791 * icf.cc (get_section_contents): Change iterators to point to the new
7792 vectors. Add reloc offset information to the contents.
7793 * icf.h (Icf::Sections_reachable_info): New typedef.
7794 (Icf::Sections_reachable_list): New typedef.
7795 (Icf::Offset_info): New typedef.
7796 (Icf::Reloc_info): New struct typedef.
7797 (Icf::Reloc_info_list): New typedef.
7798 (Icf::symbol_reloc_list): Delete method.
7799 (Icf::addend_reloc_list): Delete method.
7800 (Icf::section_reloc_list): Delete method.
7801 (Icf::reloc_info_list): New method.
7802 (Icf::reloc_info_list_): New member.
7803
7804 2010-02-19 Doug Kwan <dougkwan@google.com>
7805
7806 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7807 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7808 * arm.cc (Arm_relocation_functions): New forward declaration.
7809 (Target_arm::Target_arm): Initialize new data members
7810 got_mod_index_offset_ and tls_base_symbol_defined_.
7811 (Target_arm::Relocate::relocate_tls): New method.
7812 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7813 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7814 New methods.
7815 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7816 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7817 (Target_arm::got_mod_index_offset_,
7818 Target_arm::tls_base_symbol_defined_): New data members.
7819 (Target_arm::Scan::local, Target::Scan::global,
7820 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7821 relocations.
7822
7823 2010-02-18 Doug Kwan <dougkwan@google.com>
7824
7825 * arm.cc (Arm_relobj::find_linked_text_section): New method.
7826 (Arm_relobj::make_exidx_input_section): Pass section index of linked
7827 text section as a parameter becuase some broken tools may not set
7828 the link in section header.
7829 (Target_arm::has_got_section): New method.
7830 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7831 without any mapping symbol as data only. Remove warning.
7832 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7833 link in its section header, try to discover the link by inspecting the
7834 REL31 relocation at the beginning of the section.
7835 (Target_arm::Scan::check_non_pic): Report name of offending relocation
7836 in error message.
7837 (Target_arm::Scan::global): Treat any reference to the symbol
7838 _GLOBAL_OFFSET_TABLE_ as a GOT access.
7839
7840 2010-02-12 Sriraman Tallam <tmsriram@google.com>
7841
7842 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7843 (Scan::global_reloc_may_be_function_pointer): New function.
7844 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7845 (Scan::global_reloc_may_be_function_pointer): New function.
7846 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7847 (Scan::global_reloc_may_be_function_pointer): New function.
7848 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7849 (Scan::global_reloc_may_be_function_pointer): New function.
7850 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7851 (Scan::global_reloc_may_be_function_pointer): New function.
7852 (Scan::possible_function_pointer_reloc): New function.
7853 (Target_x86_64::can_check_for_function_pointers): New function.
7854 * gc.h (gc_process_relocs): Scan relocation types to determine if
7855 function pointers were taken for targets that support it.
7856 * icf.cc (Icf::find_identical_sections): Include functions for
7857 folding in safe ICF whose pointer is not taken.
7858 * icf.h (Secn_fptr_taken_set): New typedef.
7859 (fptr_section_id_): New member.
7860 (section_has_function_pointers): New function.
7861 (set_section_has_function_pointers): New function.
7862 (check_section_for_function_pointers): New function.
7863 * options.h: Fix comment for safe ICF option.
7864 * target.h (can_check_for_function_pointers): New function.
7865 * testsuite/Makefile.am: Add icf_safe_so_test test case.
7866 Modify icf_safe_test for X86-64.
7867 * testsuite/Makefile.in: Regenerate.
7868 * testsuite/icf_safe_so_test.cc: New file.
7869 * testsuite/icf_safe_so_test.sh: New file.
7870 * testsuite/icf_safe_test.cc (kept_func_3): New function.
7871 (main): Change to take pointer to function kept_func_3.
7872 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7873 folding is done correctly for X86-64.
7874
7875 2010-02-12 David S. Miller <davem@davemloft.net>
7876
7877 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7878 is_symbolless parameter.
7879 (Output_reloc<SHT_REL>::is_symbolless): New.
7880 (Output_reloc<SHT_REL>::is_symbolless_): New.
7881 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7882 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7883 (Output_reloc<SHT_RELA>::is_symbolless): New.
7884 (Output_data_reloc::add_global): Handle is_symbolless.
7885 (Output_data_reloc::add_global_relative): Likewise.
7886 (Output_data_reloc::add_local): Likewise.
7887 (Output_data_reloc::add_local_relative): Likewise.
7888 (Output_data_reloc::add_symbolless_global_addend): New.
7889 (Output_data_reloc::add_symbolless_local_addend): New.
7890 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7891 is_symbolless.
7892 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7893 instead of ->is_relative_
7894 (Output_reloc::write): Likewise.
7895 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7896 (Output_reloc::write_rel): Simplify.
7897
7898 * sparc.cc (Target_sparc::Scan::local): Use
7899 ->add_symbolless_local_addend as needed.
7900 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7901 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
7902 based upon relocation offset.
7903
7904 2010-02-11 Doug Kwan <dougkwan@google.com>
7905
7906 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7907 (Target_arm::Scan::global): Ditto. Also remove a comment before the
7908 beginning of function.
7909 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7910 and MOVT_ABS relocations. Those are non issued in scanning. Fix
7911 parameter is_32bit in calls to should_apply_static_reloc.
7912 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7913 (check_DATA): Add arm_abs_global.stdout.
7914 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7915 arm_abs_global.stdout): New rules.
7916 (MOSTLLYCLEANFILES): Add arm_abs_global
7917 * Makefile.in: Regenerate.
7918 * testsuite/arm_abs_global.s: New file.
7919 * testsuite/arm_abs_global.sh: Ditto.
7920 * testsuite/arm_abs_lib.s: Ditto.
7921
7922 2010-02-11 Ian Lance Taylor <iant@google.com>
7923
7924 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7925 Read_relocs task.
7926 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
7927 Allocate_commons_task first.
7928 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7929 task, rather than symtab_lock_.
7930 (Gc_process_relocs::~Gc_process_relocs): New function.
7931 (Gc_process_relocs::is_runnable): Check this_blocker_.
7932 (Gc_process_relocs::locks): Use next_blocker_ rather than
7933 blocker_.
7934 (Scan_relocs::~Scan_relocs): New function.
7935 (Scan_relocs::is_runnable): Check this_blocker_ rather than
7936 symtab_lock_.
7937 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
7938 next_blocker_.
7939 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7940 fields. Add this_blocker_ and next_blocker_ fields. Adjust
7941 constructor accordingly.
7942 (class Gc_process_relocs): Likewise.
7943 (class Scan_relocs): Likewise.
7944 * common.h (class Allocate_commons_task): Remove symtab_lock_
7945 field, and corresponding constructor parameter.
7946 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7947 symtab_lock_.
7948 (Allocate_commons_task::locks): Likewise.
7949
7950 2010-02-11 Ian Lance Taylor <iant@google.com>
7951
7952 * gold-threads.h (class Once): Define.
7953 (class Initialize_lock): Rewrite as child of Once.
7954 * gold-threads.cc (class Once_initialize): Define.
7955 (once_pointer_control): New static variable.
7956 (once_pointer, once_arg): New static variables.
7957 (c_run_once): New static function.
7958 (Once::Once, Once::run_once, Once::internal_run): New functions.
7959 (class Initialize_lock_once): Remove.
7960 (initialize_lock_control): Remove.
7961 (initialize_lock_pointer): Remove.
7962 (initialize_lock_once): Remove.
7963 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7964 (Initialize_lock::initialize): Rewrite.
7965 (Initialize_lock::do_run_once): New function.
7966 * archive.cc (Archive::interpret_header): Only clear name if it is
7967 not already empty.
7968 * fileread.cc: Include "gold-threads.h"
7969 (file_counts_lock): New static variable.
7970 (file_counts_initialize_lock): Likewise.
7971 (File_read::release): Only increment counts when using --stats.
7972 Use a lock around the increment.
7973 * parameters.cc (class Set_parameters_target_once): Define.
7974 (set_parameters_target_once): New static variable.
7975 (Parameters::Parameters): Move here from parameters.h.
7976 (Parameters::set_target): Rewrite.
7977 (Parameters::set_target_once): New function.
7978 (Parameters::clear_target): Move here and rewrite.
7979 * parameters.h (class Parameters): Update declarations. Add
7980 set_parameters_target_once_ field.
7981 (Parameters::Parameters): Move to parameters.cc.
7982 (Parameters::clear_target): Likewise.
7983 * readsyms.cc (Read_symbols::do_group): Create a Start_group
7984 task.
7985 (Start_group::~Start_group): New function.
7986 (Start_group::is_runnable): New function.
7987 (Start_group::locks, Start_group::run): New functions.
7988 (Finish_group::run): Change saw_undefined to size_t.
7989 * readsyms.h (class Start_group): Define.
7990 (class Finish_group): Change saw_undefined_ field to size_t.
7991 (Finish_group::Finish_group): Remove saw_undefined and
7992 this_blocker parameters. Change all callers.
7993 (Finish_group::set_saw_undefined): New function.
7994 (Finish_group::set_blocker): New function.
7995 * symtab.h (class Symbol_table): Change saw_undefined to return
7996 size_t. Change saw_undefined_ field to size_t.
7997 * target-select.cc (Set_target_once::do_run_once): New function.
7998 (Target_selector::Target_selector): Initialize set_target_once_
7999 field. Don't initialize lock_ and initialize_lock_ fields.
8000 (Target_selector::instantiate_target): Rewrite.
8001 (Target_selector::set_target): New function.
8002 * target-select.h (class Set_target_once): Define.
8003 (class Target_selector): Update declarations. Make
8004 Set_target_once a friend. Remove lock_ and initialize_lock_
8005 fields. Add set_target_once_ field.
8006
8007 2010-02-10 Ian Lance Taylor <iant@google.com>
8008
8009 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8010 queueing any tasks.
8011 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
8012 (queue_middle_tasks): Add all blockers before queueing any tasks.
8013 (queue_final_tasks): Likewise.
8014 * token.h (Task_token::add_blockers): New function.
8015 * object.h (Input_objects::number_of_relobjs): New function.
8016
8017 2010-02-10 Ian Lance Taylor <iant@google.com>
8018
8019 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8020 shared, not if not position independent.
8021 * x86_64.cc (Relocate::relocate_tls): Likewise.
8022 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8023 (tls_pie_pic_test): New target.
8024 * testsuite/Makefile.in: Rebuild.
8025
8026 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8027 (tls_test_main_pie.o, tls_test_pie.o): New targets.
8028 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8029 * testsuite/Makefile.in: Rebuild.
8030
8031 2010-02-09 David S. Miller <davem@davemloft.net>
8032
8033 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8034 R_SPARC_RELATIVE using ->add_local_relative().
8035 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8036
8037 * output.h (Output_data_dynamic::add_section_size): New method
8038 that takes two Output_data objects.
8039 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8040 entry param. Handle it in initializers.
8041 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8042 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8043 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8044 arg.
8045 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8046 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8047 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8048 for dynrel_includes_plt.
8049 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8050 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8051 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8052 before .rela.plt
8053 (Target_sparc::do_finalize_sections): Update to pass true for
8054 dynrel_includes_plt.
8055 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8056 output before .rela.plt
8057 (Target_powerpc::do_finalize_sections): Update to pass true for
8058 dynrel_includes_plt when 32-bit.
8059
8060 2010-02-08 Doug Kwan <dougkwan@google.com>
8061
8062 * arm.cc (Arm_relobj::simple_input_section_output_address): New
8063 method.
8064 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8065 Arm_relobj::scan_section_for_cortex_a8_stubs,
8066 Arm_relobj::do_relocation_section): Instead of calling
8067 Output_section::output_address, use faster
8068 Arm_relobj::simple_input_section_output_address.
8069
8070 2010-02-08 David S. Miller <davem@davemloft.net>
8071
8072 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8073 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8074 relocation helper function.
8075
8076 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8077 just like R_SPARC_GOT{10,13,22}.
8078 (Target_sparc::Scan::local): Likewise.
8079 (Target_sparc::Relocate:relocate): Likewise.
8080
8081 2010-02-06 Ian Lance Taylor <iant@google.com>
8082
8083 * configure.ac: Rewrite targetobjs duplicate removal code to use
8084 only shell constructs.
8085 * configure: Rebuild.
8086
8087 2010-02-05 Doug Kwan <dougkwan@google.com>
8088
8089 PR 11247
8090 * arm.cc (Arm_relobj::section_is_scannable): New method.
8091 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8092 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8093
8094 2010-02-04 Doug Kwan <dougkwan@google.com>
8095
8096 PR 11247
8097 * arm-reloc-property.cc (cstdio): Include.
8098 * configure.ac (targetobjs): Remove duplicates.
8099 * configure: Regenerate.
8100 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8101 big and little endian version for a given address size.
8102
8103 2010-02-03 Doug Kwan <dougkwan@google.com>
8104
8105 * arm-reloc-property.cc
8106 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8107 definition.
8108 * arm-reloc-property.h
8109 (Arm_reloc_property_table::get_implemented_static_reloc_property):
8110 New method definition.
8111 (Arm_reloc_property_table::reloc_name_in_error_message): New method
8112 declaration.
8113 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8114 overflow to N.
8115 (GOT_PREL): Change implemented to Y.
8116 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8117 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8118 (Arm_relocate_functions::movw_abs_nc): Remove method.
8119 (Arm_relocate_functions::movt_abs): Ditto.
8120 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8121 (Arm_relocate_functions::thm_movt_abs): Ditto.
8122 (Arm_relocate_functions::movw_rel_nc): Ditto.
8123 (Arm_relocate_functions::movw_rel): Ditto.
8124 (Arm_relocate_functions::movt_rel): Ditto.
8125 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8126 (Arm_relocate_functions:thm_movw_rel): Ditto.
8127 (Arm_relocate_functions:thm_movt_rel): Ditto.
8128 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8129 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8130 New method definitions.
8131 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8132 (Arm_relocation_functions::arm_grp_ldr): Ditto.
8133 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8134 (Arm_relocation_functions::arm_grp_ldc): Ditto.
8135 (Target_arm::Relocate::relocate): Check for non-static or
8136 unimplemented relocation code and exit early. Change calls to
8137 Target_arm::reloc_uses_thumb_bit and
8138 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8139 instead. Refactor code to handle similar relocations to increase
8140 code sharing. Remove check for unsupported relocation code in switch
8141 statement.
8142 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8143 relocation property table to find out size. Change error message to
8144 print out the name of a relocation code instead of the numeric value.
8145 (Target_arm::scan_reloc_for_stub): Use relocation property table
8146 instead of calling Target_arm::reloc_uses_thumb_bit().
8147
8148 2010-02-02 Doug Kwan <dougkwan@google.com>
8149
8150 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8151 types of relaxed input section.
8152
8153 2010-02-02 Doug Kwan <dougkwan@google.com>
8154
8155 * Makefile.am (HFILES): Add arm-reloc-property.h.
8156 (DEFFILES): New.
8157 (TARGETSOURCES): Add arm-reloc-property.cc
8158 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8159 (libgold_a_SOURCES): $(DEFFILES)
8160 * Makefile.in: Regenerate.
8161 * arm-reloc-property.cc: New file.
8162 * arm-reloc-property.h: New file.
8163 * arm-reloc.def: New file.
8164 * arm.cc: Update comments.
8165 (arm-reloc-property.h): New included header.
8166 (arm_reloc_property_table): New global variable.
8167 (Target_arm::do_select_as_default_target): New method definition.
8168 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8169 arm-reloc-property to targ_extra_obj.
8170 * parameters.cc (set_parameters_target): Call
8171 Target::select_as_default_target().
8172 * target.h (Target::select_as_default_target): New method definition.
8173 (Target::do_select_as_default_target): Same.
8174
8175 2010-02-01 Doug Kwan <dougkwan@google.com>
8176
8177 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8178 first_output_text_section_.
8179 (Arm_exidx_fixup::first_output_text_section): New method definition.
8180 (Arm_exidx_fixup::first_output_text_section_): New data member.
8181 (Arm_exidx_fixup::process_exidx_section): Record the first text
8182 output section seen.
8183 (Arm_output_section::fix_exidx_coverage): Set correct linked section
8184 and entsize in output section header.
8185
8186 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8187
8188 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8189 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8190 (Arm_relocate_functions::thm_alu11): New Method.
8191 (Arm_relocate_functions::thm_pc8): New Method.
8192 (Arm_relocate_functions::thm_pc12): New Method.
8193 (Target_arm::Scan::local): Handle the relocations.
8194 (Target_arm::Scan::global): Likewise.
8195 (Target_arm::Relocate::relocate): Likewise.
8196 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8197
8198 2010-01-29 Doug Kwan <dougkwan@google.com>
8199
8200 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8201 of relocation types as ld.
8202
8203 2010-01-29 Doug Kwan <dougkwan@google.com>
8204
8205 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8206 to public.
8207 (Arm_relocate_functions::thumb_branch_common): Ditto.
8208 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8209 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8210 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8211 Arm_relocate_functions::jump24): Remove.
8212 (Target_arm::Relocate::relocate): Adjust code to call
8213 Arm_relocation_functions::arm_branch_common and
8214 Arm_relocation_functions::thumb_branch_common instead of their removed
8215 wrappers. Merge switch-cases together to reduce source code size.
8216
8217 2010-01-29 Doug Kwan <dougkwan@google.com>
8218
8219 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8220 output_local_symbol_count_needs_update_.
8221 (Arm_relobj::output_local_symbol_count_needs_update,
8222 Arm_relobj::set_output_local_symbol_count_needs_update,
8223 Arm_relobj::update_output_local_symbol_count): New methods.
8224 (Arm_relobj::output_local_symbol_count_needs_update_): New data
8225 member.
8226 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8227 of pointed function as in a R_ARM_PREL31 relocation.
8228 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8229 for output local symbol count updating.
8230 (Target_arm::do_relax): Update output local symbol counts in objects
8231 if necessary.
8232 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8233
8234 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8235
8236 * arm.cc: Added support for the ARM relocations:
8237 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8238 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8239 (Arm_relocate_functions::movw_rel_nc): Renamed (was
8240 movw_prel_nc).
8241 (Arm_relocate_functions::movw_rel): New method.
8242 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8243 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8244 thm_movw_prel_nc).
8245 (Arm_relocate_functions::thm_movw_rel): New method.
8246 (Arm_relocate_functions::thm_movt_rel): Renamed (was
8247 thm_movt_prel).
8248 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8249 relocations.
8250 (Target_arm::Scan::global): Likewise.
8251 (Target_arm::Relocate::relocate): Likewise.
8252 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8253 Likewise.
8254
8255 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8256
8257 * arm.cc: Added support for ARM group relocations.
8258 (Target_arm::reloc_needs_sym_origin): New method.
8259 (Arm_relocate_functions::calc_grp_kn): New method.
8260 (Arm_relocate_functions::calc_grp_residual): New method.
8261 (Arm_relocate_functions::calc_grp_gn): New method.
8262 (Arm_relocate_functions::arm_grp_alu): New Method.
8263 (Arm_relocate_functions::arm_grp_ldr): New Method.
8264 (Arm_relocate_functions::arm_grp_ldrs): New Method.
8265 (Arm_relocate_functions::arm_grp_ldc): New Method.
8266 (Target_arm::Scan::local): Handle the ARM group relocations.
8267 (Target_arm::Scan::global): Likewise.
8268 (Target_arm::Relocate::relocate): Likewise.
8269 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8270 Likewise.
8271
8272 2010-01-26 Doug Kwan <dougkwan@google.com>
8273
8274 * arm.cc (set): Include.
8275 (class Arm_exidx_fixup): Change type of last_input_section_ to const
8276 pointer type.
8277 (Arm_output_section::Text_section_list): New type.
8278 (Arm_output_section::append_text_sections_to_list): New method.
8279 (Arm_output_section::fix_exidx_coverage): Ditto.
8280 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8281 (Arm_relobj::convert_input_section_to_relaxed_section): Use
8282 Relobj::set_section_offset() instead of
8283 Sized_relobj::invalidate_section_offset().
8284 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8285 parameter for section headers. Ignore relocation sections for
8286 unallocated sections and EXIDX sections.
8287 (Target_arm::fix_exidx_coverage): New method.
8288 (Target_arm::output_section_address_less_than): New type.
8289 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8290 linked text section instead of the EXIDX section.
8291 (Arm_output_section::create_stub_group): Add an assertion to check
8292 that this is not an EXIDX output section.
8293 (Arm_output_section::append_text_sections_to_list): New method.
8294 (Arm_output_section::fix_exidx_coverage): Ditto.
8295 (Arm_relobj::scan_sections_for_stubs): Adjust call to
8296 Arm_relobj::section_needs_reloc_stub_scanning.
8297 (Target_arm::do_relax): Fix EXIDX output section coverage in the
8298 first pass.
8299 (Target_arm::fix_exidx_coverage): New method.
8300 * object.h (Relobj::set_output_section): New method.
8301 (Sized_relobj::invalidate_section_offset): Remove method.
8302 (Sized_relobj::do_invalidate_section_offset): Remove method.
8303 (Sized_relobj::do_set_section_offset): Handle offset value -1.
8304
8305 2010-01-25 Doug Kwan <dougkwan@google.com>
8306
8307 * arm.cc (Arm_exidx_merged_section::do_output_offset):
8308 Fix warning due to signed and unsigned comparison on a 32-bit host.
8309
8310 2010-01-22 Doug Kwan <dougkwan@google.com>
8311
8312 * arm.cc (Target_arm::do_relax): Record an output section for section
8313 offset adjustment it contains any stub table that has changed.
8314 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8315 offsets in an output section if necessary.
8316 * output.cc (Output_section::Output_section): Initialize
8317 section_offsets_need_adjustments_.
8318 (Output_section::add_input_section_for_script): Renamed to
8319 Output_section::add_simple_input_section.
8320 (Output_section::save_states): Add a comment.
8321 (Output_section::discard_states): New method defintion.
8322 (Output_section::adjust_section_offsets): Same.
8323 * output.h (Output_section::add_input_section_for_script): Renamed to
8324 Output_section::add_simple_input_section.
8325 (Output_section::discard_states): New method declaration.
8326 (Output_section::adjust_section_offsets): Same.
8327 (Output_section::section_offsets_need_adjustment,
8328 Output_section::set_section_offsets_need_adjustment): New method
8329 definitions.
8330 (Output_section::section_offsets_need_adjustment_): New data member.
8331 * script-sections.cc
8332 (Output_section_element_input::set_section_address): Adjust code for
8333 renaming of Output_section::add_input_section_for_script.
8334 (Orphan_output_section::set_section_address): Same.
8335
8336 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8337
8338 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8339 Fix_v4bx enum values .
8340 * gold/options.h (General_options): New option definitions.
8341 (General_options::fix_v4bx): New method.
8342 (General_options::Fix_v4bx): New enum.
8343 * gold/options.cc (General_options::parse_fix_v4bx): New method.
8344 (General_options::parse_fix_v4bx_interworking): New method.
8345
8346 2010-01-22 Doug Kwan <dougkwan@google.com>
8347
8348 * arm.cc (Arm_exidx_fixup): New class.
8349
8350 2010-01-21 Doug Kwan <dougkwan@google.com>
8351
8352 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8353 classes.
8354 (Arm_exidx_section_offset_map): New type.
8355
8356 2010-01-21 Doug Kwan <dougkwan@google.com>
8357
8358 * arm.cc (Arm_exidx_input_section): New class.
8359 (Arm_relobj::exidx_input_section_by_link,
8360 Arm_relobj::exidx_input_section_by_shndx,
8361 Arm_relobj::make_exidx_input_section): New methods.
8362 (read_arm_attributes_section): Remove.
8363 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8364 information about them.
8365 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8366 to here.
8367
8368 2010-01-20 Doug Kwan <dougkwan@google.com>
8369
8370 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8371 Input_section_specifier to Section_id.
8372 (Target_arm::new_arm_input_section: Adjust code for change of key
8373 type.
8374 (Target_arm::find_arm_input_section): Ditto.
8375 * gc.h (object.h): Include for Section_id nand Section_id_hash.
8376 (Section_id): Remove.
8377 (Garbage_collection::Section_id_hash): Remove.
8378 * icf.h (object.h): Include for Section_id nand Section_id_hash.
8379 (Section_id): Remove.
8380 (Icf::Section_id_hash): Remove.
8381 * object.h (Section_id, Const_section_id, Section_id_hash,
8382 Const_section_id_hash): New type definitions.
8383 * output.cc (Output_section::add_relaxed_input_section): Change to
8384 use Const_section_id instead of Input_section_specifier as key type.
8385 (Output_section::add_merge_input_section): Ditto.
8386 (Output_section::build_relaxation_map): Change to use Section_id
8387 instead of Input_section_specifier as key type.
8388 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8389 Ditto.
8390 (Output_section::convert_input_sections_to_relaxed_sections): Change
8391 to use Const_section_id instead of Input_section_specifier as key type.
8392 (Output_section::find_merge_section): Ditto.
8393 (Output_section::find_relaxed_input_section): Ditto.
8394 * output.h (Input_section_specifier): Remove class.
8395 (Output_section::Output_section_data_by_input_section_map): Change
8396 key type to Const_section_id.
8397 (Output_section::Output_relaxed_input_section_by_input_section_map):
8398 Ditto.
8399 (Output_section::Relaxation_map): Change key type to Section_id.
8400
8401 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8402
8403 * gold/arm.cc: Added support for R_ARM_V4BX relocation
8404 (class Arm_v4bx_stub): New class.
8405 (DEF_STUBS): Updated definition to support v4_veneer_bx.
8406 (Stub_factory::make_arm_v4bx_stub): New method.
8407 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8408 (Stub_table::empty): Handle v4bx stubs.
8409 (Stub_table::add_arm_v4bx_stub): New method.
8410 (Stub_table::find_arm_v4bx_stub): New method.
8411 (Arm_relocate_functions::v4bx): New method.
8412 (Target_arm::fix_v4bx): New method.
8413 (Target_arm::Target_arm): Handle R_ARM_V4BX.
8414 (Stub_table::relocate_stubs): Likewise.
8415 (Stub_table::do_write): Likewise.
8416 (Stub_table::update_data_size_and_addralign): Likewise.
8417 (Stub_table::finalize_stubs): Likewise.
8418 (Target_arm::Scan::local): Likewise.
8419 (Target_arm::Scan::global): Likewise.
8420 (Target_arm::do_finalize_sections): Likewise.
8421 (Target_arm::Relocate::relocate): Likewise.
8422 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8423 Likewise.
8424 (Target_arm::scan_reloc_for_stub): Likewise.
8425 (Target_arm::scan_reloc_section_for_stubs): Likewise.
8426
8427 2010-01-19 Ian Lance Taylor <iant@google.com>
8428
8429 * output.cc (Output_section_headers::do_sized_write): Write large
8430 segment count to sh_info field.
8431 (Output_file_header::do_sized_write): For large segment count,
8432 write PN_XNUM to e_phnum field.
8433
8434 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8435
8436 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8437 (Arm_relocate_functions::thm_jump8): New function.
8438 (Arm_relocate_functions::thm_jump11): New function.
8439 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8440 R_ARM_THM_JUMP11.
8441 (Target_arm::Scan::global): Likewise.
8442 (Target_arm::Relocate::relocate): Likewise.
8443 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8444 Likewise.
8445
8446 2010-01-14 Doug Kwan <dougkwan@google.com>
8447
8448 * arm.cc (map, utility): Include headers.
8449 (Target_arm::apply_cortex_a8_workaround): New method.
8450 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8451 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8452 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8453 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8454 the --[no-]fix-cortex-a8 command line options.
8455 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8456 (Target_arm::relocate_stub): Use addend in instruction template.
8457 * options.h (DEFINE_bool): Set the user-set flag.
8458 (General_options): Add --[no-]-fix-cortex options.
8459 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8460 : Update fast look-up map after conversion.
8461
8462 2010-01-14 Sriraman Tallam <tmsriram@google.com>
8463
8464 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8465 in the first pass of do_layout.
8466
8467 2010-01-13 Doug Kwan <dougkwan@google.com>
8468
8469 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8470 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8471 apparent compiler problem of not folding static constant integral
8472 data members of elfcpp::Elf_sizes<32>.
8473
8474 2010-01-13 Doug Kwan <dougkwan@google.com>
8475
8476 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8477 Arm_relobj::section_needs_cortex_a8_stub_scanning,
8478 Arm_relobj::scan_section_for_cortex_a8_erratum,
8479 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8480 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8481 sections to scan for relocation stubs into a new method
8482 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
8483 relocation and Cortex-A8 stub scanning.
8484 (Target_arm::do_relax): Force stubs to be after stubbed sections
8485 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
8486 the beginning of a new relaxation pass. Update a comment.
8487 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8488
8489 2010-01-12 Ian Lance Taylor <iant@google.com>
8490
8491 * target-reloc.h (visibility_error): New inline function.
8492 (relocate_section): Call visibility_error.
8493 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8494 (MOSTLYCLEANFILES): Likewise.
8495 (protected_4_pic.o, protected_3.err): New targets.
8496 * testsuite/protected_4.cc: New file.
8497
8498 2010-01-12 Doug Kwan <dougkwan@google.com>
8499
8500 * arm.cc (Cortex_a8_reloc): New class.
8501 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8502 and cortex_a8_relocs_info_.
8503 (Target_arm::fix_cortex_a8): New method definition.
8504 (Target_arm::Cortex_a8_relocs_info): New type.
8505 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8506 New data member declarations.
8507 (Target_arm::scan_reloc_for_stub): Record information about
8508 relocations for THUMB branches that might be exempted from the
8509 Cortex-A8 workaround.
8510 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8511 at the beginning of a relaxation pass.
8512
8513 2010-01-12 Doug Kwan <dougkwan@google.com>
8514
8515 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8516 (Arm_relobj::Mapping_symbol_position,
8517 Arm_reloj::Mapping_symbol_position_less,
8518 Arm_relobj::Mapping_symbols_info): New types.
8519 (Target_arm::is_mapping_symbol_name): New method definition.
8520 (Arm_relobj::do_count_local_symbols): Save information about mapping
8521 symbols.
8522
8523 2010-01-11 Doug Kwan <dougkwan@google.com>
8524
8525 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8526 Arm_relocate_functions::thumb32_branch_upper,
8527 Arm_relocate_functions::thumb32_branch_lower,
8528 Arm_relocate_functions::thumb32_cond_branch_offset,
8529 Arm_relocate_functions::thumb32_cond_branch_upper,
8530 Arm_relocate_functions::thumb32_cond_branch_lower,
8531 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8532 branch offset encoding.
8533 (Arm_relocate_functions::thumb_branch_common): Use new branch
8534 offset encoding methods to avoid code duplication.
8535 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8536 (Stub_addend_reader::operator()): Use new branch encoding method
8537 to avoid code duplication.
8538
8539 2010-01-11 Doug Kwan <dougkwan@google.com>
8540
8541 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8542 (Target_arm::do_finalize_sections): Define special EXIDX section
8543 symbols only if referenced.
8544 * gc.h (Garbage_collection::add_reference): New method.
8545 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8546 code duplication.
8547
8548 2010-01-11 Ian Lance Taylor <iant@google.com>
8549
8550 * script.cc (Version_script_info::build_expression_list_lookup):
8551 Change complaing about duplicate wildcard match from error to
8552 warning.
8553
8554 * script.cc (class Lazy_demangler): Recreate--revert part of patch
8555 of 2009-12-30.
8556 (Version_script_info::Version_script_info): Initialize globs_,
8557 default_version_, default_is_global_, and exact_. Don't
8558 initialize globals_ or locals_.
8559 (Version_script_info::build_lookup_tables): Build local symbols
8560 first.
8561 (Version_script_info::unquote): New function.
8562 (Version_script_info::add_exact_match): New function.
8563 (Version_script_info::build_expression_list_lookup): Remove lookup
8564 parameter. Add is_global parameter. Change all callers. Handle
8565 wildcard pattern specially. Unquote pattern. Call
8566 add_exact_match.
8567 (Version_script_info::get_name_to_match): New function.
8568 (Version_script_info::get_symbol_version): New function.
8569 (Version_script_info::get_symbol_version_helper): Remove.
8570 (Version_script_info::check_unmatched_names): Call unquote.
8571 * script.h (class Version_script_info): Change get_symbol_version
8572 to be non-inline and add is_global parameter; change all callers.
8573 Rewrite symbol_is_local. Update declarations. Define struct
8574 Version_tree_match, Exact, Globs. Don't define struct Lookup.
8575 Remove globals_ and locals_ members. Add exact_, globs_,
8576 default_version_, is_global_.
8577 (Version_script_info::Glob): Remove pattern, add expression and
8578 is_global. Update constructor. Change all callers.
8579 * dynobj.cc (Versions::finalize): Mark the version symbol as the
8580 default version.
8581 (Versions::symbol_section_contents): If a symbol is undefined, or
8582 defined in a dynamic object, set the version index to
8583 VER_NDX_LOCAL.
8584 * symtab.cc (Symbol_table::add_from_relobj): Don't call
8585 symbol_is_local.
8586 (Symbol_table::add_from_pluginobj): Likewise.
8587 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8588
8589 2010-01-11 Doug Kwan <dougkwan@google.com>
8590
8591 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8592 (incremental_dump_LDADD): Add linking option for libintl.
8593 * Makefile.in: Regenerate.
8594
8595 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
8596
8597 PR gold/11144
8598 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8599 instead of -Ds.
8600 * testsuite/Makefile.in: Regenerated.
8601
8602 2010-01-10 Doug Kwan <dougkwan@google.com>
8603
8604 * options.h (DEFINE_var): Use parentheses around argument varname__
8605 in macro body to avoid any unintended subsequent substitutions.
8606
8607 2010-01-10 Ian Lance Taylor <iant@google.com>
8608
8609 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8610 candidates before doing symbol resolution.
8611
8612 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8613 ODR candidates if only one is weak.
8614
8615 2010-01-08 Ian Lance Taylor <iant@google.com>
8616
8617 * script.cc (Version_script_info::build_expression_list_lookup):
8618 Don't warn about ambiguous version, just record the ambiguity.
8619 (Version_script_info::get_symbol_version_helper): Give error if
8620 version is ambiguous.
8621
8622 2010-01-08 Doug Kwan <dougkwan@google.com>
8623
8624 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8625 prev_data_size_ and prev_addralign_. Remove initializer for
8626 deleted data member has_been_changed_.
8627 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8628 to determine if the table is empty.
8629 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8630 Remove.
8631 (Stub_table::add_reloc_stub): Define method in class definition
8632 instead of just declaring it there.
8633 (Stub_table::add_cortex_a8_stub): New method definition.
8634 (Stub_table::update_data_size_and_addralign): Ditto.
8635 (Stub_table::finalize_stubs): Ditto.
8636 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8637 (Stub_table::do_addralign_): Return address alignment in the
8638 (Stub_table::do_reset_address_and_file_offset): Define method in
8639 class definition instead of declaring it there. Set current data
8640 size to be the data size of the previous pass.
8641 (Stub_table::set_final_data_size): Use current data size as the
8642 final data size.
8643 (Stub_table::relocate_stub): Change parameter type of stub from
8644 Reloc_stub pointer to Stub pointer.
8645 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8646 (Stub_table::Cortex_a8_stub_list): New typedef.
8647 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8648 Stub_table::prev_addralign_): New data member.
8649 (Arm_relobj::Arm_relobj): Initialize data member
8650 section_has_cortex_a8_workaround_.
8651 (Arm_relobj::section_has_cortex_a8_workaround,
8652 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8653 definitions.
8654 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8655 declarations.
8656 (Target_arm::relocate_stub): Change parameter type of stub from
8657 Reloc_stub pointer to Stub pointer.
8658 (Insn_template::size, Insn_template::alignment): Handle
8659 THUMB16_SPECIAL_TYPE.
8660 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8661 Stub_table::update_data_size_and_addralign,
8662 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8663 definitions.
8664 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8665 (Stub_table::do_write): Ditto.
8666 (Target_arm::do_relax): Adjust code for changes in Stub_table.
8667
8668 2010-01-08 Ian Lance Taylor <iant@google.com>
8669
8670 PR 11108
8671 * symtab.h (class Symbol): Remove fields is_target_special_ and
8672 has_plt_offset_. Add field is_defined_in_discarded_section_.
8673 (Symbol::is_defined_in_discarded_section): New function.
8674 (Symbol::set_is_defined_in_discarded_section): New function.
8675 (Symbol::has_plt_offset): Rewrite.
8676 (Symbol::set_plt_offset): Verify that new offset is not -1U.
8677 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8678 Don't initialize is_target_special_ or has_plt_offset_.
8679 Initialize is_defined_in_discarded_section_.
8680 (Symbol_table::add_from_relobj): If appropriate, set
8681 is_defined_in_discarded_section.
8682 * resolve.cc (Symbol::override_base_with_special): Don't test
8683 is_target_special_. Change has_plt_offset_ to has_plt_offset().
8684 * target-reloc.h (relocate_section): Do special handling for
8685 symbols defined in discarded sections for global symbols as well
8686 as local symbols.
8687
8688 2010-01-08 Ian Lance Taylor <iant@google.com>
8689
8690 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8691 the SHT_SYMTAB case.
8692
8693 2010-01-08 Ian Lance Taylor <iant@google.com>
8694
8695 * object.cc (Sized_relobj::do_layout): Don't get confused if
8696 layout_eh_frame returns NULL.
8697
8698 2010-01-08 Ian Lance Taylor <iant@google.com>
8699
8700 PR 11084
8701 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8702 dynamic symbol table, use the normal symbol table.
8703 (Sized_dynobj::do_read_symbols): Remove assertion about type of
8704 symbol table.
8705
8706 2010-01-08 Ian Lance Taylor <iant@google.com>
8707
8708 PR 11072
8709 * layout.cc (Layout::include_section): Remove .gnu_debuglink
8710 sections.
8711
8712 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
8713
8714 * version.cc (print_version): Change to "Copyright 2010".
8715
8716 2010-01-08 Ian Lance Taylor <iant@google.com>
8717
8718 PR 10287
8719 PR 11063
8720 * i386.cc (class Target_i386): Change return type of plt_section
8721 to be non-const.
8722 (class Output_data_plt_i386): Add tls_desc_rel_ field.
8723 (Output_data_plt_i386::Output_data_plt_i386): Initialize
8724 tls_desc_rel_ field.
8725 (Output_data_plt_i386::rel_tls_desc): New function.
8726 (Target_i386::rel_tls_desc_section): New function.
8727 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8728 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8729 R_386_TLS_DESC reloc in rel_tls_desc_section.
8730 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8731 Define struct Tlsdesc_info.
8732 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8733 (Target_x86_64::do_reloc_symbol_index): New function.
8734 (Target_x86_64::add_tlsdesc_info): New function.
8735 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8736 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8737 tlsdesc_rel_ field.
8738 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
8739 all callers.
8740 (Output_data_plt_x86_64::rela_tlsdesc): New function.
8741 (Target_x86_64::rela_tlsdesc_section): New function.
8742 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8743 handling.
8744 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8745 (Target_x86_64::do_reloc_addend): New function.
8746 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8747 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8748 declarations. Define TARGET_CODE. Add arg field to u1_ union.
8749 (Output_reloc::type): New function.
8750 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8751 (Output_reloc::is_target_specific): New function.
8752 (Output_reloc::target_arg): New function.
8753 (class Output_reloc) [SHT_RELA]: Add four new constructors for
8754 absolute relocs and target specific relocs.
8755 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8756 add_target_specific.
8757 (class Output_data_reloc) [SHT_RELA]: Likewise.
8758 * output.cc (Output_reloc::Output_reloc): Add four new versions
8759 for absolute relocs and target specific relocs.
8760 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8761 (Output_reloc::get_symbol_index): Likewise.
8762 (Output_reloc::local_section_offset): Check that local_sym_index_
8763 is not TARGET_CODE or 0.
8764 (Output_reloc::symbol_value): Likewise.
8765 (Output_reloc::write) [SHT_RELA]: Call target for target specific
8766 reloc.
8767 * target.h (class Target): Add reloc_symbol_index and reloc_addend
8768 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
8769 functions.
8770 * layout.cc (add_target_dynamic_tags): Use output section for
8771 DT_PLTRELSZ and DT_JMPREL.
8772
8773 2010-01-07 Ian Lance Taylor <iant@google.com>
8774
8775 PR 11061
8776 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8777 function.
8778 (class Output_data_reloc_generic): Define.
8779 (class Output_data_reloc_base): Change base class to
8780 Output_data_reloc_generic. Change add() method to call
8781 bump_relative_reloc_count for a relative reloc. Remove
8782 sort_relocs_ field.
8783 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8784 to sort_relocs().
8785 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8786 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
8787 appropriate.
8788 * layout.h (class Layout): Update declaration.
8789
8790 2010-01-07 Ian Lance Taylor <iant@google.com>
8791
8792 * output.h (class Output_data): Add const version of
8793 output_section and do_output_section.
8794 (class Output_section_data): Add const version of
8795 do_output_section.
8796 (class Output_section): Likewise.
8797 * layout.cc (Layout::add_target_dynamic_tags): New function.
8798 * layout.h (class Layout): Update declarations.
8799 * arm.cc (Target_arm::do_finalize_sections): Use
8800 add_target_dynamic_tags.
8801 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8802 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8803 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8804 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8805
8806 2010-01-07 Ian Lance Taylor <iant@google.com>
8807
8808 PR 11042
8809 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8810 object as needed.
8811
8812 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
8813 Ian Lance Taylor <iant@google.com>
8814
8815 PR 11019
8816 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8817 Xindex::read_symtab_xindex.
8818
8819 2010-01-07 Doug Kwan <dougkwan@google.com>
8820
8821 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8822 (Insn_template::thumb16_bcond_insn): New method declaration.
8823 (Insn_template): Fix spelling.
8824 (Stub::thumb16_special): New method declaration.
8825 (Stub::do_write): Define virtual method which was previously pure
8826 virtual.
8827 (Stub::do_thumb16_special): New method declaration.
8828 (Stub::do_fixed_endian_write): New template member.
8829 (Reloc_stub::do_write): Remove.
8830 (Reloc_stub::do_fixed_endian_write): Remove.
8831 (Cortex_a8_stub): New class definition.
8832 (Stub_factory::make_cortex_a8_stub): New method definition.
8833 (Stub_factory::Stub_factory): Add missing static storage class
8834 qualifier for elf32_arm_stub_a8_veneer_blx.
8835
8836 2010-01-07 Ian Lance Taylor <iant@google.com>
8837
8838 PR 10980
8839 * options.h (class General_options): Add --warn-unresolved-symbols
8840 and --error-unresolved-symbols.
8841 * errors.cc (Errors::undefined_symbol): Implement
8842 --warn-unresolved-symbols.
8843
8844 * options.h (class General_options): Add -z text and -z textoff.
8845 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8846
8847 2010-01-06 Sriraman Tallam <tmsriram@google.com>
8848
8849 * gc.h (Garbage_collection::Cident_section_map): New typedef.
8850 (Garbage_collection::cident_sections): New function.
8851 (Garbage_collection::add_cident_section): New function.
8852 (Garbage_collection::cident_sections_): New member.
8853 (gc_process_relocs): Add references to sections whose names are C
8854 identifiers.
8855 * gold.h (cident_section_start_prefix): New constant.
8856 (cident_section_stop_prefix): New constant.
8857 (is_cident): New function.
8858 * layout.cc (Layout::define_section_symbols): Replace string constants
8859 with the newly defined constants.
8860 * object.cc (Sized_relobj::do_layout): Track sections whose names are
8861 C identifiers.
8862 * testsuite/Makefile.am: Add gc_orphan_section_test.
8863 * testsuite/Makefile.in: Regenerate.
8864 * testsuite/gc_orphan_section_test.cc: New file.
8865 * testsuite/gc_orphan_section_test.sh: New file.
8866
8867 2010-01-06 Ian Lance Taylor <iant@google.com>
8868
8869 PR 10980
8870 * options.h (class General_options): Add --warn-shared-textrel.
8871 * layout.cc (Layout::finish_dynamic_section): Implement
8872 --warn-shared-textrel.
8873
8874 PR 10980
8875 * options.h (class General_options): Add --warn-multiple-gp.
8876
8877 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
8878
8879 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8880 $(THREADSLIB) and $(LIBDL).
8881 * Makefile.in: Rebuild.
8882
8883 2010-01-06 Ian Lance Taylor <iant@google.com>
8884
8885 PR 10980
8886 * options.cc (General_options::parse_section_start): New function.
8887 (General_options::section_start): New function.
8888 (General_options::General_options): Initialize all members.
8889 * options.h: Include <map>
8890 (class General_options): Add --section-start. Add section_starts_
8891 member.
8892 * layout.cc (Layout::attach_allocated_section_to_segment): If
8893 --section-start was used, set the address of the segment. Remove
8894 local sort_sections.
8895 (Layout::relaxation_loop_body): If the address of the load segment
8896 has been set by --section-start, don't use it.
8897 * output.h (Output_segment::update_flags_for_output_section): New
8898 function.
8899 * output.cc (Output_segment::add_output_section): Call
8900 update_flags_for_output_section.
8901
8902 2010-01-05 Ian Lance Taylor <iant@google.com>
8903
8904 PR 10980
8905 * options.h (class General_options): Add --undefined-version.
8906 * script.cc (struct Version_expression): Add was_matched_by_symbol
8907 field.
8908 (Version_script_info::matched_symbol): New function.
8909 (Version_script_info::get_symbol_version_helper): Call
8910 matched_symbol.
8911 (Version_script_info::check_unmatched_names): New function.
8912 * script.h (class Version_script_info): Update declarations.
8913 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8914
8915 * options.h (class General_options): Use DEFINE_bool_alias for
8916 allow_multiple_definition.
8917 * resolve.cc (Symbol_table::should_override): Don't test
8918 allow_multiple_definition.
8919
8920 PR 10980
8921 * options.h (class General_options): Add --cref.
8922 * main.cc (main): Print cref table if --cref. Don't close mapfile
8923 until after printing cref table.
8924 * cref.cc: Include "symtab.h".
8925 (class Cref_inputs): Define Cref_table_compare and Cref_table.
8926 (Cref_table_compare::operator()): New function.
8927 (Cref_inputs::gather_cref): New function.
8928 (filecol): New static const.
8929 (Cref_inputs::print_cref): New function.
8930 (Cref::print_cref): New function.
8931 * cref.h: Include <cstdio>.
8932 (class Cref): Update declarations.
8933 * mapfile.h (Mapfile::file): New function.
8934 * object.h (class Object): Define Symbols. Declare virtual
8935 do_get_global_symbols.
8936 (Object::get_global_symbols): New function.
8937 * object.cc (Input_objects::add_object): Pass object to cref_ if
8938 --cref.
8939 (Input_objects::archive_start): Likewise.
8940 (Input_objects::archive_stop): Likewise.
8941 (Input_objects::print_cref): New function.
8942 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8943 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8944 --cref.
8945 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8946 function.
8947 * plugin.h (class Sized_pluginobj): Update declarations.
8948
8949 2010-01-05 Ian Lance Taylor <iant@google.com>
8950
8951 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8952 to is_default_version. Rename insdef to insdefault.
8953 (Symbol_table::add_from_relobj): Rename def to is_default_version
8954 and local to is_forced_local.
8955 (Symbol_table::add_from_pluginobj): Likewise.
8956 (Symbol_table::add_from_dynobj): Likewise.
8957 (Symbol_table::define_special_symbol): Rename insdef to
8958 insdefault.
8959
8960 2010-01-04 Ian Lance Taylor <iant@google.com>
8961
8962 PR 10980
8963 * options.h (class General_options): Add
8964 --allow-multiple-definition and -z muldefs.
8965 * resolve.cc (Symbol_table::should_override): Don't warn about a
8966 multiple symbol definition if --allow-multiple-definition or -z
8967 muldefs.
8968
8969 PR 10980
8970 * options.h (class General_options): Add --add-needed and
8971 --copy-dt-needed-entries. Tweak --as-needed help entry.
8972 * object.cc (Input_objects::check_dynamic_dependencies): Give an
8973 error if --copy-dt-needed-entries aka --add-needed is used and
8974 would cause a change in behaviour.
8975
8976 PR 10980
8977 * options.h (class General_options): Add -G as a short version of
8978 --shared. Add no-op options -assert, -g, and -i.
8979
8980 2010-01-04 Sriraman Tallam <tmsriram@google.com>
8981
8982 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8983 check for .text or .gnu.linkonce.t sections.
8984 * icf.cc (Icf::find_identical_sections): Ditto.
8985 Change the detection for mangled function name within the section
8986 name.
8987 * icf.h (is_section_foldable_candidate): New function.
8988
8989 2009-12-30 Ian Lance Taylor <iant@google.com>
8990
8991 PR 10980
8992 * options.h (class General_options): Permit two dashes with
8993 --retain-symbols-file.
8994
8995 2009-12-30 Ian Lance Taylor <iant@google.com>
8996
8997 PR 10979
8998 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8999 don't put the file header and segment headers in the text
9000 segment.
9001
9002 PR 10979
9003 * common.cc (Sort_commons::operator()): Stabilize sort when both
9004 entries are NULL.
9005 (Symbol_table::do_allocate_commons_list): When allocating common
9006 symbols, skip a symbol which is no longer common.
9007 * symtab.h (Symbol::is_common): Test whether the symbol comes from
9008 an object before checking its type.
9009 * testsuite/common_test_2.c: New file.
9010 * testsuite/common_test_3.c: New file.
9011 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9012 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9013 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9014 (common_test_2_pic.o, common_test_2.so): New targets.
9015 (common_test_3_pic.o, common_test_3.so): New targets.
9016 * testsuite/Makefile.in: Rebuild.
9017
9018 PR 10979
9019 * script.cc (read_input_script): If we see a new SECTIONS clause,
9020 and we have added an input section, give an error.
9021 * layout.h (class Layout): Add have_added_input_section function.
9022 Add have_added_input_section_ field.
9023 * layout.cc (Layout::Layout): Initialize
9024 have_added_input_section_.
9025 (Layout::layout): Set have_added_input_section_.
9026 (Layout::layout_eh_frame): Likewise.
9027
9028 2009-12-30 Ian Lance Taylor <iant@google.com>
9029
9030 PR 10931
9031 * options.h (class General_options): Add --sort-common option.
9032 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9033 * common.cc (Sort_common): Add sort_order parameter to
9034 constructor. Add sort_order_ field.
9035 (Sort_commons::operator): Check sort_order_.
9036 (Symbol_table::allocate_commons): Determine the sort order.
9037 (Symbol_table::do_allocate_commons): Add sort_order parameter.
9038 Change all callers.
9039 (Symbol_table::do_allocate_commons_list): Likewise.
9040
9041 2009-12-30 Ian Lance Taylor <iant@google.com>
9042
9043 PR 10916
9044 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9045 symbols from this object, don't change the visibility of an
9046 undefined symbol.
9047 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9048
9049 2009-12-30 Ian Lance Taylor <iant@google.com>
9050
9051 PR 10861
9052 * script.h (class Version_script_info): Define Language enum.
9053 Update declarations. Define Glob, Exact, and Lookup types. Add
9054 new fields globals_, locals_, and is_finalized_.
9055 * script.cc: Various formatting fixes.
9056 (class Parser_closure): Change language_stack_ from a vector of
9057 std::string to one of Version_script_info::Language. Adjust all
9058 uses accordingly.
9059 (class Lazy_demangler): Remove.
9060 (struct Version_expression): Change language from std::string to
9061 Version_script_info::Language.
9062 (Version_script_info::Version_script_info): New function.
9063 (Version_script_info::~Version_script_info): Don't call clear.
9064 (Version_script_info::finalize): New function.
9065 (Version_script_info::build_lookup_tables): New function.
9066 (Version_script_info::build_expression_list_lookup): New
9067 function.
9068 (Version_script_info::get_symbol_version_helper): Rewrite to use
9069 lookup tables.
9070 (Version_script_info::print_expression_list): Adjust to use
9071 Version_script_info::Language.
9072 (script_push_lex_into_version_mode): Check that the version script
9073 has not been finalized.
9074 (version_script_push_lang): Change language string to
9075 Version_script_info::Language.
9076 * options.cc (Command_line::version_script): New function.
9077 * options.h (class General_options): Add finalize_dynamic_list
9078 function. Change version_script from declaration to definition.
9079 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9080 * testsuite/version_script.map: Remove duplicate def of foo.
9081 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9082 version_script.map.
9083 * testsuite/Makefile.in: Rebuild.
9084
9085 2009-12-30 Ian Lance Taylor <iant@google.com>
9086
9087 PR 10843
9088 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9089 if the input symbol index is 0, make the output symbol index 0.
9090
9091 2009-12-30 Ian Lance Taylor <iant@google.com>
9092
9093 PR 10670
9094 * options.h (class General_options): Add -x/--discard-all.
9095 * object.cc (Sized_relobj::do_count_local_symbols): Handle
9096 --discard-all. If the local symbol needs a dynamic entry, check
9097 that before handling --discard-locals.
9098
9099 2009-12-30 Ian Lance Taylor <iant@google.com>
9100
9101 PR 10450
9102 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9103 flags to PF_R.
9104 (Output_segment::add_output_section): Don't change the flags if
9105 the type is PT_TLS.
9106
9107 PR 10450
9108 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9109 GNU hash table if they need a dynamic value. Otherwise, don't add
9110 them if they are defined in a dynamic object or are forced local.
9111
9112 2009-12-29 Ian Lance Taylor <iant@google.com>
9113
9114 PR 10450
9115 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9116 .gnu.hash table for a 32-bit target.
9117
9118 PR 10450
9119 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9120 regular and a dynamic object only needs a dynamic symbol table
9121 entry if it is externally visible.
9122
9123 PR 10450
9124 * i386.cc (class Target_i386): Initialize global_offset_table_ in
9125 constructor. Add global_offset_table_ field.
9126 (Target_i386::got_section): Set global_offset_table_.
9127 (Target_i386::do_finalize_sections): Set global_offset_table_
9128 size.
9129 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9130 in constructor. Add global_offset_table_ field.
9131 (Target_x86_64::got_section): Set global_offset_table_.
9132 (Target_x86_64::do_finalize_sections): Set global_offset_table_
9133 size.
9134
9135 * layout.cc (Layout::Layout): Initialize increase_relro_.
9136 (Layout::get_output_section): Add is_relro, is_last_relro, and
9137 is_first_non_relro parameters. Change all callers.
9138 (Layout::choose_output_section): Likewise.
9139 (Layout::add_output_section_data): Likewise.
9140 (Layout::make_output_section): Likewise.
9141 (Layout::set_segment_offsets): Clear increase_relro when using a
9142 linker script.
9143 * layout.h (class Layout): Add increase_relro method. Add
9144 increase_relro_ field. Update declarations.
9145 * output.cc (Output_section::Output_section): Initialize
9146 is_last_relro_ and is_first_non_relro_.
9147 (Output_segment::add_output_section): Group relro sections is
9148 do_sort is true. Handle is_last_relro and is_first_non_relro.
9149 (Output_segment::maximum_alignment): Remove relro handling.
9150 (Output_segment::set_section_addresses): Add increase_relro
9151 parameter. Change all callers. Add initial alignment to align
9152 relro sections on separate page. Remove old relro handling.
9153 (Output_segment::set_section_list_addresses): Remove in_relro
9154 parameter. Change all callers.
9155 (Output_segment::set_offset): Add increase parameter. Change all
9156 callers. Remove old relro handling.
9157 * output.h (class Output_section): Add new methods: is_last_relro,
9158 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9159 Add is_last_relro_ and is_first_non_relro_ fields.
9160 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9161 Create separate .got.plt section. Call increase_relro.
9162 * x86_64.cc (Target_x86_64::got_section): Likewise.
9163 * testsuite/relro_script_test.t: Add .got.plt.
9164
9165 PR 10450
9166 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9167 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9168 (Layout::finalize): Call set_dynamic_symbol_size.
9169 (Layout::set_dynamic_symbol_size): New function.
9170 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
9171 set_dynamic_symbol_size.
9172
9173 PR 10450
9174 * output.h (class Output_section): Add is_entsize_zero_ field.
9175 * output.cc (Output_section::Output_section): Initialize
9176 is_entsize_zero_.
9177 (Output_section::set_entsize): If two different entsizes are
9178 requested, force it to zero.
9179 (Output_section::add_input_section): Set flags for .debug_str
9180 before updating section flags. Set entsize.
9181 (Output_section::update_flags_for_input_section): Set SHF_MERGE
9182 and SHF_STRING if all input sections have those flags.
9183
9184 2009-12-29 Rafael Espindola <espindola@google.com>
9185
9186 * main.cc (main): Fix the sys time reporting.
9187 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9188 reporting.
9189
9190 2009-12-29 Sriraman Tallam <tmsriram@google.com>
9191
9192 * options.cc (General_options::parse_version): Allow -v to exit
9193 without an error if there is nothing to link.
9194
9195 2009-12-29 Ian Lance Taylor <iant@google.com>
9196
9197 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9198 using a version of gcc before 4.1.
9199 * configure: Rebuild.
9200
9201 2009-12-28 Chris Demetriou <cgd@google.com>
9202
9203 * attributes.cc (Output_attributes_section_data::do_write): Use
9204 std::vector::front rather than std::vector::data.
9205
9206 2009-12-28 Ian Lance Taylor <iant@google.com>
9207
9208 * symtab.h (class Symbol_table): Add enum Defined.
9209 * resolve.cc (Symbol_table::should_override): Add defined
9210 parameter. Change all callers. Test whether object is NULL
9211 before calling a method on it.
9212 (Symbol_table::report_resolve_problem): Add defined parameter.
9213 Change all callers.
9214 (Symbol_table::should_override_with_special): Likewise.
9215 * symtab.cc (Symbol_table::define_in_output_data): Add defined
9216 parameter. Change all callers.
9217 (Symbol_table::do_define_in_output_data): Likewise.
9218 (Symbol_table::define_in_output_segment): Likewise.
9219 (Symbol_table::do_define_in_output_segment): Likewise.
9220 (Symbol_table::define_as_constant): Likewise.
9221 (Symbol_table::do_define_as_constant): Likewise.
9222 * script.h (class Symbol_assignment): Add is_defsym parameter to
9223 constructor; change all callers.
9224 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9225 parameter. Change all callers. Add is_defsym_ field.
9226 (class Parser_closure): Add parsing_defsym parameter to
9227 constructor; change all callers. Add parsing_defsym accessor
9228 function. Add parsing_defsym_ field.
9229
9230 2009-12-28 Ian Lance Taylor <iant@google.com>
9231
9232 * gold.cc (queue_middle_tasks): Fix formatting.
9233 * object.cc (Relobj::is_section_name_included): Likewise.
9234
9235 2009-12-23 Ian Lance Taylor <iant@google.com>
9236
9237 * i386.cc (Target_i386::do_calls_non_split): Recognize
9238 -fsplit-stack prologue for a function with a static chain.
9239 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9240 -fsplit-stack prologue when using %r11.
9241
9242 2009-12-21 Sriraman Tallam <tmsriram@google.com>
9243
9244 * options.cc (General_options::parse_version): Make -v continue and do
9245 the link like GNU ld does.
9246
9247 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
9248
9249 * Makefile.am (CCFILES): Add timer.cc.
9250 (HFILES): Add timer.h.
9251 * configure.ac: Check for sysconf and times.
9252 * main.cc: include timer.h.
9253 (main): Use Timer instead of get_run_time.
9254 * timer.cc: New.
9255 * timer.h: New.
9256 * workqueue.cc: include timer.h.
9257 (Workqueue::find_and_run_task):
9258 Report user, sys and wall time.
9259 * Makefile.in: Regenerate.
9260 * config.in: Regenerate.
9261 * configure: Regenerate.
9262
9263 2009-12-16 Doug Kwan <dougkwan@google.com>
9264
9265 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9266 sections.
9267 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9268 relaxed input sections.
9269 * output.cc (Output_section::find_relaxed_input_section): Change
9270 return type to Output_relaxed_input_section pointer. Adjust code
9271 for new type of relaxed_input_section_map_.
9272 * output.h (Output_section::find_relaxed_input_section): Change
9273 return type to Output_relaxed_input_section pointer.
9274 (Output_section::Output_relaxed_input_section_by_input_section_map):
9275 New type.
9276 (Output_section::relaxed_input_section_map_): Change type to
9277 Output_section::Output_relaxed_input_section_by_input_section_map.
9278 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9279 input section.
9280
9281 2009-12-15 Ian Lance Taylor <iant@google.com>
9282
9283 * layout.cc (Layout::create_shstrtab): Only write out after input
9284 sections if we are compressing debug sections.
9285
9286 2009-12-15 Ian Lance Taylor <iant@google.com>
9287
9288 * archive.cc (Archive::add_symbols): Only look up a symbol without
9289 a version if there is, in fact, a version.
9290
9291 2009-12-14 Ian Lance Taylor <iant@google.com>
9292
9293 Revert -Wshadow changes, all changes from:
9294 2009-12-11 Doug Kwan <dougkwan@google.com>
9295 2009-12-11 Nick Clifton <nickc@redhat.com>
9296 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9297
9298 2009-12-11 Doug Kwan <dougkwan@google.com>
9299
9300 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9301 due to -Wshadow.
9302 * attributes.cc (Object_attribute::size): Ditto.
9303 (Attributes_section_data::size): Ditto.
9304 (Attributes_section_data::Attributes_section_data): Ditto.
9305 (Output_attributes_section_data::do_write): Ditto.
9306 * attributes.h (Object_attribute::set_type): Ditto.
9307 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9308
9309 2009-12-11 Nick Clifton <nickc@redhat.com>
9310
9311 * archive.cc: Fix shadowed variable warnings.
9312 * arm.cc: Likewise.
9313 * compressed_output.cc: Likewise.
9314 * compressed_output.h: Likewise.
9315 * configure: Likewise.
9316 * dwarf_reader.cc: Likewise.
9317 * dynobj.cc: Likewise.
9318 * dynobj.h: Likewise.
9319 * ehframe.cc: Likewise.
9320 * ehframe.h: Likewise.
9321 * errors.cc: Likewise.
9322 * expression.cc: Likewise.
9323 * fileread.cc: Likewise.
9324 * fileread.h: Likewise.
9325 * freebsd.h: Likewise.
9326 * i386.cc: Likewise.
9327 * icf.cc: Likewise.
9328 * incremental.h: Likewise.
9329 * layout.cc: Likewise.
9330 * layout.h: Likewise.
9331 * mapfile.cc: Likewise.
9332 * merge.cc: Likewise.
9333 * merge.h: Likewise.
9334 * object.cc: Likewise.
9335 * object.h: Likewise.
9336 * options.h: Likewise.
9337 * output.cc: Likewise.
9338 * output.h: Likewise.
9339 * parameters.cc: Likewise.
9340 * plugin.cc: Likewise.
9341 * powerpc.cc: Likewise.
9342 * reduced_debug_output.cc: Likewise.
9343 * reduced_debug_output.h: Likewise.
9344 * reloc.cc: Likewise.
9345 * reloc.h: Likewise.
9346 * resolve.cc: Likewise.
9347 * script-sections.cc: Likewise.
9348 * script.cc: Likewise.
9349 * script.h: Likewise.
9350 * sparc.cc: Likewise.
9351 * symtab.cc: Likewise.
9352 * symtab.h: Likewise.
9353 * target-select.cc: Likewise.
9354 * target-select.h: Likewise.
9355 * token.h: Likewise.
9356 * workqueue.cc: Likewise.
9357 * workqueue.h: Likewise.
9358 * x86_64.cc: Likewise.
9359
9360 2009-12-10 Doug Kwan <dougkwan@google.com>
9361
9362 * arm.cc (attributes.h): New include.
9363 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9364 (Arm_relobj::~Arm_relobj): Delete object pointed by
9365 attributes_section_data_.
9366 (Arm_relobj::attributes_section_data): New method definition.
9367 (Arm_relobj::attributes_section_data_): New data member declaration.
9368 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9369 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9370 attributes_section_data_.
9371 (Arm_dynobj::attributes_section_data): New method definition.
9372 (Arm_dynobj::attributes_section_data_): New data member declaration.
9373 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
9374 initialization value of may_use_blx_ to false.
9375 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9376 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9377 object attributes to compute results instead of hard-coding.
9378 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9379 Target_arm::get_secondary_compatible_arch,
9380 Target_arm::set_secondary_compatible_arch
9381 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9382 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9383 New method declarations.
9384 (Target_arm::get_aeabi_object_attribute): New method definition.
9385 (Target_arm::attributes_section_data_): New data member declaration.
9386 (read_arm_attributes_section): New template definition.
9387 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9388 (Arm_dynobj::do_read_symbols): Ditto.
9389 (Target_arm::do_finalize_sections): Merge attributes sections from
9390 input. Check for BLX use after attributes section merging.
9391 Fix __exidx_start and __exidx_end visibility. Create an
9392 .ARM.attributes section if necessary.
9393 (Target_arm::get_secondary_compatible_arch,
9394 Target_arm::set_secondary_compatible_arch,
9395 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9396 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9397 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9398 New method definitions.
9399
9400 2009-12-09 Ian Lance Taylor <iant@google.com>
9401
9402 * plugin.cc (Plugin::load): Don't cast from void* to a function
9403 pointer.
9404
9405 2009-12-09 Ian Lance Taylor <iant@google.com>
9406
9407 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9408 information fields.
9409
9410 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
9411
9412 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9413 Replace two_file_shared_1.so with two_file_shared_2.so.
9414 * testsuite/Makefile.in: Regenerated.
9415
9416 2009-12-08 Doug Kwan <dougkwan@google.com>
9417
9418 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9419 (HFILES): Add attributes.h and int_encoding.h.
9420 * Makefile.in: Regenerate.
9421 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9422 function definitions to int_encoding.cc
9423 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9424 prototypes to int_encoding.h
9425 * reduced_debug_output.cc (int_encoding.h): New include.
9426 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9427 function definitions to int_encoding.cc
9428 (insert_into_vector, read_from_pointer): Move template definitions to
9429 int_encoding.h
9430 * attributes.cc: New file.
9431 * attributes.h: New file.
9432 * int_encoding.cc: New file.
9433 * int_encoding.h: New file.
9434
9435 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
9436
9437 PR gold/11055
9438 * incremental-dump.cc (dump_incremental_inputs): New.
9439 (main): Use dump_incremental_inputs.
9440
9441 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
9442
9443 PR gold/10893
9444 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9445 checking elfcpp::STT_FUNC.
9446 (Target_i386::Relocate::relocate): Likewise.
9447 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9448
9449 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9450 symbols from shared libraries into normal FUNC symbols.
9451
9452 * symtab.h (Symbol): Add is_func and use it.
9453
9454 2009-12-05 Doug Kwan <dougkwan@google.com>
9455
9456 * arm.cc (Target_arm::arm_info): Initialize new fields
9457 attributes_section and attributes_vendor.
9458 * i386.cc (Target_i386::i386_info): Same.
9459 * object.cc (Sized_relobj::do_layout): Skip attribute section.
9460 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9461 fields attributes_section and attributes_vendor.
9462 * sparc.cc (Target_sparc::sparc_info): Same.
9463 * target.h (Target::attributes_section, Target::attributes_vendor,
9464 Target::is_attributes_section, Target::attribute_arg_type,
9465 Target::attributes_order): New method definitions.
9466 (Target::Target_info::attributes_section,
9467 Target::Target_info::attributes_vendor): New fields.
9468 (Target::do_attribute_arg_type, Target::do_attributes_order): New
9469 virtual method definitions.
9470 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9471 attributes_section and attributes_vendor.
9472 * testsuite/testfile.cc (Target_test::test_target_info): Same.
9473
9474 2009-12-05 Doug Kwan <dougkwan@google.com>
9475
9476 * arm.cc: Update comments about interworking and stub generation.
9477 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9478 considered as non-PIC.
9479 (Arm_relocate_functions::base_abs): Fix formatting.
9480 (Arm_relocate_functions::got_prel): Fix comment. Change interface
9481 of function to use GOT entry address instead of offset.
9482 (Target_arm::Scan::global): Issue an error if a symbol would need a
9483 PLT does not get one because it is untyped. Remove code to create
9484 dynamic symbols for relative branches.
9485 (Target_arm::Relocate::relocate: Use 0 instead of false since function
9486 takes unsigned integer instead of boolean.
9487
9488 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
9489
9490 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9491 (two_file_test_LDADD): Likewise.
9492 (common_test_1_LDADD): Likewise.
9493 (exception_test_LDADD) Likewise.
9494 (weak_test_LDADD): Likewise.
9495 (many_sections_test_LDADD): Likewise.
9496 (initpri1_LDADD): Likewise.
9497 (script_test_1_LDADD): Likewise.
9498 (script_test_2_LDADD): Likewise.
9499 (justsyms_LDADD): Likewise.
9500 (binary_test_LDADD): Likewise.
9501 (large_LDADD): Likewise.
9502 * testsuite/Makefile.in: Regenerated.
9503
9504 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
9505
9506 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9507 (Symbol_table::override_with_special): Likewise.
9508 (Symbol_table::add_from_object): Likewise.
9509
9510 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9511
9512 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9513 Don't set the data_offset twice.
9514
9515 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
9516
9517 * testsuite/Makefile.in: Regenerate.
9518
9519 2009-12-03 Doug Kwan <dougkwan@google.com>
9520
9521 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9522 (Target_arm::do_finalize_sections): Add parameter for symbol table
9523 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
9524 * i386.cc (Target_i386::do_finalize_sections): Add an additional
9525 parameter for symbol table pointer.
9526 * layout.cc (Layout::finalize): Call Target::finalize_sections with
9527 an additional parameter for a pointer to symbol table.
9528 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9529 parameter for a symbol table pointer.
9530 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9531 * target.h (Target::finalize_sections, Target::do_finalize_sections):
9532 Ditto.
9533 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9534 parameter for a symbol table pointer.
9535
9536 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
9537
9538 * incremental.cc (Incremental_inputs_header)
9539 (Incremental_inputs_header_write, Incremental_inputs_entry)
9540 (Incremental_inputs_entry_write): Move ...
9541 * incremental.h (Incremental_inputs_header)
9542 (Incremental_inputs_header_write, Incremental_inputs_entry)
9543 (Incremental_inputs_entry_write): here.
9544
9545 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9546
9547 * incremental.cc (make_sized_incremental_binary): Set the target.
9548 Error if it is incompatible.
9549 * output.h (Output_file): Add filename method.
9550
9551 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9552
9553 * incremental.cc (Incremental_inputs_entry): Remove unused argument
9554 from the get_* methods.
9555
9556 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9557
9558 * incremental-dump.cc (main): Check that the offeset of a script is 0.
9559 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9560 Write 0 for the data_offset of scripts.
9561
9562 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
9563
9564 * testsuite/Makefile.am: Add the incremental_test.sh test.
9565 * testsuite/incremental_test.sh: New.
9566 * testsuite/incremental_test_1.c: New.
9567 * testsuite/incremental_test_2.c: New.
9568
9569 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
9570
9571 * incremental-dump.cc (main): Fix typos.
9572
9573 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
9574
9575 PR gold/11025
9576 * incremental-dump.cc (main): Use llu to print 64 bit values.
9577
9578 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
9579 H.J. Lu <hongjiu.lu@intel.com>
9580
9581 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9582 $(LIBDL).
9583 (incremental_dump_LDADD): Likewise.
9584 * Makefile.in: Regenerated.
9585
9586 2009-11-25 Doug Kwan <dougkwan@google.com>
9587
9588 Revert:
9589
9590 2009-11-25 Doug Kwan <dougkwan@google.com>
9591
9592 * arm.cc (Target_arm::Target_arm): Move method definition
9593 outside of class definition. Add code to handle
9594 --target1-rel, --target1-abs and --target2= options.
9595 (Target_arm::get_reloc_reloc_type): Change method to be
9596 non-static and const.
9597 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9598 New data member declaration.
9599 (Target_arm::Scan::local, Target_arm::Scan::global,
9600 Target_arm::Relocate::relocate,
9601 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9602 Adjust call to Target_arm::get_real_reloc_type.
9603 (Target_arm::get_real_reloc_type): Use command line options
9604 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9605 * options.h (--target1-rel, --target1-abs, --target2): New
9606 ARM-only options.
9607
9608 2009-11-25 Doug Kwan <dougkwan@google.com>
9609
9610 * arm.cc (Target_arm::Target_arm): Move method definition outside of
9611 class definition. Add code to handle --target1-rel, --target1-abs
9612 and --target2= options.
9613 (Target_arm::get_reloc_reloc_type): Change method to be non-static
9614 and const.
9615 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9616 member declaration.
9617 (Target_arm::Scan::local, Target_arm::Scan::global,
9618 Target_arm::Relocate::relocate,
9619 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9620 call to Target_arm::get_real_reloc_type.
9621 (Target_arm::get_real_reloc_type): Use command line options to
9622 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9623 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9624 options.
9625
9626 2009-11-25 Doug Kwan <dougkwan@google.com>
9627
9628 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9629 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9630 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9631 formatting.
9632 (Arm_relocate_functions::thm_call): Replace body with a call to
9633 Arm_relocate_functions::thumb_branch_common.
9634 (Arm_relocate_functions::thm_jump24,
9635 Arm_relocate_functions::thm_xpc22): New method definitions.
9636 (Arm_relocate_functions::thumb_branch_common): New method definition.
9637 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9638 operator.
9639 (Target_arm::Relocate::relocate): Adjust call to thm_call.
9640 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9641
9642 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9643
9644 * Makefile.am: Build incremental-dump
9645 * Makefile.in: Regenerate.
9646 * incremental-dump.cc: New.
9647 * incremental.cc (Incremental_inputs_header_data,
9648 Incremental_inputs_entry_data): Move to incremental.h
9649 * incremental.h: (Incremental_inputs_header_data,
9650 Incremental_inputs_entry_data): Move from incremental.cc
9651
9652 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9653
9654 * incremental.cc (Incremental_inputs_header,
9655 Incremental_inputs_header_write, Incremental_inputs_entry,
9656 Incremental_inputs_entry_write): Add a typedef with the data type.
9657
9658 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
9659
9660 * incremental.cc (Incremental_inputs_header,
9661 Incremental_inputs_header_write, Incremental_inputs_entry,
9662 Incremental_inputs_entry_write): Update comment about which
9663 type has the filed descriptions.
9664
9665 2009-11-15 Doug Kwan <dougkwan@google.com>
9666
9667 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9668 (Arm_relocate_functions::arm_branch_common): Change method defintion
9669 in class definition to a method declaration and update list of formal
9670 parameters.
9671 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9672 Arm_relocation_functions::jump24): Adjust call to
9673 Arm_relocate_functions::arm_branch_common. Update list of formal
9674 parameters.
9675 (Arm_relocate_functions::xpc25): New method definition.
9676 (Arm_relocate_functions::arm_branch_common): Move method defintion
9677 out from class definition. Use stubs for mode-switching and extending
9678 branch ranges.
9679 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9680 specially. Change code to enable use of stubs in ARM branches.
9681
9682 2009-11-10 Doug Kwan <dougkwan@google.com>
9683
9684 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9685 in method declaration.
9686 (Target_arm::relocate_stub): New method declaration.
9687 (Target_arm::default_target): Change to return a pointer instead of
9688 a const reference.
9689 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9690 Target_arm::default_target.
9691 (Arm_Relobj::do_relocate_sections): Remove options paramater in
9692 method definition.
9693 (Target_arm::relocate_section): Adjust view.
9694 (Target_arm::relocate_stub): New method definition.
9695
9696 2009-11-10 Doug Kwan <dougkwan@google.com>
9697
9698 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9699 a format warning.
9700 * incremental.cc (open_incremental_binary): Initialized local
9701 variables to avoid warnings.
9702 * object.cc (make_elf_object): Ditto.
9703 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9704 a format warning.
9705
9706 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
9707
9708 PR gold/10930
9709 * testsuite/plugin_test.c: Include "config.h".
9710
9711 2009-11-09 Doug Kwan <dougkwan@google.com>
9712
9713 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9714 (arm_symbol_value): Remove.
9715 (Arm_relocate_functions::arm_branch_common,
9716 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9717 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9718 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9719 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9720 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9721 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9722 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9723 Arm_relocate_functions::thm_mobw_abs_nc,
9724 Arm_relocate_functions::thm_mov_abs,
9725 Arm_relocate_functions::movw_prel_nc,
9726 Arm_relocate_functions::thm_movt_abs,
9727 Arm_relocate_functions::movt_prel,
9728 Arm_relocate_functions::thm_movw_prel_nc,
9729 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9730 (Target_arm::Relocate::relocate): Only decompose address into two
9731 parts if relocation type uses the thumb-bit and pass the actual
9732 bit instead of a flag indicating that the thumb-bit is used. Adjust
9733 calls to methods in Arm_relocate_functions for this change.
9734
9735 2009-11-08 Ian Lance Taylor <iant@google.com>
9736
9737 PR 10925
9738 * reloc.cc: Instantiate
9739 Sized_relobj::initialize_input_to_output_maps and
9740 Sized_relobj:free_input_to_output_maps.
9741
9742 2009-11-06 Ian Lance Taylor <iant@google.com>
9743
9744 PR 10876
9745 * defstd.cc (in_segment): Set only_if_ref true for "end".
9746
9747 2009-11-06 Doug Kwan <dougkwan@google.com>
9748
9749 * arm.cc (class Reloc_stub): Correct a comment.
9750 (Target_arm::Target_arm): Initialize arm_input_section_map_.
9751 (Target_arm::scan_section_for_stubs): New method declaration.
9752 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9753 Change methods from private to protected.
9754 (Target_arm::do_may_relax): New method definition.
9755 (Target_arm::do_relax, Target_arm::group_sections,
9756 Target_arm::scan_reloc_for_stub,
9757 Target_arm::scan_reloc_section_for_stubs): New method declarations.
9758 (Target_arm::arm_input_section_map_): New data member declaration.
9759 (Target_arm::scan_reloc_for_stub,
9760 Target_arm::scan_reloc_section_for_stubs,
9761 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9762 Target_arm::do_relax): New method definitions.
9763
9764 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
9765
9766 * configure.ac: Check for (struct stat)::st_mtim
9767 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9768 * config.in: Regenerate.
9769 * configure: Regenerate.
9770
9771 2009-11-05 Ian Lance Taylor <iant@google.com>
9772
9773 PR 10910
9774 * output.cc (Output_segment::add_output_section): Add missing
9775 return statement.
9776
9777 2009-11-04 Ian Lance Taylor <iant@google.com>
9778
9779 PR 10880
9780 * object.h (class Object): Add is_needed and set_is_needed
9781 methods. Add is_needed_ field. Make bool fields into bitfields.
9782 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9783 defined in a dynamic object and referenced by a regular object,
9784 set is_needed for the dynamic object.
9785 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9786 if the file is marked with as_needed and it is not needed.
9787
9788 2009-11-04 Ian Lance Taylor <iant@google.com>
9789
9790 PR 10887
9791 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9792 tags if data is discarded by linker script.
9793 * i386.cc (Target_i386::do_finalize_sections): Likewise.
9794 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9795 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9796 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9797
9798 2009-11-04 Ian Lance Taylor <iant@google.com>
9799
9800 * layout.cc (Layout::get_output_section): Add is_interp and
9801 is_dynamic_linker_section parameters. Change all callers.
9802 (Layout::choose_output_section): Likewise.
9803 (Layout::make_output_section): Likewise.
9804 (Layout::add_output_section_data): Add is_dynamic_linker_section
9805 parameter. Change all callers.
9806 * layout.h (class Layout): Update declarations.
9807 * output.h (class Output_section): Add is_interp, set_is_interp,
9808 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9809 Add is_interp_, is_dynamic_linker_section_ fields. Change
9810 generate_code_fills_at_write_ to a bitfield.
9811 * output.cc (Output_section::Output_sections): Initialize new
9812 fields.
9813 (Output_segment::add_output_section): Add do_sort parameter.
9814 Change all callers.
9815
9816 2009-11-03 Ian Lance Taylor <iant@google.com>
9817
9818 PR 10860
9819 * options.h (class General_options): Add --warn-common.
9820 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9821 merging two common symbols.
9822 (Symbol_table::should_override): Handle --warn-common when merging
9823 a common symbol with a defined symbol. Use report_resolve_problem
9824 for multiple definitions.
9825 (Symbol_table::report_resolve_problem): New function.
9826 * symtab.h (class Symbol_table): Declare report_resolve_problem.
9827
9828 2009-11-03 Doug Kwan <dougkwan@google.com>
9829
9830 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9831 stub_factory_.
9832 (Target_arm::stub_factory): New method definition.
9833 (Target_arm::new_arm_input_section,
9834 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9835 Target_arm::reloc_uses_thumb_bit): New method declarations.
9836 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9837 New type definitions.
9838 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9839 member declarations.
9840 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9841 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9842 New method definitions.
9843
9844 2009-11-03 Ian Lance Taylor <iant@google.com>
9845
9846 * options.h (class General_options): Add --warn_constructors.
9847
9848 2009-11-03 Ian Lance Taylor <iant@google.com>
9849
9850 PR 10893
9851 * defstd.cc (in_section): Add entries for __rel_iplt_start,
9852 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9853
9854 2009-11-03 Ian Lance Taylor <iant@google.com>
9855
9856 PR 10895
9857 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9858 --msgid-bugs-address.
9859 (install-pdf): New target.
9860 (install-data_yes): Look up one directory to find mkinstalldirs.
9861
9862 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
9863
9864 * po/Make-in (.po.gmo): Don't generate .gmo files in source
9865 tree.
9866
9867 2009-10-30 Doug Kwan <dougkwan@google.com>
9868
9869 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9870
9871 2009-10-30 Doug Kwan <dougkwan@google.com>
9872
9873 * arm.cc (Stub_addend_reader): New struct template definition
9874 and partial specializations.
9875 (Stub_addend_reader::operator()): New method definition for a
9876 partially specialized template.
9877
9878 2009-10-30 Doug Kwan <dougkwan@google.com>
9879
9880 * arm.cc (Arm_relobj::processor_specific_flags): New method
9881 definition.
9882 (Arm_relobj::do_read_symbols): New method declaration.
9883 (Arm_relobj::processor_specific_flags_): New data member declaration.
9884 (Arm_dynobj): New class definition.
9885 (Target_arm::do_finalize_sections): Add input_objects parameter.
9886 (Target_arm::do_adjust_elf_header): New method declaration.
9887 (Target_arm::are_eabi_versions_compatible,
9888 (Target_arm::merge_processor_specific_flags): New method declaration.
9889 (Target_arm::do_make_elf_object): New overloaded method definitions
9890 and declaration.
9891 (Arm_relobj::do_read_symbols): New method definition.
9892 (Arm_dynobj::do_read_symbols): Ditto.
9893 (Target_arm::do_finalize_sections): Add input_objects parameters.
9894 Merge processor-specific flags from all input objects.
9895 (Target_arm::are_eabi_versions_compatible,
9896 Target_arm::merge_processor_specific_flags,
9897 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9898 New method definitions.
9899 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9900 Input_objects pointer type parameter.
9901 * layout.cc (Layout::finalize): Pass input objects to target's.
9902 finalize_sections function.
9903 * output.cc (Output_file_header::do_sized_write): Set ELF file
9904 header's processor-specific flags.
9905 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9906 Input_objects pointer type parameter.
9907 * sparc.cc (Target_sparc::do_finalize_sections): Same.
9908 * target.h (Input_objects): New forward class declaration.
9909 (Target::processor_specific_flags,
9910 Target::are_processor_specific_flags_sect): New method definitions.
9911 (Target::finalize_sections): Add input_objects parameter.
9912 (Target::Target): Initialize processor_specific_flags_ and
9913 are_processor_specific_flags_set_.
9914 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9915 parameter.
9916 (Target::set_processor_specific_flags): New method definition.
9917 (Target::processor_specific_flags_,
9918 Target::are_processor_specific_flags_set_): New data member
9919 declarations.
9920 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9921 Input_objects pointer type parameter.
9922
9923 2009-10-30 Doug Kwan <dougkwan@google.com>
9924
9925 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9926
9927 2009-10-28 Ian Lance Taylor <iant@google.com>
9928
9929 * object.h (class Relobj): Drop options parameter from
9930 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9931 do_scan_relocs, do_relocate. Change all callers.
9932 (class Sized_relobj): Drop options parameters from
9933 do_gc_process_relocs, do_scan_relocs, do_relocate,
9934 do_relocate_sections, relocate_sections, emit_relocs_scan,
9935 emit_relocs_scan_reltype. Change all callers.
9936 (struct Relocate_info): Remove options field and all references to
9937 it.
9938 * reloc.h (class Read_relocs): Remove options constructor
9939 parameter and options_ field. Change all callers.
9940 (class Gc_process_relocs, class Scan_relocs): Likewise.
9941 (class Relocate_task): Likewise.
9942 * target-reloc.h (scan_relocs): Remove options parameter. Change
9943 all callers.
9944 (scan_relocatable_relocs): Likewise.
9945 * target.h (class Sized_target): Remove options parameter from
9946 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
9947 all callers.
9948 * gc.h (gc_process_relocs): Remove options parameter. Change all
9949 callers.
9950 * arm.cc: Update functions to remove options parameters.
9951 * i386.cc: Likewise.
9952 * powerpc.cc: Likewise.
9953 * sparc.cc: Likewise.
9954 * x86_64.cc: Likewise.
9955 * testsuite/testfile.cc: Likewise.
9956
9957 2009-10-28 Doug Kwan <dougkwan@google.com>
9958
9959 * arm.cc (Arm_relobj): New class definition.
9960 (Arm_relobj::scan_sections_for_stubs,
9961 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9962 New method definitions.
9963
9964 2009-10-28 Cary Coutant <ccoutant@google.com>
9965
9966 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9967 (Plugin::cleanup_done_): New member.
9968 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9969 (Plugin_manager::cleanup_done_): Remove.
9970 (Plugin_manager::add_input_file): Edit error message.
9971 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9972 (Plugin_manager::cleanup): Remove use of cleanup_done_.
9973
9974 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
9975
9976 * fileread.cc: (File_read::View::~View): Use the new
9977 data_ownership_ filed.
9978 (File_read::~File_read): Dispose the new whole_file_view_.
9979 (File_read::open): Mmap the whole file if needed.
9980 (File_read::open): Use whole_file_view_ instead of contents_.
9981 (File_read::find_view): Use whole_file_view_ if applicable.
9982 (File_read::do_read): Use whole_file_view_ instead of contents_.
9983 (File_read::make_view): Use whole_file_view_ instead of contents_,
9984 update File_read::View::View call.
9985 (File_read::find_or_make_view): Update File_read::View::View
9986 call.
9987 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9988 remove contents_
9989 (File_read::View::Data_ownership): New enum.
9990 (File_read::View::View): Replace bool mapped_ with Data_ownership
9991 argument.
9992 (File_read::View::mapped_): Remove (replaced by data_ownership_).
9993 (File_read::View::data_ownership_): New field.
9994 (File_read::contents_): Remove (replaced by whole_file_view_).
9995 (File_read::whole_file_view_): New field.
9996 * options.h (class General_options): Add --keep-files-mapped.
9997
9998 2009-10-27 Cary Coutant <ccoutant@google.com>
9999
10000 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10001 * testsuite/Makefile.am (plugin_test_5): New test case.
10002 * testsuite/Makefile.in: Regenerate.
10003
10004 2009-10-25 Doug Kwan <dougkwan@google.com>
10005
10006 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10007 from private to protected to allow access by child class.
10008 (Sized_relobj::do_relocate_sections): New method declaration.
10009 (Sized_relobj::relocate_sections): Virtualize.
10010 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10011 Sized_relobj::relocate_sections. Instantiate template explicitly
10012 for different target sizes and endianity.
10013
10014 2009-10-24 Doug Kwan <dougkwan@google.com>
10015
10016 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10017 (Arm_input_section::as_arm_input_section): New method.
10018 (Arm_output_section): New class definition.
10019 (Arm_output_section::create_stub_group,
10020 Arm_output_section::group_sections): New method definitions.
10021
10022 2009-10-22 Doug Kwan <dougkwan@google.com>
10023
10024 * arm.cc (Arm_input_section): New class definition.
10025 (Arm_input_section::init, Arm_input_section:do_write,
10026 Arm_input_section::set_final_data_size,
10027 Arm_input_section::do_reset_address_and_file_offset): New method
10028 definitions.
10029
10030 2009-10-21 Doug Kwan <dougkwan@google.com>
10031
10032 * arm.cc (Stub_table, Arm_input_section): New forward class
10033 declarations.
10034 (Stub_table): New class defintion.
10035 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10036 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10037 New method definition.
10038
10039 2009-10-21 Doug Kwan <dougkwan@google.com>
10040
10041 * arm.cc: Update copyright comments.
10042 (Target_arm): New forward class template declaration.
10043 (Arm_address): New type.
10044 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10045 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10046 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10047 constants.
10048 (Insn_template): Same.
10049 (DEF_STUBS): New macro.
10050 (Stub_type): New enum type.
10051 (Stub_template): New class definition.
10052 (Stub): Same.
10053 (Reloc_stub): Same.
10054 (Stub_factory): Same.
10055 (Target_arm::Target_arm): Initialize may_use_blx_ and
10056 should_force_pic_veneer_.
10057 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10058 Target_arm::should_force_pic_veneer,
10059 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10060 Target_arm::using_thumb_only, Target_arm:;default_target): New
10061 method defintions.
10062 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10063 New data member declarations.
10064 (Insn_template::size, Insn_template::alignment): New method defintions.
10065 (Stub_template::Stub_template): New method definition.
10066 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10067 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10068 (Stub_factory::Stub_factory): New method definition.
10069 * gold.h (string_hash): New template.
10070 * output.h (Input_section_specifier::hash_value): Use
10071 gold::string_hash.
10072 (Input_section_specifier::string_hash): Remove.
10073 * stringpool.cc (Stringpool_template::string_hash): Use
10074 gold::string_hash.
10075
10076 2009-10-20 Doug Kwan <dougkwan@google.com>
10077
10078 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10079 symbols of relaxed input sections.
10080 * output.h (Output_section::find_relaxed_input_section): Make
10081 method public.
10082
10083 2009-10-16 Doug Kwan <dougkwan@google.com>
10084
10085 * dynobj.cc (Versions::Versions): Initialize version_script_.
10086 Only insert base version symbol definition for a shared object
10087 if version script defines any version versions.
10088 (Versions::define_base_version): New method definition.
10089 (Versions::add_def): Check that base version is not needed.
10090 (Versions::add_need): Define base version lazily.
10091 * dynobj.h (Versions::define_base_version): New method declaration.
10092 (Versions::needs_base_version_): New data member declaration.
10093 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10094 (check_DATA): Add no_version_test.stdout.
10095 (libno_version_test.so, no_version_test.o no_version_test.stdout):
10096 New make rules.
10097 * testsuite/Makefile.in: Regenerate.
10098 * testsuite/no_version_test.c: New file.
10099 * testsuite/no_version_test.sh: Ditto.
10100
10101 2009-10-16 Doug Kwan <dougkwan@google.com>
10102
10103 * expression.cc (class Segment_start_expression): New class definition.
10104 (Segment_start_expression::value): New method definition.
10105 (script_exp_function_segment_start): Return a new
10106 Segment_start_expression.
10107 * gold/script-c.h (script_saw_segment_start_expression): New function
10108 prototype.
10109 * script-sections.cc (Script_sections::Script_sections): Initialize
10110 SAW_SEGMENT_START_EXPRESSION_ to false.
10111 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10112 and -Tbbs options to specify section addresses if given in
10113 command line and no SEGMENT_START expression is seen in a script.
10114 * script-sections.h (Script_sections::saw_segment_start_expression,
10115 Script_sections::set_saw_segment_start_expression): New method
10116 definition.
10117 (Script_sections::saw_segment_start_expression_): New data member
10118 declaration.
10119 * script.cc (script_saw_segment_start_expression): New function.
10120 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10121 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10122 script_test_7.sh and script_test_8.sh.
10123 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10124 script_test_8.stdout.
10125 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10126 (script_test_6, script_test_6.stdout, script_test_7,
10127 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10128 * Makefile.in: Regenerate.
10129 * testsuite/script_test_6.sh: New file.
10130 * testsuite/script_test_6.t: Same.
10131 * testsuite/script_test_7.sh: Same.
10132 * testsuite/script_test_7.t: Same.
10133 * testsuite/script_test_8.sh: Same.
10134
10135 2009-10-16 Doug Kwan <dougkwan@google.com>
10136
10137 * output.cc (Output_segment::set_section_list_address): Cast
10138 expressions to unsigned long long type to avoid format warnings.
10139
10140 2009-10-15 Ian Lance Taylor <iant@google.com>
10141
10142 * script.cc (Script_options::add_symbol_assignment): Always add a
10143 dot assignment to script_sections_.
10144 * script-sections.cc (Script_sections::add_dot_assignment):
10145 Initialize if necessary.
10146
10147 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10148 program headers with no load segment if there is a linker script.
10149
10150 * layout.cc (Layout::set_segment_offsets): Align the file offset
10151 to the segment aligment for -N or -n with no load segment.
10152 * output.cc (Output_segment::add_output_section): Don't crash if
10153 the first section is a TLS section.
10154 (Output_segment::set_section_list_addresses): Print an error
10155 message if the address moves backward in a linker script.
10156 * script-sections.cc
10157 (Output_section_element_input::set_section_addresses): Don't
10158 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10159 (Orphan_output_section::set_section_addresses): Likewise.
10160
10161 2009-10-15 Doug Kwan <dougkwan@google.com>
10162
10163 * layout.cc (Layout::finish_dynamic_section): Generate tags
10164 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10165 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10166 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10167
10168 2009-10-14 Ian Lance Taylor <iant@google.com>
10169
10170 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10171 fields.
10172 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10173 data_shdr fields of relinfo.
10174 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10175 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
10176 R_386_TLS_LDO_32, adjust based on section flags.
10177 (Target_i386::Relocate::fix_up_ldo): Remove.
10178
10179 2009-10-13 Ian Lance Taylor <iant@google.com>
10180
10181 Add support for -pie.
10182 * options.h (class General_options): Add -pie and
10183 --pic-executable.
10184 (General_options::output_is_position_independent): Test -pie.
10185 (General_options::output_is_executable): Return true if not shared
10186 and not relocatable.
10187 (General_options::output_is_pie): Remove.
10188 * options.cc (General_options::finalize): Reject incompatible uses
10189 of -pie.
10190 * gold.cc (queue_middle_tasks): A -pie link is not static.
10191 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10192 * symtab.cc (Symbol::final_value_is_known): Return false if
10193 output_is_position_independent.
10194 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10195 output_is_position_independent.
10196 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10197 output_is_position_independent.
10198 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10199 output_is_position_independent.
10200 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10201 two_file_pie_test.
10202 (basic_pie_test.o, basic_pie_test): New targets.
10203 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10204 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10205 (two_file_pie_test): New target.
10206 * testsuite/Makefile.in: Rebuild.
10207 * README: Remove note saying that -pie is not supported.
10208
10209 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
10210
10211 * options.h (class General_options): Add -init and -fini.
10212 * layout.cc (Layout::finish_dynamic_section): Emit
10213 given init and fini functions.
10214
10215 2009-10-13 Sriraman Tallam <tmsriram@google.com>
10216
10217 * gc.h (gc_process_relocs): Check if icf is enabled using new
10218 function.
10219 * gold.cc (queue_initial_tasks): Likewise.
10220 (queue_middle_tasks): Likewise.
10221 * object.cc (do_layout): Likewise.
10222 * symtab.cc (is_section_folded): Likewise.
10223 * main.cc (main): Likewise.
10224 * reloc.cc (Read_relocs::run): Likewise.
10225 (Sized_relobj::do_scan_relocs): Likewise.
10226 * icf.cc (is_function_ctor_or_dtor): New function.
10227 (Icf::find_identical_sections): Check if function is ctor or dtor when
10228 safe icf is chosen.
10229 * options.h (General_options::icf): Change option to be an enum.
10230 (Icf_status): New enum.
10231 (icf_enabled): New method.
10232 (icf_safe_folding): New method.
10233 (set_icf_status): New method.
10234 (icf_status_): New variable.
10235 * (options.cc) (General_options::finalize): Set icf_status_.
10236 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10237 icf_test and icf_keep_unique_test to use the --icf enum flag.
10238 * testsuite/icf_safe_test.sh: New file.
10239 * testsuite/icf_safe_test.cc: New file.
10240
10241 2009-10-12 Sriraman Tallam <tmsriram@google.com>
10242
10243 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10244 includes to gc.h and icf.h.
10245 * arm.cc: Include gc.h.
10246 * gold.cc: Likewise.
10247 * i386.cc: Likewise.
10248 * powerpc.cc: Likewise.
10249 * sparc.cc: Likewise.
10250 * x86_64.cc: Likewise.
10251 * gc.h: Include icf.h.
10252
10253 2009-10-11 Ian Lance Taylor <iant@google.com>
10254
10255 * plugin.cc: Include "gold.h" before other header files.
10256
10257 2009-10-10 Chris Demetriou <cgd@google.com>
10258
10259 * options.h (Input_file_argument::Input_file_type): New enum.
10260 (Input_file_argument::is_lib_): Replace with...
10261 (Input_file_argument::type_): New member.
10262 (Input_file_argument::Input_file_argument): Take Input_file_type
10263 'type' rather than boolean 'is_lib' as second argument.
10264 (Input_file_argument::is_lib): Use type_.
10265 (Input_file_argument::is_searched_file): New function.
10266 (Input_file_argument::may_need_search): Handle is_searched_file.
10267 * options.cc (General_options::parse_library): Support -l:filename.
10268 (General_options::parse_just_symbols): Update for Input_file_argument
10269 changes.
10270 (Command_line::process): Likewise.
10271 * archive.cc (Archive::get_file_and_offset): Likewise.
10272 * plugin.cc (Plugin_manager::release_input_file): Likewise.
10273 * script.cc (read_script_file, script_add_file): Likewise.
10274 * fileread.cc (Input_file::Input_file): Likewise.
10275 (Input_file::will_search_for): Handle is_searched_file.
10276 (Input_file::open): Likewise.
10277 * readsyms.cc (Read_symbols::get_name): Likewise.
10278 * testsuite/Makefile.am (searched_file_test): New test.
10279 * testsuite/Makefile.in: Regenerate.
10280 * testsuite/searched_file_test.cc: New file.
10281 * testsuite/searched_file_test_lib.cc: New file.
10282
10283 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10284 Ian Lance Taylor <iant@google.com>
10285
10286 * descriptor.cc: Include <cstdio> and "binary-io.h".
10287 (Descriptors::open): Open the files in binary mode always.
10288 * script.cc (Lex::get_token): Treat \r as whitespace.
10289
10290 2009-10-09 Ian Lance Taylor <iant@google.com>
10291
10292 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10293
10294 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10295 Ian Lance Taylor <iant@google.com>
10296
10297 * configure.ac: Check for readv function also.
10298 * fileread.cc (readv): Define if not HAVE_READV.
10299 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10300 does not exist.
10301 * config.in: Regenerate.
10302 * configure: Regenerate.
10303
10304 2009-10-09 Doug Kwan <dougkwan@google.com>
10305
10306 * layout.cc (Layout::make_output_section): Call target hook to make
10307 ordinary output section.
10308 (Layout::finalize): Adjust parameter list of call the
10309 Target::may_relax().
10310 * layout.h (class Layout::section_list): New method.
10311 * merge.h (Output_merge_base::entsize): Change visibility to public.
10312 (Output_merge_base::is_string, Output_merge_base::do_is_string):
10313 New methods.
10314 (Output_merge_string::do_is_string): New method.
10315 * object.cc (Sized_relobj::do_setup): renamed from
10316 Sized_relobj::set_up.
10317 * object.h (Sized_relobj::adjust_shndx,
10318 Sized_relobj::initializ_input_to_output_maps,
10319 Sized_relobj::free_input_to_output_maps): Change visibilities to
10320 protected.
10321 (Sized_relobj::setup): Virtualize.
10322 (Sized_relobj::do_setup): New method declaration.
10323 (Sized_relobj::invalidate_section_offset,
10324 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10325 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10326 * options.cc (parse_int): New function.
10327 * options.h (parse_int): New declaration.
10328 (DEFINE_int): New macro.
10329 (stub_group_size): New option.
10330 * output.cc (Output_section::Output_section): Initialize memebers
10331 merge_section_map_, merge_section_by_properties_map_,
10332 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10333 (Output_section::add_input_section): Handled deferred code-fill
10334 generation and remove an old comment.
10335 (Output_section::add_relaxed_input_section): New method definition.
10336 (Output_section::add_merge_input_section): Use merge section by
10337 properties map to speed to search. Update merge section maps
10338 as appropriate.
10339 (Output_section::build_relaxation_map): New method definition.
10340 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10341 Same.
10342 (Output_section::relax_input_section): Renamed to
10343 Output_section::convert_input_sections_to_relaxed_sections and change
10344 interface to take a vector of pointers to relaxed sections.
10345 (Output_section::find_merge_section,
10346 Output_section::find_relaxed_input_section): New method definitions.
10347 (Output_section::is_input_address_mapped,
10348 Output_section::output_offset, Output_section::output_address):
10349 Use output section data maps to speed up searching.
10350 (Output_section::find_starting_output_address): Add comments.
10351 (Output_section::do_write,
10352 Output_section::write_to_postprocessing_buffer): Do code-fill
10353 generation as appropriate.
10354 (Output_section::get_input_sections): Invalidate relaxed input section
10355 map.
10356 (Output_section::restore_states): Adjust type of checkpoint .
10357 Invalidate relaxed input section map.
10358 * output.h (Output_merge_base): New class declaration.
10359 (Input_section_specifier): New class defintion.
10360 (class Output_relaxed_input_section) Change base class to
10361 Output_section_data_build.
10362 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10363 base class initializer.
10364 (Output_section::add_relaxed_input_section): New method declaration.
10365 (Output_section::Input_section): Change visibility to protected.
10366 (Output_section::Input_section::relobj,
10367 Output_section::Input_section::shndx): Handle relaxed input sections.
10368 Output_section::input_sections) Change visibility to protected. Also
10369 define overload to return a non-const pointer.
10370 (Output_section::Merge_section_properties): New class defintion.
10371 (Output_section::Merge_section_by_properties_map,
10372 Output_section::Output_section_data_by_input_section_map,
10373 Output_section::Relaxation_map): New types.
10374 (Output_section::relax_input_section): Rename method to
10375 Output_section::convert_input_sections_to_relaxed_sections and change
10376 interface to take a vector of relaxed section pointers.
10377 (Output_section::find_merge_section,
10378 Output_section::find_relaxed_input_section,
10379 Output_section::build_relaxation_map,
10380 Output_section::convert_input_sections_in_list_to_relaxed_sections):
10381 New method declarations.
10382 (Output_section::merge_section_map_
10383 Output_section::merge_section_by_properties_map_,
10384 Output_section::relaxed_input_section_map_,
10385 Output_section::is_relaxed_input_section_map_valid_,
10386 Output_section::generate_code_fills_at_write_): New data members.
10387 * script-sections.cc
10388 (Output_section_element_input::set_section_addresses): Call
10389 current_data_size and addralign methods of relaxed input sections.
10390 (Orphan_output_section::set_section_addresses): Call current_data_size
10391 and addralign methods of relaxed input sections.
10392 * symtab.cc (Symbol_table::compute_final_value): Extract template
10393 from the body of Symbol_table::sized_finalize_symbol.
10394 (Symbol_table::sized_finalized_symbol): Call
10395 Symbol_table::compute_final_value.
10396 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10397 (Symbol_table::compute_final_value): New templated method declaration.
10398 * target.cc (Target::do_make_output_section): New method defintion.
10399 * target.h (Target::make_output_section): New method declaration.
10400 (Target::relax): Add more parameters for input objects, symbol table
10401 and layout. Adjust call to do_relax.
10402 (Target::do_make_output_section): New method declaration.
10403 (Target::do_relax): Add parameters for input objects, symbol table
10404 and layout.
10405
10406 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10407
10408 * pread.c: Include stdio.h.
10409
10410 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10411
10412 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10413 defined.
10414
10415 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
10416
10417 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10418 Change read_shndx type to unsigned int.
10419 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10420 int.
10421 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10422 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10423 Change read_shndx type to unsigned int.
10424 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10425 int.
10426 (Sized_dwarf_line_info::read_line_mappings): Likewise.
10427 * layout.cc (Layout::create_symtab_sections): Cast the result of
10428 local_symcount * symsize to off_t in the gold_assert.
10429
10430 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10431
10432 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10433 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10434 R_ARM_BASE_ABS.
10435 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10436 (Arm_relocate_functions::thm_abs5): New function.
10437 (Arm_relocate_functions::abs12): New function.
10438 (Arm_relocate_functions::abs16): New function.
10439 (Arm_relocate_functions::base_abs): New function.
10440 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10441 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
10442 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10443 R_ARM_BASE_ABS.
10444 (Scan::global): Likewise.
10445 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10446 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10447 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10448 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10449 R_ARM_BASE_ABS.
10450
10451 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10452
10453 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10454 (Arm_relocate_functions::movt_prel): New function.
10455 (Arm_relocate_functions::thm_movw_prel_nc): New function.
10456 (Arm_relocate_functions::thm_movt_prel): New function.
10457 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10458 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10459 (Scan::global, Relocate::relocate): Likewise.
10460 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10461
10462 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10463
10464 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10465 Incremental_checker.
10466 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10467 unsigned int.
10468 (class Incremental_inputs_header): New class.
10469 (Incremental_inputs_header_writer): Edit comment.
10470 (Incremental_inputs_entry): New class.
10471 (Incremental_inputs_entry_writer): Edit comment.
10472 (Sized_incremental_binary::do_find_incremental_inputs_section):
10473 Add *strtab_shndx parameter, fill it.
10474 (Sized_incremental_binary::do_check_inputs): New method.
10475 (Incremental_checker::can_incrementally_link_output_file): Use
10476 Sized_incremental_binary::check_inputs.
10477 (Incremental_inputs::report_command_line): Save command line in
10478 command_line_.
10479 * incremental.h:
10480 (Incremental_binary::find_incremental_inputs_section): New
10481 method.
10482 (Incremental_binary::do_find_incremental_inputs_section): Add
10483 strtab_shndx parameter.
10484 (Incremental_binary::do_check_inputs): New pure virtual method.
10485 (Sized_incremental_binary::do_check_inputs): Declare.
10486 (Incremental_checker::Incremental_checker): Add incremental_inputs
10487 parameter, use it to initialize incremental_inputs_.
10488 (Incremental_checker::incremental_inputs_): New field.
10489 (Incremental_checker::command_line): New method.
10490 (Incremental_checker::inputs): New method.
10491 (Incremental_checker::command_line_): New field.
10492
10493 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
10494
10495 * incremental.cc: Include <cstdarg> and "target-select.h".
10496 (vexplain_no_incremental): New function.
10497 (explain_no_incremental): New function.
10498 (Incremental_binary::error): New method.
10499 (Sized_incremental_binary::do_find_incremental_inputs_section): New
10500 method.
10501 (make_sized_incremental_binary): New function.
10502 (open_incremental_binary): New function.
10503 (can_incrementally_link_file): Add checks if output is ELF and has
10504 inputs section.
10505 * incremental.h: Include "elfcpp_file.h" and "output.h".
10506 (Incremental_binary): New class.
10507 (Sized_incremental_binary): New class.
10508 (open_incremental_binary): Declare.
10509 * object.cc (is_elf_object): Use
10510 elfcpp::Elf_recognizer::is_elf_file.
10511 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10512 * output.h (Output_file::filesize): New method.
10513
10514 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10515
10516 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10517 New function.
10518 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10519 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10520 function.
10521 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10522 function.
10523 (Arm_relocate_functions::movw_abs_nc): New function.
10524 (Arm_relocate_functions::movt_abs): New function.
10525 (Arm_relocate_functions::thm_movw_abs_nc): New function.
10526 (Arm_relocate_functions::thm_movt_abs): New function.
10527 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10528 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10529 (Scan::global): Likewise.
10530 (Relocate::relocate): Likewise.
10531 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10532
10533 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10534
10535 * arm.cc (Arm_relocate_functions::got_prel) New function.
10536 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10537 (Relocate::relocate): Likewise.
10538 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10539
10540 2009-10-06 Ian Lance Taylor <iant@google.com>
10541
10542 * options.h (class General_options): Define
10543 split_stack_adjust_size parameter.
10544 * object.h (class Object): Add uses_split_stack_ and
10545 has_no_split_stack_ fields. Add uses_split_stack and
10546 has_no_split_stack accessor functions. Declare
10547 handle_split_stack_section.
10548 (class Reloc_symbol_changes): Define.
10549 (class Sized_relobj): Define Function_offsets. Declare
10550 split_stack_adjust, split_stack_adjust_reltype, and
10551 find_functions.
10552 * object.cc (Object::handle_split_stack_section): New function.
10553 (Sized_relobj::do_layout): Call handle_split_stack_section.
10554 * dynobj.cc (Sized_dynobj::do_layout): Call
10555 handle_split_stack_section.
10556 * reloc.cc (Sized_relobj::relocate_sections): Call
10557 split_stack_adjust for executable sections in split_stack
10558 objects. Pass reloc_map to relocate_section.
10559 (Sized_relobj::split_stack_adjust): New function.
10560 (Sized_relobj::split_stack_adjust_reltype): New function.
10561 (Sized_relobj::find_functions): New function.
10562 * target-reloc.h: Include "object.h".
10563 (relocate_section): Add reloc_symbol_changes parameter. Change
10564 all callers.
10565 * target.h (class Target): Add calls_non_split method. Declare
10566 do_calls_non_split virtual method. Declare match_view and
10567 set_view_to_nop.
10568 * target.cc: Include "elfcpp.h".
10569 (Target::do_calls_non_split): New function.
10570 (Target::match_view): New function.
10571 (Target::set_view_to_nop): New function.
10572 * gold.cc (queue_middle_tasks): Give an error if mixing
10573 split-stack and non-split-stack objects with -r.
10574 * i386.cc (Target_i386::relocate_section): Add
10575 reloc_symbol_changes parameter.
10576 (Target_i386::do_calls_non_split): New function.
10577 * x86_64.cc (Target_x86_64::relocate_section): Add
10578 reloc_symbol_changes parameter.
10579 (Target_x86_64::do_calls_non_split): New function.
10580 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10581 parameter.
10582 * powerpc.cc (Target_powerpc::relocate_section): Add
10583 reloc_symbol_changes parameter.
10584 * sparc.cc (Target_sparc::relocate_section): Add
10585 reloc_symbol_changes parameter.
10586 * configure.ac: Call AM_CONDITIONAL for the default target.
10587 * configure: Rebuild.
10588 * testsuite/Makefile.am (TEST_AS): New variable.
10589 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10590 (check_DATA): Add split_i386 and split_x86_64 files.
10591 (SPLIT_DEFSYMS): Define.
10592 (split_i386_[1234n].o): New targets.
10593 (split_i386_[124]): New targets.
10594 (split_i386_[1234r].stdout): New targets.
10595 (split_x86_64_[1234n].o): New targets.
10596 (split_x86_64_[124]): New targets.
10597 (split_x86_64_[1234r].stdout): New targets.
10598 (MOSTLYCLEANFILES): Add new executables.
10599 * testsuite/split_i386.sh: New file.
10600 * testsuite/split_x86_64.sh: New file.
10601 * testsuite/split_i386_1.s: New file.
10602 * testsuite/split_i386_2.s: New file.
10603 * testsuite/split_i386_3.s: New file.
10604 * testsuite/split_i386_4.s: New file.
10605 * testsuite/split_i386_n.s: New file.
10606 * testsuite/split_x86_64_1.s: New file.
10607 * testsuite/split_x86_64_2.s: New file.
10608 * testsuite/split_x86_64_3.s: New file.
10609 * testsuite/split_x86_64_4.s: New file.
10610 * testsuite/split_x86_64_n.s: New file.
10611 * testsuite/testfile.cc (Target_test): Update relocation_section
10612 function.
10613 * testsuite/Makefile.in: Rebuild.
10614
10615 2009-10-06 Ian Lance Taylor <iant@google.com>
10616
10617 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10618 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10619 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
10620 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10621 the address on ldo_addrs_.
10622 (Target_i386::Relocate::fix_up_ldo): New function.
10623
10624 2009-10-06 Rafael Espindola <espindola@google.com>
10625
10626 * plugin.cc (add_input_library): New.
10627 (Plugin::load): Add add_input_library to tv.
10628 (Plugin_manager::add_input_file): Add the is_lib argument.
10629 (add_input_file): Update call to Plugin_manager::add_input_file.
10630 (add_input_library): New.
10631 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10632
10633 2009-09-30 Doug Kwan <dougkwan@google.com>
10634
10635 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10636 symbol and call Symbol::may_need_copy_reloc to determine if
10637 a copy reloc is needed.
10638 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10639 nocopyreloc is given in command line.
10640 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10641 given in command line.
10642 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10643 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10644 of the removed Target_i386::may_need_copy_reloc.
10645 * options.h (copyreloc): New option with default value false.
10646 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10647 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10648 instead of the removed Target_powerpc::may_need_copy_reloc.
10649 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10650 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10651 instead of the removed Target_sparc::may_need_copy_reloc.
10652 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10653 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10654 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10655 instead of the removed Target_x86_64::may_need_copy_reloc.
10656
10657 2009-09-30 Ian Lance Taylor <iant@google.com>
10658
10659 * object.h (class Object): Remove target_ field, and target,
10660 sized_target, and set_target methods.
10661 (Object::sized_target): Remove.
10662 (class Sized_relobj): Update declarations. Remove sized_target.
10663 * object.cc (Sized_relobj::setup): Remove target parameter.
10664 Change all callers.
10665 (Input_objects::add_object): Don't do anything with the target.
10666 (make_elf_sized_object): Add punconfigured parameter. Change all
10667 callers. Set or test parameter target.
10668 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10669 Change all callers.
10670 * parameters.cc (Parameters::set_target): Change parameter type to
10671 be non-const.
10672 (Parameters::default_target): Remove.
10673 (set_parameters_target): Change parameter type to be non-const.
10674 (parameters_force_valid_target): New function.
10675 (parameters_clear_target): New function.
10676 * parameters.h (class Parameters): Update declarations. Remove
10677 default_target method. Add sized_target and clear_target
10678 methods. Change target_ to be non-const.
10679 (set_parameters_target): Update declaration.
10680 (parameters_force_valid_target): Declare.
10681 (parameters_clear_target): Declare.
10682 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10683 as NULL if we aren't searching.
10684 (Add_symbols::run): Don't check for compatible target.
10685 * fileread.cc (Input_file::open_binary): Call
10686 parameters_force_valid_target.
10687 * gold.cc (queue_middle_tasks): Likewise.
10688 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
10689 set_target on object.
10690 * dynobj.h (class Sized_dynobj): Update declarations.
10691 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10692 make_elf_object returns NULL.
10693 (Archive::include_member): Don't check whether object target is
10694 compatible.
10695 * output.cc (Output_section::add_input_section): Get target from
10696 parameters.
10697 (Output_section::relax_input_section): Likewise.
10698 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10699 parameters.
10700 (Sized_relobj::do_scan_relocs): Likewise.
10701 (Sized_relobj::relocate_sections): Likewise.
10702 * resolve.cc (Symbol_table::resolve): Likewise.
10703 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
10704 parameter. Change all callers.
10705 (Symbol_table::add_from_object): Get target from parameters.
10706 (Symbol_table::add_from_relobj): Don't check object target.
10707 (Symbol_table::add_from_dynobj): Likewise.
10708 (Symbol_table::define_special_symbol): Get target from
10709 parameters.
10710 * symtab.h (class Symbol_table): Update declaration.
10711 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10712 parameter. Change all callers. Clear parameter target.
10713 (Binary_test): Test target here.
10714 * testsuite/object_unittest.cc (gold_testsuite): Remove
10715 target_test_pointer parameter. Change all callers.
10716 (Object_test): Test target here.
10717
10718 2009-09-26 Ian Lance Taylor <iant@google.com>
10719
10720 * testsuite/initpri1.c: Don't try to use constructor priorities if
10721 compiling with gcc before 4.3.
10722
10723 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
10724
10725 * testsuite/retain_symbols_file_test.sh (check_present): Change
10726 output file name to retain_symbols_file_test.stdout.
10727 (check_absent): Likewise.
10728
10729 2009-09-18 Craig Silverstein <csilvers@google.com>
10730
10731 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10732 * options.cc: Include <cerrno> and <fstream>.
10733 (General_options::finalize): Parse -retain-symbols-file tag.
10734 * options.h: New flag.
10735 (General_options): New method should_retain_symbol, new
10736 variable symbols_to_retain.
10737 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10738 should_retain_symbol map.
10739 * testsuite/Makefile.am (retain_symbols_file_test): New test.
10740 * testsuite/Makefile.in: Regenerate.
10741 * testsuite/retain_symbols_file_test.sh: New file.
10742
10743 2009-09-18 Nick Clifton <nickc@redhat.com>
10744
10745 * po/es.po: Updated Spanish translation.
10746
10747 2009-09-17 Doug Kwan <dougkwan@google.com>
10748
10749 * debug.h (DEBUG_RELAXATION): New constant.
10750 (DEBUG_ALL): Add DEBUG_RELAXATION.
10751 (debug_string_to_enum): Add relaxation debug option.
10752 * layout.cc
10753 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10754 Layout::Relaxation_debug_check::read_sections,
10755 Layout::Relaxation_debug_check::read_sections): New method definitions.
10756 (Layout::Layout): Initialize data members
10757 record_output_section_data_from_scrips_,
10758 script_output_section_data_list_ and relaxation_debug_check_.
10759 (Layout::save_segments, Layout::restore_segments,
10760 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10761 Layout::relaxation_loop_body): New method definitions.
10762 (Layout::finalize): Support relaxation. Move section layout code to
10763 Layout::relaxation_loop_body.
10764 (Layout::set_asection_address_from_script): Move code for orphan
10765 section placement out.
10766 (Layout::place_orphan_sections_in_script): New method definition.
10767 * layout.h (Output_segment_headers, Output_file_header):
10768 New forward class declarations.
10769 (Layout::~Layout): Define.
10770 (Layout::new_output_section_data_from_script): New method definition.
10771 (Layout::place_orphan_sections_in_script): New method declaration.
10772 (Layout::Segment_states): New type declaration.
10773 (Layout::save_segments, Layout::restore_segments,
10774 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10775 Layout::relaxation_loop_body): New method declarations.
10776 (Layout::Output_section_data_list): New type declaration.
10777 (Layout::Relaxation_debug_check): New class definition.
10778 (Layout::record_output_section_data_from_script_,
10779 Layout::script_output_section_data_list_, Layout::segment_states_,
10780 Layout::relaxation_debug_check_): New data members.
10781 * output.cc: (Output_section_headers::do_size): New method definition.
10782 (Output_section_headers::Output_section_headers): Move size
10783 computation to Output_section_headers::do_size.
10784 (Output_segment_headers::do_size): New method definition.
10785 (Output_file_header::Output_file_header): Move size computation to
10786 Output_file_header::do_size and call it.
10787 (Output_file_header::do_size): New method definition.
10788 (Output_data_group::Output_data_group): Adjust call to
10789 Output_section_data.
10790 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10791 (Output_symtab_xindex::do_write): Add array bound check.
10792 (Output_section::Input_section::print_to_mapfile): Handle
10793 RELAXED_INPUT_SECTION_CODE.
10794 (Output_section::Output_section): Initialize data member checkpoint_.
10795 (Output_section::~Output_section): Delete checkpoint object pointed
10796 by checkpoint_.
10797 (Output_section::add_input_section): Always add an Input_section if
10798 relaxing.
10799 (Output_section::add_merge_input_section): Add assert.
10800 (Output_section::relax_input_section): New method definition.
10801 (Output_section::set_final_data_size): Set load address to zero for
10802 an unallocated section.
10803 (Output_section::do_address_and_file_offset_have_reset_values):
10804 New method definition.
10805 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10806 Handle relaxed input section.
10807 (Output_section::sort_attached_input_sections): Checkpoint input
10808 section list lazily.
10809 (Output_section::get_input_sections): Change type of input_sections to
10810 list of Simple_input_section pointers. Checkpoint input section list
10811 lazily. Also handle relaxed input sections.
10812 (Output_section::add_input_section_for_script): Take a reference to
10813 a Simple_input_section object instead of Relobj pointer and section
10814 index as parameter. Handle relaxed input sections.
10815 (Output_section::save_states, Output_section::restore_states): New
10816 method definitions.
10817 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10818 (Output_data::is_data_size_fixed): New method definition.
10819 (Output_data::reset_addresss_and_file_offset): Do not reset data size
10820 if it is fixed.
10821 (Output_data::address_and_file_offset_have_reset_values): New method
10822 definition.
10823 (Output_data::do_address_and_file_offset_have_reset_values): New method
10824 definition.
10825 (Output_data::set_data_size): Check that data size is not fixed.
10826 (Output_data::fix_data_size): New method definition.
10827 (Output_data::is_data_size_fixed_): New data member.
10828 (Output_section_headers::set_final_data_size): New method definition.
10829 (Output_section_headers::do_size): New method declaration.
10830 (Output_segment_headers::set_final_data_size): New method definition.
10831 (Output_segment_headers::do_size): New method declaration.
10832 (Output_file_header::set_final_data_size)::New method definition.
10833 (Output_file_header::do_size)::New method declaration.
10834 (Output_section_data::Output_section_data): Add new parameter
10835 is_data_size_fixed and use it to fix data size.
10836 (Output_data_const::Output_data_const): Adjust call to base class
10837 constructor and fix data size.
10838 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10839 base class constructor and fix data size.
10840 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10841 base class constructor and fix data size.
10842 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10843 class constructor and fix data size.
10844 (Output_data_group::set_final_data_size): New method definition.
10845 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10846 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10847 class constructor and fix data size.
10848 (Output_relaxed_input_section): New class definition.
10849 (Output_section::Simple_input_section): New class definition.
10850 (Output_section::get_input_sections): Adjust parameter list.
10851 (Output_section::add_input_section_for_script): Same.
10852 (Output_section::save_states, Output_section::restore_states,
10853 Output_section::do_address_and_file_offset_have_reset_values,
10854 (Output_section::Input_section::Input_section): Handle
10855 RELAXED_INPUT_SECTION_CODE. Add new overload for
10856 Output_relaxed_input_section.
10857 (Output_section::Input_section::is_input_section,
10858 Output_section::Input_section::set_output_section): Handle relaxed
10859 input section.
10860 (Output_section::Input_section::is_relaxed_input_section,
10861 Output_section::Input_section::output_section_data,
10862 Output_section::Input_section::relaxed_input_section): New method
10863 definitions.
10864 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10865 value.
10866 (Output_section::Input_section::u1_): Update comments.
10867 (Output_section::Input_section::u2_): Add new union member poris.
10868 (Output_section::Checkpoint_output_section): New classs definition.
10869 (Output_section::relax_input_section): New method declaration.
10870 (Output_section::checkpoint_): New data member.
10871 (Output_segment): Update comments.
10872 (Output_segment::Output_segment): Un-privatize copy constructor.
10873 (Output_segment::operator=): Un-privatize.
10874 * script-sections.cc (Output_section_element::Input_section_list):
10875 Change element type to Output_section::Simple_input_section.
10876 (Output_section_element_dot_assignment::set_section_addresses):
10877 Register output section data for relaxation clean up.
10878 (Output_data_exression::Output_data_expression): Adjust call to base
10879 constructor to fix data size.
10880 (Output_section_element_data::set_section_addresses): Register
10881 Output_data_expression object for relaxation clean up.
10882 (struct Input_section_info): Replace Relobj pointer and section index
10883 pair with Output_section::Simple_input_section and Convert struct to a
10884 class.
10885 (Input_section_sorter::operator()): Adjust access to
10886 Input_section_info data member to use accessors.
10887 (Output_section_element_input::set_section_addresses): Use layout
10888 parameter. Adjust code to use Output_section::Simple_input_section
10889 and Input_secction_info classes. Register filler for relaxation
10890 clean up.
10891 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10892 and section index pair with Output_section::Simple_input_section
10893 class. Adjust code accordingly.
10894 (Phdrs_element::release_segment): New method definition.
10895 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10896 segment list.
10897 (Script_sections::release_segments): New method definition.
10898 * gold/script-sections.h (Script_sections::release_segments): New
10899 method declaration.
10900 * gold/target.h (Target::may_relax, Target::relax,
10901 Target::do_may_relax, Target::do_relax): New method definitions.
10902
10903 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
10904
10905 * arm.cc (has_signed_unsigned_overflow): New function.
10906 (Arm_relocate_functions::abs8): New function.
10907 (Target_arm::Scan::local): Handle R_ARM_ABS8.
10908 (Target_arm::Scan::global): Likewise.
10909 (Target_arm::relocate::relocate): Likewise.
10910 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10911 Likewise.
10912
10913 2009-09-16 Cary Coutant <ccoutant@google.com>
10914
10915 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10916 * testsuite/Makefile.in: Regenerate.
10917
10918 2009-09-11 Nick Clifton <nickc@redhat.com>
10919
10920 * po/gold.pot: Updated by the Translation project.
10921
10922 2009-09-08 Cary Coutant <ccoutant@google.com>
10923
10924 * output.cc (Output_file::open): Add execute permission to empty file.
10925 * testsuite/Makefile.am (permission_test): New test.
10926 * testsuite/Makefile.in: Regenerate.
10927
10928 2009-09-02 Ian Lance Taylor <iant@google.com>
10929
10930 * output.cc (Output_file::resize): Call map_no_anonymous rather
10931 than map.
10932
10933 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
10934
10935 * gold.cc: Include "incremental.h".
10936 (queue_initial_tasks): Call Incremental_checker methods.
10937 * incremental.cc: Include "output.h".
10938 (Incremental_checker::can_incrementally_link_output_file): New
10939 method.
10940 * incremental.h (Incremental_checker): New class.
10941
10942 * output.cc (Output_file::open_for_modification): New method.
10943 (Output_file::map_anonymous): Changed return type to bool. Record
10944 map in base_ field.
10945 (Output_file::map_no_anonymous): New method, broken out of map.
10946 (Output_file::map): Use map_no_anonymous and map_anonymous.
10947 * output.h (class Output_file): Update declarations.
10948
10949 2009-08-24 Cary Coutant <ccoutant@google.com>
10950
10951 * options.h (Command_line::Pre_options): New class.
10952 (Command_line::pre_options): New member.
10953 * options.cc (gold::options::ready_to_register): New variable.
10954 (One_option::register_option): Do nothing if not registering options.
10955 Assert if same short option registered twice.
10956 (General_options::General_options): Turn off option registration when
10957 done constructing.
10958 (Command_line::Pre_options::Pre_options): New constructor.
10959
10960 2009-08-24 Cary Coutant <ccoutant@google.com>
10961
10962 * options.h (General_options::no_keep_memory): Remove incorrect
10963 short option.
10964
10965 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10966
10967 * Makefile.am (am__skiplex, am__skipyacc): New.
10968 * Makefile.in: Regenerate.
10969
10970 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10971
10972 * Makefile.am (AM_CPPFLAGS): Renamed from ...
10973 (INCLUDES): ... this.
10974 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10975 (AM_CPPFLAGS): Renamed from ...
10976 (INCLUDE): ... this.
10977 * Makefile.in, testsuite/Makefile.in: Regenerate.
10978
10979 * Makefile.in: Regenerate.
10980 * aclocal.m4: Likewise.
10981 * config.in: Likewise.
10982 * configure: Likewise.
10983 * testsuite/Makefile.in: Likewise.
10984
10985 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10986 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10987 * Makefile.in: Regenerate.
10988 * testsuite/Makefile.in: Regenerate.
10989
10990 2009-08-19 Cary Coutant <ccoutant@google.com>
10991
10992 * resolve.cc (Symbol_table::resolve): Don't complain about defined
10993 symbols in shared libraries overridden by hidden or internal symbols
10994 in the main program.
10995
10996 2009-08-19 Chris Demetriou <cgd@google.com>
10997
10998 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10999 checking source file names in error messages.
11000
11001 2009-08-18 Doug Kwan <dougkwan@google.com>
11002
11003 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11004 an elcpp::Ehdr as parameter. Adjust call to set_target.
11005 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11006 an elfcpp::Ehdr as parameter.
11007 * object.cc (Object::set_target): Remove the version that looks up
11008 a target and sets it.
11009 (Sized_relobj::setup): Take a Target object instead of
11010 an elfcpp::Ehdr as parameter. Adjust call to set_target.
11011 (make_elf_sized_object): Find target and ask target to
11012 make an ELF object.
11013 * object.h: (Object::set_target): Remove the version that looks up
11014 a target and sets it.
11015 (Sized_relobj::setup): Take a Target object instead of
11016 an elfcpp:Ehdr as parameter.
11017 * target.cc: Include dynobj.h.
11018 (Target::do_make_elf_object_implementation): New.
11019 (Target::do_make_elf_object): New.
11020 * target.h (Target::make_elf_object): New template declaration.
11021 (Target::do_make_elf_object): New method declarations.
11022 (Target::do_make_elf_object_implementation): New template declaration.
11023
11024 2009-08-14 Ian Lance Taylor <iant@google.com>
11025
11026 * gold.h (FUNCTION_NAME): Define.
11027 (gold_unreachable): Use FUNCTION_NAME.
11028
11029 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11030
11031 * icf.cc (Icf::find_identical_sections): Issue a warning when a
11032 symbol in the --keep-unique list is not found.
11033
11034 2009-08-12 Sriraman Tallam <tmsriram@google.com>
11035
11036 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11037 been maked as --keep-unique.
11038 (Icf::unfold_section): New function.
11039 * icf.h (Icf::unfold_section): New function.
11040 * options.h (General_options::keep_unique): New option.
11041 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11042 * testsuite/Makefile.in: Regenerate.
11043 * testsuite/icf_keep_unique_test.sh: New file.
11044 * testsuite/icf_keep_unique_test.cc: New file.
11045
11046 2009-08-12 Cary Coutant <ccoutant@google.com>
11047
11048 PR 10471
11049 * resolve.cc (Symbol_table::resolve): Check for references from
11050 dynamic objects to hidden and internal symbols.
11051 * testsuite/Makefile.am (hidden_test.sh): New test.
11052 * testsuite/Makefile.in: Regenerate.
11053 * testsuite/hidden_test.sh: New script.
11054 * testsuite/hidden_test_1.c: New test source.
11055 * testsuite/hidden_test_main.c: New test source.
11056
11057 2009-08-11 Doug Kwan <dougkwan@google.com>
11058
11059 * arm.cc: Update comments.
11060 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11061 segment to locate the .ARM.exidx section if present.
11062
11063 2009-08-09 Doug Kwan <dougkwan@google.com>
11064
11065 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11066 patch.
11067
11068 2009-08-07 Sriraman Tallam <tmsriram@google.com>
11069 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11070 compiler warnings.
11071
11072 2009-08-06 Sriraman Tallam <tmsriram@google.com>
11073
11074 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11075 valid tls_segment only for non-debug-section relocations.
11076 * testsuite/Makefile.am: Add gc_tls_test.
11077 * testsuite/Makefile.in: Regenerate.
11078 * testsuite/gc_tls_test.cc: New file.
11079 * testsuite/gc_tls_test.sh: New file.
11080
11081 2009-08-05 Sriraman Tallam <tmsriram@google.com>
11082
11083 * icf.cc: New file.
11084 * icf.h: New file.
11085 * Makefile.am (CCFILES): Add icf.cc.
11086 (HFILES): Add icf.h
11087 * Makefile.in: Regenerate.
11088 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11089 * gc.h (gc_process_relocs): Populate lists used by icf to contain
11090 section, symbol and addend information for the relocs.
11091 * gold.cc (queue_middle_tasks): Call identical code folding.
11092 * gold.h: Add defines for multimap.
11093 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11094 to the call of finalize_local_symbols.
11095 * main.cc (main): Create object of class Icf.
11096 * object.cc (Sized_relobj::do_layout): Allow this function to be
11097 called twice during icf.
11098 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11099 to sections marked as identical by icf.
11100 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11101 when available.
11102 (Sized_relobj::do_section_entsize): New function.
11103 * object.h (Object::section_entsize): New function.
11104 (Object::do_section_entsize): New pure virtual function.
11105 (Relobj::finalize_local_symbols): Add new parameter.
11106 (Relobj::do_section_entsize): New function.
11107 * options.h (General_options::icf): New option.
11108 (General_options::icf_iterations): New option.
11109 (General_options::print_icf_sections): New option.
11110 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11111 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11112 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11113 icf.
11114 * symtab.cc (Symbol_table::is_section_folded): New function.
11115 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
11116 to sections marked as identical by icf.
11117 * symtab.h (Symbol_table::set_icf): New function.
11118 (Symbol_table::icf): New function.
11119 (Symbol_table::is_section_folded): New function.
11120 (Symbol_table::icf_): New data member.
11121 * target-reloc.h (relocate_section): Ignore sections folded by icf.
11122 * testsuite/Makefile.am: Add commands to build icf_test.
11123 * testsuite/Makefile.in: Regenerate.
11124 * testsuite/icf_test.sh: New file.
11125 * testsuite/icf_test.cc: New file.
11126
11127 2009-07-24 Chris Demetriou <cgd@google.com>
11128
11129 * layout.cc (is_compressible_debug_section): Fix incorrect
11130 comment about compressed section names.
11131
11132 2009-07-20 Ian Lance Taylor <ian@airs.com>
11133
11134 PR 10419
11135 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11136
11137 2009-07-16 Ian Lance Taylor <iant@google.com>
11138
11139 PR 10400
11140 * layout.h: #include <map>.
11141 (class Kept_section): Change from struct to class. Add accessors
11142 and setters. Add section size to Comdat_group mapping. Change
11143 Comdat_group to std::map. Add is_comdat_ field. Add
11144 linkonce_size field in union.
11145 (class Layout): Update declaration of find_or_add_kept_section.
11146 Don't declare find_kept_object.
11147 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11148 parameter. Add object, shndx, is_comdat, and is_group_name
11149 parameters. Change all callers. Adjust for new Kept_section.
11150 (Layout::find_kept_object): Remove.
11151 * object.cc (Sized_relobj::include_section_group): Update use of
11152 Kept_section. Rename secnum to shndx. Only record
11153 Kept_comdat_section if sections are the same size.
11154 (Sized_relobj::include_linkonce_section): Update use of
11155 Kept_section. Only record Kept_comdat_section if sections are the
11156 same size. Set size of linkonce section.
11157 (Sized_relobj::map_to_kept_section): Update call to
11158 get_kept_comdat_section.
11159 * object.h (class Sized_relobj): Rename fields in
11160 Kept_comdat_section to drop trailing underscores; change object
11161 field to Relobj*. Change Kept_comdat_section_table to store
11162 struct rather than pointer.
11163 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11164 Add kept_object and kept_shndx parameters. Change all callers.
11165 (Sized_relobj::get_kept_comdat_section): Change return type to
11166 bool. Add kept_object and kept_shndx parameters. Change all
11167 callers.
11168 * plugin.cc (Pluginobj::include_comdat_group): Update call to
11169 Layout::find_or_add_kept_section.
11170
11171 2009-07-09 Ian Lance Taylor <iant@google.com>
11172
11173 * merge.cc (Object_merge_map::initialize_input_to_output_map):
11174 Reserve space in the hash table.
11175
11176 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
11177
11178 * fileread.cc (File_read::get_mtime): New method.
11179 * fileread.h (Timespec): New structure.
11180 (File_read::get_mtime): New method.
11181 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11182 Renamed from timestamp_nsec.
11183 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11184 Elf_Xword.
11185 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11186 timestamp_nsec.
11187 (Incremental_inputs::report_archive): Save mtime; style fix.
11188 (Incremental_inputs::report_obejct): Save mtime; style fix.
11189 (Incremental_inputs::report_script): Save mtime; style fix.
11190 (Incremental_inputs::finalize_inputs): Style fix.
11191 (Incremental_inputs::finalize): Style fix.
11192 (Incremental_inputs::create_input_section_data): Store inputs
11193 mtime.
11194 * incremental.h (Incremental_inputs::report_script): Add mtime
11195 argument.
11196 (Incremental_inputs::Input_info::Input_info): Intialize only one
11197 union member.
11198 (Incremental_inputs::Input_info::archive): Move to nameless
11199 union.
11200 (Incremental_inputs::Input_info::obejct): Move to nameless union.
11201 (Incremental_inputs::Input_info::script): Move to nameless union.
11202 (Incremental_inputs::mtime): New field.
11203 * script.cc (read_input_script): Pass file mtime to
11204 Incremental_input.
11205 * script.h (Script_info::inputs): Style fix.
11206
11207 2009-07-01 Ian Lance Taylor <ian@airs.com>
11208
11209 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11210 instead of 32.
11211
11212 2009-06-24 Ian Lance Taylor <iant@google.com>
11213
11214 PR 10156
11215 * layout.cc (Layout::choose_output_section): If we find an
11216 existing section, update the flags.
11217 (Layout::create_notes): New function, broken out of
11218 Layout::finalize.
11219 (Layout::finalize): Don't create note sections.
11220 (Layout::create_note): Don't crash if linker script discards
11221 section.
11222 (Layout::create_gold_note): Likewise.
11223 (Layout::create_build_id): Likewise. Don't set
11224 after_input_sections on the section.
11225 (Layout::create_executable_stack_info): Remove target parameter.
11226 Change caller.
11227 * layout.h (class Layout): Declare create_notes. Update
11228 declaration of create_executable_stack_info.
11229 * gold.cc (queue_middle_tasks): Call create_notes.
11230 * output.cc (Output_section::update_flags_for_input_section): Move
11231 here from output.h. If SHF_ALLOC flag is newly set, mark address
11232 invalid.
11233 * output.h (Output_data::mark_address_invalid): New function.
11234 (class Output_section): Only declare, not define,
11235 update_flags_for_input_section. Remove set_flags.
11236
11237 2009-06-24 Ian Lance Taylor <iant@google.com>
11238
11239 * script-sections.cc (Output_section_definition::
11240 set_section_addresses): Rename shadowing local load_address to
11241 laddr.
11242
11243 2009-06-24 Ian Lance Taylor <iant@google.com>
11244
11245 PR 10244
11246 * reloc.cc (relocate_sections): Skip empty relocation sections.
11247
11248 2009-06-23 Ian Lance Taylor <iant@google.com>
11249
11250 PR 10156
11251 * layout.cc (Layout::create_note): Use choose_output_section
11252 rather than make_output_section.
11253
11254 2009-06-23 Ian Lance Taylor <iant@google.com>
11255
11256 PR 10237
11257 * options.cc (General_options::parse_V): Set printed_version_.
11258 (General_options::General_options): Initialize printed_version_.
11259 * options.h (class General_options): Add printed_version_ field.
11260 * gold.cc (queue_initial_tasks): If there are no input files,
11261 don't give a fatal error if we printed the version information.
11262 (queue_middle_tasks): If using -r with a shared object, give a
11263 fatal error rather than an ordinary error.
11264
11265 2009-06-23 Ian Lance Taylor <iant@google.com>
11266
11267 PR 10219
11268 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11269 (Layout::make_output_section): Set have_stabstr_section_ if we see
11270 a .stab*str section.
11271 (Layout::finalize): Call link_stabs_sections.
11272 (Layout::link_stabs_sections): New file.
11273 * layout.h (class Layout): Add have_stabstr_section_ field.
11274 Declare link_stabs_sections.
11275
11276 2009-06-23 Doug Kwan <dougkwan@google.com>
11277
11278 * Makefile.am (libgold_a_LIBADD): New.
11279 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11280 * Makefile.in: Regenerate.
11281 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11282 * configure: Regenerate.
11283 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11284 * fileread.cc: Include sys/state.h
11285 * gold.h: Declare memmem and strndup if found missing.
11286 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11287
11288 2009-06-23 Ian Lance Taylor <iant@google.com>
11289
11290 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11291 * configure: Rebuild.
11292
11293 2009-06-23 Ian Lance Taylor <iant@google.com>
11294
11295 PR 10147
11296 * object.cc (Object::section_contents): Don't try to get a view if
11297 the section has length zero.
11298 (Object::handle_gnu_warning_section): If the section is empty, use
11299 the name of the section as the warning.
11300
11301 2009-06-23 Ian Lance Taylor <iant@google.com>
11302
11303 PR 10133
11304 * stringpool.h (class Stringpool_template): Add optimize_ field.
11305 (Stringpool_template::set_optimize): New function.
11306 * stringpool.cc (Stringpool_template::Stringpool_template):
11307 Initialize optimize_ field.
11308 (Stringpool_template::set_string_offsets): Test local optimize
11309 fild rather than parameter.
11310 * layout.cc (Layout::Layout): Call set_optimize on the section
11311 name stringpool.
11312
11313 2009-06-22 Ian Lance Taylor <iant@google.com>
11314
11315 PR 10030
11316 * yyscript.y: Parse TARGET.
11317 * script.cc (script_set_target): New function.
11318 * script-c.h (script_set_target): Declare.
11319 * options.cc (General_options::string_to_object_format): Rename
11320 from string_to_object_format in anonymous namespace. Change
11321 callers.
11322 * options.h (class General_options): Declare
11323 string_to_object_format.
11324
11325 2009-06-22 Ian Lance Taylor <iant@google.com>
11326
11327 * script-sections.cc (Script_sections::create_segments): Don't put
11328 program headers in a PT_LOAD segment if -n or -N.
11329
11330 2009-06-22 Ian Lance Taylor <iant@google.com>
11331
11332 PR 10141
11333 * options.h (class General_options): Add -z lazy and -z now. Sort
11334 -z options into alphabetical order.
11335 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11336
11337 2009-06-21 Ian Lance Taylor <iant@google.com>
11338
11339 * layout.cc (Layout::make_output_section): Call
11340 Target::new_output_section.
11341 (Layout::attach_allocated_section_to_segment): Put large section
11342 sections in a separate load segment with the large segment flag
11343 set.
11344 (Layout::segment_precedes): Sort large data segments after other
11345 load segments.
11346 (align_file_offset): New static function.
11347 (Layout::set_segment_offsets): Use align_file_offset.
11348 * output.h (class Output_section): Add is_small_section_ and
11349 is_large_section_ fields.
11350 (Output_section::is_small_section): New function.
11351 (Output_section::set_is_small_section): New function.
11352 (Output_section::is_large_section): New function.
11353 (Output_section::set_is_large_section): New function.
11354 (Output_section::is_large_data_section): New function.
11355 (class Output_segment): Add is_large_data_segment_ field.
11356 (Output_segment::is_large_data_segment): New function.
11357 (Output_segment::set_is_large_data_segment): New function.
11358 * output.cc (Output_section::Output_section): Initialize new
11359 fields.
11360 (Output_segment::Output_segment): Likewise.
11361 (Output_segment::add_output_section): Add assertion that large
11362 data sections always go in large data segments. Force small data
11363 sections to the end of the list of data sections. Force small BSS
11364 sections to the start of the list of BSS sections. For large BSS
11365 sections to the end of the list of BSS sections.
11366 * symtab.h (class Symbol): Declare is_common_shndx.
11367 (Symbol::is_defined): Check Symbol::is_common_shndx.
11368 (Symbol::is_common): Likewise.
11369 (class Symbol_table): Define enum Commons_section_type. Update
11370 declarations. Add small_commons_ and large_commons_ fields.
11371 * symtab.cc (Symbol::is_common_shndx): New function.
11372 (Symbol_table::Symbol_table): Initialize new fields.
11373 (Symbol_table::add_from_object): Put small and large common
11374 symbols in the right list.
11375 (Symbol_table::sized_finalized_symbol): Check
11376 Symbol::is_common_shndx.
11377 (Symbol_table::sized_write_globals): Likewise.
11378 * common.cc (Symbol_table::do_allocate_commons): Allocate new
11379 common symbol lists. Don't call do_allocate_commons_list if the
11380 list is empty.
11381 (Symbol_table::do_allocate_commons_list): Remove is_tls
11382 parameter. Add comons_section_type parameter. Change all
11383 callers. Handle small and large common symbols.
11384 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11385 Symbol::is_common_shndx.
11386 * resolve.cc (symbol_to_bits): Likewise.
11387 * target.h (Target::small_common_shndx): New function.
11388 (Target::small_common_section_flags): New function.
11389 (Target::large_common_shndx): New function.
11390 (Target::large_common_section_flags): New function.
11391 (Target::new_output_section): New function.
11392 (Target::Target_info): Add small_common_shndx, large_common_shndx,
11393 small_common_section_flags, and large_common_section_flags
11394 fields.
11395 (Target::do_new_output_section): New virtual function.
11396 * arm.cc (Target_arm::arm_info): Initialize new fields.
11397 * i386.cc (Target_i386::i386_info): Likewise.
11398 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11399 Likewise.
11400 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11401 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11402 (Target_x86_64::do_new_output_section): New function.
11403 * configure.ac: Define conditional MCMODEL_MEDIUM.
11404 * testsuite/Makefile.am (check_PROGRAMS): Add large.
11405 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11406 (large_LDFLAGS): Define.
11407 * testsuite/large.c: New file.
11408 * testsuite/testfile.cc (Target_test::test_target_info):
11409 Initialize new fields.
11410 * configure, testsuite/Makefile.in: Rebuild.
11411
11412 2009-06-05 Doug Kwan <dougkwan@google.com>
11413
11414 * Makefile.am (CCFILES): Add target.cc.
11415 * Makefile.in: Regenerate.
11416 * i386.cc (class Target_i386): Define new virtual method to
11417 override do_is_local_label_name in parent.
11418 * object.cc (Sized_relobj::do_count_local_symbols): Discard
11419 local symbols if --discard-locals or -X is given.
11420 * options.h (class General_options): Declare new options
11421 '--discard-locals' and '-X' for discarding locals.
11422 * target.h (class Target): Define new methods is_local_label_name.
11423 Declare new virtual method do_is_local_label_name.
11424 * target.cc: New file.
11425 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11426 (check_SCRIPTS): Add discard_locals_test.sh.
11427 (check_DATA): Add discard_local_tests.syms.
11428 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11429 (discard_local_tests.syms, discard_locals_test.o): New make rules.
11430 * testsuite/Makefile.in: Regenerate.
11431 * testsuite/discard_locals_test.c: New file.
11432 * testsuite/discard_locals_test.sh: Same.
11433
11434 2009-06-05 Doug Kwan <dougkwan@google.com>
11435
11436 * object.cc (Sized_relobj::Sized_relobj): Initialize
11437 discarded_eh_frame_shndx_ to -1U.
11438 (Sized_relobj::do_layout): Record index of a discard .eh_frame
11439 section.
11440 (Sized_relobj::do_count_local_symbols): Skip local symbols in
11441 a discarded .eh_frame section.
11442 (Sized_relobj::do_finalize_local_symbols): Ditto.
11443 * object.h (class Sized_relobj): Declare new member
11444 discarded_eh_frame_shndx_.
11445 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11446 (local_labels_test.o, local_labels_test): New rules.
11447 * testsuite/Makefile.in: Regenerate.
11448
11449 2009-06-04 Doug Kwan <dougkwan@google.com>
11450
11451 * layout.cc (Layout::section_name_mapping): Add mapping for
11452 special ARM sections.
11453
11454 2009-06-03 Doug Kwan <dougkwan@google.com>
11455
11456 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11457 (utils::has_overflow): Same.
11458
11459 2009-06-03 Ian Lance Taylor <iant@google.com>
11460
11461 * layout.cc (Layout::section_name_mapping): New array, replacing
11462 Layout::linkonce_mapping.
11463 (Layout::section_name_mapping_count): New variable, replacing
11464 Layout::linkonce_mapping_count.
11465 (Layout::linkonce_output_name): Remove.
11466 (Layout::output_section_name): Rewrite.
11467 * layout.h (class Layout): Rename Linkonce_mapping to
11468 Section_name_mapping, linkonce_mapping to section_name_mapping,
11469 linkonce_mapping_count to section_name_mapping_count. Don't
11470 declare linkonce_output_name.
11471
11472 2009-06-03 Doug Kwan <dougkwan@google.com>
11473
11474 * gold/arm.cc (namespace utils): New.
11475 (Target_arm::reloc_is_non_pic): Define new method.
11476 (class Arm_relocate_functions): New.
11477 (Target_arm::Relocate::relocate): Handle relocation types used by
11478 Android.
11479
11480 2009-06-03 Ian Lance Taylor <iant@google.com>
11481
11482 * arm.cc (Target_arm::scan::global): Use || instead of |.
11483
11484 2009-06-02 Doug Kwan <dougkwan@google.com>
11485
11486 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
11487 issued_non_pic_error_.
11488 (class Target_arm::Scan): Declare new method check_non_pic.
11489 Define new method symbol_needs_plt_entry.
11490 Declare new data member issued_non_pic_error_.
11491 (class Target_arm::Relocate): Declare new method
11492 should_apply_static_reloc.
11493 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11494 (Target_arm::Scan::check_non_pic): Define new method.
11495 (Target_arm::Scan::local): Handle a small subset of reloc types used
11496 by Android.
11497 (Target_arm::Scan::local): Same.
11498 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11499
11500 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
11501
11502 * incremental.cc (Incremental_inputs::report_command_line): Filter
11503 out --incremental-* options.
11504
11505 2009-05-29 Doug Kwan <dougkwan@google.com>
11506
11507 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11508 template class.
11509 (class Target_arm): Update comment.
11510 (Target_arm::Target_arm): Initialize new data members GOT_,
11511 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11512 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11513 and Target_arm::rel_dyn_section.
11514 Declare new_enum Target_arm::Got_type.
11515 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11516 and DYNBSS_.
11517 Update commments for member do_dynsym_value.
11518 (Target_arm::got_size, Target_arm::plt_section,
11519 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11520 new methods inside class defintion.
11521 (Target_arm::got_section): Define new method.
11522 (Target_arm::rel_dyn_section): Same.
11523 (Output_data_plt_arm): New template class.
11524 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11525 (Output_data_plt_arm:do_adjust_output_section): Define new method.
11526 (Output_data_plt_arm::add_entry): Same.
11527 (Output_data_plt_arm::first_plt_entry): Define new
11528 static data member for PLT instruction template.
11529 (Output_data_plt_arm::plt_entry): Same.
11530 (Output_data_plt_arm::do_write): Define new method.
11531 (Target_arm::make_plt_entry): Same.
11532 (Target_arm::do_finalize_sections): Same.
11533 (Target_arm::do_dynsym_value): Same.
11534
11535 2009-05-28 Doug Kwan <dougkwan@google.com>
11536
11537 * Makefile.am (TARGETSOURCES): Add arm.cc.
11538 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11539 * Makefile.in: Regenerate.
11540 * arm.cc: New file.
11541 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11542
11543 2009-05-26 Doug Kwan <dougkwan@google.com>
11544
11545 * options.cc (General_options::parse_exclude_libs). Fix a comment.
11546 (General_options::check_excluded_libs): Strip off directories in
11547 archive name before matching like GNU ld does.
11548 * testsuite/Makefile.am (MOSTLYCLEANFILES,
11549 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11550 (exclude_libs_test_LDFLAGS): Add linker option
11551 -Wl,--exclude-libs,libexclude_libs_test_3
11552 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11553 an explicit archive without using -l.
11554 (alt/libexclude_libs_test_3.a): New make rule.
11555 * testsuite/Makefile.in: Regenerate.
11556 * testsuite/exclude_libs_test.c : Declare lib3_default().
11557 (main): Call it.
11558 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11559 * exclude_libs_test_3.c: New file.
11560
11561 2009-05-26 Nick Clifton <nickc@redhat.com>
11562
11563 * po/id.po: New Indonesian translation.
11564 * po/gold.pot: Updated template file.
11565
11566 2009-05-22 Sriraman Tallam <tmsriram@google.com>
11567
11568 * testsuite/Makefile.am: Add -ffunction-sections to compile
11569 gc_comdat_test files. Add -Wl,--gc-sections to build
11570 gc_comdat_test.
11571 * testsuite/Makefile.in: Regenerate.
11572 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11573
11574 2009-05-21 Sriraman Tallam <tmsriram@google.com>
11575
11576 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11577 kept comdat section was garbage collected.
11578 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11579 * testsuite/Makefile.in: Regenerate.
11580 * testsuite/gc_comdat_test.sh: New file.
11581 * testsuite/gc_comdat_test_1.cc: New file.
11582 * testsuite/gc_comdat_test_2.cc: New file.
11583
11584 2009-05-19 Doug Kwan <dougkwan@google.com>
11585
11586 * archive.cc (Archive::Archive): Move constructor from archive.h
11587 to here. Initialize no_export_.
11588 (Archive::get_elf_object_for_member): Set no_export flag of object.
11589 * archive.h (Archive::Archive): Move constructor body to
11590 archive.cc.
11591 (Archive::no_export): New method.
11592 (Archive::no_export_): New field.
11593 * object.h (Object::Object): Initialize no_export_ to false.
11594 (Object::no_export, Object::set_no_export): New methods.
11595 (Object::no_export_): New field.
11596 * options.cc (General_options::parse_exclude_libs): New method.
11597 (General_options::check_excluded_libs) Same.
11598 * options.h (exclude_libs): New option.
11599 (General_options::check_excluded_libs): New method declaration.
11600 (General_options::excluded_libs_): New field.
11601 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11602 default or protected visibility if an object has no-export flag set.
11603 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11604 (check_SCRIPTS): Add exclude_libs_test.sh.
11605 (check_DATA): Add exclude_libs_test.syms.
11606 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11607 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11608 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11609 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11610 (exclude_libs_test.syms, libexclude_libs_test_1.a,
11611 libexclude_libs_test_2.a): New rules.
11612 * testsuite/Makefile.in: Regenerate.
11613 * testsuite/exclude_libs_test.c: New file.
11614 * testsuite/exclude_libs_test.sh: Ditto.
11615 * testsuite/exclude_libs_test_1.c: Ditto.
11616 * testsuite/exclude_libs_test_2.c: Ditto.
11617
11618 2009-05-15 Ian Lance Taylor <iant@google.com>
11619
11620 * configure.ac: Check for declarations for cases where libiberty.h
11621 checks HAVE_DECL_xxx.
11622 * configure, config.in: Rebuild.
11623
11624 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
11625
11626 * gold.h (Incremental_argument_list): Remove (invalid) forward
11627 declaration.
11628 * incremental.cc (Incremental_inputs::report_achive): New method.
11629 (Incremental_inputs::report_object): New method.
11630 (Incremental_inputs::report_script): New method.
11631 (Incremental_inputs::finalize_inputs): New method.
11632 (Incremental_inputs::finalize): Call finalize_inputs().
11633 (Incremental_inputs::sized_create_incremental_inputs_section_data):
11634 Create inputs entries.
11635 * incremental.h (Incremental_input_type): New enum.
11636 (Incremental_inputs::Incremental_input): Initialize new fields.
11637 (Incremental_inputs::report_inputs): New method.
11638 (Incremental_inputs::report_achive): New method.
11639 (Incremental_inputs::report_object): New method.
11640 (Incremental_inputs::report_script): New method.
11641 (Incremental_inputs::finalize_inputs): New method.
11642 (Incremental_inputs::Input_info): New struct.
11643 (Incremental_inputs::Input_info_map): New typedef.
11644 (Incremental_inputs::lock_): New field.
11645 (Incremental_inputs::Inputs_): New field.
11646 (Incremental_inputs::Inputs_map): New field.
11647 * main.cc (main): Call Incremental_input::report_inputs.
11648 * options.h (Input_argument_list): Typedef moved from
11649 Input_arguments.
11650 (Input_file_group::Files): Remove, use ::Input_argument_list.
11651 (Input_file_group::Input_argument_list): Remove, use
11652 ::Input_argument_list.
11653 * plugin.cc (Plugin_manager::add_input_file): Add error in
11654 incremental build.
11655 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11656 functions.
11657 * script.cc (read_input_script): Call
11658 Incremental_input::report_script.
11659 * script.h (Script_info): New class.
11660
11661 2009-04-27 Ian Lance Taylor <iant@google.com>
11662
11663 * x86_64.cc (do_adjust_output_section): Set entsize to
11664 plt_entry_size.
11665
11666 2009-04-23 Elliott Hughes <enh@google.com>
11667
11668 * output.cc (Output_file::close): After short writes, continue
11669 writing from the correct offset in the buffer being written.
11670
11671 2009-04-23 Chris Demetriou <cgd@google.com>
11672
11673 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11674 * configure: Regenerate.
11675 * config.in: Regenerate.
11676 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11677 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11678
11679 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
11680
11681 * incremental.cc (Incremental_inputs_header_data): Renamed from
11682 Incremental_input_header_data.
11683 (Incremental_inputs_header_data::data_size): New field.
11684 (Incremental_inputs_header_data::put_input_file_count): Renamed
11685 from input_file_count.
11686 (Incremental_inputs_header_data::put_command_line_offset): Renamed
11687 from command_line_offset.
11688 (Incremental_inputs_header_data::put_reserved): Renamed from
11689 put_reserved.
11690 (Incremental_inputs_entry_data): Renamed from
11691 Incremental_input_entry_data.
11692 (Incremental_inputs_entry_data::data_size): New field.
11693 (Incremental_inputs::report_command_line): New method.
11694 (Incremental_inputs::finalize): New method.
11695 (Incremental_inputs::create_incremental_inputs_data): New method.
11696 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11697 * incremental.h: New file.
11698 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11699 (Layout::finalize): Create incremental inputs section in
11700 incremental builds.
11701 (Layout::create_incremental_info_sections): New method.
11702 * layout.h (Layout::incremental_inputs): New method.
11703 (Layout::create_incremental_info_sections): New method.
11704 (Layout::incremental_inputs_): New field.
11705 * main.cc (main): Notify Incremental_input of the command line.
11706
11707 2009-04-01 Ian Lance Taylor <iant@google.com>
11708 Mikolaj Zalewski <mikolajz@google.com>
11709
11710 * gold.h (reserve_unordered_map): Define, three versions, one for
11711 each version of Unordered_map.
11712 * layout.cc (Layout::Layout): Remove options parameter. Add
11713 number_of_input_files parameter. Don't initialize options_.
11714 Initialize number_of_input_files_ and resized_signatures_. Move
11715 sections_are_attached_.
11716 (Layout::layout_group): Reserve space for group_signatures_.
11717 (Layout::find_or_add_kept_section): Change name parameter to be a
11718 reference. Resize signatures_ map when it gets large enough.
11719 (Layout::layout_eh_frame): Use parameters->options() instead of
11720 this->options_.
11721 (Layout::make_output_section): Likewise.
11722 (Layout::attach_allocated_section_to_segment): Likewise.
11723 (Layout::finalize, Layout::create_executable_stack): Likewise.
11724 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11725 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11726 * layout.h (class Layout): Update declarations. Remove options_
11727 field. Add number_of_input_files_ and resized_signatures_
11728 fields. Move sections_are_attached_ field.
11729 * main.cc (main): Pass number of input files to Layout
11730 constructor. Don't pass options.
11731
11732 2009-03-30 Ian Lance Taylor <iant@google.com>
11733
11734 * ffsll.c (ffsll): Correct implementation.
11735
11736 2009-03-27 Ian Lance Taylor <iant@google.com>
11737
11738 * ffsll.c: New file.
11739 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11740 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11741 * ftruncate.c (ftruncate): Declare before definition.
11742 * mremap.c (mremap): Likewise.
11743 * pread.c (pread): Likewise.
11744 * configure, Makefile.in, config.in: Rebuild.
11745
11746 * mremap.c: New file.
11747 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11748 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11749 (mremap): Declare if HAVE_MREMAP is not defined.
11750 * configure, Makefile.in, config.in: Rebuild.
11751
11752 2009-03-27 Cary Coutant <ccoutant@google.com>
11753
11754 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11755 position independent.
11756 * sparc.cc (Target_sparc::check_non_pic): Likewise.
11757 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11758
11759 2009-03-24 Cary Coutant <ccoutant@google.com>
11760
11761 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11762 an executable.
11763 (needs_dynamic_reloc): Likewise.
11764
11765 2009-03-24 Ian Lance Taylor <iant@google.com>
11766
11767 * yyscript.y (file_cmd): Recognize EXTERN.
11768 (extern_name_list, extern_name_list_body): New nonterminals.
11769 * script.cc (script_add_extern): Define.
11770 * script-c.h (script_add_extern): Declare.
11771
11772 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
11773
11774 * object.cc (is_elf_object): Define.
11775 * object.h (is_elf_object): Declare.
11776 * archive.cc (Archive::get_elf_object_for_member): Call
11777 is_elf_object.
11778 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11779
11780 2009-03-24 Elliott Hughes <enh@google.com>
11781
11782 * output.cc (Output_file::map_anonymous): Define.
11783 (Output_file::map): Use map_anonymous. If the regular mmap fails,
11784 try an anonymous one. Report the size if the mmap fails.
11785 * output.h (class Output_file): Declare map_anonymous.
11786
11787 2009-03-24 Ian Lance Taylor <iant@google.com>
11788
11789 * target-select.cc (instantiate_target): Don't acquire the lock if
11790 the instantiated_target_ field has already been set.
11791
11792 2009-03-23 Ian Lance Taylor <iant@google.com>
11793
11794 * gold-threads.h (class Initialize_lock): Define.
11795 * gold-threads.cc (class Initialize_lock_once): Define.
11796 (initialize_lock_control): New static variable.
11797 (initialize_lock_pointer): New static variable.
11798 (initialize_lock_once): New static function.
11799 (Initialize_lock::Initialize_lock): Define.
11800 (Initialize_lock::initialize): Define.
11801 * target-select.h: Include "gold-threads.h".
11802 (class Target_selector): Add lock_ and initialize_lock_ fields.
11803 Don't define instantiate_target, just declare it.
11804 * target-select.cc (Target_selector::Target_selector): Initialize
11805 new fields.
11806 (Target_selector::instantiate_target): Define.
11807 * descriptors.h: Include "gold-threads.h".
11808 (class Descriptors): Add initialize_lock_ field.
11809 * descriptors.cc (Descriptors::Descriptors): Initialize new
11810 field.
11811 (Descriptors::open): Use initialize_lock_ field
11812 * errors.h (class Errors): Add initialize_lock_ field.
11813 * errors.cc (Errors::Errors): Initialize new field.
11814 (Errors::initialize_lock): Use initialize_lock_ field.
11815 * powerpc.cc (class Target_selector_powerpc): Remove
11816 instantiated_target_ field. In do_recognize call
11817 instantiate_target rather than do_instantiate_target. In
11818 do_instantiate_target just allocate a new target.
11819 * sparc.cc (class Target_selector_sparc): Likewise.
11820
11821 * freebsd.h: New file.
11822 * i386.cc: Include "freebsd.h".
11823 (Target_i386): Derive from Target_freebsd rather than
11824 Sized_target.
11825 (Target_selector_i386): Derive from Target_selector_freebsd rather
11826 than Target_selector.
11827 * x86_64.cc: Include "freebsd.h".
11828 (Target_x86_64): Derive from Target_freebsd rather than
11829 Sized_target.
11830 (Target_selector_x86_64): Derive from Target_selector_freebsd
11831 rather than Target_selector.
11832 * target.h (class Target): Add adjust_elf_header and
11833 do_adjust_elf_header.
11834 * output.cc (Output_file_header:: do_sized_write): Call target
11835 adjust_elf_header routine.
11836 * configure.tgt: Set targ_osabi.
11837 * configure.ac: Define GOLD_DEFAULT_OSABI.
11838 * parameters.cc (Parameters::default_target): Pass
11839 GOLD_DEFAULT_OSABI to select_target.
11840 * target-select.h (class Target_selector): Make instantiate_target
11841 protected rather than private.
11842 * Makefile.am (HFILES): Add freebsd.h.
11843 * configure, Makefile.in, config.in: Rebuild.
11844
11845 * merge.cc (do_add_input_section): Correct pend value. Change
11846 message about last entry not being null terminated from error to
11847 warning.
11848
11849 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
11850
11851 * incremental.cc: New file.
11852 * Makefile.am (CCFILES): Add incremental.cc.
11853 * Makefile.in: Rebuild.
11854
11855 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
11856
11857 * layout.cc (Layout::output_section_name): Preserve names
11858 of '.note.' sections.
11859
11860 2009-03-19 Ian Lance Taylor <iant@google.com>
11861
11862 * descriptors.cc (Descriptors::open): Check that the options are
11863 valid before using them.
11864
11865 2009-03-18 Ian Lance Taylor <iant@google.com>
11866
11867 * script-sections.h: Include <list>.
11868 (class Script_sections): Change Sections_elements from std::vector
11869 to std::list. Typedef public Elements_iterator. Add
11870 orphan_section_placement_, data_segment_align_start_, and
11871 saw_data_segment_align_ fields. Remove data_segment_align_index_
11872 field.
11873 * script-sections.cc (class Orphan_section_placement): New class.
11874 (class Sections_element): Add virtual functions is_relro and
11875 orphan_section_init. Remove virtual function place_orphan_here.
11876 (class Output_section_definition): Add is_relro and
11877 orphan_section_init. Remove place_orphan_here.
11878 (class Orphan_output_section): Likewise.
11879 (Script_sections::Script_sections): Update for field changes.
11880 (Script_sections::data_segment_align): Set saw_data_segment_align_
11881 and data_segment_align_start_, not data_segment_align_index.
11882 (Script_sections::data_segment_relro_end): Check
11883 saw_data_segment_align_. Use data_segment_align_start_ rather
11884 than data_segment_align_index_.
11885 (Script_sections::place_orphan): Rewrite to use
11886 Orphan_section_placement.
11887
11888 2009-03-17 Ian Lance Taylor <iant@google.com>
11889
11890 * archive.cc (Archive::add_symbols): Check for a version attached
11891 to the symbol name in the archive map.
11892 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11893 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11894 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11895 (ver_test_11.a): New target.
11896 * testsuite/Makefile.in: Rebuild.
11897
11898 * configure.ac: Check for chsize and posix_fallocate. Replace
11899 ftruncate.
11900 * ftruncate.c: New file, from gnulib.
11901 * output.cc (posix_fallocate): Define dummy version if not
11902 HAVE_POSIX_FALLOCATE.
11903 (Output_file::map): Call posix_fallocate rather than lseek and
11904 write.
11905 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11906 * configure, Makefile.in, config.in: Rebuild.
11907
11908 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
11909
11910 * layout.h (Layout::create_note): Add section_name parameter.
11911 * layout.cc (Layout::create_note): Likewise.
11912 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11913
11914 2009-03-17 Ian Lance Taylor <iant@google.com>
11915
11916 * descriptors.cc: Include "options.h".
11917 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11918 (Descriptors::open): Always use O_CLOEXEC when opening a new
11919 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
11920 then set FD_CLOEXEC.
11921
11922 * sparc.cc (class Target_sparc): Add has_got_section.
11923 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11924 make sure we have a GOT section.
11925
11926 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11927 (Target_sparc::Scan::local): Likewise.
11928 (Target_sparc::Scan::global): Likewise.
11929 (Target_sparc::Relocate::relocate): Likewise.
11930 (Target_sparc::Relocate::relocate_tls): Likewise.
11931
11932 * symtab.cc (Symbol_table::define_default_version): New function,
11933 broken out of add_from_object.
11934 (Symbol_table::add_from_object): Call define_default_version.
11935 (Symbol_table::define_special_symbol): Add resolve_oldsym
11936 parameter. Change all callers. If the version for a symbol comes
11937 from a version script, resolve it with the symbol with the same
11938 name with no version. Also add the symbol without a version if
11939 appropriate.
11940 (do_define_in_output_data): If resolving with oldsym, don't delete
11941 sym.
11942 (do_define_in_output_segment): Likewise.
11943 (do_define_as_constant): Likewise.
11944 * symtab.h (class Symbol_table): Update declarations.
11945
11946 2009-03-13 Ian Lance Taylor <iant@google.com>
11947
11948 * readsyms.cc (Read_symbols::incompatible_warning): New function.
11949 (Read_symbols::requeue): New function.
11950 (Read_symbols::do_read_symbols): If make_elf_object fails because
11951 the target type is not configured, and the file was searched for,
11952 issue a warning and retry with the next directory.
11953 (Add_symbols::run): If the file has an incompatible format, and
11954 it was searched for, requeue the Read_symbols task. On error,
11955 release the object.
11956 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
11957 dirindex parameter to constructor. Change all callers. Declare
11958 incompatible_warning and requeue.
11959 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11960 input_argument_ and input_group_ fields. Add them to
11961 constructor. Change all callers.
11962 (class Read_script): Add dirindex_ field. Add it to constructor.
11963 Change all callers.
11964 * archive.cc (Archive::setup): Remove input_objects parameter.
11965 Change all callers.
11966 (Archive::get_file_and_offset): Likewise.
11967 (Archive::read_all_symbols): Likewise.
11968 (Archive::read_symbols): Likewise.
11969 (Archive::get_elf_object_for_member): Remove input_objects
11970 parameter. Add punconfigured parameter. Change all callers.
11971 (Archive::add_symbols): Change return type to bool. Check return
11972 value of include_member.
11973 (Archive::include_all_members): Likewise.
11974 (Archive::include_member): Change return type to bool. Return
11975 false if first included object has incompatible target. Set
11976 included_member_ field.
11977 (Add_archive_symbols::run): If add_symbols returns false, requeue
11978 Read_symbols task.
11979 * archive.h (class Archive): Add included_member_ field.
11980 Initialize it in constructor. Add input_file and searched_for
11981 methods. Update declarations.
11982 (class Add_archive_symbols): Add dirpath_, dirindex_, and
11983 input_argument_ fields. Add them to constructor. Change all
11984 callers.
11985 * script.cc: Include "target-select.h".
11986 (class Parser_closure): Add skip_on_incompatible_target_ and
11987 found_incompatible_target_ fields. Add
11988 skip_on_incompatible_target parameter to constructor. Change all
11989 callers. Add methods skip_on_incompatible_target,
11990 clear_skip_on_incompatible_target, found_incompatible_target, and
11991 set_found_incompatible_target.
11992 (read_input_script): Add dirindex parameter. Change all callers.
11993 If parser finds an incompatible target, requeue Read_symbols
11994 task.
11995 (script_set_symbol): Clear skip_on_incompatible_target in
11996 closure.
11997 (script_add_assertion, script_parse_option): Likewise.
11998 (script_start_sections, script_add_phdr): Likewise.
11999 (script_check_output_format): New function.
12000 * script.h (read_input_script): Update declaration.
12001 * script-c.h (script_check_output_format): Declare.
12002 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12003 (ignore_cmd): Remove OUTPUT_FORMAT.
12004 * fileread.cc (Input_file::Input_file): Add explicit this.
12005 (Input_file::will_search_for): New function.
12006 (Input_file::open): Add pindex parameter. Change all callers.
12007 * fileread.h (class Input_file): Add input_file_argument method.
12008 Declare will_search_for. Update declarations.
12009 * object.cc (make_elf_object): Add punconfigured parameter.
12010 Change all callers.
12011 * object.h (class Object): Make input_file public. Add
12012 searched_for method.
12013 (make_elf_object): Update declaration.
12014 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
12015 restart search.
12016 * dirsearch.h (class Dirsearch): Update declaration.
12017 * options.h (class General_options): Add --warn-search-mismatch.
12018 * parameters.cc (Parameters::is_compatible_target): New function.
12019 * parameters.h (class Parameters): Declare is_compatible_target.
12020 * workqueue.cc (Workqueue::add_blocker): New function.
12021 * workqueue.h (class Workqueue): Declare add_blocker.
12022
12023 * fileread.cc (Input_file::open): Remove options parameter.
12024 Change all callers.
12025 (Input_file::open_binary): Likewise.
12026 * script.cc (read_input_script): Likewise.
12027 * readsyms.h (class Read_symbols): Remove options_ field. Remove
12028 options parameter from constructor. Change all callers.
12029 (class Read_script): Likewise.
12030 * fileread.h (class Input_file): Update declarations.
12031 * script.h (read_input_script): Update declaration.
12032
12033 2009-03-10 Nick Clifton <nickc@redhat.com>
12034
12035 * po/es.po: New Spanish translation.
12036
12037 2009-03-06 Cary Coutant <ccoutant@google.com>
12038
12039 * options.cc (parse_short_option): Keep dash_z from registering itself.
12040
12041 2009-03-03 Ian Lance Taylor <iant@google.com>
12042
12043 PR 9918
12044 * target-reloc.h (relocate_section): Pass output_section to
12045 relocate.
12046 * i386.cc (Target_i386::should_apply_static_reloc): Add
12047 output_section parameter. Change all callers.
12048 (Target_i386::Relocate::relocate): Add output_section parameter.
12049 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12050 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12051 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12052 * testsuite/two_file_shared.sh: New script.
12053 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12054 (check_DATA): Add two_file_shared.dbg.
12055 (two_file_shared.dbg): New target.
12056 * testsuite/Makefile.in: Rebuild.
12057
12058 2009-03-01 Ian Lance Taylor <iant@google.com>
12059
12060 * configure.ac: Check for byteswap.h.
12061 * configure: Rebuild.
12062 * config.in: Rebuild.
12063
12064 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
12065
12066 * layout.cc (Layout::find_or_add_kept_section): New function.
12067 (Layout::add_comdat): Removed.
12068 * layout.h (struct Kept_section): Move out of class Layout.
12069 Remove trailing underscores from field names. Add group_sections
12070 field. Rename group_ field to is_group. Change all uses.
12071 (class Layout): Declare find_or_add_kept_section, not add_comdat.
12072 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12073 comdat_groups_ field.
12074 (Sized_relobj::include_section_group): Use
12075 find_or_add_kept_section and Kept_section::group_sections.
12076 (Sized_relobj::include_linkonce_section): Likewise.
12077 * object.cc (class Sized_relobj): Don't define Comdat_group or
12078 Comdat_group_table. Remove find_comdat_group and
12079 add_comdat_group. Remove comdat_groups_ field.
12080 * plugin.cc (include_comdat_group): Use
12081 Layout::find_or_add_kept_section.
12082
12083 2009-02-28 Ian Lance Taylor <iant@google.com>
12084
12085 * README: --gc-sections and map files are now supported. Document
12086 some build requirements.
12087
12088 PR 6992
12089 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12090 relocatable link set the value of the section symbol to zero.
12091 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12092 relocatable link don't include the section address in the local
12093 symbol value.
12094
12095 2009-02-27 Ian Lance Taylor <iant@google.com>
12096
12097 PR 6811
12098 * options.h (class Search_directory): Add is_system_directory.
12099 (class General_options): Declare is_in_system_directory.
12100 * options.cc (get_relative_sysroot): Make static.
12101 (get_default_sysroot): Make static.
12102 (General_optoins::is_in_system_directory): New function.
12103 * fileread.cc (Input_file::is_in_system_directory): New function.
12104 * fileread.h (class Input_file): Declare is_in_system_directory.
12105 * object.h (class Object): Add is_in_system_directory.
12106 (class Input_objects): Remove system_library_directory_ field.
12107 * object.cc (Input_objects::add_object): Don't set
12108 system_library_directory_.
12109 (input_objects::found_in_system_library_directory): Remove.
12110 * symtab.cc (Symbol_table::write_globals): Remove input_objects
12111 parameter. Change all callers.
12112 (Symbol_table::sized_write_globals): Likewise.
12113 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12114 Call Object::is_in_system_directory.
12115 * symtab.h (class Symbol_table): Update declarations.
12116
12117 PR 5990
12118 * descriptors.h (Open_descriptor): Add is_on_stack field.
12119 * descriptors.cc (Descriptors::open): If the descriptor is on the
12120 top of the stack, remove it. Initialize is_on_stack field.
12121 (Descriptors::release): Only add pod to stack if it is not on the
12122 stack already.
12123 (Descriptors::close_some_descriptor): Clear stack_next and
12124 is_on_stack fields.
12125
12126 PR 7091
12127 * output.cc (Output_section::find_starting_output_address): Rename
12128 from starting_output_address; add PADDR parameter; change return
12129 type.
12130 * output.h (class Output_section): Declare
12131 find_starting_output_address instead of starting_output_address.
12132 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12133 section symbol for which we can't find a merge section.
12134
12135 PR 9836
12136 * symtab.cc (Symbol_table::add_from_object): If the visibility is
12137 hidden or internal, force the symbol to be local.
12138 * resolve.cc (Symbol::override_visibility): Define.
12139 (Symbol::override_base): Use override_visibility.
12140 (Symbol_table::resolve): Likewise.
12141 (Symbol::override_base_with_special): Likewise.
12142 (Symbol_table::override_with_special): If the visibility is hidden
12143 or internal, force the symbol to be local.
12144 * symtab.h (class Symbol): Add set_visibility and
12145 override_visibility.
12146 * testsuite/ver_test_1.sh: New file.
12147 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12148 (check_DATA): Add ver_test_1.syms.
12149 (ver_test_1.syms): New target.
12150 * testsuite/Makefile.in: Rebuild.
12151
12152 2009-02-25 Cary Coutant <ccoutant@google.com>
12153
12154 * layout.cc (Layout::choose_output_section): Don't rename sections
12155 when using a linker script that has a SECTIONS clause.
12156 * Makefile.in: Regenerate.
12157
12158 * testsuite/Makefile.am (script_test_5.sh): New test case.
12159 * testsuite/Makefile.in: Regenerate.
12160 * testsuite/script_test_5.cc: New file.
12161 * testsuite/script_test_5.sh: New file.
12162 * testsuite/script_test_5.t: New file.
12163
12164 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
12165
12166 * archive.cc (Archive::include_member): Update calls to add_symbols.
12167 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12168 the Layout argument.
12169 * dynobj.h (do_add_symbols): Add the Layout argument.
12170 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12171 Layout argument.
12172 * object.h (Object::add_symbols): Add the Layout argument.
12173 (Object::do_add_symbols): Add the Layout argument.
12174 (Sized_relobj::do_add_symbols): Add the Layout argument.
12175 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12176 Unify the two versions.
12177 (Add_plugin_symbols): Remove.
12178 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12179 (Sized_pluginobj::do_add_symbols): Unify the two versions.
12180 (Add_plugin_symbols): Remove.
12181 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12182 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12183 (Add_symbols::run): Make it work with Pulginobj.
12184
12185 2009-02-06 Ian Lance Taylor <iant@google.com>
12186
12187 * object.cc (Sized_relobj::do_layout): Make info message start
12188 with lower case letter.
12189
12190 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
12191
12192 * binary.cc: Fix file comment.
12193
12194 * options.h (enum Incremental_disposition): Define.
12195 (class General_options): Add new options: --incremental,
12196 --incremental_changed, --incremental_unchanged,
12197 --incremental_unknown. Add incremental_disposition_ and
12198 implicit_incremental_ fields.
12199 (General_options::incremental_disposition): New function.
12200 (class Position_dependent_options): Add incremental_disposition
12201 option.
12202 (Position_dependent_options::copy_from_options): Set incremental
12203 dispositions.
12204 * options.cc (General_options::parse_incremental_changed): New
12205 function.
12206 (General_options::parse_incremental_unchanged): New function.
12207 (General_options::parse_incremental_unknown): New function.
12208 (General_options::General_options): Initialize new fields
12209 incremental_disposition_ and implicit_incremental_.
12210 (General_options::finalize): Check for uasge of --incremental-*
12211 without --incremental.
12212
12213 2009-02-06 Chris Demetriou <cgd@google.com>
12214
12215 * gold.h (gold_undefined_symbol): Change to take only a Symbol
12216 pointer and to report location as the file name associated with
12217 the symbol.
12218 (gold_undefined_symbol_at_location): New function to replace the
12219 old gold_undefined_symbol functionality.
12220 * target-reloc.h (relocate_section): Update to use
12221 gold_undefined_symbol_at_location.
12222 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12223 Call gold_undefined_symbol function rather than gold_error.
12224 * errors.h (Errors::undefined_symbol): Take location as a
12225 string, rather than calculating it from a relocation.
12226 * errors.cc (Errors::fatal): Print "fatal error:" before the
12227 formatted message.
12228 (Errors::error, Errors::error_at_location): Print "error: "
12229 before the formatted message.
12230 (Errors::undefined_symbol): Take location as a string, rather
12231 than calculating it from a relocation.
12232 (gold_undefined_symbol_at_location): New function akin to
12233 old gold_undefined_symbol, calculates location from relocation.
12234 (gold_undefined_symbol): Change to take only a Symbol pointer
12235 and to report location as the file name associated with the symbol.
12236 * testsuite/debug_msg.sh: Update for changed error messages.
12237 * testsuite/undef_symbol.sh: Likewise.
12238
12239 2009-02-04 Duncan Sands <baldrick@free.fr>
12240
12241 PR 9812
12242 * reduced_debug_output.h
12243 (Output_reduced_debug_abbrev_section::failed): Use format for
12244 gold_warning.
12245 (Output_reduced_debug_info_section::faild): Likewise.
12246
12247 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
12248
12249 * script.cc (Lazy_demangler): New class.
12250 (Version_script_info::get_symbol_version_helper): Demangle a
12251 symbol only once.
12252
12253 2009-01-29 Cary Coutant <ccoutant@google.com>
12254
12255 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12256 to __tls_get_addr.
12257 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12258
12259 2009-01-28 Ian Lance Taylor <iant@google.com>
12260
12261 * version.cc (version_string): Bump to 1.9.
12262
12263 * gold.h: Include <cstring> and <stdint.h>.
12264 * version.cc: Include <cstdio>.
12265 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12266 warning.
12267 * reduced_debug_output.cc (insert_into_vector): Rename from
12268 Insert_into_vector; change all callers. Use Swap_unaligned to
12269 avoid aliasing issue; remove union since it is unnecessary.
12270
12271 2009-01-27 Sriraman Tallam <tmsriram@google.com>
12272
12273 * Makefile.am (CCFILES): Add gc.cc.
12274 (HFILES): Add gc.h.
12275 * Makefile.in: Regenerate.
12276 * gold.cc (Gc_runner): New class.
12277 (queue_initial_tasks): Call garbage collection related tasks
12278 when corresponding options are invoked.
12279 (queue_middle_gc_tasks): New function.
12280 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12281 processed early before laying out sections during garbage collection.
12282 * gold.h (queue_middle_gc_tasks): New function.
12283 (is_prefix_of): Move from "layout.cc".
12284 * i386.cc (Target_i386::gc_process_relocs): New function.
12285 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12286 * main.cc (main): Create object of class "Garbage_collection".
12287 * object.cc (Relobj::copy_symbols_data): New function.
12288 (Relobj::is_section_name_included): New function.
12289 (Sized_relobj::do_layout): Allow this function to be called twice
12290 during garbage collection and defer layout of section during the
12291 first call.
12292 * object.h (Relobj::get_symbols_data): New function.
12293 (Relobj::is_section_name_included): New function.
12294 (Relobj::copy_symbols_data): New function.
12295 (Relobj::set_symbols_data): New function.
12296 (Relobj::get_relocs_data): New function.
12297 (Relobj::set_relocs_data): New function.
12298 (Relobj::is_output_section_offset_invalid): New pure virtual function.
12299 (Relobj::gc_process_relocs): New function.
12300 (Relobj::do_gc_process_relocs): New pure virtual function.
12301 (Relobj::sd_): New data member.
12302 (Sized_relobj::is_output_section_offset_invalid): New function.
12303 (Sized_relobj::do_gc_process_relocs): New function.
12304 * options.h (General_options::gc_sections): Modify to not be a no-op.
12305 (General_options::print_gc_sections): New option.
12306 * plugin.cc (Plugin_finish::run): Remove function call to
12307 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
12308 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12309 * reloc.cc (Read_relocs::run): Add task to process relocs and
12310 determine unreferenced sections when doing garbage collection.
12311 (Gc_process_relocs): New class.
12312 (Sized_relobj::do_gc_process_relocs): New function.
12313 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12314 sections that are garbage collected.
12315 * reloc.h (Gc_process_relocs): New class.
12316 * sparc.cc (Target_sparc::gc_process_relocs): New function.
12317 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12318 symbols whose corresponding sections are garbage collected.
12319 (Symbol_table::Symbol_table): Add new parameter for the garbage
12320 collection object.
12321 (Symbol_table::gc_mark_undef_symbols): New function.
12322 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12323 (Symbol_table::gc_mark_dyn_syms): New function.
12324 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12325 as garbage.
12326 (Symbol_table::add_from_object): Likewise.
12327 (Symbol_table::add_from_relobj): When building shared objects, do not
12328 treat externally visible symbols as garbage.
12329 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12330 table information for static and relocatable links.
12331 * symtab.h (Symbol_table::set_gc): New function.
12332 (Symbol_table::gc): New function.
12333 (Symbol_table::gc_mark_undef_symbols): New function.
12334 (Symbol_table::gc_mark_symbol_for_shlib): New function.
12335 (Symbol_table::gc_mark_dyn_syms): New function.
12336 (Symbol_table::gc_): New data member.
12337 * target.h (Sized_target::gc_process_relocs): New pure virtual
12338 function.
12339 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12340 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12341
12342 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
12343
12344 * options.h (General_options::gc_sections): Define as a no-op for now.
12345 (General_options::no_keep_memory): Ditto.
12346 (General_options::Bshareable): Define.
12347 * options.cc (General_options::finalize): Honor -Bshareable.
12348
12349 2009-01-20 Andreas Schwab <schwab@suse.de>
12350
12351 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12352 read the value in the contents, since we don't use it. Use the
12353 template endianness when writing.
12354 (Relocate::relocate): Use it for R_PPC_REL16_HA.
12355
12356 2009-01-19 Andreas Schwab <schwab@suse.de>
12357
12358 * configure.tgt (powerpc64-*): Fix targ_obj.
12359
12360 2009-01-15 Ian Lance Taylor <iant@google.com>
12361
12362 * object.cc (Sized_relobj::write_local_symbols): Don't write out
12363 local symbols when stripping all symbols.
12364
12365 2009-01-14 Cary Coutant <ccoutant@google.com>
12366
12367 * output.cc (Output_reloc): Add explicit instantiations.
12368
12369 2009-01-14 Cary Coutant <ccoutant@google.com>
12370
12371 * archive.cc (Archive::get_elf_object_for_member): Remove call
12372 to File_read::claim_for_plugin.
12373 * descriptors.cc (Descriptors::open): Remove reference to
12374 is_claimed.
12375 (Descriptors::claim_for_plugin): Remove.
12376 * descriptors.h (Descriptors::claim_for_plugin): Remove.
12377 (Descriptors::is_claimed): Remove.
12378 (claim_descriptor_for_plugin): Remove.
12379 * fileread.cc (File_read::claim_for_plugin): Remove.
12380 * fileread.h (File_read::claim_for_plugin): Remove.
12381 (File_read::descriptor): Reopen descriptor if necessary.
12382 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
12383 (Plugin_manager::all_symbols_read): Add task parameter. Change
12384 all callers.
12385 (Plugin_manager::get_input_file): New function.
12386 (Plugin_manager::release_input_file): New function.
12387 (Pluginobj::Pluginobj): Add filesize parameter and initialize
12388 corresponding data member.
12389 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12390 and pass to base constructor. Change all callers.
12391 (get_input_file, release_input_file): New functions.
12392 (make_sized_plugin_object): Add filesize parameter. Change all callers.
12393 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12394 (Plugin_manager::all_symbols_read): Add task parameter.
12395 (Plugin_manager::get_input_file): New function.
12396 (Plugin_manager::release_input_file): New function.
12397 (Plugin_manager::task_): New data member.
12398 (Pluginobj::Pluginobj): Add filesize parameter.
12399 (Pluginobj::filename): New function.
12400 (Pluginobj::descriptor): New function.
12401 (Pluginobj::filesize): New function.
12402 (Pluginobj::filesize_): New data member.
12403 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12404 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12405 File_read::claim_for_plugin; use Object::unlock to unlock the file.
12406
12407 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12408 with archive libraries.
12409 * testsuite/Makefile.in: Regenerate.
12410 * testsuite/plugin_test.c (struct sym_info): New type.
12411 (get_input_file, release_input_file): New static variables.
12412 (onload): Capture new transfer vector entries.
12413 (claim_file_hook): Stop reading at end of file according to filesize.
12414 Factor out parsing of readelf output into separate function.
12415 (all_symbols_read_hook): Exercise get_input_file and release_input_file
12416 APIs and get the source file name from the symbol table. Convert
12417 source file name to corresponding object file name. Print info
12418 message when adding new input files.
12419 (parse_readelf_line): New function.
12420 * testsuite/plugin_test_1.sh: Add checks for new info messages.
12421 * testsuite/plugin_test_2.sh: Likewise.
12422 * testsuite/plugin_test_3.sh: Likewise.
12423 * testsuite/plugin_test_4.sh: New test case.
12424
12425 2009-01-07 Ian Lance Taylor <iant@google.com>
12426
12427 * version.cc (version_string): Bump to 1.8.
12428
12429 2008-12-23 Cary Coutant <ccoutant@google.com>
12430
12431 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12432 * plugin.cc (Plugin_manager::finish): Rename as
12433 layout_deferred_objects. Move cleanup to separate function.
12434 (Plugin_manager::cleanup): New function.
12435 (Plugin_finish::run): Call layout_deferred_objects and cleanup
12436 separately.
12437 * plugin.h (Plugin_manager::finish): Rename as
12438 layout_deferred_objects.
12439 (Plugin_manager::cleanup): New function.
12440 (Plugin_manager::cleanup_done): New field.
12441
12442 2008-12-23 Cary Coutant <ccoutant@google.com>
12443
12444 * plugin.cc (is_visible_from_outside): New function.
12445 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12446 so we don't return "IR only" status for exported symbols or -r links.
12447
12448 * testsuite/Makefile.am (plugin_test_3): New test case.
12449 * testsuite/Makefile.in: Regenerate.
12450 * testsuite/plugin_test_3.sh: New file.
12451
12452 2008-12-22 Cary Coutant <ccoutant@google.com>
12453
12454 * object.cc (Sized_relobj::layout_section): New function.
12455 (Sized_relobj::do_layout): Defer layout of input sections until after
12456 plugin has provided replacement files.
12457 (Sized_relobj::do_layout_deferred_sections): New function.
12458 * object.h (Relobj::set_section_offset): Remove virtual keyword.
12459 (Relobj::layout_deferred_sections): New function.
12460 (Relobj::do_layout_deferred_sections): New function.
12461 (Sized_relobj::do_layout_deferred_sections): New function.
12462 (Sized_relobj::layout_section): New function.
12463 (Sized_relobj::Deferred_layout): New structure.
12464 (Sized_relobj::deferred_layout_): New field.
12465 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12466 Change all callers. Layout deferred sections.
12467 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
12468 references.
12469 (Plugin_hook::run): Move code from do_plugin_hook inline.
12470 (Plugin_hook::do_plugin_hook): Remove.
12471 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12472 (Plugin_manager::finish): Renamed, was cleanup.
12473 (Plugin_manager::should_defer_layout): New function.
12474 (Plugin_manager::add_deferred_layout_object): New function.
12475 (Plugin_manager::Deferred_layout_list): New type.
12476 (Plugin_manager::deferred_layout_objects_): New field.
12477 (Plugin_hook::do_plugin_hook): Remove.
12478
12479 2008-12-17 Ian Lance Taylor <iant@google.com>
12480
12481 * options.h (class General_options): Add --no case for
12482 --export-dynamic.
12483
12484 2008-12-16 Cary Coutant <ccoutant@google.com>
12485
12486 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12487 vector.
12488 (Plugin_manager::claim_file): Create plugin object even if
12489 plugin did not call the add_symbols callback.
12490 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12491 asking for more symbols than were added.
12492 * testsuite/Makefile.am (plugin_test_1): Add test case with
12493 no global symbols.
12494 (empty.syms): New target.
12495 * testsuite/Makefile.in: Regenerate.
12496 * testsuite/plugin_test.c (claim_file_hook): Add new debug
12497 message. Don't call add_symbols if no globals.
12498 (all_symbols_read_hook): Don't provide replacement for empty
12499 claimed file.
12500
12501 2008-12-12 Ian Lance Taylor <iant@google.com>
12502
12503 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12504 r_type == 0 for a local symbol with r_sym == 0.
12505 (scan_relocatable_relocs): Pass r_sym to
12506 local_non_section_strategy.
12507 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12508 r_sym parameter.
12509
12510 * configure.ac: Update test for TLS descriptors: they are
12511 supported as of glibc 2.9.
12512 * configure: Rebuild.
12513
12514 2008-12-11 Ian Lance Taylor <iant@google.com>
12515
12516 PR 7091
12517 * target-reloc.h (Default_scan_relocatable_relocs): For each
12518 function, map r_type == 0 to RELOC_DISCARD.
12519
12520 2008-12-10 Cary Coutant <ccoutant@google.com>
12521
12522 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12523 object to override a kept COMDAT group from a plugin object.
12524
12525 2008-12-09 Ian Lance Taylor <iant@google.com>
12526
12527 PR 7088
12528 * yyscript.y (file_cmd): Handle INPUT.
12529
12530 * testsuite/initpri1.c: Change all declarations to be full
12531 prototypes by adding void, to avoid compiler warnings.
12532
12533 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
12534
12535 * options.cc (General_options::parse_plugin_opt): New.
12536 (General_options::add_plugin): The argument now is just the filename.
12537 (General_options::add_plugin_option): New.
12538 * options.h (plugin_opt): New.
12539 (add_plugin): Change argument name.
12540 (add_plugin_option): New.
12541 * plugin.cc (Plugin::load): Don't parse the plugin option.
12542 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12543 (Plugin::add_option): New.
12544 (Plugin::args_): Change type.
12545 (Plugin::filename_): New.
12546 (Plugin_manager::add_plugin_option): New.
12547 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12548 * testsuite/Makefile.in: Regenerate.
12549
12550 2008-12-05 Cary Coutant <ccoutant@google.com>
12551
12552 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12553 Handle --strip-lto-sections option.
12554 * options.h (strip_lto_sections): New option.
12555
12556 2008-12-01 Cary Coutant <ccoutant@google.com>
12557
12558 * plugin.cc (ld_plugin_message): Change format parameter to const.
12559 Fix mismatch between new[] and delete.
12560
12561 2008-11-14 Cary Coutant <ccoutant@google.com>
12562
12563 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12564 instead of -1U.
12565
12566 2008-11-05 Craig Silverstein <csilvers@google.com>
12567
12568 * options.cc (General_options::parse_dynamic_list): New function.
12569 * options.h (General_options): New flags dynamic_list,
12570 dynamic_list_data, dynamic_list_cpp_new, and
12571 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
12572 (General_options::in_dynamic_list): New function.
12573 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12574 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12575 (Lex::can_continue_name): Likewise.
12576 (yylex): Likewise.
12577 (read_script_file): New parameter script_options.
12578 (read_dynamic_list): New function.
12579 (Script_options::define_dynamic_list): New function.
12580 (dynamic_list_keyword_parsecodes): New variable.
12581 (dynamic_list_keywords): New variable.
12582 * script.h (Script_options::define_dynamic_list): New function
12583 prototype.
12584 (read_dynamic_list): New function prototype.
12585 * symtab.cc (strprefix): New macro.
12586 (Symbol::should_add_dynsym_entry): Support dynamic_list,
12587 dynamic_list_data, dynamic_list_cpp_new, and
12588 dynamic_list_cpp_typeinfo.
12589 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12590 (dynamic_list_expr): New rule.
12591 (dynamic_list_nodes): Likewise.
12592 (dynamic_list_node): Likewise.
12593 * testsuite/Makefile.am (dynamic_list): New test.
12594 * testsuite/Makefile.in: Regenerated.
12595 * testsuite/dynamic_list.t: New file.
12596 * testsuite/dynamic_list.sh: New file.
12597
12598 2008-11-05 Craig Silverstein <csilvers@google.com>
12599
12600 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12601 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12602 (t11_last): Likewise.
12603 * testsuite/ver_test_6.c (main): Likewise.
12604
12605 2008-10-07 Cary Coutant <ccoutant@google.com>
12606
12607 * options.c (General_options::finalize): Add check for -static and
12608 -shared.
12609 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12610 is not empty.
12611
12612 2008-10-02 Cary Coutant <ccoutant@google.com>
12613
12614 * plugin.cc (make_sized_plugin_object): Fix conditional
12615 compilation to work when not all targets are enabled.
12616
12617 2008-09-29 Cary Coutant <ccoutant@google.com>
12618
12619 * archive.cc (Archive::get_file_and_offset): Use filename instead
12620 of name to get library path.
12621 (Archive::include_member): Unlock external member of a thin archive.
12622
12623 * testsuite/Makefile.am (TEST_AR): New variable.
12624 (thin_archive_test_1): New test.
12625 (thin_archive_test_2): New test.
12626 * testsuite/Makefile.in: Regenerate.
12627 * testsuite/thin_archive_main.cc: New file.
12628 * testsuite/thin_archive_test_1.cc: New file.
12629 * testsuite/thin_archive_test_2.cc: New file.
12630 * testsuite/thin_archive_test_3.cc: New file.
12631 * testsuite/thin_archive_test_4.cc: New file.
12632
12633 2008-09-29 Cary Coutant <ccoutant@google.com>
12634
12635 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12636 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12637 instead of -1U.
12638 (Sized_relobj::do_finalize_local_symbols): Likewise.
12639 (Sized_relobj::map_to_kept_section): Likewise.
12640 * object.h (Sized_relobj::invalid_address): New constant.
12641 (Sized_relobj::do_output_section_offset): Check for invalid_address
12642 and return -1ULL.
12643 * output.cc (Output_reloc::local_section_offset): Use constant
12644 invalid_address instead of -1U.
12645 (Output_reloc::get_address): Likewise.
12646 (Output_section::output_address): Change -1U to -1ULL.
12647 * output.h (Output_reloc::invalid_address): New constant.
12648 * reloc.cc (Sized_relobj::write_sections): Use constant
12649 invalid_address instead of -1U.
12650 (Sized_relobj::relocate_sections): Likewise.
12651 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12652 values for merge sections.
12653 * target-reloc.h (relocate_for_relocatable): Use constant
12654 invalid_address instead of -1U.
12655
12656 2008-09-19 Cary Coutant <ccoutant@google.com>
12657
12658 Add plugin functionality for link-time optimization (LTO).
12659 * configure.ac (plugins): Add --enable-plugins option.
12660 * configure: Regenerate.
12661 * config.in: Regenerate.
12662 * Makefile.am (LIBDL): New variable.
12663 (CCFILES): Add plugin.cc.
12664 (HFILES): Add plugin.h.
12665 (ldadd_var): Add LIBDL.
12666 * Makefile.in: Regenerate.
12667
12668 * archive.cc: Include "plugin.h".
12669 (Archive::setup): Don't preread archive symbols when using a plugin.
12670 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
12671 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12672 files.
12673 (Archive::include_member): Add symbols from plugin objects.
12674 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12675 * descriptors.cc (Descriptors::open): Check for file descriptors
12676 abandoned by plugins.
12677 (Descriptors::claim_for_plugin): New function.
12678 * descriptors.h (Descriptors::claim_for_plugin): New function.
12679 (Open_descriptor::is_claimed): New field.
12680 (claim_descriptor_for_plugin): New function.
12681 * fileread.cc (File_read::claim_for_plugin): New function.
12682 * fileread.h (File_read::claim_for_plugin): New function.
12683 (File_read::descriptor): New function.
12684 * gold.cc: Include "plugin.h".
12685 (queue_initial_tasks): Add task to call plugin hooks for generating
12686 new object files.
12687 * main.cc: Include "plugin.h".
12688 (main): Load plugin libraries.
12689 * object.h (Pluginobj): Declare.
12690 (Object::pluginobj): New function.
12691 (Object::do_pluginobj): New function.
12692 (Object::set_target): New function.
12693 * options.cc: Include "plugin.h".
12694 (General_options::parse_plugin): New function.
12695 (General_options::General_options): Initialize plugins_ field.
12696 (General_options::add_plugin): New function.
12697 * options.h (Plugin_manager): Declare.
12698 (General_options): Add --plugin option.
12699 (General_options::has_plugins): New function.
12700 (General_options::plugins): New function.
12701 (General_options::add_plugin): New function.
12702 (General_options::plugins_): New field.
12703 * plugin.cc: New file.
12704 * plugin.h: New file.
12705 * readsyms.cc: Include "plugin.h".
12706 (Read_symbols::do_read_symbols): Check for archive before checking
12707 for ELF file. Call plugin hooks to claim files.
12708 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12709 from a real object file; force override when processing replacement
12710 files.
12711 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12712 (Symbol::init_base_object): Likewise.
12713 (Symbol::init_base_output_data): Likewise.
12714 (Symbol::init_base_output_segment): Likewise.
12715 (Symbol::init_base_constant): Likewise.
12716 (Symbol::init_base_undefined): Likewise.
12717 (Symbol::output_section): Assert that object is not a plugin.
12718 (Symbol_table::add_from_pluginobj): New function.
12719 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12720 undefined.
12721 (Symbol_table::sized_write_globals): Likewise.
12722 (Symbol_table::add_from_pluginobj): Instantiate template.
12723 * symtab.h (Sized_pluginobj): Declare.
12724 (Symbol::in_real_elf): New function.
12725 (Symbol::set_in_real_elf): New function.
12726 (Symbol::in_real_elf_): New field.
12727 (Symbol_table::add_from_pluginobj): New function.
12728
12729 * testsuite/Makefile.am (AM_CFLAGS): New variable.
12730 (LIBDL): New variable.
12731 (LDADD): Add LIBDL.
12732 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12733 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12734 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12735 (MOSTLYCLEANFILES): Likewise.
12736 * testsuite/Makefile.in: Regenerate.
12737 * testsuite/plugin_test.c: New file.
12738 * testsuite/plugin_test_1.sh: New file.
12739 * testsuite/plugin_test_2.sh: New file.
12740
12741 2008-09-16 Ian Lance Taylor <iant@google.com>
12742
12743 * target-reloc.h (relocate_section): Check whether a symbol is
12744 defined by the ABI before reporting an undefined symbol error.
12745 * target.h (Target::is_defined_by_abi): Make parameter const.
12746 (Target::do_is_defined_by_abi): Likewise.
12747 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12748 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12749 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12750 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12751 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12752 * testsuite/Makefile.in: Rebuild.
12753
12754 * fileread.cc (make_view): Add casts to avoid warning.
12755
12756 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12757
12758 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12759 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12760
12761 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
12762
12763 * options.h (General_options::output_is_executable): New.
12764 (General_options::output_is_pie): New.
12765 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12766 for shared libraries.
12767 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12768
12769 2008-09-11 Chris Demetriou <cgd@google.com>
12770
12771 * options.h (origin): New -z option.
12772 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12773 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12774 in DT_FLAGS_1.
12775
12776 2008-09-05 Cary Coutant <ccoutant@google.com>
12777
12778 * fileread.cc (File_read::make_view): Add check for attempt to map
12779 beyond end of file.
12780
12781 2008-09-05 Cary Coutant <ccoutant@google.com>
12782
12783 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12784 explicit instantiations.
12785
12786 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
12787
12788 PR gold/6858
12789 * options.cc (General_options::finalize): Allow undefined symbols
12790 in shlibs if linking -shared.
12791
12792 PR gold/6859
12793 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12794 symbols as not needing a dynsym entry.
12795
12796 2008-08-20 Craig Silverstein <csilvers@google.com>
12797
12798 * fileread.cc (File_read::open): Do not lock the file unless it
12799 was successfully opened.
12800
12801 2008-08-14 Cary Coutant <ccoutant@google.com>
12802
12803 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12804 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12805 * testsuite/tls_test.cc (struct int128): 128-bit struct
12806 for testing TLS relocs with non-zero addend.
12807 (v12): New TLS variable.
12808 (t12): New test.
12809 (t_last): Add check for v12.
12810 * testsuite/tls_test.h (t12): New function.
12811 * testsuite/tls_test_main.cc (thread_routine): Call new test.
12812
12813 2008-08-13 Ian Lance Taylor <iant@google.com>
12814
12815 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12816 set tls_segment_ or relro_segment_.
12817 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12818 when appropriate.
12819 * output.h (Output_section::clear_is_relro): New function.
12820 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12821 sections specially even when output_data_ is empty.
12822 (Output_segment::maximum_alignment): When first section is relro,
12823 only force alignment for PT_LOAD segments.
12824 * script.cc (script_data_segment_align): New function.
12825 (script_data_segment_relro_end): New function.
12826 * script-c.h (script_data_segment_align): Declare.
12827 (script_data_segment_relro_end): Declare.
12828 * script-sections.h (class Script_sections): Declare
12829 data_segment_align and data_segment_relro_end. Add fields
12830 segment_align_index_ and saw_relro_end_.
12831 * script-sections.cc (class Sections_element): Add set_is_relro
12832 virtual function. Add new bool* parameter to place_orphan_here.
12833 Add get_output_section virtual function.
12834 (class Output_section_definition): Add set_is_relro. Add new
12835 bool* parameter to place_orphan_here. Add get_output_section.
12836 Add is_relro_ field.
12837 (Output_section_definition::Output_section_definition): Initialize
12838 evaluated_address_, evaluated_load_address, evaluated_addralign_,
12839 and is_relro_ fields.
12840 (Output_section_definition::place_orphan_here): Add is_relro
12841 parameter.
12842 (Output_section_definition::set_section_addresses): Set relro for
12843 output section.
12844 (Output_section_definition::alternate_constraint): Likewise.
12845 (class Orphan_output_section): Add new bool* parameter to
12846 place_orphan_here. Add get_output_section.
12847 (Orphan_output_section::place_orphan_here): Add is_relro
12848 parameter.
12849 (Script_sections::Script_sections): Initialize
12850 data_segment_align_index_ and saw_relro_end_.
12851 (Script_sections::data_segment_align): New function.
12852 (Script_sections::data_segment_relro_end): New function.
12853 (Script_sections::place_orphan): Set or clear is_relro.
12854 (Script_sections::set_section_addresses): Force alignment of first
12855 TLS section.
12856 * yyscript.y (exp): Call script_data_segment_align and
12857 script_data_segment_relro_end.
12858 * testsuite/relro_script_test.t: New file.
12859 * testsuite/relro_test.cc (using_script): Declare.
12860 (t1, t2): Test using_script.
12861 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12862 (relro_script_test_SOURCES): Define.
12863 (relro_script_test_DEPENDENCIES): Define.
12864 (relro_script_test_LDFLAGS): Define.
12865 (relro_script_test_LDADD): Define.
12866 (relro_script_test.so): New target.
12867 * testsuite/Makefile.in: Rebuild.
12868
12869 2008-08-06 Cary Coutant <ccoutant@google.com>
12870
12871 * archive.cc (Archive::total_archives, Archive::total_members)
12872 (Archive::total_members_loaded): New variables.
12873 (Archive::setup): Add parameter. Add option to preread
12874 archive symbols.
12875 (Archive::read_armap): Add counter.
12876 (Archive::get_file_and_offset): New function.
12877 (Archive::get_elf_object_for_member): New function.
12878 (Archive::read_all_symbols): New function.
12879 (Archive::read_symbols): New function.
12880 (Archive::add_symbols): Add counters.
12881 (Archive::include_all_members): Use armap to find members if it's
12882 already built.
12883 (Archive::include_member): Skip reading symbols if already read.
12884 Factored code into Archive::get_file_and_offset and
12885 Archive::get_elf_object_for_member. Changed call to
12886 Mapfile::report_include_archive_member.
12887 (Archive::print_stats): New function.
12888 * archive.h: Declare Object and Read_symbols_data classes.
12889 (Archive::Archive): Add initializers for new members.
12890 (Archive::setup): Add parameter.
12891 (Archive::print_stats): New function.
12892 (Archive::total_archives, Archive::total_members)
12893 (Archive::total_members_loaded): New variables.
12894 (Archive::get_file_and_offset): New function.
12895 (Archive::get_elf_object_for_member): New function.
12896 (Archive::read_all_symbols): New function.
12897 (Archive::read_symbols): New function.
12898 (Archive::Archive_member): New class.
12899 (Archive::members_): New member.
12900 (Archive::num_members_): New member.
12901 * main.cc: Include archive.h.
12902 (main): Call Archive::print_stats.
12903 * mapfile.cc (Mapfile::report_include_archive_member): Delete
12904 archive parameter; member_name is now the fully-decorated name.
12905 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12906 * options.h: (General_options): Add --preread-archive-symbols option.
12907 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12908 Archive::setup.
12909
12910 2008-08-04 Ian Lance Taylor <iant@google.com>
12911
12912 * symtab.h (Symbol::use_plt_offset): New function.
12913 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12914 * powerpc.cc (Relocate::relocate): Likewise.
12915 * sparc.cc (Relocate::relocate): Likewise.
12916 * x86_64.cc (Relocate::relocate): Likewise.
12917 * testsuite/weak_plt.sh: New test.
12918 * testsuite/weak_plt_main.cc: New test.
12919 * testsuite/weak_plt_shared.cc: New test.
12920 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12921 (check_PROGRAMS): Add weak_plt.
12922 (check_DATA): Add weak_plt_shared.so.
12923 (weak_plt_main_pic.o, weak_plt): New targets.
12924 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12925 * testsuite/Makefile.in: Rebuild.
12926
12927 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12928 gcctestdir/ld.
12929 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12930 * testsuite/Makefile.in: Rebuild.
12931
12932 2008-08-04 Alan Modra <amodra@bigpond.net.au>
12933
12934 * Makefile.am (POTFILES.in): Set LC_ALL=C.
12935 * Makefile.in: Regenerate.
12936 * po/POTFILES.in: Regenerate.
12937
12938 2008-07-29 Ian Lance Taylor <iant@google.com>
12939
12940 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12941 symbols before other symbols.
12942 * testsuite/script_test_2.cc (test_addr): Declare.
12943 (test_addr_alias): Declare.
12944 (main): Check that test_addr and test_addr_alias have the right
12945 values.
12946 * testsuite/script_test_2.t: Define test_addr_alias and
12947 test_addr.
12948
12949 2008-07-24 Ian Lance Taylor <iant@google.com>
12950
12951 PR 5990
12952 * descriptors.cc: New file.
12953 * descriptors.h: New file.
12954 * gold-threads.h (class Hold_optional_lock): New class.
12955 * fileread.cc: Include "descriptors.h".
12956 (File_read::~File_read): Release descriptor rather than closing
12957 it.
12958 (File_read::open) [file]: Call open_descriptor rather than open.
12959 Set is_descriptor_opened_.
12960 (File_read::open) [memory]: Assert that descriptor is not open.
12961 (File_read::reopen_descriptor): New function.
12962 (File_read::release): Release descriptor.
12963 (File_read::do_read): Make non-const. Reopen descriptor.
12964 (File_read::read): Make non-const.
12965 (File_read::make_view): Reopen descriptor.
12966 (File_read::do_readv): Likewise.
12967 * fileread.h (class File_read): Add is_descriptor_opened_ field.
12968 Update declarations.
12969 * layout.cc: Include "descriptors.h".
12970 (Layout::create_build_id): Use open_descriptor rather than open.
12971 * output.cc: Include "descriptors.h".
12972 (Output_file::open): Use open_descriptor rather than open.
12973 * archive.cc (Archive::const_iterator): Change Archive to be
12974 non-const.
12975 (Archive::begin, Archive::end): Make non-const.
12976 (Archive::count_members): Likewise.
12977 * archive.h (class Archive): Update declarations.
12978 * object.h (Object::read): Make non-const.
12979 * Makefile.am (CCFILES): Add descriptors.cc.
12980 (HFILES): Add descriptors.h.
12981 * Makefile.in: Rebuild.
12982
12983 PR 6716
12984 * gold.h: Always include <clocale>. Add Solaris workarounds
12985 following code in binutils/sysdep.h.
12986
12987 PR 6048
12988 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12989 this->eh_frame_hdr_ is NULL before using it.
12990
12991 * dynobj.cc (Versions::Versions): Update comment.
12992
12993 * dynobj.cc (Versions::Versions): If there is an soname, use it as
12994 the base version name.
12995
12996 * stringpool.cc (Stringpool_template::add_with_length): Set key to
12997 array size plus one.
12998 (Stringpool_template::set_string_offsets): Subtract one from key
12999 before using it as an array index.
13000 (Stringpool_template::get_offset_with_length): Likewise.
13001 (Stringpool_template::write_to_buffer): Likewise.
13002 * stringpool.h (Stringpool_template::get_offset_from_key):
13003 Likewise.
13004
13005 2008-07-23 Ian Lance Taylor <iant@google.com>
13006
13007 PR 6658
13008 * object.h (Merged_symbol_value::value): Do our best to handle a
13009 negative addend.
13010
13011 PR 6647
13012 * script.cc (Version_script_info::get_versions): Don't add empty
13013 version tag to return value.
13014 (Version_script_info::get_symbol_version_helper): Change return
13015 type to bool. Add pversion parameter. Change all callers.
13016 (script_register_vers_node): Don't require a non-NULL tag.
13017 * script.h (class Version_script_info): Update declarations.
13018 (Version_script_info::get_symbol_version): Change return type to
13019 bool. Add version parameter. Change all callers.
13020 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13021 handling. Handle an empty version from a version script.
13022 (Symbol_table::define_special_symbol): Likewise.
13023 * testsuite/ver_test_10.script: New file.
13024 * testsuite/ver_test_10.sh: New file.
13025 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13026 (check_DATA): Add ver_test_10.syms.
13027 (ver_test_10.syms, ver_test_10.so): New target.
13028 * testsuite/Makefile.in: Rebuild.
13029
13030 2008-07-23 Simon Baldwin <simonb@google.com>
13031
13032 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13033 to zero for undefined symbols from dynamic libraries.
13034
13035 2008-07-23 Ian Lance Taylor <iant@google.com>
13036
13037 * symtab.cc (Symbol_table::resolve): Remove version parameter.
13038 Change all callers.
13039 * symtab.h (class Symbol_table): Update declaration.
13040 * testsuite/ver_test_9.cc: New file.
13041 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13042 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13043 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13044 (ver_test_9.so, ver_test_9.o): New targets.
13045 * testsuite/Makefile.in: Rebuild.
13046
13047 2008-07-22 Ian Lance Taylor <iant@google.com>
13048
13049 * options.h (class General_options): Define --check-sections.
13050 * layout.cc (Layout::set_segment_offsets): Handle
13051 --check-sections.
13052
13053 * options.h (class General_options): Define -n/--nmagic and
13054 -N/--omagic.
13055 * options.cc (General_options::finalize): For -n/--nmagic or
13056 -N/--omagic, set -static.
13057 * layout.cc (Layout::attach_allocated_section_to_segment): If
13058 -N/--omagic, don't put read-only and read-write sections in
13059 different segments.
13060 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13061 finding a read-only segment.
13062 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13063 don't set the minimum segment alignment to the common page size,
13064 and don't set the file offset to the address modulo the page size.
13065 * script-sections.cc (Script_sections::create_segments): If
13066 -n/--omagic, don't put read-only and read-write sections in
13067 different segments.
13068
13069 * cref.cc: New file.
13070 * cref.h: New file.
13071 * options.h (class General_options): Add --print-symbol-counts.
13072 * main.cc (main): Issue defined symbol report if requested.
13073 * archive.cc (Archive::interpret_header): Make into a const member
13074 function.
13075 (Archive::add_symbols): Call Input_objects::archive_start and
13076 archive_stop.
13077 (Archive::const_iterator): Define new class.
13078 (Archive::begin, Archive::end): New functions.
13079 (Archive::include_all_members): Rewrite to use iterator.
13080 (Archive::count_members): New function.
13081 * archive.h (class Archive): Update declarations.
13082 (Archive::filename): New function.
13083 * object.cc: Include "cref.h".
13084 (Sized_relobj::Sized_relobj): Initialize defined_count_.
13085 (Sized_relobj::do_get_global_symbol_counts): New function.
13086 (Input_objects::add_object): Add object to cross-referencer.
13087 (Input_objects::archive_start): New function.
13088 (Input_objects::archive_stop): New function.
13089 (Input_objects::print_symbol_counts): New function.
13090 * object.h: Declare Cref and Archive.
13091 (Object::get_global_symbol_counts): New function.
13092 (Object::do_get_global_symbol_counts): New pure virtual function.
13093 (class Sized_relobj): Add defined_count_ field. Update
13094 declarations.
13095 (class Input_objects): Add cref_ field. Update constructor.
13096 Update declarations.
13097 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13098 defined_count_.
13099 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13100 symbol counts.
13101 (Sized_dynobj::do_get_global_symbol_counts): New function.
13102 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13103 defined_count_. Update declarations. Define Symbols typedef.
13104 * symtab.cc (Symbol_table::add_from_relobj): Add defined
13105 parameter. Change all callers.
13106 (Symbol_table::add_from_dynobj): Add sympointers and defined
13107 parameters. Change all callers.
13108 * symtab.h (class Symbol_table): Update declarations.
13109 * Makefile.am (CCFILES): Add cref.cc.
13110 (HFILES): Add cref.h.
13111 * Makefile.in: Rebuild.
13112
13113 2008-07-22 Simon Baldwin <simonb@google.com>
13114
13115 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13116 to zero when writing undefined symbols.
13117
13118 2008-07-22 Ian Lance Taylor <iant@google.com>
13119
13120 * output.cc (Output_section::add_input_section): Don't try to
13121 merge empty merge sections.
13122
13123 2008-07-21 Craig Silverstein <csilvers@google.com>
13124
13125 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13126 Include symbol version in error message.
13127
13128 2008-07-20 Chris Demetriou <cgd@google.com>
13129
13130 * configure.ac (gold_cv_c_random_seed): New configured variable.
13131 (RANDOM_SEED_CFLAGS): New substituted variable.
13132 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13133 * configure: Rebuild.
13134 * Makefile.in: Likewise.
13135 * testsuite/Makefile.in: Likewise.
13136
13137 2008-07-18 Ian Lance Taylor <iant@google.com>
13138
13139 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13140 where we see NAME/NULL and NAME/VERSION as separate symbols.
13141 * testsuite/ver_test_main.cc (main): Call t4.
13142 (t4, t4_2a): Define.
13143 * testsuite/ver_test_2.cc (t4_2): Define.
13144 * testsuite/ver_test_2.script: Put t4_2a in VER2.
13145 * testsuite/ver_test_4.cc (t4_2a): Define.
13146 * testsuite/ver_test_4.script: Put t4_2a in VER2.
13147 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13148
13149 2008-07-17 Ian Lance Taylor <iant@google.com>
13150
13151 * dynobj.cc (Versions::add_def): If we give an error about a
13152 missing version, go ahead and create the version anyhow.
13153
13154 2008-07-10 Ian Lance Taylor <iant@google.com>
13155
13156 Handle output sections with more than 0x7fffffff bytes.
13157 * object.h (class Relobj): Change map_to_output_ to
13158 output_sections_, and just keep a section pointer. Change all
13159 uses. Move comdat group support to Sized_relobj.
13160 (Relobj::is_section_specially_mapped): Remove.
13161 (Relobj::output_section): Remove poff parameter. Change all
13162 callers.
13163 (Relobj::output_section_offset): New function.
13164 (Relobj::set_section_offset): Rewrite.
13165 (Relobj::map_to_output): Remove.
13166 (Relobj::output_sections): New function.
13167 (Relobj::do_output_section_offset): New pure virtual function.
13168 (Relobj::do_set_section_offset): Likewise.
13169 (class Sized_relobj): Add section_offsets_ field. Add comdat
13170 group support from Relobj. Update declarations.
13171 (Sized_relobj::get_output_section_offset): New function.
13172 (Sized_relobj::do_output_section_offset): New function.
13173 (Sized_relobj::do_set_section_offset): New function.
13174 * object.cc (Relobj::output_section_address): Remove.
13175 (Sized_relobj::Sized_relobj): Initialize new fields.
13176 (Sized_relobj::include_section_group): Cast find_kept_object to
13177 Sized_relobj.
13178 (Sized_relobj::include_linkonce_section): Likewise.
13179 (Sized_relobj::do_layout): Use separate arrays for output section
13180 and output offset.
13181 (Sized_relobj::do_count_local_symbols): Change map_to_output to
13182 output_sections.
13183 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13184 output_sections and section_offsets.
13185 (Sized_relobj::write_local_symbols): Likewise.
13186 (map_to_kept_section): Compute output address directly.
13187 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13188 output_sections and section_offsets.
13189 (Sized_relobj::write_sections): Likewise.
13190 (Sized_relobj::relocate_sections): Likewise.
13191 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13192 * output.h (class Output_reloc): Update declarations. Change
13193 u2_.relobj to Sized_relobj*.
13194 (class Output_data_reloc): Change add functions to use
13195 Sized_relobj*.
13196 * output.cc (Output_reloc::Output_reloc): Change relobj to
13197 Sized_relobj*.
13198 (Output_reloc::local_section_offset): Change return type to
13199 Elf_Addr. Use get_output_section_offset.
13200 (Output_reloc::get_address): Likewise.
13201 (Output_section::is_input_address_mapped): Don't call
13202 is_section_specially_mapped.
13203 (Output_section::output_offset): Likewise.
13204 (Output_section::output_address): Likewise.
13205 (Output_section::starting_output_address): Likewise.
13206 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13207 parameter to Sized_relobj*.
13208 (Copy_relocs::need_copy_reloc): Likewise.
13209 (Copy_relocs::save): Likewise.
13210 * copy-relocs.h (class Copy_relocs): Update declarations.
13211 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13212 Sized_relobj*. Change relobj_ field to Sized_relobj*.
13213 * target-reloc.h (relocate_for_relocatable): Change
13214 offset_in_output_section type to Elf_Addr. Change code that uses
13215 it as well.
13216 * layout.cc (Layout::layout): Always set *off.
13217 * mapfile.cc (Mapfile::print_input_section): Use
13218 output_section_offset.
13219 * i386.cc (Target_i386::copy_reloc): Change object parameter to
13220 Sized_relobj*.
13221 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13222 * sparc.cc (Target_sparc::copy_reloc): Likewise.
13223 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13224
13225 2008-07-03 Ian Lance Taylor <iant@google.com>
13226
13227 * layout.cc (Layout::include_section): Do not discard unrecognized
13228 SHT_STRTAB sections.
13229
13230 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
13231
13232 * script.cc (Lex::can_continue_name): Make '?' allowable in
13233 version-script names.
13234 * testsuite/version_script.map: Change glob pattern to use '?'
13235
13236 2008-06-30 Manish Singh <yosh@gimp.org>
13237
13238 PR 6585
13239 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13240 Correct typo.
13241
13242 2008-06-30 Ian Lance Taylor <iant@google.com>
13243
13244 PR 6660
13245 PR 6682
13246 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13247 versions]: Don't try to read the value in the contents, since we
13248 don't use it. Use the template endianness when writing.
13249
13250 2008-06-25 Cary Coutant <ccoutant@google.com>
13251
13252 * fileread.cc (File_read::make_view): Assert on zero-length view.
13253 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13254 symbol table when there are no symbols to read.
13255
13256 2008-06-23 Craig Silverstein <csilvers@google.com>
13257
13258 * version.cc (version_string): Bump to 1.7
13259
13260 2008-06-18 Craig Silverstein <csilvers@google.com>
13261
13262 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13263 constant 0xFFFF to type Valtype.
13264 (Powerpc_relocate_functions::rel16_ha): Likewise.
13265
13266 2008-06-17 Ian Lance Taylor <iant@google.com>
13267
13268 * output.h (Output_section::Input_section): Initialize p2align_ to
13269 zero for Output_section_data constructors.
13270 (Output_section::Input_section::addralign): If not an input
13271 section, return the alignment of the Output_section_data.
13272 * testsuite/copy_test.cc: New file.
13273 * testsuite/copy_test_1.cc: New file.
13274 * testsuite/copy_test_2.cc: New file.
13275 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13276 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13277 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13278 (copy_test_1_pic.o, copy_test_1.so): New targets.
13279 (copy_test_2_pic.o, copy_test_2.so): New targets.
13280 * testsuite/Makefile.in: Rebuild.
13281
13282 * script-sections.cc (Script_sections::place_orphan): Initialize
13283 local variable exact.
13284
13285 2008-06-13 David Edelsohn <edelsohn@gnu.org>
13286
13287 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13288
13289 2008-06-12 David Edelsohn <edelsohn@gnu.org>
13290 David S. Miller <davem@davemloft.net>
13291
13292 * powerpc.cc: New file.
13293 * Makefile.am (TARGETSOURCES): Add powerpc.cc
13294 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13295 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13296 * Makefile.in: Rebuild.
13297
13298 2008-06-09 Ian Lance Taylor <iant@google.com>
13299
13300 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13301 <exception>.
13302 (throwing, orig_terminate): New static variables.
13303 (terminate_handler): New static function.
13304 (t2): Set terminate handler.
13305
13306 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
13307
13308 PR 6584
13309 * binary.cc (Binary_to_elf::sized_convert): Fix .data
13310 alignment.
13311
13312 2008-05-30 Cary Coutant <ccoutant@google.com>
13313
13314 * archive.cc (Archive::include_all_members) Correct to step
13315 over symbol table and extended name table in thin archives.
13316
13317 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
13318
13319 PR 6407
13320 * target-reloc.h (relocate_for_relocatable): Fix new_offset
13321 calculation.
13322
13323 2008-05-28 Caleb Howe <cshowe@google.com>
13324
13325 * reduced_debug_output.cc: New file.
13326 * reduced_debug_output.h: New file.
13327 * options.h (class General_options): Add --strip-debug-non-line.
13328 * options.cc (General_options::finalize): Add strip_debug_non_line
13329 to the strip heirarchy.
13330 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13331 fields.
13332 * layout.cc: Include "reduced_debug_output.h".
13333 (Layout::Layout): Initialize new fields.
13334 (line_only_debug_sections): New static array.
13335 (is_lines_only_debug_sections): New static inline function.
13336 (Layout::include_section): Handle --strip-debug-non-line.
13337 (Layout::make_output_section): If --strip-debug-non-line, build
13338 new output sections for .debug_abbrev and .debug_info.
13339 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13340 gold. Warn about possible overflow.
13341 (read_signed_LEB_128): Likewise.
13342 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13343 (read_signed_LEB_128): Declare.
13344 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13345 (HFILES): Add reduced_debug_output.h.
13346 * Makefile.in: Rebuild.
13347
13348 2008-05-21 Ian Lance Taylor <iant@google.com>
13349
13350 * mapfile.cc: New file.
13351 * mapfile.h: New file.
13352 * options.h (class General_options): Add -M/--print-map and -Map.
13353 * options.cc (General_options::finalize): Make -M equivalent to
13354 -Map -.
13355 * main.cc: Include <cstdio> and "mapfile.h".
13356 (main): Open mapfile if requested.
13357 * gold.cc (class Middle_runner): Add mapfile_ field. Update
13358 constructor. Change caller.
13359 (queue_initial_tasks): Add mapfile parameter. Change caller.
13360 (queue_middle_tasks): Likewise.
13361 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13362 declarations.
13363 * archive.cc: Include "mapfile.h".
13364 (Archive::add_symbols): Add mapfile parameter. Change all
13365 callers. Pass mapfile, symbol, and reason to include_member.
13366 (Archive::include_all_members): Add mapfile parameter. Change all
13367 callers.
13368 (Archive::include_member): Add mapfile, sym, and why parameters.
13369 Change all callers. Report inclusion to map file.
13370 * archive.h: Include "fileread.h".
13371 (class Archive): Update declarations.
13372 (Archive::file): New const method.
13373 (class Add_archive_symbols): Add mapfile_ field. Update
13374 constructor. Change all callers.
13375 * readsyms.h (class Read_symbols): Likewise.
13376 (class Finish_group): Likewise.
13377 (class Read_script): Likewise.
13378 * common.cc: Include "mapfile.h".
13379 (Symbol_table::allocate_commons): Add mapfile parameter. Change
13380 all callers.
13381 (Symbol_table::do_allocate_commons): Likewise.
13382 (Symbol_table::do_allocate_commons_list): Likewise. Report common
13383 symbol allocation to mapfile.
13384 * common.h (class Allocate_commons_task): Add mapfile_ field.
13385 Update constructor. Change all callers.
13386 * symtab.h (class Symbol_table): Update declarations.
13387 * layout.cc: Include "mapfile.h".
13388 (Layout_task_runner::run): Print information to mapfile.
13389 (Layout::create_gold_note): Change Output_data_fixed_space to
13390 Output_data_zero_fill.
13391 (Layout::create_build_id): Likewise.
13392 (Layout::print_to_mapfile): New function.
13393 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
13394 constructor. Change caller.
13395 (class Layout): Declare print_to_mapfile.
13396 * output.cc (Output_section::Input_section::print_to_mapfile): New
13397 function.
13398 (Output_section::add_input_section): If producing a map, always
13399 add to input_sections_ list.
13400 (Output_section::do_print_to_mapfile): New function.
13401 (Output_segment::print_sections_to_mapfile): New function.
13402 (Output_segment::print_section_list_to_mapfile): New function.
13403 * output.h: Include "mapfile.h".
13404 (Output_data::print_to_mapfile): New function.
13405 (Output_data::do_print_to_mapfile): New virtual function.
13406 (Output_segment_headers::do_print_to_mapfile): New function.
13407 (Output_file_header::do_print_to_mapfile): New function.
13408 (Output_data_const::do_print_to_mapfile): New function.
13409 (class Output_data_const_buffer): Add map_name_ field. Update
13410 constructor. Change all callers. Add do_print_to_mapfile
13411 function.
13412 (class Output_data_fixed_space): Likewise.
13413 (class Output_data_space): Likewise.
13414 (class Output_data_zero_fill): New class.
13415 (Output_data_strtab::do_print_to_mapfile): New function.
13416 (Output_data_reloc_base::do_print_to_mapfile): New function.
13417 (Output_relocatable_relocs::do_print_to_mapfile): New function.
13418 (Output_data_group::do_print_to_mapfile): New function.
13419 (Output_data_got::do_print_to_mapfile): New function.
13420 (Output_data_dynamic::do_print_to_mapfile): New function.
13421 (Output_symtab_xindex::do_print_to_mapfile): New function.
13422 (class Output_section): Declare do_print_to_mapflie. Declare
13423 print_to_mapfile in Input_section.
13424 (class Output_segment): Declare new functions.
13425 * object.h (Sized_relobj::symbol_count): New function.
13426 * script-sections.cc
13427 (Output_section_element_dot_assignment::set_section_addresses):
13428 Change Output_data_fixed_space to Output_data_zero_fill.
13429 (Output_data_expression::do_print_to_mapfile): New function.
13430 * script.cc (read_input_script): Add mapfile parameter. Change
13431 all callers.
13432 * script.h (read_input_script): Update declaration.
13433 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13434 (Eh_frame::do_print_to_mapfile): New function.
13435 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13436 (Output_merge_string::do_print_to_mapfile): New function.
13437 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13438 function.
13439 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13440 function.
13441 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13442 function.
13443 * Makefile.am (CCFILES): Add mapfile.cc.
13444 (HFILES): Add mapfile.h.
13445 * Makefile.in: Rebuild.
13446
13447 2008-05-19 Ian Lance Taylor <iant@google.com>
13448
13449 * options.h (class General_options): Add -z relro.
13450 * layout.cc (Layout::Layout): Initialize relro_segment_.
13451 (Layout::add_output_section_data): Return the output section.
13452 (Layout::make_output_section): Rcognize relro sections and mark
13453 them appropriately.
13454 (Layout::attach_allocated_section_to_segment): Put relro sections
13455 in a PT_GNU_RELRO segment.
13456 (Layout::create_initial_dynamic_sections): Mark the .dynamic
13457 section as relro.
13458 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13459 PT_TLS segments.
13460 (Layout::linkonce_mapping): Map d.rel.ro.local to
13461 .data.rel.ro.local.
13462 (Layout::output_section_name): Us .data.rel.ro.local for any
13463 section which begins with that.
13464 * layout.h (class Layout): Update add_output_section_data
13465 declaration. Add relro_segment_ field.
13466 * output.cc (Output_section::Output_section): Initialize is_relro_
13467 and is_relro_local_ fields.
13468 (Output_segment::add_output_section): Group relro sections.
13469 (Output_segment::is_first_section_relro): New function.
13470 (Output_segment::maximum_alignment): If there is a relro section,
13471 align the segment to the common page size.
13472 (Output_segment::set_section_addresses): Track whether we are
13473 looking at relro sections. If the last section is a relro
13474 section, align to the common page size.
13475 (Output_segment::set_section_list_addresses): Add in_relro
13476 parameter. Change all callers. Align to the page size when
13477 moving from relro to non-relro section.
13478 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13479 segment.
13480 * output.h (class Output_section): Add is_relro_ and
13481 is_relro_local_ fields.
13482 (Output_section::is_relro): New function.
13483 (Output_section::set_is_relro): New function.
13484 (Output_section::is_relro_local): New function.
13485 (Output_section::set_is_relro_local): New function.
13486 (class Output_segment): Update declarations.
13487 * i386.cc (Target_i386::got_section): Mark .got section as relro.
13488 * sparc.cc (Target_sparc::got_section): Likewise.
13489 * x86_64.cc (Target_x86_64::got_section): Likewise.
13490 * testsuite/relro_test_main.cc: New file.
13491 * testsuite/relro_test.cc: New file.
13492 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13493 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13494 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13495 (relro_test.so, relro_test_pic.o): New targets.
13496 * testsuite/Makefile.in: Rebuild.
13497
13498 2008-05-16 Ian Lance Taylor <iant@google.com>
13499
13500 * output.cc (Output_segment::add_output_section): Remove front
13501 parameter.
13502 * output.h (class Output_segment): Remove
13503 add_initial_output_section and overloaded add_output_section.
13504 Update declaration of remaining add_output_section.
13505 * layout.cc (Layout::create_interp): Call add_output_section
13506 rather than add_initial_output_section.
13507 (Layout::finish_dynamic_section): Likewise.
13508
13509 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13510 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
13511 know the dynamic type.
13512 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13513 field. Initialize it in constructor.
13514 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13515 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13516 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13517 reloc.
13518
13519 * output.cc (Output_reloc::get_address): Change return type to
13520 Elf_Addr.
13521 * output.h (class Output_reloc): Update get_address declaration.
13522 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13523 for section addresses.
13524
13525 2008-05-09 Ian Lance Taylor <iant@google.com>
13526
13527 PR 6493
13528 * gold.cc (gold_nomem): Use return value of write.
13529
13530 2008-05-08 Ian Lance Taylor <iant@google.com>
13531
13532 * symtab.c (Symbol::init_base_output_data): Add version
13533 parameter. Change all callers.
13534 (Symbol::init_base_output_segment): Likewise.
13535 (Symbol::init_base_constant): Likewise.
13536 (Symbol::init_base_undefined): Likewise.
13537 (Sized_symbol::init_output_data): Likewise.
13538 (Sized_symbol::init_output_segment): Likewise.
13539 (Sized_symbol::init_constant): Likewise.
13540 (Sized_symbol::init_undefined): Likewise.
13541 (Symbol_table::do_define_in_output_data): If the new symbol has a
13542 version, mark it as the default.
13543 (Symbol_table::do_define_in_output_segment): Likewise.
13544 (Symbol_table::do_define_as_constant): Likewise.
13545 * symtab.h (class Symbol): Update declarations.
13546 (class Sized_symbol): Likewise.
13547 * resolve.cc (Symbol::override_version): New function.
13548 (Symbol::override_base): Call override_version.
13549 (Symbol::override_base_with_special): Likewise.
13550 * testsuite/ver_script_8.script: New file.
13551 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13552 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13553 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13554 (ver_test_8_1.so, ver_test_8_2.so): New targets.
13555
13556 2008-05-06 Ian Lance Taylor <iant@google.com>
13557
13558 PR 6049
13559 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13560 functions.
13561 (class General_options): Remove existing --undefined, and add
13562 --no-undefined instead. Add new --undefined as synonym for -u.
13563 * archive.cc (Archive::add_symbols): Check whether symbol was
13564 named with -u.
13565 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13566 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13567 all uses. Add IS_UNDEFINED. Update declarations to split
13568 different versions of init_base. Declare init_base_undefined.
13569 (Symbol::is_defined): Handle IS_UNDEFINED.
13570 (Symbol::is_undefined): Likewise.
13571 (Symbol::is_weak_undefined): Call is_undefined.
13572 (Symbol::is_absolute): Handle IS_CONSTANT.
13573 (class Sized_symbol): Update declarations to split different
13574 versions of init. Declare init_undefined.
13575 (class Symbol_table): Declare new functions.
13576 * symtab.cc (Symbol::init_base_object): Rename from init_base.
13577 Change all callers.
13578 (Symbol::init_base_output_data): Likewise.
13579 (Symbol::init_base_output_segment): Likewise.
13580 (Symbol::init_base_constant): Likewise.
13581 (Symbol::init_base_undefined): New function.
13582 (Sized_symbol::init_object): Rename from init. Change all
13583 callers.
13584 (Sized_symbol::init_output_data): Likewise.
13585 (Sized_symbol::init_output_segment): Likewise.
13586 (Sized_symbol::init_constant): Likewise.
13587 (Sized_symbol::init_undefined): New function.
13588 (Symbol_table::add_undefined_symbols_from_command_line): New
13589 function.
13590 (Symbol_table::do_add_undefined_symbols_from_command_line): New
13591 function.
13592 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13593 (Symbol::output_section): Likewise.
13594 (Symbol::set_output_section): Likewise.
13595 (Symbol_table::sized_finalize_symbol): Likewise.
13596 (Symbol_table::sized_write_globals): Likewise.
13597 * resolve.cc (Symbol_table::should_override): Likewise.
13598 (Symbol::override_base_with_special): Likewise.
13599
13600 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13601 symbol, change it to have default visibility.
13602 * testsuite/protected_1.cc: New file.
13603 * testsuite/protected_2.cc: New file.
13604 * testsuite/protected_3.cc: New file.
13605 * testsuite/protected_main_1.cc: New file.
13606 * testsuite/protected_main_2.cc: New file.
13607 * testsuite/protected_main_3.cc: New file.
13608 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13609 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13610 (protected_1_LDFLAGS, protected_1_LDADD): Define.
13611 (protected_1.so): New target.
13612 (protected_1_pic.o, protected_2_pic.o): New targets.
13613 (protected_3_pic.o): New target.
13614 (check_PROGRAMS): Add protected_2.
13615 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13616 (protected_2_LDFLAGS, protected_2_LDADD): Define.
13617 * testsuite/Makefile.in: Rebuild.
13618
13619 * options.h (DEFINE_var): Add set_user_set_##varname__.
13620 (DEFINE_bool_alias): New macro.
13621 (class General_options): Define -Bstatic using DEFINE_bool_alias
13622 rather than DEFINE_special. Add --undefined as an alias for -z
13623 defs.
13624 * options.cc (General_options::parse_Bstatic): Remove.
13625
13626 * options.h (class General_options): Add --fatal-warnings.
13627 * main.cc (main): Implement --fatal-warnings.
13628 * errors.h (Errors::warning_count): New function.
13629
13630 * options.h (class General_options): Add -Bsymbolic-functions.
13631 * symtab.h (Symbol::is_preemptible): Check for
13632 -Bsymbolic-functions.
13633
13634 2008-05-05 Ian Lance Taylor <iant@google.com>
13635
13636 * options.h (DEFINE_bool): For DASH_Z, create the negative option
13637 as noVARNAME rather than no-VARNAME.
13638 (class General_options): Add option -z combreloc.
13639 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13640 get_address.
13641 (Output_reloc::sort_before) [SHT_REL]: New function.
13642 (Output_reloc::sort_before) [SHT_RELA]: New function.
13643 (class Output_data_reloc_base): Add sort_relocs_ field. Define
13644 Sort_relocs_comparison.
13645 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13646 parameter. Change all callers.
13647 (Output_data_reloc::Output_data_reloc) [both versions]: Add
13648 sort_relocs parameter. Change all callers.
13649 * output.cc (Output_reloc::get_address): New function, broken out
13650 of write_rel.
13651 (Output_reloc::write_rel): Call it.
13652 (Output_reloc::compare): New function.
13653 (Output_data_reloc_base::do_write): Optionally sort relocs.
13654
13655 * configure.ac: If targ_extra_obj is set, link it in.
13656 * configure.tgt: Initialize all variables.
13657 (x86_64*): Set targ_extra_obj and targ_extra_size.
13658 * configure: Rebuild.
13659
13660 * object.cc (Sized_relobj::include_section_group): Adjust section
13661 indexes read from group data. Build vector to pass to
13662 layout_group.
13663 * layout.cc (Layout::layout_group): Add flags and shndxes
13664 parameters. Remove contents parameter. Change caller. Update
13665 explicit instantiations.
13666 * layout.h (class Layout): Update layout_group declaration.
13667 * output.cc (Output_data_group::Output_data_group): Add flags and
13668 input_shndxes parameters. Remove contents parameter. Change
13669 caller.
13670 (Output_data_group::do_write): Change input_sections_ to
13671 input_shndxes_.
13672 * output.h (class Output_data_group): Update constructor
13673 declaration. Rename input_sections_ to input_shndxes_.
13674 * testsuite/many_sections_test.cc: Add template.
13675
13676 2008-04-30 Cary Coutant <ccoutant@google.com>
13677
13678 * target-reloc.h (relocate_section): Fix dead-pointer bug.
13679
13680 * layout.cc (Layout::include_section): Refactored check for debug
13681 info section.
13682 (Layout::add_comdat): Add new parameters. Change type
13683 of signature parameter. Add object and shndx to signatures table.
13684 (Layout::find_kept_object): New function.
13685 * layout.h: Include <cstring>.
13686 (Layout::is_debug_info_section): New function.
13687 (Layout::add_comdat): Add new parameters.
13688 (Layout::find_kept_object): New function.
13689 (Layout::Kept_section): New struct.
13690 (Layout::Signatures): Change type of map range.
13691 * object.cc (Relobj::output_section_address): New function.
13692 (Sized_relobj::include_section_group): Add new parameters. Change
13693 calls to Layout::add_comdat. Change to build table of kept comdat
13694 groups and table mapping discarded sections to kept sections.
13695 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
13696 (Sized_relobj::do_layout): Change calls to include_section_group and
13697 include_linkonce_section.
13698 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13699 value to zero when section is discarded.
13700 (Sized_relobj::map_to_kept_section): New function.
13701 * object.h (Relobj::output_section_address): New function.
13702 (Relobj::Comdat_group): New type.
13703 (Relobj::find_comdat_group): New function.
13704 (Relobj::Comdat_group_table): New type.
13705 (Relobj::Kept_comdat_section): New type.
13706 (Relobj::Kept_comdat_section_table): New type.
13707 (Relobj::add_comdat_group): New function.
13708 (Relobj::set_kept_comdat_section): New function.
13709 (Relobj::get_kept_comdat_section): New function.
13710 (Relobj::comdat_groups_): New field.
13711 (Relobj::kept_comdat_sections_): New field.
13712 (Symbol_value::input_value): Update comment.
13713 (Sized_relobj::map_to_kept_section) New function.
13714 (Sized_relobj::include_linkonce_section): Add new parameter.
13715 * target-reloc.h (Comdat_behavior): New type.
13716 (get_comdat_behavior): New function.
13717 (relocate_section): Add code to map a discarded section to the
13718 corresponding kept section when applying a relocation.
13719
13720 2008-04-30 Craig Silverstein <csilvers@google.com>
13721
13722 * dwarf_reader.cc (next_generation_count): New static var.
13723 (Addr2line_cache_entry): New struct.
13724 (addr2line_cache): New static var.
13725 (Dwarf_line_info::one_addr2line): Added caching.
13726 (Dwarf_line_info::clear_addr2line_cache): New function.
13727 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13728 cache-size parameter.
13729 (Dwarf_line_info::one_addr2line_cache): New function.
13730 * symtab.cc (Symbol_table::detect_odr_violations): Pass
13731 new cache-size argument to one_addr2line(), and clear cache.
13732
13733 2008-04-28 Cary Coutant <ccoutant@google.com>
13734
13735 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13736 R_386_PC8 relocations.
13737
13738 2008-04-23 Ian Lance Taylor <iant@google.com>
13739
13740 * object.cc (Sized_relobj::include_section_group): Check for
13741 invalid section group.
13742
13743 * object.cc (make_elf_object): Correct test for 64-bit ELF file
13744 header size.
13745
13746 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13747 than read for file header.
13748 * archive.cc (Archive::include_member): Likewise.
13749
13750 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
13751
13752 * aclocal.m4: Regenerate.
13753 * configure: Regenerate.
13754
13755 2008-04-19 Ian Lance Taylor <iant@google.com>
13756
13757 * version.cc (version_string): Bump to 1.6.
13758
13759 * testsuite/Makefile.am (many_sections_r_test): New target.
13760 (many_sections_r_test_SOURCES): Remove.
13761 (many_sections_r_test_DEPENDENCIES): Remove.
13762 (many_sections_r_test_LDFLAGS): Remove.
13763 (many_sections_r_test_LDADD): Remove.
13764
13765 * object.cc (Sized_relobj::do_add_symbols): Always pass
13766 local_symbol_count_ to add_from_relobj.
13767
13768 * testsuite/Makefile.am (many_sections_check.h): Only check one in
13769 every thousand variables.
13770 * testsuite/Makefile.in: Rebuild.
13771
13772 * object.cc (Xindex::initialize_symtab_xindex): New function.
13773 (Xindex::read_symtab_xindex): New function.
13774 (Xindex::sym_xindex_to_shndx): New function.
13775 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13776 available.
13777 (Sized_relobj::do_initialize_xindex): New function.
13778 (Sized_relobj::do_read_symbols): Adjust section links.
13779 (Sized_relobj::symbol_section_and_value): Add is_ordinary
13780 parameter. Change all callers.
13781 (Sized_relobj::include_section_group): Adjust section links and
13782 symbol section indexes.
13783 (Sized_relobj::do_layout): Adjust section links.
13784 (Sized_relobj::do_count_local_symbols): Adjust section links and
13785 symbol section indexes.
13786 (Sized_relobj::do_finalize_local_symbols): Distinguish between
13787 ordinary and special symbols.
13788 (Sized_relobj::write_local_symbols): Add symtab_xindex and
13789 dynsym_xindex parameters. Change all callers. Adjust section
13790 links. Use SHN_XINDEX when needed.
13791 (Sized_relobj::get_symbol_location_info): Adjust section links.
13792 Don't get fooled by special symbols.
13793 * object.h (class Xindex): Define.
13794 (class Object): Add xindex_ parameter. Declare virtual functoin
13795 do_initialize_xindex.
13796 (Object::adjust_sym_shndx): New function.
13797 (Object::set_xindex): New protected function.
13798 (class Symbol_value): Add is_ordinary_shndx_ field.
13799 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13800 (Symbol_value::value): Assert ordinary section.
13801 (Symbol_value::initialize_input_to_output_map): Likewise.
13802 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13803 Change all callers.
13804 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
13805 all callers.
13806 (class Sized_relobj): Update declarations.
13807 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13808 parameter. Change all callers.
13809 (Sized_relobj::adjust_shndx): New function.
13810 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13811 field.
13812 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13813 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
13814 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
13815 (Sized_dynobj::read_dynsym_section): Adjust section links.
13816 (Sized_dynobj::read_dynamic): Likewise.
13817 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
13818 section links.
13819 (Sized_dynobj::do_initialize_xindex): New function.
13820 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
13821 do_initialize_xindex.
13822 (Sized_dynobj::adjust_shndx): New function.
13823 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13824 dynsym_xindex_ fields.
13825 (Layout::finalize): Add a call to set_section_indexes before
13826 creating the symtab sections.
13827 (Layout::set_section_indexes): Don't do anything if the section
13828 already has a section index.
13829 (Layout::create_symtab_sections): Add shnum parameter. Change
13830 caller. Create .symtab_shndx section if needed.
13831 (Layout::create_shdrs): Add shstrtab_section parameter. Change
13832 caller.
13833 (Layout::allocated_output_section_count): New function.
13834 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13835 needed.
13836 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13837 fields. Update declarations.
13838 (Layout::symtab_xindex): New function.
13839 (Layout::dynsym_xindex): New function.
13840 (class Write_symbols_task): Add layout_ field.
13841 (Write_symbols_task::Write_symbols_task): Add layout parameter.
13842 Change caller.
13843 * output.cc (Output_section_headers::Output_section_headers): Add
13844 shstrtab_section parameter. Change all callers.
13845 (Output_section_headers::do_sized_write): Store overflow values
13846 for section count and section string table section index in
13847 section header zero.
13848 (Output_file_header::do_sized_write): Check for overflow of
13849 section count and section string table section index.
13850 (Output_symtab_xindex::do_write): New function.
13851 (Output_symtab_xindex::endian_do_write): New function.
13852 * output.h (class Output_section_headers): Add shstrtab_section_.
13853 Update declarations.
13854 (class Output_symtab_xindex): Define.
13855 (Output_section::has_out_shndx): New function.
13856 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13857 field.
13858 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13859 Change all callers.
13860 (Sized_symbol::init): Likewise.
13861 (Symbol::output_section): Check for ordinary symbol.
13862 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
13863 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
13864 callers.
13865 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13866 Change all callers. Simplify handling of symbols from sections
13867 not included in the link.
13868 (Symbol_table::add_from_dynobj): Handle ordinary symbol
13869 distinction.
13870 (Weak_alias_sorter::operator()): Assert that symbols are
13871 ordinary.
13872 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13873 distinction.
13874 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13875 parameters. Change all callers.
13876 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
13877 symbol distinction. Use SHN_XINDEX when needed.
13878 (Symbol_table::write_section_symbol): Add symtab_xindex
13879 parameter. Change all callers.
13880 (Symbol_table::sized_write_section_symbol): Likewise. Use
13881 SHN_XINDEX when needed.
13882 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
13883 declarations.
13884 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
13885 (Symbol::is_defined): Check is_ordinary.
13886 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13887 (Symbol::is_absolute, Symbol::is_common): Likewise.
13888 (class Sized_symbol): Update declarations.
13889 (class Symbol_table): Update declarations.
13890 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13891 parameters. Change all callers.
13892 (Sized_symbol::override): Likewise.
13893 (Symbol_table::override): Likewise.
13894 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
13895 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
13896 is_ordinary, and orig_st_shndx parameters. Change all callers.
13897 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13898 to be in an ordinary section.
13899 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13900 object and is_ordinary parameters. Change all callers.
13901 (Sized_dwarf_line_info::read_relocs): Add object parameter.
13902 Change all callers. Don't add undefined or non-ordinary symbols
13903 to reloc_map_.
13904 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13905 Change all callers.
13906 * dwarf_reader.h (class Sized_dwarf_line_info): Update
13907 declarations.
13908 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13909 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13910 (Sized_relobj::relocate_sections): Likewise.
13911 * target-reloc.h (scan_relocs): Adjust section symbol index.
13912 (scan_relocatable_relocs): Likewise.
13913 * i386.cc (Scan::local): Check for ordinary symbols.
13914 * sparc.cc (Scan::local): Likewise.
13915 * x86_64.cc (Scan::local): Likewise.
13916 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13917 to symbol_section_and_value.
13918 * testsuite/many_sections_test.cc: New file.
13919 * testsuite/Makefile.am (BUILT_SOURCES): Define.
13920 (check_PROGRAMS): Add many_sections_test.
13921 (many_sections_test_SOURCES): Define.
13922 (many_sections_test_DEPENDENCIES): Define.
13923 (many_sections_test_LDFLAGS): Define.
13924 (BUILT_SOURCES): Add many_sections_define.h.
13925 (many_sections_define.h): New target.
13926 (BUILT_SOURCES): Add many_sections_check.h.
13927 (many_sections_check.h): New target.
13928 (check_PROGRAMS): Add many_sections_r_test.
13929 (many_sections_r_test_SOURCES): Define.
13930 (many_sections_r_test_DEPENDENCIES): Define.
13931 (many_sections_r_test_LDFLAGS): Define.
13932 (many_sections_r_test_LDADD): Define.
13933 (many_sections_r_test.o): New target.
13934 * testsuite/Makefile.in: Rebuild.
13935
13936 2008-04-17 Cary Coutant <ccoutant@google.com>
13937
13938 * errors.cc (Errors::info): New function.
13939 (gold_info): New function.
13940 * errors.h (Errors::info): New function.
13941 * gold.h (gold_info): New function.
13942 * object.cc (Input_objects::add_object): Print trace output.
13943 * options.cc (options::parse_set): New function.
13944 (General_options::parse_wrap): Deleted.
13945 (General_options::General_options): Deleted initializer.
13946 * options.h (options::String_set): New typedef.
13947 (options::parse_set): New function.
13948 (DEFINE_set): New macro.
13949 (General_options::wrap): Changed to use DEFINE_set. Changed
13950 callers of any_wrap_symbols and is_wrap_symbol.
13951 (General_options::trace, General_options::trace_symbol):
13952 New options.
13953 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13954 (General_options::wrap_symbols_): Deleted.
13955 * symtab.cc (Symbol_table::add_from_object): Print trace output.
13956
13957 2008-04-17 David S. Miller <davem@davemloft.net>
13958
13959 * options.cc (General_options::parse_V): New function.
13960 * options.h: Add entries for -V and -Qy.
13961
13962 2008-04-17 Ian Lance Taylor <iant@google.com>
13963
13964 * common.cc (Symbol_table::allocate_commons): Remove options
13965 parameter. Change caller.
13966 (Symbol_table::do_allocate_commons): Remove options parameter.
13967 Change caller. Just call do_allocate_commons_list twice.
13968 (Symbol_table::do_allocate_commons_list): New function, broken out
13969 of do_allocate_commons.
13970 * common.h (class Allocate_commons_task): Remove options_ field.
13971 Update constructor.
13972 * symtab.cc (Symbol_table::Symbol_table): Initialize
13973 tls_commons_.
13974 (Symbol_table::add_from_object): Put TLS common symbols on
13975 tls_commons_ list.
13976 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13977 which are IN_OUTPUT_DATA.
13978 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
13979 allocate_commons and do_allocate_commons declarations. Declare
13980 do_allocate_commons_list.
13981 * gold.cc (queue_middle_tasks): Update creation of
13982 Allocate_commons_task to not pass options.
13983 * testsuite/Makefile.am (INCLUDES): Add -I.. .
13984 (TLS_TEST_C_FLAGS): New variable.
13985 (tls_test_c_pic.o): New target.
13986 (tls_test_shared.so): Link in tls_test_c_pic.o.
13987 (tls_test_c_pic_ie.o): New target.
13988 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13989 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13990 (tls_test_c.o): New target.
13991 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13992 (tls_pic_test_LDADD): Likewise.
13993 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13994 (tls_shared_gd_to_ie_test_LDADD): Likewise.
13995 (tls_test_c_gnu2.o): New target.
13996 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13997 tls_test_c_gnu2.o.
13998 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13999 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14000 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14001 * testsuite/tls_test.cc: Include "config.h".
14002 (t_last): Call t11_last.
14003 * testsuite/tls_test.h (t11, t11_last): Declare.
14004 * testsuite/tls_test_c.c: New file.
14005 * testsuite/tls_test_main.cc (thread_routine): Call t11.
14006 * configure.ac: Check for OpenMP support.
14007 * configure, config.in, Makefile.in: Rebuild.
14008 * testsuite/Makefile.in: Rebuild.
14009
14010 2008-04-16 Cary Coutant <ccoutant@google.com>
14011
14012 * i386.cc (Target_i386::define_tls_base_symbol): New function.
14013 (Target_i386::tls_base_symbol_defined_): New field.
14014 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14015 (Target_i386::Scan::global): Likewise.
14016 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14017 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14018 (Target_x86_64::tls_base_symbol_defined_): New field.
14019 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14020 (Target_x86_64::Scan::global): Likewise.
14021
14022 2008-04-16 Cary Coutant <ccoutant@google.com>
14023
14024 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14025 (Symbol::needs_plt_entry): Allow weak undefined symbols.
14026 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14027 building shared libraries.
14028 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14029 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14030 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14031 * testsuite/Makefile.in: Rebuild.
14032 * testsuite/weak_undef.h: New file.
14033 * testsuite/weak_undef_file1.cc: Add extra test cases.
14034 * testsuite/weak_undef_file2.cc: Likewise.
14035 * testsuite/weak_undef_test.cc: Likewise.
14036
14037 2008-04-16 David S. Miller <davem@davemloft.net>
14038
14039 * sparc.cc (Target_sparc::Scan): Change from struct to class.
14040 Add issued_non_pic_error_ field. Declare check_non_pic.
14041 (Target_sparc::Scan::check_non_pic): New function.
14042 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14043 (Target_sparc::Scan::global): Likewise.
14044
14045 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14046 * configure: Rebuild.
14047
14048 * options.h (DEFINE_enable): New macro.
14049 (new_dtags): New enable option.
14050 (initfirst, interpose, loadfltr, nodefaultlib,
14051 nodelete, nodlopen, nodump): New -z options.
14052 * layout.cc (Layout:finish_dynamic_section): If new
14053 dtags enabled, emit DT_RUNPATH. Also, emit a
14054 DT_FLAGS_1 containing any specified -z flags.
14055
14056 2008-04-16 Ian Lance Taylor <iant@google.com>
14057
14058 * copy-relocs.cc: New file.
14059 * copy-relocs.h: New file.
14060 * reloc.cc: Remove Copy_relocs code.
14061 * reloc.h: Likewise.
14062 * reloc-types.h (struct Reloc_types) [both versions]: Add
14063 get_reloc_addend_noerror.
14064 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14065 variants of add_global which take an addend which must be zero.
14066 * i386.cc: Include "copy-relocs.h".
14067 (class Target_i386): Change type of copy_relocs_ to variable,
14068 update initializer.
14069 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14070 Change all callers.
14071 (Target_i386::do_finalize_sections): Change handling of
14072 copy_relocs_.
14073 * sparc.cc: Include "copy-relocs.h".
14074 (class Target_sparc): Change type of copy_relocs_ to variable,
14075 update initializer.
14076 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14077 Change all callers.
14078 (Target_sparc::do_finalize_sections): Change handling of
14079 copy_relocs_.
14080 * x86_64.cc: Include "copy-relocs.h".
14081 (class Target_x86_64): Change type of copy_relocs_ to variable,
14082 update initializer.
14083 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14084 class. Change all callers.
14085 (Target_x86_64::do_finalize_sections): Change handling of
14086 copy_relocs_.
14087 * Makefile.am (CCFILES): Add copy-relocs.cc.
14088 (HFILES): Add copy-relocs.h.
14089
14090 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14091
14092 * testsuite/script_test_4.sh: Permit leading zeroes.
14093
14094 2008-04-15 Ian Lance Taylor <iant@google.com>
14095
14096 * script-sections.cc (Script_sections::create_segments): Use
14097 header_size_adjustment even when there is enough room for the
14098 headers.
14099 * testsuite/script_test_4.sh: New file.
14100 * testsuite/script_test_4.t: New file.
14101 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14102 (check_DATA): Add script_test_4.stdout.
14103 (MOSTLYCLEANFILES): Likewise.
14104 (script_test_4): New target.
14105 (script_test_4.stdout): New target.
14106 * testsuite/Makefile.in: Rebuild.
14107
14108 * sparc.cc: Add definitions for Output_data_plt_sparc class
14109 constants.
14110
14111 2008-04-14 David S. Miller <davem@davemloft.net>
14112
14113 * sparc.cc: New file.
14114 * Makefile.am (TARGETSOURCES): Add sparc.cc
14115 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14116 * configure.tgt: Document targ_extra_size and
14117 targ_extra_big_endian. Add entries for sparc-* and
14118 sparc64-*.
14119 * configure.ac: Handle targ_extra_size and
14120 targ_extra_big_endian.
14121 * Makefile.in: Rebuild.
14122 * configure: Likewise.
14123 * po/POTFILES.in: Likewise.
14124 * po/gold.pot: Likewise.
14125
14126 2008-04-14 Ian Lance Taylor <iant@google.com>
14127
14128 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14129 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14130 in the name/type/flags to section mapping. Don't call
14131 allocate_output_section.
14132 (Layout::choose_output_section): Change parameter from adjust_name
14133 to is_input_section. Don't permit input sections after sections
14134 are attached to segments. Don't call allocate_output_section.
14135 (Layout::layout_eh_frame): Call update_flags_for_input_section,
14136 not write_enable_output_section.
14137 (Layout::make_output_section): Don't push to
14138 unattached_section_list_ nor call attach_to_segment. Call
14139 attach_section_to_segment if sections are attached.
14140 (Layout::attach_sections_to_segments): New function.
14141 (Layout::attach_section_to_segment): New function.
14142 (Layout::attach_allocated_section_to_segment): Rename from
14143 attach_to_segment. Remove flags parameter.
14144 (Layout::allocate_output_section): Remove function.
14145 (Layout::write_enable_output_section): Remove function.
14146 * layout.h (class Layout): Update for above changes. Add new
14147 field sections_are_attached_.
14148 * output.h (Output_section::update_flags_for_input_section): New
14149 function.
14150 * output.cc (Output_section::add_input_section): Call
14151 update_flags_for_input_section.
14152 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14153
14154 2008-04-11 Cary Coutant <ccoutant@google.com>
14155
14156 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14157 thought unnecessary.
14158 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14159
14160 2008-04-11 Ian Lance Taylor <iant@google.com>
14161
14162 * output.h (class Output_section_data): Remove inline definition
14163 of set_addralign.
14164 * output.cc (Output_section_data::set_addralign): New function.
14165
14166 2008-04-11 Cary Coutant <ccoutant@google.com>
14167
14168 Add support for TLS descriptors for i386 and x86_64.
14169 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14170 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14171 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14172 GOT_TYPE_TLS_DESC.
14173 (Target_i386::got_mod_index_entry): Remove unnecessary code.
14174 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14175 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
14176 relocations.
14177 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14178 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14179 Fix problem with initial-exec relocations.
14180 (Target_i386::Relocate::relocate_tls): Likewise.
14181 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14182 relaxation.
14183 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14184 support for section-plus-offset dynamic table entries.
14185 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14186 (Output_data_dynamic::Dynamic_entry): Add support for
14187 section-plus-offset dynamic table entries.
14188 (Output_data_dynamic::Classification): Likewise.
14189 (Output_data_dynamic::classification_): Renamed offset_.
14190 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14191 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14192 (Target_x86_64::make_plt_section): New function.
14193 (Target_x86_64::reserve_tlsdesc_entries): New function.
14194 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14195 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14196 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14197 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14198 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14199 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14200 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14201 add extra PLT entry for TLS descriptors.
14202 (Output_data_plt_x86_64::got_): New field.
14203 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14204 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14205 fields.
14206 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14207 descriptors.
14208 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14209 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14210 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14211 R_386_TLS_DESC_CALL relocations.
14212 (Target_x86_64::Scan::global): Likewise.
14213 (Target_x86_64::do_finalize_sections): Add dynamic table entries
14214 for TLS descriptors.
14215 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14216 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14217 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14218 GD-to-IE relaxation.
14219 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14220 and TLS_DESCRIPTORS.
14221 * Makefile.in: Rebuild.
14222 * configure: Rebuild.
14223 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14224 (tls_test_shared2.so): New target.
14225 (tls_shared_gd_to_ie_test_SOURCES): New variable.
14226 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14227 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14228 (tls_shared_gd_to_ie_test_LDADD): New variable.
14229 (tls_shared_gnu2_gd_to_ie_test): New target.
14230 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14231 New targets.
14232 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14233 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14234 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14235 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14236 (tls_shared_gnu2_test): New target.
14237 (tls_test_gnu2_shared.so): New target.
14238 (tls_shared_gnu2_test_SOURCES): New variable.
14239 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14240 (tls_shared_gnu2_test_LDFLAGS): New variable.
14241 (tls_shared_gnu2_test_LDADD): New variable.
14242 * testsuite/Makefile.in: Rebuild.
14243 * testsuite/Makefile.
14244
14245 2008-04-11 Ian Lance Taylor <iant@google.com>
14246
14247 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14248 justsyms.t.
14249 * testsuite/Makefile.in: Rebuild.
14250
14251 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14252 long.
14253 * testsuite/script_test_2.cc (main): Adjust test.
14254
14255 2008-04-11 David S. Miller <davem@davemloft.net>
14256 Ian Lance Taylor <iant@google.com>
14257
14258 * options.h (General_options): Add entries for '-Y' and
14259 '-relax'.
14260 * options.cc (General_options:finalize): If -Y was used, add those
14261 entries to the library path instead of the default "/lib" and
14262 "/usr/lib".
14263
14264 2008-04-11 David S. Miller <davem@davemloft.net>
14265
14266 * testsuite/justsyms.t: Start at 0x100.
14267 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14268 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14269 long.
14270 * testsuite/script_test_2.cc: Adjust string and section length
14271 checks.
14272
14273 2008-04-09 Ian Lance Taylor <iant@google.com>
14274
14275 PR gold/5996
14276 * script-sections.cc (Sections_element::allocate_to_segment): Add
14277 orphan parameter.
14278 (Output_section_definition::allocate_to_segment): Likewise.
14279 (Orphan_output_section::allocate_to_segment): Likewise.
14280 (Script_sections::attach_sections_using_phdrs_clause): Don't
14281 propagate non-PT_LOAD segments to orphan sections.
14282 * testsuite/Makefile.am (script_test_3.stdout): Generate using
14283 readelf rather than objdump.
14284 * testsuite/script_test_3.sh: Adjust accordingly. Test that
14285 .interp section and PT_INTERP segment are the same size.
14286 * testsuite/Makefile.in: Rebuild.
14287
14288 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14289 aliases for symbols defined in the same object.
14290 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14291 (weak_alias_test_SOURCES): New variable.
14292 (weak_alias_test_DEPENDENCIES): New variable.
14293 (weak_alias_test_LDFLAGS): New variable.
14294 (weak_alias_test_LDADD): New variable.
14295 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14296 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14297 (weak_alias_test_3.o): New target.
14298 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14299 * testsuite/weak_alias_test_main.cc: New file.
14300 * testsuite/weak_alias_test_1.cc: New file.
14301 * testsuite/weak_alias_test_2.cc: New file.
14302 * testsuite/weak_alias_test_3.cc: New file.
14303
14304 2008-04-08 Ian Lance Taylor <iant@google.com>
14305
14306 * options.h (class General_options): Add --noinhibit-exec option.
14307 * main.cc (main): Check --noinhibit-exec.
14308
14309 * options.h (class General_options): Define --wrap as a special
14310 option. Add wrap_symbols_ field.
14311 (General_options::any_wrap_symbols): New function.
14312 (General_options::is_wrap_symbol): New function.
14313 * options.cc (General_options::parse_wrap): New function.
14314 (General_options::General_options): Initialize wrap_symbols_.
14315 * symtab.cc (Symbol_table::wrap_symbol): New function.
14316 (Symbol_table::add_from_object): Handle --wrap.
14317 * symtab.h (class Symbol_table): Declare wrap_symbol.
14318 * target.h (Target::wrap_char): New function.
14319 (Target::Target_info): Add wrap_char field.
14320 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14321 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14322 * testsuite/testfile.cc (Target_test::test_target_info):
14323 Likewise.
14324
14325 * errors.cc (Errors::undefined_symbol): Mention symbol version if
14326 there is one.
14327
14328 * layout.h (class Layout): Add added_eh_frame_data_ field.
14329 * layout.cc (Layout::Layout): Initialize new field.
14330 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14331 output section until we find a section we merged successfully.
14332 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14333 that the size be non-zero.
14334
14335 * merge.cc (Object_merge_map::get_output_offset): Remove inline
14336 qualifier.
14337
14338 2008-04-08 Craig Silverstein <csilvers@google.com>
14339
14340 * configure.ac: Export new conditional variable HAVE_ZLIB.
14341 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14342 on HAVE_ZLIB.
14343 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14344 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14345
14346 2008-04-07 Ian Lance Taylor <iant@google.com>
14347
14348 * version.cc (version_string): Set to "1.5".
14349
14350 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14351 Add issued_non_pic_error_ field. Declare check_non_pic.
14352 (Target_x86_64::Scan::check_non_pic): New function.
14353 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14354 (Target_x86_64::Scan::global): Likewise.
14355
14356 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14357 addend parameter. Change caller. Handle merge sections.
14358 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14359 Address to Addend. Don't add in the result of
14360 local_section_offset, pass down the addend and use the returned
14361 value.
14362 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14363 Update declarations of local_section_offset and symbol_value.
14364 * testsuite/two_file_test_1.cc (t18): New function.
14365 * testsuite/two_file_test_2.cc (f18): New function.
14366 * testsuite/two_file_test_main.cc (main): Call t18.
14367 * testsuite/two_file_test.h (t18, f18): Declare.
14368
14369 * configure.ac: Don't test for objdump, c++filt, or readelf.
14370 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14371 conditionals.
14372 (TEST_READELF): New variable.
14373 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14374 (check_PROGRAMS): Add two_file_strip_test.
14375 (two_file_strip_test): New target.
14376 (check_PROGRAMS): Add two_file_same_shared_strip_test.
14377 (two_file_same_shared_strip_test_SOURCES): New variable.
14378 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14379 (two_file_same_shared_strip_test_LDFLAGS): New variable.
14380 (two_file_same_shared_strip_test_LDADD): New variable.
14381 (two_file_shared_strip.so): New target.
14382 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14383 (ver_test_5.syms, ver_test_7.syms): Likewise.
14384 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14385 (strip_test_3.stdout): Use TEST_OBJDUMP.
14386 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14387
14388 2008-04-04 Cary Coutant <ccoutant@google.com>
14389
14390 * symtab.h (Symbol::is_weak_undefined): New function.
14391 (Symbol::is_strong_undefined): New function.
14392 (Symbol::is_absolute): New function.
14393 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14394 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14395 absolute symbols.
14396 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14397 (weak_undef_test): New target.
14398 * testsuite/Makefile.in: Rebuild.
14399 * testsuite/weak_undef_file1.cc: New file.
14400 * testsuite/weak_undef_file2.cc: New file.
14401 * testsuite/weak_undef_test.cc: New file.
14402
14403 2008-04-03 Craig Silverstein <csilvers@google.com>
14404
14405 * compressed_output.h (class Output_compressed_section): Use
14406 unsigned buffer.
14407 * compressed_output.cc (zlib_compress): Use unsigned buffers,
14408 add zlib header.
14409 (zlib_compressed_suffix): Removed.
14410 (Output_compressed_section::set_final_data_size): Use unsigned
14411 buffers.
14412 * testsuite/Makefile.am (flagstest_compress_debug_sections):
14413 Fix linker invocation.
14414 (flagstest_o_specialfile_and_compress_debug_sections):
14415 Likewise.
14416 * testsuite/Makefile.in: Regenerated.
14417
14418 2008-04-02 David S. Miller <davem@davemloft.net>
14419
14420 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14421 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14422
14423 2008-04-02 Craig Silverstein <csilvers@google.com>
14424
14425 * TODO: New file.
14426
14427 2008-04-02 Ian Lance Taylor <iant@google.com>
14428
14429 * fileread.cc (File_read::find_view): Add byteshift and vshifted
14430 parameters. Update for new key type to views_. Change all
14431 callers.
14432 (File_read::read): Adjust for byteshift in returned view.
14433 (File_read::add_view): New function, broken out of
14434 find_and_make_view.
14435 (File_read::make_view): New function, broken out of
14436 find_and_make_view.
14437 (File_read::find_or_make_view): Add offset and aligned
14438 parameters. Rewrite accordingly. Change all callers.
14439 (File_read::get_view): Add offset and aligned parameters. Adjust
14440 for byteshift in return value.
14441 (File_read::get_lasting_view): Likewise.
14442 * fileread.h (class File_read): Update declarations.
14443 (class File_read::View): Add byteshift_ field. Add byteshift to
14444 constructor. Add byteshift method.
14445 * archive.h (Archive::clear_uncached_views): New function.
14446 (Archive::get_view): Add aligned parameter. Change all callers.
14447 * object.h (Object::get_view): Add aligned parameter. Change all
14448 callers.
14449 (Object::get_lasting_view): Likewise.
14450
14451 * fileread.cc (File_read::release): Don't call clear_views if
14452 there are multiple objects.
14453 * fileread.h (File_read::clear_uncached_views): New function.
14454 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14455 on the archive.
14456
14457 2008-03-31 Cary Coutant <ccoutant@google.com>
14458
14459 Add thin archive support.
14460 * archive.cc (Archive::armagt): New const.
14461 (Archive::setup): Remove task parameter and calls to unlock.
14462 (Archive::unlock_nested_archives): New function.
14463 (Archive::read_header): Add nested_off parameter. Change
14464 all callers.
14465 (Archive::interpret_header): Likewise.
14466 (Archive::include_all_members): Change to handle thin
14467 archives.
14468 (Archive::include_member): Likewise.
14469 * archive.h (Archive::Archive): Add new parameters and
14470 initializers.
14471 (Archive::armagt): New const.
14472 (Archive::setup): Remove task parameter.
14473 (Archive::unlock_nested_archives): New function.
14474 (Archive::read_header): Add nested_off parameter.
14475 (Archive::interpret_header): Likewise.
14476 (Archive::Nested_archive_table): New typedef.
14477 (Archive::is_thin_archive_): New field.
14478 (Archive::nested_archives_): New field.
14479 (Archive::options_): New field.
14480 (Archive::dirpath_): New field.
14481 (Archive::task_): New field.
14482 * readsyms.cc (Read_symbols::do_read_symbols): Add check
14483 for thin archives. Pass additional parameters to
14484 Archive::Archive. Unlock the archive file after calling
14485 Archive::setup.
14486
14487 2008-03-29 Ian Lance Taylor <iant@google.com>
14488
14489 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14490 version symbol to be local.
14491 * testsuite/ver_test_4.sh: New file.
14492 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14493 (check_DATA): Add ver_test_4.syms.
14494 (ver_test_4.syms): New target.
14495 * testsuite/Makefile.in: Rebuild.
14496
14497 * output.cc
14498 (Output_section::Input_section_sort_entry::has_priority): New
14499 function.
14500 (Output_section::Input_section_sort_entry::match_file_name): New
14501 function.
14502 (Output_section::Input_section_sort_entry::match_section_name):
14503 Remove.
14504 (Output_section::Input_section_sort_entry::match_section_name_prefix):
14505 Remove.
14506 (Output_section::Input_section_sort_entry::match_section_file):
14507 Remove.
14508 (Output_section::Input_section_sort_compare::operator()): Rewrite
14509 using new Input_section_sort_entry functions. Sort crtbegin and
14510 crtend first. Sort sections with no priority before sections with
14511 a priority.
14512 * testsuite/initpri1.c (d3): Check j != 4.
14513 (cd5): New constructor/destructor function.
14514 (main): Check j != 2.
14515
14516 * symtab.cc (Symbol_table::add_from_object): If we don't use the
14517 new symbol when resolving, don't call set_is_default.
14518 * testsuite/ver_test_7.cc: New file.
14519 * testsuite/ver_test_7.sh: New file.
14520 * testsuite/Makefile.am (ver_test_7.so): New target.
14521 (ver_test_7.o): New target.
14522 (check_SCRIPTS): Add ver_test_7.sh.
14523 (check_DATA): Add ver_test_7.syms.
14524 (ver_test_7.syms): New target.
14525
14526 2008-03-28 Ian Lance Taylor <iant@google.com>
14527
14528 * layout.cc (Layout::layout): If we see an input section with a
14529 name that needs sorting, set the must_sort flag for the output
14530 section.
14531 (Layout::make_output_section): If the name of the output section
14532 indicates that it might require sorting, set the may_sort flag.
14533 * output.h (Output_section::may_sort_attached_input_sections): New
14534 function.
14535 (Output_section::set_may_sort_attached_input_sections): New
14536 function.
14537 (Output_section::must_sort_attached_input_sections): New
14538 function.
14539 (Output_section::set_must_sort_attached_input_sections): New
14540 function.
14541 (class Output_section): Declare Input_section_sort_entry. Define
14542 Input_section_sort_compare. Declare
14543 sort_attached_input_sections. Add new fields:
14544 may_sort_attached_input_sections_,
14545 must_sort_attached_input_sections_,
14546 attached_input_sections_are_sorted_.
14547 * output.cc (Output_section::Output_section): Initialize new
14548 fields.
14549 (Output_section::add_input_section): Add an entry to
14550 input_sections_ if may_sort or must_sort are true.
14551 (Output_section::set_final_data_size): Call
14552 sort_attached_input_sections if necessary.
14553 (Output_section::Input_section_sort_entry): Define new class.
14554 (Output_section::Input_section_sort_compare::operator()): New
14555 function.
14556 (Output_section::sort_attached_input_sections): New function.
14557 * configure.ac: Check whether the compiler supports constructor
14558 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
14559 * testsuite/initpri1.c: New file.
14560 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14561 CONSTRUCTOR_PRIORITY.
14562 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14563 (initpri1_LDFLAGS): New variable.
14564 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14565
14566 2008-03-27 Ian Lance Taylor <iant@google.com>
14567
14568 * common.cc (Sort_commons::operator): Correct sorting algorithm.
14569 * testsuite/common_test_1.c: New file.
14570 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14571 (common_test_1_SOURCES): New variable.
14572 (common_test_1_DEPENDENCIES): New variable.
14573 (common_test_1_LDFLAGS): New variable.
14574
14575 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14576 and commons_ correctly when NAME/VERSION does not override
14577 NAME/NULL.
14578 * testsuite/ver_test_6.c: New file.
14579 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14580 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14581 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14582
14583 2008-03-26 Ian Lance Taylor <iant@google.com>
14584
14585 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14586 of an undefined symbol from a version script.
14587 * testsuite/Makefile.am (ver_test_5.so): New target.
14588 (ver_test_5.o): New target.
14589 (check_SCRIPTS): Add ver_test_5.sh.
14590 (check_DATA): Add ver_test_5.syms.
14591 (ver_test_5.syms): New target.
14592 * testsuite/ver_test_5.cc: New file.
14593 * testsuite/ver_test_5.script: New file.
14594 * testsuite/ver_test_5.sh: New file.
14595 * Makefile.in, testsuite/Makefile.in: Rebuild.
14596
14597 PR gold/5986
14598 Fix problems building gold with gcc 4.3.0.
14599 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14600 (gold_error_at_location, gold_warning_at_location): Use it.
14601 * configure.ac: Check whether we can compile and use a template
14602 function with a printf attribute.
14603 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14604 when jumping over bytes.
14605 * object.cc: Instantiate Object::read_section_data.
14606 * debug.h: Include <cstring>
14607 * dwarf_reader.cc: Include <algorithm>
14608 * main.cc: Include <cstring>.
14609 * options.cc: Include <cstring>.
14610 * output.cc: Include <cstring>.
14611 * script.cc: Include <cstring>.
14612 * script.h: Include <string>.
14613 * symtab.cc: Include <cstring> and <algorithm>.
14614 * target-select.cc: Include <cstring>.
14615 * version.cc: Include <string>.
14616 * testsuite/testmain.cc: Include <cstdlib>.
14617 * configure, config.in: Rebuild.
14618
14619 2008-03-25 Ian Lance Taylor <iant@google.com>
14620
14621 * options.cc: Include "../bfd/bfdver.h".
14622 (options::help): Print bug reporting address.
14623
14624 * version.cc (print_version): Adjust output for current value of
14625 BFD_VERSION_STRING.
14626
14627 * NEWS: New file.
14628
14629 * options.cc (options::help): Print list of supported targets.
14630 * target-select.h: Include <vector>.
14631 (class Target_selector): Make machine_, size_, and is_big_endian_
14632 fields const. Add bfd_name_ and instantiated_target_ fields.
14633 (Target_selector::Target_selector): Add bfd_name parameter.
14634 (Target_selector::recognize): Make non-virtual, call
14635 do_recognize.
14636 (Target_selector::recognize_by_name): Make non-virtual, call
14637 do_recognize_by_name.
14638 (Target_selector::supported_names): New function.
14639 (Target_selector::bfd_name): New function.
14640 (Target_selector::do_instantiate_target): New pure virtual
14641 function.
14642 (Target_selector::do_recognize): New virtual function.
14643 (Target_selector::do_recognize_by_name): New virtual function.
14644 (Target_selector::instantiate_target): New private function.
14645 (supported_target_names): Declare.
14646 * target-select.cc (Target_selector::Target_selector): Update for
14647 new parameter and fields.
14648 (select_target_by_name): Check that the name matches before
14649 calling recognize_by_name.
14650 (supported_target_names): New function.
14651 * i386.cc (class Target_selector_i386): Update Target_selector
14652 constructor call. Remove recognize and recognize_by_name. Add
14653 do_instantiate_target.
14654 * x86_64.cc (class Target_selector_x86_64): Likewise.
14655 * testsuite/testfile.cc (class Target_selector_test): Update for
14656 changes to Target_selector.
14657
14658 * README: Rewrite, with some notes on unsupported features.
14659
14660 2008-03-24 Cary Coutant <ccoutant@google.com>
14661
14662 * i386.cc (Target_i386::Got_type): New enum declaration.
14663 (Target_i386::Scan::local): Updated callers of Output_data_got
14664 member functions.
14665 (Target_i386::Scan::global): Likewise.
14666 (Target_i386::Relocate::relocate): Likewise.
14667 (Target_i386::Relocate::relocate_tls): Likewise.
14668 * object.h (Got_offset_list): New class.
14669 (Sized_relobj::local_has_got_offset): Added got_type parameter.
14670 (Sized_relobj::local_got_offset): Likewise.
14671 (Sized_relobj::set_local_got_offset): Likewise.
14672 (Sized_relobj::local_has_tls_got_offset): Removed.
14673 (Sized_relobj::local_tls_got_offset): Removed.
14674 (Sized_relobj::set_local_tls_got_offset): Removed.
14675 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14676 * output.cc (Output_data_got::add_global): Added got_type parameter.
14677 (Output_data_got::add_global_with_rel): Likewise.
14678 (Output_data_got::add_global_with_rela): Likewise.
14679 (Output_data_got::add_global_pair_with_rel): New function.
14680 (Output_data_got::add_global_pair_with_rela): New function.
14681 (Output_data_got::add_local): Added got_type parameter.
14682 (Output_data_got::add_local_with_rel): Likewise.
14683 (Output_data_got::add_local_with_rela): Likewise.
14684 (Output_data_got::add_local_pair_with_rel): New function.
14685 (Output_data_got::add_local_pair_with_rela): New function.
14686 (Output_data_got::add_global_tls): Removed.
14687 (Output_data_got::add_global_tls_with_rel): Removed.
14688 (Output_data_got::add_global_tls_with_rela): Removed.
14689 (Output_data_got::add_local_tls): Removed.
14690 (Output_data_got::add_local_tls_with_rel): Removed.
14691 (Output_data_got::add_local_tls_with_rela): Removed.
14692 * output.h (Output_data_got::add_global): Added got_type parameter.
14693 (Output_data_got::add_global_with_rel): Likewise.
14694 (Output_data_got::add_global_with_rela): Likewise.
14695 (Output_data_got::add_global_pair_with_rel): New function.
14696 (Output_data_got::add_global_pair_with_rela): New function.
14697 (Output_data_got::add_local): Added got_type parameter.
14698 (Output_data_got::add_local_with_rel): Likewise.
14699 (Output_data_got::add_local_with_rela): Likewise.
14700 (Output_data_got::add_local_pair_with_rel): New function.
14701 (Output_data_got::add_local_pair_with_rela): New function.
14702 (Output_data_got::add_global_tls): Removed.
14703 (Output_data_got::add_global_tls_with_rel): Removed.
14704 (Output_data_got::add_global_tls_with_rela): Removed.
14705 (Output_data_got::add_local_tls): Removed.
14706 (Output_data_got::add_local_tls_with_rel): Removed.
14707 (Output_data_got::add_local_tls_with_rela): Removed.
14708 * resolve.cc (Symbol::override_base_with_special): Removed
14709 reference to has_got_offset_ field.
14710 * symtab.cc (Symbol::init_fields): Replaced initialization
14711 of got_offset_ with got_offsets_. Removed initialization
14712 of has_got_offset_
14713 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14714 (Symbol::got_offset): Likewise.
14715 (Symbol::set_got_offset): Likewise.
14716 (Symbol::has_tls_got_offset): Removed.
14717 (Symbol::tls_got_offset): Removed.
14718 (Symbol::set_tls_got_offset): Removed.
14719 (Symbol::got_offset_): Removed.
14720 (Symbol::tls_mod_got_offset_): Removed.
14721 (Symbol::tls_pair_got_offset_): Removed.
14722 (Symbol::got_offsets_): New field.
14723 (Symbol::has_got_offset): Removed.
14724 (Symbol::has_tls_mod_got_offset): Removed.
14725 (Symbol::has_tls_pair_got_offset): Removed.
14726 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14727 (Target_x86_64::Scan::local): Updated callers of Output_data_got
14728 member functions.
14729 (Target_x86_64::Scan::global): Likewise.
14730 (Target_x86_64::Relocate::relocate): Likewise.
14731 (Target_x86_64::Relocate::relocate_tls): Likewise.
14732
14733 2008-03-25 Ben Elliston <bje@au.ibm.com>
14734
14735 * yyscript.y: Fix spelling error in comment.
14736
14737 2008-03-24 Ian Lance Taylor <iant@google.com>
14738
14739 * options.h (class General_options): Define build_id option.
14740 * layout.h (class Layout): Declare write_build_id, create_note,
14741 create_build_id. Add build_id_note_ member.
14742 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14743 "libiberty.h", "md5.h", "sha1.h".
14744 (Layout::Layout): Initialize eh_frame_data_,
14745 eh_frame_hdr_section_, and build_id_note_.
14746 (Layout::finalize): Call create_build_id.
14747 (Layout::create_note): New function, broken out of
14748 Layout::create_gold_note.
14749 (Layout::create_gold_note): Call create_note.
14750 (Layout::create_build_id): New function.
14751 (Layout::write_build_id): New function.
14752 (Close_task_runner::run): Call write_build_id.
14753
14754 * x86_64.cc: Correct license to GPLv3.
14755
14756 2008-03-23 Ian Lance Taylor <iant@google.com>
14757
14758 * options.cc: Include "demangle.h".
14759 (parse_optional_string): New function.
14760 (parse_long_option): Handle takes_optional_argument.
14761 (parse_short_option): Update dash_z initializer. Handle
14762 takes_optional_argument.
14763 (General_options::General_options): Initialize do_demangle_.
14764 (General_options::finalize): Set do_demangle_. Handle demangling
14765 style.
14766 * options.h (parse_optional_string): Declare.
14767 (struct One_option): Add optional_arg field. Update constructor.
14768 Update call constructor calls. Add takes_optional_argument
14769 function.
14770 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
14771 (DEFINE_optional_string): Define.
14772 (General_options::demangle): Change from DEFINE_bool to
14773 DEFINE_optional_string.
14774 (General_options::no_demangle): New function.
14775 (General_options::do_demangle): New function.
14776 (General_options::set_do_demangle): New function.
14777 (General_options::execstack_status_): Move definition to end of
14778 class definition.
14779 (General_options::static_): Likewise.
14780 (General_options::do_demangle_): New field.
14781 * object.cc (big_endian>::get_symbol_location_info): Call
14782 Options::do_demangle, not Options::demangle.
14783 * symtab.cc (demangle): Likewise.
14784
14785 2008-03-22 Ian Lance Taylor <iant@google.com>
14786
14787 * gold.h: Include <cstddef> and <sys/types.h>
14788 * options.h: Include <cstring>.
14789
14790 2008-03-21 Ian Lance Taylor <iant@google.com>
14791
14792 * Added source code to GNU binutils.
14793 \f
14794 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14795
14796 Copying and distribution of this file, with or without modification,
14797 are permitted in any medium without royalty provided the copyright
14798 notice and this notice are preserved.
14799
14800 Local Variables:
14801 mode: change-log
14802 left-margin: 8
14803 fill-column: 74
14804 version-control: never
14805 End:
This page took 0.315824 seconds and 5 git commands to generate.